static void elzPortRx(void* port, uint8_t dlci, const uint8_t* data, uint16_t sz){ char *c, *r; while(data[sz - 1] == '\n') sz--; c = malloc(sz + 1); if(c){ memcpy(c, data, sz); c[sz] = 0; r = elzTalk(c); if(r){ btRfcommPortTx(port, dlci, r, strlen(r)); free(r); return; } } btRfcommPortTx(port, dlci, "OUT OF MEMORY", 13); }
void btRfcommPortTx_ADK(void* port, uint8_t dlci, const uint8_t* data, uint16_t size){ btRfcommPortTx(port, dlci, data, size); }