aboutsummaryrefslogtreecommitdiff
path: root/lib/pbdrv/pb-msg.c
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-14 18:49:03 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-14 18:49:03 +0200
commit33ff43ccd7c619f885b3dd4e9a2e0ffe7ed0875c (patch)
treed9a42ad176f6ea2094b75026b221f44bae45071a /lib/pbdrv/pb-msg.c
parent959d43a0aeedcbc80c9bb2d4c99b4f5bd4e7b3d2 (diff)
finish message send functions
Diffstat (limited to 'lib/pbdrv/pb-msg.c')
-rw-r--r--lib/pbdrv/pb-msg.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/pbdrv/pb-msg.c b/lib/pbdrv/pb-msg.c
index 695a696..3f6fa95 100644
--- a/lib/pbdrv/pb-msg.c
+++ b/lib/pbdrv/pb-msg.c
@@ -5,8 +5,9 @@
pb_buf_t pb_msg_write(const pb_msg_t * msg) {
pb_buf_t buf = { 0 };
- mpack_writer_t writer;
+ if (msg == NULL) return buf;
+ mpack_writer_t writer;
mpack_writer_init_growable(&writer, &buf.data, &buf.size);
pb_ser_w(&writer, msg);
@@ -35,17 +36,3 @@ void pb_msg_free(pb_msg_t * msg) {
free(msg);
}
-pb_buf_t pb_msg_write_req_magic() {
- pb_cmd_magic_t content = {
- .magic = (char *) &pb_cmd_magic_req[0],
- ._magic_size = sizeof(pb_cmd_magic_req),
- };
- pb_msg_t msg_write = {
- .type = PB_CMD_MAGIC,
- .action = PB_ACTION_REQ,
- .sender = 0,
- .msg = &content,
- };
- return pb_msg_write(&msg_write);
-}
-