mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 10:21:49 +00:00
bnep: emit open channel complete event, discard incoming connection event
This commit is contained in:
parent
f761755944
commit
0f489073ef
@ -559,17 +559,14 @@ extern "C" {
|
||||
// data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), mtu (16), remote_address (48)
|
||||
#define BNEP_EVENT_OPEN_CHANNEL_COMPLETE 0xC1
|
||||
|
||||
// data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), mtu (16), remote_address (48)
|
||||
#define BNEP_EVENT_INCOMING_CONNECTION 0xC2
|
||||
|
||||
// data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48)
|
||||
#define BNEP_EVENT_CHANNEL_CLOSED 0xC3
|
||||
#define BNEP_EVENT_CHANNEL_CLOSED 0xC2
|
||||
|
||||
// data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48), channel state (8)
|
||||
#define BNEP_EVENT_CHANNEL_TIMEOUT 0xC4
|
||||
#define BNEP_EVENT_CHANNEL_TIMEOUT 0xC3
|
||||
|
||||
// data: event(8), len(8)
|
||||
#define BNEP_EVENT_READY_TO_SEND 0xC5
|
||||
#define BNEP_EVENT_READY_TO_SEND 0xC4
|
||||
|
||||
// data: event(8), address_type(8), address (48), [number(32)]
|
||||
#define SM_JUST_WORKS_REQUEST 0xD0
|
||||
|
20
src/bnep.c
20
src/bnep.c
@ -105,20 +105,6 @@ static void bnep_emit_open_channel_complete(bnep_channel_t *channel, uint8_t sta
|
||||
(*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, channel->l2cap_cid, (uint8_t *) event, sizeof(event));
|
||||
}
|
||||
|
||||
static void bnep_emit_incoming_connection(bnep_channel_t *channel)
|
||||
{
|
||||
log_info("BNEP_EVENT_INCOMING_CONNECTION bd_addr: %s", bd_addr_to_str(channel->remote_addr));
|
||||
uint8_t event[2 + sizeof(bd_addr_t) + 3 * sizeof(uint16_t)];
|
||||
event[0] = BNEP_EVENT_INCOMING_CONNECTION;
|
||||
event[1] = sizeof(event) - 2;
|
||||
bt_store_16(event, 2, channel->uuid_source);
|
||||
bt_store_16(event, 4, channel->uuid_dest);
|
||||
bt_store_16(event, 6, channel->max_frame_size);
|
||||
BD_ADDR_COPY(&event[8], channel->remote_addr);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
(*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, channel->l2cap_cid, (uint8_t *) event, sizeof(event));
|
||||
}
|
||||
|
||||
static void bnep_emit_channel_timeout(bnep_channel_t *channel)
|
||||
{
|
||||
log_info("BNEP_EVENT_CHANNEL_TIMEOUT bd_addr: %s", bd_addr_to_str(channel->remote_addr));
|
||||
@ -1479,17 +1465,21 @@ static void bnep_channel_state_machine(bnep_channel_t* channel, bnep_channel_eve
|
||||
bnep_send_connection_request(channel, channel->uuid_source, channel->uuid_dest);
|
||||
}
|
||||
if (channel->state_var & BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_RESPONSE) {
|
||||
int emit_connected = 0;
|
||||
if ((channel->state == BNEP_CHANNEL_STATE_CLOSED) ||
|
||||
(channel->state == BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_REQUEST)) {
|
||||
/* Set channel state to STATE_CONNECTED */
|
||||
channel->state = BNEP_CHANNEL_STATE_CONNECTED;
|
||||
/* Stop timeout timer! */
|
||||
bnep_channel_stop_timer(channel);
|
||||
emit_connected = 1;
|
||||
}
|
||||
|
||||
bnep_channel_state_remove(channel, BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_RESPONSE);
|
||||
bnep_send_connection_response(channel, channel->response_code);
|
||||
bnep_emit_incoming_connection(channel);
|
||||
if (emit_connected){
|
||||
bnep_emit_open_channel_complete(channel, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (channel->state_var & BNEP_CHANNEL_STATE_VAR_SND_FILTER_NET_TYPE_SET) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user