flipperzero-firmware/lib/toolbox/protocols/protocol.h
Sergey Gavrilov 4bf29827f8
M*LIB: non-inlined strings, FuriString primitive (#1795)
* Quicksave 1
* Header stage complete
* Source stage complete
* Lint & merge fixes
* Includes
* Documentation step 1
* FBT: output free size considering BT STACK
* Documentation step 2
* py lint
* Fix music player plugin
* unit test stage 1: string allocator, mem, getters, setters, appends, compare, search.
* unit test: string equality
* unit test: string replace
* unit test: string start_with, end_with
* unit test: string trim
* unit test: utf-8
* Rename
* Revert fw_size changes
* Simplify CLI backspace handling
* Simplify CLI character insert
* Merge fixes
* Furi: correct filenaming and spelling
* Bt: remove furi string include

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-10-06 00:15:23 +09:00

46 lines
1.3 KiB
C

#pragma once
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <lib/toolbox/level_duration.h>
#include <furi.h>
typedef void* (*ProtocolAlloc)(void);
typedef void (*ProtocolFree)(void* protocol);
typedef uint8_t* (*ProtocolGetData)(void* protocol);
typedef void (*ProtocolDecoderStart)(void* protocol);
typedef bool (*ProtocolDecoderFeed)(void* protocol, bool level, uint32_t duration);
typedef bool (*ProtocolEncoderStart)(void* protocol);
typedef LevelDuration (*ProtocolEncoderYield)(void* protocol);
typedef void (*ProtocolRenderData)(void* protocol, FuriString* result);
typedef bool (*ProtocolWriteData)(void* protocol, void* data);
typedef struct {
ProtocolDecoderStart start;
ProtocolDecoderFeed feed;
} ProtocolDecoder;
typedef struct {
ProtocolEncoderStart start;
ProtocolEncoderYield yield;
} ProtocolEncoder;
typedef struct {
const size_t data_size;
const char* name;
const char* manufacturer;
const uint32_t features;
const uint8_t validate_count;
ProtocolAlloc alloc;
ProtocolFree free;
ProtocolGetData get_data;
ProtocolDecoder decoder;
ProtocolEncoder encoder;
ProtocolRenderData render_data;
ProtocolRenderData render_brief_data;
ProtocolWriteData write_data;
} ProtocolBase;