mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-16 13:22:15 +00:00
events: RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE -> RFCOMM_EVENT_CHANNEL_OPENED
This commit is contained in:
parent
62c468cbb2
commit
f8f6a918bd
@ -70,7 +70,7 @@ by RFCOMM:
|
||||
- RFCOMM_EVENT_CHANNEL_CLOSED - emitted when channel is closed. No
|
||||
status information is provided.
|
||||
|
||||
- RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE - sent if channel
|
||||
- RFCOMM_EVENT_CHANNEL_OPENED - sent if channel
|
||||
establishment is done. Status not equal zero indicates an error.
|
||||
Possible errors: an L2CAP error, out of memory.
|
||||
|
||||
@ -87,7 +87,7 @@ by RFCOMM:
|
||||
|
||||
Event | Event Code
|
||||
-----------|-----------------------------
|
||||
RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE | 0x80
|
||||
RFCOMM_EVENT_CHANNEL_OPENED | 0x80
|
||||
RFCOMM_EVENT_CHANNEL_CLOSED | 0x81
|
||||
RFCOMM_EVENT_INCOMING_CONNECTION | 0x82
|
||||
RFCOMM_EVENT_CREDITS | 0x84
|
||||
@ -98,7 +98,7 @@ Table: RFCOMM Events. {#tbl:rfcommEvents}
|
||||
|
||||
RFCOMM event paramaters, with size in bits:
|
||||
|
||||
- RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
- RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
- *event(8), len(8), status(8), address(48), handle(16), server_channel(8), rfcomm_cid(16), max_frame_size(16)*
|
||||
- RFCOMM_EVENT_CHANNEL_CLOSED:
|
||||
- *event(8), len(8), rfcomm_cid(16)*
|
||||
|
@ -347,7 +347,7 @@ see Section [on manual credit assignement](#sec:manualCreditsProtocols).
|
||||
|
||||
The packet handler that is given as an input parameter of the RFCOMM
|
||||
create channel function will be assigned to the new outgoing channel.
|
||||
This handler receives the RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE and
|
||||
This handler receives the RFCOMM_EVENT_CHANNEL_OPENED and
|
||||
RFCOMM_EVENT_CHANNEL_CLOSED events, and RFCOMM data packets, as shown in
|
||||
Listing [below](#lst:RFCOMMremoteService).
|
||||
|
||||
@ -358,7 +358,7 @@ Listing [below](#lst:RFCOMMremoteService).
|
||||
switch (packet_type){
|
||||
case HCI_EVENT_PACKET:
|
||||
switch (hci_event_packet_get_type(packet)){
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
if (rfcomm_event_open_channel_complete_get_status(packet)) {
|
||||
printf("Connection failed\n\r");
|
||||
} else {
|
||||
@ -415,7 +415,7 @@ Listing [below](#lst:RFCOMMService) provides the RFCOMM service example code.
|
||||
rfcomm_channel_id = rfcomm_event_incoming_connection_get_rfcomm_cid(packet);
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
if (rfcomm_event_open_channel_complete_get_status(packet)){
|
||||
printf("RFCOMM channel open failed.");
|
||||
break;
|
||||
|
@ -549,16 +549,16 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
|
||||
static void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
|
||||
if (event[0] == RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE){
|
||||
if (event[0] == RFCOMM_EVENT_CHANNEL_OPENED){
|
||||
handle = little_endian_read_16(event, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE received for handle 0x%04x\n", handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED received for handle 0x%04x\n", handle);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event[0]){
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
handle = little_endian_read_16(event, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE received for handle 0x%04x\n", handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED received for handle 0x%04x\n", handle);
|
||||
return;
|
||||
|
||||
case HCI_EVENT_INQUIRY_RESULT:
|
||||
|
@ -445,9 +445,9 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac
|
||||
#endif
|
||||
|
||||
static void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
if (event[0] == RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE){
|
||||
if (event[0] == RFCOMM_EVENT_CHANNEL_OPENED){
|
||||
handle = little_endian_read_16(event, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE received for handle 0x%04x\n", handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED received for handle 0x%04x\n", handle);
|
||||
return;
|
||||
}
|
||||
if (event[0] != HCI_EVENT_HFP_META) return;
|
||||
|
@ -129,7 +129,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n", packet[2]);
|
||||
|
@ -141,7 +141,7 @@ static void one_shot_timer_setup(void){
|
||||
* - HCI_EVENT_PIN_CODE_REQUEST (Standard pairing) or
|
||||
* - HCI_EVENT_USER_CONFIRMATION_REQUEST (Secure Simple Pairing),
|
||||
* - RFCOMM_EVENT_INCOMING_CONNECTION,
|
||||
* - RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE, and
|
||||
* - RFCOMM_EVENT_CHANNEL_OPENED, and
|
||||
* - RFCOMM_EVENT_CHANNEL_CLOSED
|
||||
*/
|
||||
|
||||
@ -158,7 +158,7 @@ static void one_shot_timer_setup(void){
|
||||
* channel number used during the SPP setup phase and the newly assigned RFCOMM
|
||||
* channel ID that is used by all BTstack commands and events.
|
||||
*
|
||||
* If RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE event returns status greater then 0,
|
||||
* If RFCOMM_EVENT_CHANNEL_OPENED event returns status greater then 0,
|
||||
* then the channel establishment has failed (rare case, e.g., client crashes).
|
||||
* On successful connection, the RFCOMM channel ID and MTU for this
|
||||
* channel are made available to the heartbeat counter. After opening the RFCOMM channel,
|
||||
@ -208,7 +208,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n", packet[2]);
|
||||
|
@ -175,7 +175,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n\r", packet[2]);
|
||||
|
@ -160,7 +160,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
sdp_client_query_rfcomm_channel_and_name_for_uuid(&handle_query_rfcomm_event, remote, SDP_PublicBrowseGroup);
|
||||
}
|
||||
break;
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
state = DONE;
|
||||
|
@ -99,7 +99,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
bt_send_cmd(&hci_pin_code_request_reply, &event_addr, 4, "0000");
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n", packet[2]);
|
||||
|
@ -125,7 +125,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
bt_send_cmd(&rfcomm_accept_connection_cmd, rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n", packet[2]);
|
||||
|
@ -146,7 +146,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
bt_send_cmd(&rfcomm_accept_connection_cmd, rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n", packet[2]);
|
||||
|
@ -747,7 +747,7 @@ static void send_rfcomm_create_channel_failed(void * connection, bd_addr_t addr,
|
||||
uint8_t event[16];
|
||||
memset(event, 0, sizeof(event));
|
||||
uint8_t pos = 0;
|
||||
event[pos++] = RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE;
|
||||
event[pos++] = RFCOMM_EVENT_CHANNEL_OPENED;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = status;
|
||||
reverse_bd_addr(addr, &event[pos]); pos += 6;
|
||||
@ -1554,7 +1554,7 @@ static void daemon_packet_handler(void * connection, uint8_t packet_type, uint16
|
||||
daemon_retry_parked();
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
cid = little_endian_read_16(packet, 13);
|
||||
connection = connection_for_rfcomm_cid(cid);
|
||||
if (!connection) break;
|
||||
|
@ -133,7 +133,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n\r", packet[2]);
|
||||
|
@ -169,7 +169,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n\r", packet[2]);
|
||||
|
@ -132,7 +132,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n\r", packet[2]);
|
||||
|
@ -170,7 +170,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n\r", packet[2]);
|
||||
|
@ -406,7 +406,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param rfcomm_cid
|
||||
* @param max_frame_size
|
||||
*/
|
||||
#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE 0x80
|
||||
#define RFCOMM_EVENT_CHANNEL_OPENED 0x80
|
||||
|
||||
/**
|
||||
* @format 2
|
||||
|
@ -978,57 +978,57 @@ static inline uint16_t l2cap_event_can_send_now_get_local_cid(const uint8_t * ev
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field status from event rfcomm_event_open_channel_complete
|
||||
* @brief Get field status from event rfcomm_event_channel_opened
|
||||
* @param event packet
|
||||
* @return status
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t rfcomm_event_open_channel_complete_get_status(const uint8_t * event){
|
||||
static inline uint8_t rfcomm_event_channel_opened_get_status(const uint8_t * event){
|
||||
return event[2];
|
||||
}
|
||||
/**
|
||||
* @brief Get field bd_addr from event rfcomm_event_open_channel_complete
|
||||
* @brief Get field bd_addr from event rfcomm_event_channel_opened
|
||||
* @param event packet
|
||||
* @param Pointer to storage for bd_addr
|
||||
* @note: btstack_type B
|
||||
*/
|
||||
static inline void rfcomm_event_open_channel_complete_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){
|
||||
static inline void rfcomm_event_channel_opened_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){
|
||||
reverse_bd_addr(&event[3], bd_addr);
|
||||
}
|
||||
/**
|
||||
* @brief Get field con_handle from event rfcomm_event_open_channel_complete
|
||||
* @brief Get field con_handle from event rfcomm_event_channel_opened
|
||||
* @param event packet
|
||||
* @return con_handle
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t rfcomm_event_open_channel_complete_get_con_handle(const uint8_t * event){
|
||||
static inline uint16_t rfcomm_event_channel_opened_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 9);
|
||||
}
|
||||
/**
|
||||
* @brief Get field server_channel from event rfcomm_event_open_channel_complete
|
||||
* @brief Get field server_channel from event rfcomm_event_channel_opened
|
||||
* @param event packet
|
||||
* @return server_channel
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t rfcomm_event_open_channel_complete_get_server_channel(const uint8_t * event){
|
||||
static inline uint8_t rfcomm_event_channel_opened_get_server_channel(const uint8_t * event){
|
||||
return event[11];
|
||||
}
|
||||
/**
|
||||
* @brief Get field rfcomm_cid from event rfcomm_event_open_channel_complete
|
||||
* @brief Get field rfcomm_cid from event rfcomm_event_channel_opened
|
||||
* @param event packet
|
||||
* @return rfcomm_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t rfcomm_event_open_channel_complete_get_rfcomm_cid(const uint8_t * event){
|
||||
static inline uint16_t rfcomm_event_channel_opened_get_rfcomm_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 12);
|
||||
}
|
||||
/**
|
||||
* @brief Get field max_frame_size from event rfcomm_event_open_channel_complete
|
||||
* @brief Get field max_frame_size from event rfcomm_event_channel_opened
|
||||
* @param event packet
|
||||
* @return max_frame_size
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t rfcomm_event_open_channel_complete_get_max_frame_size(const uint8_t * event){
|
||||
static inline uint16_t rfcomm_event_channel_opened_get_max_frame_size(const uint8_t * event){
|
||||
return little_endian_read_16(event, 14);
|
||||
}
|
||||
|
||||
|
@ -463,9 +463,9 @@ void hfp_handle_hci_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
rfcomm_accept_connection(hfp_connection->rfcomm_cid);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE packet_handler type %u, size %u\n", packet_type, size);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED packet_handler type %u, size %u\n", packet_type, size);
|
||||
|
||||
reverse_bd_addr(&packet[3], event_addr);
|
||||
hfp_connection = get_hfp_connection_context_for_bd_addr(event_addr);
|
||||
@ -476,7 +476,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
remove_hfp_connection_context(hfp_connection);
|
||||
} else {
|
||||
hfp_connection->acl_handle = little_endian_read_16(packet, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE con_handle 0x%02x\n", hfp_connection->acl_handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED con_handle 0x%02x\n", hfp_connection->acl_handle);
|
||||
|
||||
hfp_connection->rfcomm_cid = little_endian_read_16(packet, 12);
|
||||
uint16_t mtu = little_endian_read_16(packet, 14);
|
||||
|
@ -611,8 +611,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_cid);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
log_info("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE packet_handler type %u, packet[0] %x", packet_type, packet[0]);
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
log_info("RFCOMM_EVENT_CHANNEL_OPENED packet_handler type %u, packet[0] %x", packet_type, packet[0]);
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
log_info("RFCOMM channel open failed, status %u§", packet[2]);
|
||||
|
@ -532,8 +532,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_cid);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
// printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE packet_handler type %u, packet[0] %x\n", packet_type, packet[0]);
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// printf("RFCOMM_EVENT_CHANNEL_OPENED packet_handler type %u, packet[0] %x\n", packet_type, packet[0]);
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (hsp_state != HSP_W4_RFCOMM_CONNECTED) return;
|
||||
if (packet[2]) {
|
||||
|
@ -160,12 +160,12 @@ static void rfcomm_emit_connection_request(rfcomm_channel_t *channel) {
|
||||
// next Cydia release will use SVN version of this
|
||||
// data: event(8), len(8), status (8), address (48), handle (16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
static void rfcomm_emit_channel_opened(rfcomm_channel_t *channel, uint8_t status) {
|
||||
log_info("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE status 0x%x addr %s handle 0x%x channel #%u cid 0x%02x mtu %u",
|
||||
log_info("RFCOMM_EVENT_CHANNEL_OPENED status 0x%x addr %s handle 0x%x channel #%u cid 0x%02x mtu %u",
|
||||
status, bd_addr_to_str(channel->multiplexer->remote_addr), channel->multiplexer->con_handle,
|
||||
channel->dlci>>1, channel->rfcomm_cid, channel->max_frame_size);
|
||||
uint8_t event[16];
|
||||
uint8_t pos = 0;
|
||||
event[pos++] = RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE; // 0
|
||||
event[pos++] = RFCOMM_EVENT_CHANNEL_OPENED; // 0
|
||||
event[pos++] = sizeof(event) - 2; // 1
|
||||
event[pos++] = status; // 2
|
||||
reverse_bd_addr(channel->multiplexer->remote_addr, &event[pos]); pos += 6; // 3
|
||||
|
@ -349,9 +349,9 @@ static void simulate_test_sequence(hfp_test_item_t * test_item){
|
||||
}
|
||||
|
||||
void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
if (event[0] == RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE){
|
||||
if (event[0] == RFCOMM_EVENT_CHANNEL_OPENED){
|
||||
handle = little_endian_read_16(event, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE received for handle 0x%04x\n", handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED received for handle 0x%04x\n", handle);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -226,10 +226,10 @@ void sdp_client_query_rfcomm_channel_and_name_for_uuid(btstack_packet_handler_t
|
||||
|
||||
|
||||
uint8_t rfcomm_create_channel(btstack_packet_handler_t handler, bd_addr_t addr, uint8_t channel, uint16_t * out_cid){
|
||||
// RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE
|
||||
// RFCOMM_EVENT_CHANNEL_OPENED
|
||||
uint8_t event[16];
|
||||
uint8_t pos = 0;
|
||||
event[pos++] = RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE;
|
||||
event[pos++] = RFCOMM_EVENT_CHANNEL_OPENED;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = 0;
|
||||
|
||||
|
@ -355,7 +355,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
rfcomm_accept_connection(rfcomm_channel_id);
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
// data: event(8), len(8), status (8), address (48), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n\r", packet[2]);
|
||||
|
@ -570,16 +570,16 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
|
||||
static void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
|
||||
if (event[0] == RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE){
|
||||
if (event[0] == RFCOMM_EVENT_CHANNEL_OPENED){
|
||||
handle = little_endian_read_16(event, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE received for handle 0x%04x\n", handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED received for handle 0x%04x\n", handle);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event[0]){
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
handle = little_endian_read_16(event, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE received for handle 0x%04x\n", handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED received for handle 0x%04x\n", handle);
|
||||
return;
|
||||
|
||||
case HCI_EVENT_INQUIRY_RESULT:
|
||||
|
@ -461,9 +461,9 @@ static int stdin_process(btstack_data_source_t *ds){
|
||||
|
||||
|
||||
static void packet_handler(uint8_t * event, uint16_t event_size){
|
||||
if (event[0] == RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE){
|
||||
if (event[0] == RFCOMM_EVENT_CHANNEL_OPENED){
|
||||
handle = little_endian_read_16(event, 9);
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE received for handle 0x%04x\n", handle);
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED received for handle 0x%04x\n", handle);
|
||||
return;
|
||||
}
|
||||
if (event[0] != HCI_EVENT_HFP_META) return;
|
||||
|
@ -118,8 +118,8 @@ static void packet_handler(void * connection, uint8_t packet_type, uint16_t chan
|
||||
hci_send_cmd(&hci_pin_code_request_reply, &event_addr, 4, "0000");
|
||||
break;
|
||||
|
||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||
printf("RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE packet_handler type %u, packet[0] %x\n", packet_type, packet[0]);
|
||||
case RFCOMM_EVENT_CHANNEL_OPENED:
|
||||
printf("RFCOMM_EVENT_CHANNEL_OPENED packet_handler type %u, packet[0] %x\n", packet_type, packet[0]);
|
||||
// data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
if (packet[2]) {
|
||||
printf("RFCOMM channel open failed, status %u\n", packet[2]);
|
||||
|
@ -28,6 +28,7 @@ s/HAVE_TIME_MS/HAVE_EMBEDDED_TIME_MS/g
|
||||
s/HAVE_TICK/HAVE_EMBEDDED_TICK/g
|
||||
s/HAVE_TIME/HAVE_POSIX_TIME/g
|
||||
s/HAVE_STDIO/HAVE_POSIX_STDIN/g
|
||||
s/RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE/RFCOMM_EVENT_CHANNEL_OPENED/g
|
||||
s/SDP_QUERY_ATTRIBUTE_BYTE/SDP_EVENT_QUERY_ATTRIBUTE_BYTE/g
|
||||
s/SDP_QUERY_ATTRIBUTE_VALUE/SDP_EVENT_QUERY_ATTRIBUTE_VALUE/g
|
||||
s/SDP_QUERY_COMPLETE/SDP_EVENT_QUERY_COMPLETE/g
|
||||
|
Loading…
Reference in New Issue
Block a user