use structure of HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE for BTSTACK_EVENT_REMOTE_NAME_CACHED to make life easier

This commit is contained in:
matthias.ringwald 2010-09-02 18:39:04 +00:00
parent 0dadb9e348
commit f653b6bd93
2 changed files with 6 additions and 5 deletions

View File

@ -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:

View File

@ -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);
}