Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_CrownstoneService.h
Go to the documentation of this file.
1
7#pragma once
8
10#include <ble/cs_Nordic.h>
11#include <ble/cs_Service.h>
16
26public:
33
40 // void tick();
41
42 // void scheduleNextTick();
43
44 virtual void handleEvent(event_t& event);
45
46protected:
52
56 buffer_ptr_t buffer, cs_buffer_size_t size, uint16_t charUuid, EncryptionAccessLevel minimumAccessLevel);
57
62 buffer_ptr_t buffer, cs_buffer_size_t size, uint16_t charUuid, EncryptionAccessLevel minimumAccessLevel);
63
65
67 buffer_ptr_t buffer, cs_buffer_size_t size, EncryptionAccessLevel minimumAccessLevel = BASIC);
68
69 void getReadBuffer(buffer_ptr_t& buffer, cs_buffer_size_t& maxLength);
70 void getWriteBuffer(buffer_ptr_t& buffer, cs_buffer_size_t& maxLength);
71
73
74protected:
77
80
87 void writeResult(uint8_t protocol, CommandHandlerTypes type, cs_result_t& result);
88
96 void writeResult(uint8_t protocol, CommandHandlerTypes type, cs_ret_code_t retCode, cs_data_t data);
97
98private:
100
104};
Characteristic of generic type T.
Definition: cs_Characteristic.h:29
Definition: cs_ControlPacketAccessor.h:27
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 22,...
Definition: cs_CrownstoneService.h:25
void getWriteBuffer(buffer_ptr_t &buffer, cs_buffer_size_t &maxLength)
Characteristic< buffer_ptr_t > * _sessionDataUnencryptedCharacteristic
Definition: cs_CrownstoneService.h:102
Characteristic< buffer_ptr_t > * _resultCharacteristic
Definition: cs_CrownstoneService.h:76
virtual void handleEvent(event_t &event)
Perform non urgent functionality every main loop.
Characteristic< uint32_t > * _factoryResetCharacteristic
Definition: cs_CrownstoneService.h:103
ResultPacketAccessor * _resultPacketAccessor
Definition: cs_CrownstoneService.h:79
void writeResult(uint8_t protocol, CommandHandlerTypes type, cs_ret_code_t retCode, cs_data_t data)
Write a result to the result characteristic.
uint8_t _keySessionDataBuffer[sizeof(session_data_t)]
Definition: cs_CrownstoneService.h:99
Characteristic< buffer_ptr_t > * _sessionDataCharacteristic
Definition: cs_CrownstoneService.h:101
void writeResult(uint8_t protocol, CommandHandlerTypes type, cs_result_t &result)
Write a result to the result characteristic.
CrownstoneService()
Constructor for general crownstone service object.
void addControlCharacteristic(buffer_ptr_t buffer, cs_buffer_size_t size, uint16_t charUuid, EncryptionAccessLevel minimumAccessLevel)
Enable the control characteristic.
void addResultCharacteristic(buffer_ptr_t buffer, cs_buffer_size_t size, uint16_t charUuid, EncryptionAccessLevel minimumAccessLevel)
Enable the result characteristic.
void addSessionDataCharacteristic(buffer_ptr_t buffer, cs_buffer_size_t size, EncryptionAccessLevel minimumAccessLevel=BASIC)
ControlPacketAccessor * _controlPacketAccessor
Definition: cs_CrownstoneService.h:78
Characteristic< buffer_ptr_t > * _controlCharacteristic
Definition: cs_CrownstoneService.h:75
void createCharacteristics()
Initialize a CrownstoneService object.
void getReadBuffer(buffer_ptr_t &buffer, cs_buffer_size_t &maxLength)
void addFactoryResetCharacteristic()
Event listener.
Definition: cs_EventListener.h:17
Definition: cs_ResultPacketAccessor.h:25
Base class for a BLE service.
Definition: cs_Service.h:26
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
CommandHandlerTypes
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Jun 3,...
Definition: cs_CommandTypes.h:10
EncryptionAccessLevel
Packets (structs) that are used over the air, over uart, or stored in flash.
Definition: cs_Packets.h:36
@ BASIC
Definition: cs_Packets.h:39
BLE service.
uint16_t cs_buffer_size_t
Definition: cs_Typedefs.h:20
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
uint8_t * buffer_ptr_t
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: 10 May....
Definition: cs_Typedefs.h:19
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27
Definition: cs_PacketsInternal.h:46
Definition: cs_Packets.h:71