Clone of the nRF51822 repository from github The correct home is https://github.com/lancaster-university/nRF51822
Dependencies: nrf51-sdk
Dependents: microbit-dal microbit-ble-open microbit-dal-eddystone microbit-dal-ble-accelerometer-example ... more
Diff: source/nRF5xGattServer.h
- Revision:
- 616:a8f9b022d8fd
- Parent:
- 615:65ea2acfc6a2
--- a/source/nRF5xGattServer.h Wed Apr 06 22:38:43 2016 +0100 +++ b/source/nRF5xGattServer.h Wed Apr 06 22:39:17 2016 +0100 @@ -27,24 +27,25 @@ class nRF5xGattServer : public GattServer { public: - static nRF5xGattServer &getInstance(); - /* Functions that must be implemented from GattServer */ virtual ble_error_t addService(GattService &); virtual ble_error_t read(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP); virtual ble_error_t read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP); virtual ble_error_t write(GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false); virtual ble_error_t write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false); + virtual ble_error_t notify(GattAttribute::Handle_t, const uint8_t[], uint16_t); virtual ble_error_t areUpdatesEnabled(const GattCharacteristic &characteristic, bool *enabledP); virtual ble_error_t areUpdatesEnabled(Gap::Handle_t connectionHandle, const GattCharacteristic &characteristic, bool *enabledP); + virtual ble_error_t reset(void); /* nRF51 Functions */ void eventCallback(void); void hwCallback(ble_evt_t *p_ble_evt); + private: - const static unsigned BLE_TOTAL_CHARACTERISTICS = 20; - const static unsigned BLE_TOTAL_DESCRIPTORS = 8; + const static unsigned BLE_TOTAL_CHARACTERISTICS = 30; + const static unsigned BLE_TOTAL_DESCRIPTORS = 20; private: /** @@ -86,6 +87,11 @@ uint8_t descriptorCount; uint16_t nrfDescriptorHandles[BLE_TOTAL_DESCRIPTORS]; + /* + * Allow instantiation from nRF5xn when required. + */ + friend class nRF5xn; + nRF5xGattServer() : GattServer(), p_characteristics(), nrfCharacteristicHandles(), p_descriptors(), descriptorCount(0), nrfDescriptorHandles() { /* empty */ }