hfp_connection_t * hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ hfp_connection_t * context = provide_hfp_connection_context_for_rfcomm_cid(channel); if (!context) return NULL; while (size > 0 && (packet[0] == '\n' || packet[0] == '\r')){ size--; packet++; } return context; }
static void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ hfp_connection_t * context = provide_hfp_connection_context_for_rfcomm_cid(channel); if (!context) return; packet[size] = 0; int pos; for (pos = 0; pos < size ; pos++){ hfp_parse(context, packet[pos]); // trigger next action after CMD received if (context->command != HFP_CMD_OK) continue; handle_switch_on_ok(context); } }