Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 22, 2014 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed) More...
#include <cs_CrownstoneService.h>
Public Member Functions | |
CrownstoneService () | |
Constructor for general crownstone service object. More... | |
virtual void | handleEvent (event_t &event) |
Perform non urgent functionality every main loop. More... | |
![]() | |
Service () | |
virtual | ~Service () |
Default empty destructor. More... | |
void | init (Stack *stack) |
Initialize the service: register it at the softdevice. More... | |
void | setUUID (const UUID &uuid) |
Set the UUID. More... | |
Stack * | getStack () |
const UUID & | getUUID () const |
uint16_t | getHandle () |
tuple< CharacteristicBase * > | getCharacteristics () |
virtual void | createCharacteristics ()=0 |
void | onBleEvent (const ble_evt_t *event) |
void | onConnect (uint16_t connectionHandle, const ble_gap_evt_connected_t &event) |
void | onDisconnect (uint16_t connectionHandle, const ble_gap_evt_disconnected_t &event) |
bool | onWrite (const ble_gatts_evt_write_t &event, uint16_t gattHandle) |
void | onTxComplete (const ble_common_evt_t *event) |
void | addCharacteristic (CharacteristicBase *characteristic) |
Add a single characteristic to the list @characteristic Characteristic to add. More... | |
void | updatedCharacteristics () |
![]() | |
BaseClass () | |
bool | isInitialized (uint8_t i=0) |
void | setInitialized (uint8_t i=0) |
void | setUninitialized (uint8_t i=0) |
Protected Member Functions | |
void | createCharacteristics () |
Initialize a CrownstoneService object. More... | |
void | addControlCharacteristic (buffer_ptr_t buffer, cs_buffer_size_t size, uint16_t charUuid, EncryptionAccessLevel minimumAccessLevel) |
Enable the control characteristic. More... | |
void | addResultCharacteristic (buffer_ptr_t buffer, cs_buffer_size_t size, uint16_t charUuid, EncryptionAccessLevel minimumAccessLevel) |
Enable the result characteristic. More... | |
void | addFactoryResetCharacteristic () |
void | addSessionDataCharacteristic (buffer_ptr_t buffer, cs_buffer_size_t size, EncryptionAccessLevel minimumAccessLevel=BASIC) |
void | getReadBuffer (buffer_ptr_t &buffer, cs_buffer_size_t &maxLength) |
void | getWriteBuffer (buffer_ptr_t &buffer, cs_buffer_size_t &maxLength) |
void | removeBuffer () |
void | writeResult (uint8_t protocol, CommandHandlerTypes type, cs_result_t &result) |
Write a result to the result characteristic. More... | |
void | writeResult (uint8_t protocol, CommandHandlerTypes type, cs_ret_code_t retCode, cs_data_t data) |
Write a result to the result characteristic. More... | |
Protected Attributes | |
Characteristic< buffer_ptr_t > * | _controlCharacteristic = nullptr |
Characteristic< buffer_ptr_t > * | _resultCharacteristic = nullptr |
ControlPacketAccessor * | _controlPacketAccessor = nullptr |
ResultPacketAccessor * | _resultPacketAccessor = nullptr |
Private Attributes | |
uint8_t | _keySessionDataBuffer [sizeof(session_data_t)] |
Characteristic< buffer_ptr_t > * | _sessionDataCharacteristic = nullptr |
Characteristic< buffer_ptr_t > * | _sessionDataUnencryptedCharacteristic = nullptr |
Characteristic< uint32_t > * | _factoryResetCharacteristic = nullptr |
Additional Inherited Members | |
![]() | |
enum | condition_t { C_SERVICE_INITIALIZED } |
![]() | |
EventListener () | |
virtual | ~EventListener () |
unregisters the listener. More... | |
virtual void | handleEvent (event_t &event)=0 |
Handle events. More... | |
void | listen () |
Registers this with the EventDispatcher. More... | |
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 22, 2014 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
General Service for the Crownstone
There are several characteristics that fit into the general service description. There is a characteristic that measures the temperature, there are several characteristics that defines the crownstone, namely by name, by type, or by location (room), and there is a characteristic to update its firmware.
If meshing is enabled, it is also possible to send a message into the mesh network using a characteristic.
Constructor for general crownstone service object.
Creates persistent storage (FLASH) object which is used internally to store name and other information that is set over so-called configuration characteristics. It also initializes all characteristics.
|
protected |
Enable the control characteristic.
|
protected |
|
protected |
Enable the result characteristic.
|
protected |
|
protectedvirtual |
Initialize a CrownstoneService object.
Add all characteristics and initialize them where necessary.
Implements Service.
Reimplemented in SetupService.
|
protected |
|
protected |
|
virtual |
Perform non urgent functionality every main loop.
Every component has a "tick" function which is for non-urgent things. Urgent matters have to be resolved immediately in interrupt service handlers. The temperature for example is updated every tick, because timing is not important for this at all.
Implements EventListener.
Reimplemented in SetupService.
|
protected |
|
protected |
Write a result to the result characteristic.
[in] | protocol | The protocol version. |
[in] | type | The command type that was handled. |
[in] | result | The result of handling the command. |
|
protected |
Write a result to the result characteristic.
[in] | protocol | The protocol version. |
[in] | type | The command type that was handled. |
[in] | retCode | The result code of handling the command. |
[in] | data | The result data of handling the command. |
|
protected |
|
protected |
|
private |
|
private |
|
protected |
|
protected |
|
private |
|
private |