Exportable version of WizziLab's modem driver.
Diff: src/alp_payload.cpp
- Revision:
- 61:820395fc5572
- Parent:
- 60:08efaaca0e83
- Child:
- 62:75d819d68e5f
--- a/src/alp_payload.cpp Fri Feb 19 10:59:42 2021 +0000 +++ b/src/alp_payload.cpp Tue Sep 07 15:58:51 2021 +0000 @@ -754,9 +754,7 @@ } alp_payload_t* alp_payload_get(alp_payload_t* alp, u8 op) -{ - FPRINT(": 0x%p\n", alp); - +{ if (NULL == alp) { return NULL; @@ -771,6 +769,39 @@ return alp_payload_get(alp->next, op); } +bool alp_payload_extract_data(alp_payload_t** alp, u8 op, void* data) +{ + alp_payload_t* alp_data = alp_payload_extract(alp, op); + + if (alp_data) + { + alp_parsed_chunk_t r; + u8* p = alp_data->d; + + alp_parse_chunk(&p, &r); + + switch (op) + { + case ALP_OPCODE_RSP_ISTATUS: + memcpy(data, r.data, r.meta.itf.length); + break;; + case ALP_OPCODE_RSP_F_DATA: + memcpy(data, r.data, r.meta.f_data.length); + break; + default: + alp_payload_free(alp_data); + return false; + break; + } + + alp_payload_free(alp_data); + + return true; + } + + return false; +} + enum { ERR_PRIO_EOPISTATUS, ERR_PRIO_STATUS,