Datasheet
Example
The following example configures an instance of the Heart Rate Monitor (HRM) Service and it's related characteristics:
virtual err_t begin(void);
// Add Descriptor function must be called right after begin()
err_t addDescriptor(BLEUuid bleuuid, void const * content, uint16_t len, BleSecurityMode read_perm = SECMODE_OPEN, BleSecurityMode write_perm = SECMODE_NO_ACCESS);
ble_gatts_char_handles_t handles(void);
/*------------- Write -------------*/
uint16_t write(const void* data, uint16_t len);
uint16_t write(const char* str);
uint16_t write8 (uint8_t num);
uint16_t write16 (uint16_t num);
uint16_t write32 (uint32_t num);
uint16_t write32 (int num);
/*------------- Read -------------*/
uint16_t read(void* buffer, uint16_t bufsize);
uint8_t read8 (void);
uint16_t read16(void);
uint32_t read32(void);
/*------------- Notify -------------*/
uint16_t getCccd(void);
bool notifyEnabled(void);
bool notify(const void* data, uint16_t len);
bool notify(const char* str);
bool notify8 (uint8_t num);
bool notify16 (uint16_t num);
bool notify32 (uint32_t num);
bool notify32 (int num);
/*------------- Indicate -------------*/
bool indicateEnabled(void);
bool indicate(const void* data, uint16_t len);
bool indicate(const char* str);
bool indicate8 (uint8_t num);
bool indicate16 (uint16_t num);
bool indicate32 (uint32_t num);
bool indicate32 (int num);
Note that this example code is incomplete. For the full example open the 'custom_hrm' example that is part
of the nRF52 BSP! The code below is for illustration purposes only.
/* HRM Service Definitions
© Adafruit Industries https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide Page 109 of 175