Loading src/lib/kinetic_pdu.c +29 −14 Original line number Diff line number Diff line Loading @@ -97,7 +97,13 @@ STATIC bus_sink_cb_res_t sink_cb(uint8_t *read_buf, } case STATE_AWAITING_HEADER: { if (unpack_header(read_buf, read_size, &si->header)) memcpy(&si->buf[si->accumulated], read_buf, read_size); si->accumulated += read_size; uint32_t remaining = PDU_HEADER_LEN - si->accumulated; if (remaining == 0) { if (unpack_header(&si->buf[0], PDU_HEADER_LEN, &si->header)) { si->accumulated = 0; si->unpack_status = UNPACK_ERROR_SUCCESS; Loading @@ -116,6 +122,14 @@ STATIC bus_sink_cb_res_t sink_cb(uint8_t *read_buf, }; return res; } } else { bus_sink_cb_res_t res = { .next_read = remaining, }; return res; } break; } case STATE_AWAITING_BODY: Loading @@ -127,6 +141,7 @@ STATIC bus_sink_cb_res_t sink_cb(uint8_t *read_buf, if (remaining == 0) { si->state = STATE_AWAITING_HEADER; si->accumulated = 0; bus_sink_cb_res_t res = { .next_read = sizeof(KineticPDUHeader), // returning the whole si, because we need access to the pdu header as well Loading Loading
src/lib/kinetic_pdu.c +29 −14 Original line number Diff line number Diff line Loading @@ -97,7 +97,13 @@ STATIC bus_sink_cb_res_t sink_cb(uint8_t *read_buf, } case STATE_AWAITING_HEADER: { if (unpack_header(read_buf, read_size, &si->header)) memcpy(&si->buf[si->accumulated], read_buf, read_size); si->accumulated += read_size; uint32_t remaining = PDU_HEADER_LEN - si->accumulated; if (remaining == 0) { if (unpack_header(&si->buf[0], PDU_HEADER_LEN, &si->header)) { si->accumulated = 0; si->unpack_status = UNPACK_ERROR_SUCCESS; Loading @@ -116,6 +122,14 @@ STATIC bus_sink_cb_res_t sink_cb(uint8_t *read_buf, }; return res; } } else { bus_sink_cb_res_t res = { .next_read = remaining, }; return res; } break; } case STATE_AWAITING_BODY: Loading @@ -127,6 +141,7 @@ STATIC bus_sink_cb_res_t sink_cb(uint8_t *read_buf, if (remaining == 0) { si->state = STATE_AWAITING_HEADER; si->accumulated = 0; bus_sink_cb_res_t res = { .next_read = sizeof(KineticPDUHeader), // returning the whole si, because we need access to the pdu header as well Loading