Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
SetupService Class Reference

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_SetupService.h>

Inheritance diagram for SetupService:
Collaboration diagram for SetupService:

Public Member Functions

 SetupService ()
 Setup Service derivces from Crownstone Service. More...
 
void createCharacteristics ()
 Initialize the Setup Service object. More...
 
void handleEvent (event_t &event)
 Perform non urgent functionality every main loop. More...
 
- Public Member Functions inherited from CrownstoneService
 CrownstoneService ()
 Constructor for general crownstone service object. More...
 
virtual void handleEvent (event_t &event)
 Perform non urgent functionality every main loop. More...
 
- Public Member Functions inherited from Service
 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...
 
StackgetStack ()
 
const UUIDgetUUID () 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 ()
 
- Public Member Functions inherited from BaseClass< 1 >
 BaseClass ()
 
bool isInitialized (uint8_t i=0)
 
void setInitialized (uint8_t i=0)
 
void setUninitialized (uint8_t i=0)
 

Protected Member Functions

void addMacAddressCharacteristic ()
 
void addSetupKeyCharacteristic (buffer_ptr_t buffer, uint16_t size)
 
- Protected Member Functions inherited from CrownstoneService
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...
 

Private Attributes

ble_gap_addr_t _myAddr
 
uint8_t _keyBuffer [SOC_ECB_KEY_LENGTH]
 
Characteristic< buffer_ptr_t > * _macAddressCharacteristic
 
Characteristic< buffer_ptr_t > * _setupKeyCharacteristic
 

Additional Inherited Members

- Public Types inherited from Service
enum  condition_t { C_SERVICE_INITIALIZED }
 
- Protected Attributes inherited from CrownstoneService
Characteristic< buffer_ptr_t > * _controlCharacteristic = nullptr
 
Characteristic< buffer_ptr_t > * _resultCharacteristic = nullptr
 
ControlPacketAccessor_controlPacketAccessor = nullptr
 
ResultPacketAccessor_resultPacketAccessor = nullptr
 

Detailed Description

Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 22, 2014 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)

Setup Service for the Crownstone

Constructor & Destructor Documentation

◆ SetupService()

Member Function Documentation

◆ addMacAddressCharacteristic()

void SetupService::addMacAddressCharacteristic ( )
inlineprotected

◆ addSetupKeyCharacteristic()

void SetupService::addSetupKeyCharacteristic ( buffer_ptr_t  buffer,
uint16_t  size 
)
inlineprotected

◆ createCharacteristics()

void SetupService::createCharacteristics ( )
virtual

Initialize the Setup Service object.

Add all characteristics and initialize them if necessary. The function will not call createCharacteristics of the super class CrownstoneService.

Reimplemented from CrownstoneService.

◆ handleEvent()

void SetupService::handleEvent ( event_t event)
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.

Reimplemented from CrownstoneService.

Member Data Documentation

◆ _keyBuffer

uint8_t SetupService::_keyBuffer[SOC_ECB_KEY_LENGTH]
private

◆ _macAddressCharacteristic

Characteristic<buffer_ptr_t>* SetupService::_macAddressCharacteristic
private

◆ _myAddr

ble_gap_addr_t SetupService::_myAddr
private

◆ _setupKeyCharacteristic

Characteristic<buffer_ptr_t>* SetupService::_setupKeyCharacteristic
private

The documentation for this class was generated from the following file: