This page is a work in progress as the API is changing as we migrate to S132v5 (nRF52832) and S140 (nRF52840) and add better Central mode support.

BLEDiscovery is a helper class to make finding characteristics on a Gatt server (hosted on a BLE peripheral) easier. For service discovery, the BLEClientService's discover() API must be used, as shown below:

API

BLEDiscovery(void); // Constructor

void     begin(void);
bool     begun(void);

void                     setHandleRange(ble_gattc_handle_range_t handle_range);
ble_gattc_handle_range_t getHandleRange(void);

uint8_t  discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic* chr[], uint8_t count);
uint8_t  discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic& chr1);
uint8_t  discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic& chr1, BLEClientCharacteristic& chr2);
uint8_t  discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic& chr1, BLEClientCharacteristic& chr2, BLEClientCharacteristic& chr3);
uint8_t  discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic& chr1, BLEClientCharacteristic& chr2, BLEClientCharacteristic& chr3, BLEClientCharacteristic& chr4);
uint8_t  discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic& chr1, BLEClientCharacteristic& chr2, BLEClientCharacteristic& chr3, BLEClientCharacteristic& chr4, BLEClientCharacteristic& chr5);
For concrete examples of how to use this API see the 'Central' folder in the examples that are part of the BSP.

This guide was first published on Jan 02, 2019. It was last updated on Sep 30, 2023.

This page (BLEDiscovery) was last updated on Jan 03, 2018.

Text editor powered by tinymce.