From f653b6bd934d7b010ab1ee878e5d8ac75db61b22 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Thu, 2 Sep 2010 18:39:04 +0000 Subject: [PATCH] use structure of HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE for BTSTACK_EVENT_REMOTE_NAME_CACHED to make life easier --- example/inquiry.c | 4 ++-- src/hci.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/example/inquiry.c b/example/inquiry.c index 4303d9e69..5e8ee87c7 100644 --- a/example/inquiry.c +++ b/example/inquiry.c @@ -171,10 +171,10 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint break; case BTSTACK_EVENT_REMOTE_NAME_CACHED: - bt_flip_addr(addr, &packet[2]); + bt_flip_addr(addr, &packet[3]); printf("Cached remote name for "); print_bd_addr(addr); - printf(": %s\n", &packet[8]); + printf(": %s\n", &packet[9]); break; case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE: diff --git a/src/hci.c b/src/hci.c index 300e60830..a8c33d414 100644 --- a/src/hci.c +++ b/src/hci.c @@ -801,12 +801,13 @@ void hci_emit_system_bluetooth_enabled(uint8_t enabled){ } void hci_emit_remote_name_cached(bd_addr_t *addr, device_name_t *name){ - uint16_t len = 2+6+248; + uint16_t len = 2+1+6+248; uint8_t event[len]; event[0] = BTSTACK_EVENT_REMOTE_NAME_CACHED; event[1] = len - 2; - BD_ADDR_COPY(&event[2], addr); - memcpy(&event[8], name, 248); + event[2] = 0; // just to be compatible with HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE + BD_ADDR_COPY(&event[3], addr); + memcpy(&event[9], name, 248); hci_dump_packet(HCI_EVENT_PACKET, 0, event, len); hci_stack.packet_handler(HCI_EVENT_PACKET, event, len); }