int btstack_main(int argc, const char * argv[]){ /* Initialize L2CAP */ l2cap_init(); l2cap_register_packet_handler(packet_handler); /* Initialise BNEP */ bnep_init(); bnep_register_packet_handler(packet_handler); bnep_register_service(NULL, bnep_local_service_uuid, 1691); /* Minimum L2CAP MTU for bnep is 1691 bytes */ /* Initialize SDP and add PANU record */ sdp_init(); uint16_t network_packet_types[] = { NETWORK_TYPE_IPv4, NETWORK_TYPE_ARP, 0}; // 0 as end of list #ifdef EMBEDDED service_record_item_t * service_record_item = (service_record_item_t *) panu_sdp_record; pan_create_panu_service((uint8_t*) &service_record_item->service_record, network_packet_types, NULL, NULL, BNEP_SECURITY_NONE); printf("SDP service buffer size: %u\n", (uint16_t) (sizeof(service_record_item_t) + de_get_len((uint8_t*) &service_record_item->service_record))); sdp_register_service_internal(NULL, service_record_item); #else pan_create_panu_service(panu_sdp_record, network_packet_types, NULL, NULL, BNEP_SECURITY_NONE); printf("SDP service record size: %u\n", de_get_len((uint8_t*) panu_sdp_record)); sdp_register_service_internal(NULL, (uint8_t*)panu_sdp_record); #endif /* Turn on the device */ hci_power_control(HCI_POWER_ON); hci_discoverable_control(1); btstack_stdin_setup(stdin_process); return 0; }
int btstack_main(int argc, const char * argv[]){ /* Register for HCI events */ hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); /* Initialize L2CAP */ l2cap_init(); /* Initialise BNEP */ bnep_init(); bnep_register_service(&packet_handler, bnep_local_service_uuid, 1691); /* Minimum L2CAP MTU for bnep is 1691 bytes */ /* Initialize SDP and add PANU record */ sdp_init(); uint16_t network_packet_types[] = { NETWORK_TYPE_IPv4, NETWORK_TYPE_ARP, 0}; // 0 as end of list pan_create_panu_sdp_record(panu_sdp_record, 0x10002, network_packet_types, NULL, NULL, BNEP_SECURITY_NONE); printf("SDP service record size: %u\n", de_get_len((uint8_t*) panu_sdp_record)); sdp_register_service((uint8_t*)panu_sdp_record); /* Turn on the device */ hci_power_control(HCI_POWER_ON); gap_discoverable_control(1); btstack_stdin_setup(stdin_process); return 0; }