Esempio n. 1
0
static void packet_handler (void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
    if (packet_type != HCI_EVENT_PACKET) return;
    uint8_t event = packet[0];

    switch (event) {
        case BTSTACK_EVENT_STATE:
            // bt stack activated, get started 
            if (packet[2] == HCI_STATE_WORKING){
                sdp_general_query_for_uuid(remote, 0x1002);
            }
            break;
        default:
            break;
    }
}
Esempio n. 2
0
/* LISTING_START(SDPQueryUUID): Querying a list of service records on a remote device. */
static void packet_handler (void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
    // printf("packet_handler type %u, packet[0] %x\n", packet_type, packet[0]);

    if (packet_type != HCI_EVENT_PACKET) return;
    uint8_t event = packet[0];

    switch (event) {
        case BTSTACK_EVENT_STATE:
            if (packet[2] == HCI_STATE_WORKING){
                sdp_general_query_for_uuid(remote, SDP_PublicBrowseGroup);
            }
            break;
        default:
            break;
    }
}