hsp_hs.c (a874746709fd7a8c0715bc158b817e9b8a601294) | hsp_hs.c (5611a760af48d1ce1beea59c7908be73bd2393f1) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 78 unchanged lines hidden (view full) --- 87 88static uint8_t hs_send_button_press = 0; 89static uint8_t hs_support_custom_indications = 0; 90static uint8_t hs_outgoing_connection = 0; 91 92typedef enum { 93 HSP_IDLE, 94 HSP_SDP_QUERY_RFCOMM_CHANNEL, | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 78 unchanged lines hidden (view full) --- 87 88static uint8_t hs_send_button_press = 0; 89static uint8_t hs_support_custom_indications = 0; 90static uint8_t hs_outgoing_connection = 0; 91 92typedef enum { 93 HSP_IDLE, 94 HSP_SDP_QUERY_RFCOMM_CHANNEL, |
95 HSP_W4_SDP_QUERY_COMPLETE, | 95 HSP_W4_SDP_EVENT_QUERY_COMPLETE, |
96 HSP_W4_RFCOMM_CONNECTED, 97 HSP_W4_USER_ACTION, 98 HSP_W2_CONNECT_SCO, 99 HSP_W4_SCO_CONNECTED, 100 HSP_ACTIVE, 101 HSP_W2_DISCONNECT_SCO, 102 HSP_W4_SCO_DISCONNECTED, 103 HSP_W2_DISCONNECT_RFCOMM, --- 219 unchanged lines hidden (view full) --- 323 if (err) { 324 hs_send_button_press = 1; 325 } 326 return; 327 } 328 329 switch (hsp_state){ 330 case HSP_SDP_QUERY_RFCOMM_CHANNEL: | 96 HSP_W4_RFCOMM_CONNECTED, 97 HSP_W4_USER_ACTION, 98 HSP_W2_CONNECT_SCO, 99 HSP_W4_SCO_CONNECTED, 100 HSP_ACTIVE, 101 HSP_W2_DISCONNECT_SCO, 102 HSP_W4_SCO_DISCONNECTED, 103 HSP_W2_DISCONNECT_RFCOMM, --- 219 unchanged lines hidden (view full) --- 323 if (err) { 324 hs_send_button_press = 1; 325 } 326 return; 327 } 328 329 switch (hsp_state){ 330 case HSP_SDP_QUERY_RFCOMM_CHANNEL: |
331 hsp_state = HSP_W4_SDP_QUERY_COMPLETE; | 331 hsp_state = HSP_W4_SDP_EVENT_QUERY_COMPLETE; |
332 sdp_query_rfcomm_channel_and_name_for_uuid(remote, SDP_Headset_AG); 333 break; 334 335 case HSP_W2_CONNECT_SCO: 336 hsp_state = HSP_W4_SCO_CONNECTED; 337 break; 338 339 case HSP_W2_DISCONNECT_SCO: --- 230 unchanged lines hidden (view full) --- 570 default: 571 break; 572 } 573 hsp_run(); 574} 575 576static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){ 577 switch (packet[0]){ | 332 sdp_query_rfcomm_channel_and_name_for_uuid(remote, SDP_Headset_AG); 333 break; 334 335 case HSP_W2_CONNECT_SCO: 336 hsp_state = HSP_W4_SCO_CONNECTED; 337 break; 338 339 case HSP_W2_DISCONNECT_SCO: --- 230 unchanged lines hidden (view full) --- 570 default: 571 break; 572 } 573 hsp_run(); 574} 575 576static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){ 577 switch (packet[0]){ |
578 case SDP_QUERY_RFCOMM_SERVICE: | 578 case SDP_EVENT_QUERY_RFCOMM_SERVICE: |
579 channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet); 580 printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr); 581 break; | 579 channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet); 580 printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr); 581 break; |
582 case SDP_QUERY_COMPLETE: | 582 case SDP_EVENT_QUERY_COMPLETE: |
583 if (channel_nr > 0){ 584 hsp_state = HSP_W4_RFCOMM_CONNECTED; 585 printf("RFCOMM create channel.\n"); 586 rfcomm_create_channel(remote, channel_nr, NULL); 587 break; 588 } 589 hsp_hs_reset_state(); 590 printf("Service not found, status %u.\n", sdp_query_complete_event_get_status(packet)); --- 13 unchanged lines hidden --- | 583 if (channel_nr > 0){ 584 hsp_state = HSP_W4_RFCOMM_CONNECTED; 585 printf("RFCOMM create channel.\n"); 586 rfcomm_create_channel(remote, channel_nr, NULL); 587 break; 588 } 589 hsp_hs_reset_state(); 590 printf("Service not found, status %u.\n", sdp_query_complete_event_get_status(packet)); --- 13 unchanged lines hidden --- |