feat: Implemented dequeue_message_ingest
This commit is contained in:
@@ -56,7 +56,6 @@ int register_client(incphub_cli_t **cli_ptr, ntl_port_t port, TaskHandle_t task)
|
|||||||
{
|
{
|
||||||
if (port == NTL_PORT_EMPTY)
|
if (port == NTL_PORT_EMPTY)
|
||||||
return INCPHUB_EINVAL;
|
return INCPHUB_EINVAL;
|
||||||
|
|
||||||
if (cli_ptr == NULL)
|
if (cli_ptr == NULL)
|
||||||
return INCPHUB_EINVAL;
|
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)
|
if (port == NTL_PORT_EMPTY)
|
||||||
return INCPHUB_EINVAL;
|
return INCPHUB_EINVAL;
|
||||||
|
|
||||||
if (client_ptr == NULL)
|
if (client_ptr == NULL)
|
||||||
return INCPHUB_EINVAL;
|
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
|
//NOTE: Does not need global lock
|
||||||
|
|
||||||
(void)buffer_ptr;
|
if (buffer_ptr == NULL)
|
||||||
(void)length_ptr;
|
return INCPHUB_EINVAL;
|
||||||
(void)max_delay;
|
if (length_ptr == NULL)
|
||||||
//TODO: Implement
|
return INCPHUB_EINVAL;
|
||||||
return INCPHUB_ERR;
|
|
||||||
|
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)
|
int do_message_dispatch(incphub_cli_t *cli, uint8_t *buffer, size_t length, incphub_addr_t source)
|
||||||
|
|||||||
Reference in New Issue
Block a user