bnep: BD_ADDR is stored in little-endian format for all BNEP_EVENT_*

This commit is contained in:
Matthias Ringwald 2019-06-05 17:22:17 +02:00
parent c9748298c9
commit fb3896319c
3 changed files with 6 additions and 4 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- FreeRTOS: use freertos/.. prefix to include FreeRTOS headers if HAVE_FREERTOS_INCLUDE_PREFIX is defined
### Fixed
- BNEP: Bluetooth address is stored in little-endian format for all BNEP_EVENT_*
### Added

View File

@ -356,8 +356,9 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
uuid_source = bnep_event_channel_opened_get_source_uuid(packet);
uuid_dest = bnep_event_channel_opened_get_destination_uuid(packet);
mtu = bnep_event_channel_opened_get_mtu(packet);
memcpy(&event_addr, &packet[11], sizeof(bd_addr_t));
bnep_event_channel_opened_get_remote_address(packet, event_addr);
printf("BNEP connection open succeeded to %s source UUID 0x%04x dest UUID: 0x%04x, max frame size %u\n", bd_addr_to_str(event_addr), uuid_source, uuid_dest, mtu);
/* Setup network interface */
gap_local_bd_addr(local_addr);
btstack_network_up(local_addr);

View File

@ -87,7 +87,7 @@ static void bnep_emit_open_channel_complete(bnep_channel_t *channel, uint8_t sta
little_endian_store_16(event, 5, channel->uuid_source);
little_endian_store_16(event, 7, channel->uuid_dest);
little_endian_store_16(event, 9, channel->max_frame_size);
bd_addr_copy(&event[11], channel->remote_addr);
reverse_bd_addr(channel->remote_addr, &event[11]);
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
}
@ -103,7 +103,7 @@ static void bnep_emit_channel_timeout(bnep_channel_t *channel)
little_endian_store_16(event, 2, channel->l2cap_cid);
little_endian_store_16(event, 4, channel->uuid_source);
little_endian_store_16(event, 6, channel->uuid_dest);
bd_addr_copy(&event[8], channel->remote_addr);
reverse_bd_addr(channel->remote_addr, &event[8]);
event[14] = channel->state;
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
@ -120,7 +120,7 @@ static void bnep_emit_channel_closed(bnep_channel_t *channel)
little_endian_store_16(event, 2, channel->l2cap_cid);
little_endian_store_16(event, 4, channel->uuid_source);
little_endian_store_16(event, 6, channel->uuid_dest);
bd_addr_copy(&event[8], channel->remote_addr);
reverse_bd_addr(channel->remote_addr, &event[8]);
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
}