void ble_host_discover_char(void* arg)
{
    /* start tx handle characteristic dynamic discovery if not yet done */
    if (host_connected && !end_read_write_char_handle) {
        printf("1\n");
        read_write_char_handle();
    }
    else if (host_connected && !end_read_notify_read_char_handle) {
        read_notify_read_char_handle();
        printf("2\n");
    }
    else if (host_connected && !end_read_write_without_rsp_char_handle) {
        read_write_without_rsp_char_handle();
        printf("3\n");
    }
    else if (host_connected && !end_read_notify_char_handle) {
        read_notify_char_handle();
        printf("4\n");
    }

    if(host_connected && end_read_write_char_handle && end_read_notify_read_char_handle && end_read_write_without_rsp_char_handle && end_read_notify_char_handle && !host_notification_enabled) {
        enableNotification();
        printf("discover over\n\r");
    } else {
        printf("host_connected: %x, end_read_write_char_handle : %x\n", host_connected, end_read_write_char_handle);
    }
}
Example #2
0
void ble_host_discover_char(void)
{
    /* Start TX handle Characteristic dynamic discovery if not yet done */
    if (connected && !end_read_write_char_handle) {
        read_write_char_handle();
    }
    /* Start RX handle Characteristic dynamic discovery if not yet done */
    else if (connected && !end_read_write_without_rsp_char_handle) {
        read_write_without_rsp_char_handle();
    }
    else if (connected && !end_read_notify_read_char_handle) {
        read_notify_read_char_handle();
    }
    else if (connected && !end_read_notify_char_handle) {
        read_notify_char_handle();
    }

    if(connected && end_read_write_char_handle && end_read_notify_read_char_handle && end_read_write_without_rsp_char_handle && end_read_notify_char_handle && !host_notification_enabled) {
        BSP_LED_Off(LED0); //end of the connection and chars discovery phase
        enableNotification();
        printf("discover over\n\r");
    }

}