37 static constexpr uint8_t FRAME_MIN_LEN = 6;
38 static constexpr size_t FRAME_MAX_PAYLOAD = 1024;
43 static constexpr size_t SEEK_CHUNK_CAP = FRAME_MAX_PAYLOAD -
SEEK_HDR_SIZE;
53 CMD_GET_IO_SEEK = 0x14,
54 CMD_SET_IO_SEEK = 0x15,
60 CMD_UNSUBSCRIBE = 0x31,
70 STATUS_INVALID_CMD = 0x01,
71 STATUS_INVALID_OBJ = 0x02,
72 STATUS_INVALID_CFG = 0x03,
73 STATUS_READ_ONLY = 0x04,
74 STATUS_WRITE_ONLY = 0x05,
75 STATUS_INVALID_FORMAT = 0x06,
83 IO_TYPE_READ_ONLY = 0x01,
84 IO_TYPE_WRITE_ONLY = 0x02,
85 IO_TYPE_READ_WRITE = 0x03,
117#ifdef CONFIG_DAWN_IO_NOTIFY
125 }
typedef SProtoSimpleNotify;
128 uint8_t rxbuffer[FRAME_MAX_PAYLOAD + FRAME_MIN_LEN];
130 std::vector<SProtoSimpleIOBind *> iobinds;
131 std::vector<SProtoSimpleData *> iobuffers;
133#ifdef CONFIG_DAWN_IO_NOTIFY
134 std::mutex subsMutex;
135 std::set<SObjectId::ObjectId> subscriptions;
136 std::vector<SProtoSimpleNotify *> notifyContexts;
183#ifdef CONFIG_DAWN_IO_NOTIFY
190 int setupNotifications();
196 void cleanupNotifications();
202 void destroyNotifications();
212 static int notifierCb(
void *priv,
io_ddata_t *data);
224 virtual int sendFrame(uint8_t cmd,
const uint8_t *payload,
size_t len) = 0;
236 void sendError(uint8_t error_code, uint8_t context);
249 void cmdGetIO(
const uint8_t *payload,
size_t len);
258 void cmdSetIO(
const uint8_t *payload,
size_t len);
267 void cmdGetIOSeek(
const uint8_t *payload,
size_t len);
275 void cmdSetIOSeek(
const uint8_t *payload,
size_t len);
284 void cmdGetCfg(
const uint8_t *payload,
size_t len);
293 void cmdSetCfg(
const uint8_t *payload,
size_t len);
302 void cmdGetInfo(
const uint8_t *payload,
size_t len);
310#ifdef CONFIG_DAWN_IO_NOTIFY
318 void cmdSubscribe(
const uint8_t *payload,
size_t len);
327 void cmdUnsubscribe(
const uint8_t *payload,
size_t len);