examples/nordic_uart: Use 'gattlib_notification_start()'

pull/204/head
Olivier Martin 2021-02-01 16:48:02 +01:00
parent b8f60de4e5
commit d63b7ccb27
1 changed files with 6 additions and 4 deletions

View File

@ -109,13 +109,15 @@ int main(int argc, char *argv[]) {
}
free(characteristics);
// Enable Status Notification
uint16_t enable_notification = 0x0001;
gattlib_write_char_by_handle(m_connection, rx_handle + 1, &enable_notification, sizeof(enable_notification));
// Register notification handler
gattlib_register_notification(m_connection, notification_cb, NULL);
ret = gattlib_notification_start(m_connection, &nus_characteristic_rx_uuid);
if (ret) {
fprintf(stderr, "Fail to start notification.\n");
return 2;
}
// Register handler to catch Ctrl+C
signal(SIGINT, int_handler);