diff --git a/app/src/incphub/src/incphub_shared.c b/app/src/incphub/src/incphub_shared.c index f39a565..6384fba 100644 --- a/app/src/incphub/src/incphub_shared.c +++ b/app/src/incphub/src/incphub_shared.c @@ -56,7 +56,6 @@ int register_client(incphub_cli_t **cli_ptr, ntl_port_t port, TaskHandle_t task) { if (port == NTL_PORT_EMPTY) return INCPHUB_EINVAL; - if (cli_ptr == NULL) return INCPHUB_EINVAL; @@ -149,7 +148,6 @@ int get_client_with_port(ntl_port_t port, incphub_cli_t **client_ptr) { if (port == NTL_PORT_EMPTY) return INCPHUB_EINVAL; - if (client_ptr == NULL) return INCPHUB_EINVAL; @@ -195,11 +193,23 @@ int dequeue_message_ingest(uint8_t **buffer_ptr, size_t *length_ptr, TickType_t { //NOTE: Does not need global lock - (void)buffer_ptr; - (void)length_ptr; - (void)max_delay; - //TODO: Implement - return INCPHUB_ERR; + if (buffer_ptr == NULL) + return INCPHUB_EINVAL; + if (length_ptr == NULL) + return INCPHUB_EINVAL; + + incphub_msg_t msg = { 0 }; + + // Try to dequeue message + if (xQueueReceive(incphub_ingest_queue, &msg, max_delay)) + { + return INCPHUB_EAGAIN; + } + + *buffer_ptr = msg.buffer; + *length_ptr = msg.length; + + return INCPHUB_OK; } int do_message_dispatch(incphub_cli_t *cli, uint8_t *buffer, size_t length, incphub_addr_t source)