void l2capServiceTx_ADK(uint16_t conn, uint16_t remChan, const uint8_t* data, uint32_t size){ //send data over L2CAP sg_buf* buf = sg_alloc(); if(!buf) return; if(sg_add_back(buf, data, size, SG_FLAG_MAKE_A_COPY)) l2capServiceTx(conn, remChan, buf); else sg_free(buf); }
static void l2capSendControlRawBuf(uint16_t conn, const uint8_t* data, uint16_t len){ sg_buf* buf; buf = sg_alloc(); if(buf){ if(sg_add_back(buf, data, len, SG_FLAG_MAKE_A_COPY)){ l2capServiceTx(conn, 1, buf); } else{ sg_free(buf); free(buf); } } }