mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-15 23:42:52 +00:00
simplified switch statement in packet handler
This commit is contained in:
parent
8a41a694f3
commit
bb6656c957
@ -40,6 +40,9 @@ static timer_source_t heartbeat;
|
||||
static int real_counter = 0;
|
||||
static int counter_to_send = 0;
|
||||
|
||||
enum STATE {INIT, W4_CONNECTION, W4_CHANNEL_COMPLETE, ACTIVE} ;
|
||||
enum STATE state = INIT;
|
||||
|
||||
static void tryToSend(void){
|
||||
if (!rfcomm_channel_id) return;
|
||||
if (real_counter <= counter_to_send) return;
|
||||
@ -66,11 +69,12 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
|
||||
bd_addr_t event_addr;
|
||||
uint8_t rfcomm_channel_nr;
|
||||
uint16_t mtu;
|
||||
uint8_t event = packet[0];
|
||||
|
||||
switch (packet_type) {
|
||||
case HCI_EVENT_PACKET:
|
||||
switch (packet[0]) {
|
||||
// handle events, ignore data
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
|
||||
switch (event) {
|
||||
case BTSTACK_EVENT_STATE:
|
||||
// bt stack activated, get started - set local name
|
||||
if (packet[2] == HCI_STATE_WORKING) {
|
||||
@ -135,11 +139,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void run_loop_register_timer(timer_source_t *timer, uint16_t period){
|
||||
|
Loading…
x
Reference in New Issue
Block a user