A library for easier setup and prototyping of new pucks, by collecting everything that is common for all pucks in one place.
Dependencies: BLE_API nRF51822
Fork of Puck by
Puck Class Reference
A library for easier setup and prototyping of IoT devices (pucks), by collecting everything that is common for all pucks in one place. More...
#include <Puck.h>
Public Member Functions | |
void | init (uint16_t minor) |
Call after finishing configuring puck (adding services, characteristics, callbacks). | |
bool | drive () |
Pass control to the bluetooth stack, executing pending callbacks afterwards. | |
int | countFreeMemory () |
Approximates malloc-able heap space. | |
void | onDataWritten (uint16_t handle) |
For internal use only. | |
void | addCharacteristic (const UUID serviceUuid, const UUID characteristicUuid, int bytes, int properties=0xA) |
Extends the given gatt service with the given gatt characteristic. | |
void | onCharacteristicWrite (const UUID *uuid, CharacteristicWriteCallback callback) |
Register callback to be triggered on characteristic write. | |
void | updateCharacteristicValue (const UUID uuid, uint8_t *value, int length) |
Update the value of the given gatt characteristic. | |
uint8_t * | getCharacteristicValue (const UUID uuid) |
Returns current value of provided gatt characteristic. | |
Static Public Member Functions | |
static Puck & | getPuck () |
Returns singleton instance of puck object. |
Detailed Description
A library for easier setup and prototyping of IoT devices (pucks), by collecting everything that is common for all pucks in one place.
Definition at line 28 of file Puck.h.
Member Function Documentation
void addCharacteristic | ( | const UUID | serviceUuid, |
const UUID | characteristicUuid, | ||
int | bytes, | ||
int | properties = 0xA |
||
) |
Extends the given gatt service with the given gatt characteristic.
If the service doesn't exist, it is created.
- Parameters:
-
serviceUuid UUID of the gatt service to be extended. characteristicUuid UUID to use for this characteristic. bytes Length in bytes of this characteristic's value. properties 8-bit bit field containing the characteristic's properties. See ble_gatt_char_properties_t.
- Returns:
- Void.
int countFreeMemory | ( | ) |
bool drive | ( | ) |
uint8_t * getCharacteristicValue | ( | const UUID | uuid ) |
Puck & getPuck | ( | ) | [static] |
void init | ( | uint16_t | minor ) |
void onCharacteristicWrite | ( | const UUID * | uuid, |
CharacteristicWriteCallback | callback | ||
) |
void onDataWritten | ( | uint16_t | handle ) |
void updateCharacteristicValue | ( | const UUID | uuid, |
uint8_t * | value, | ||
int | length | ||
) |
Generated on Wed Jul 13 2022 20:59:23 by 1.7.2