Event listener.
Definition: cs_EventListener.h:17
Class that:
Definition: cs_UartConnection.h:19
void onUserStatus(const uart_msg_status_user_t &status)
To be called on UART status command.
bool isEncryptedAlive()
Returns whether the connection is considered to be alive and encrypted (receiving encrypted heartbeat...
void init()
Initialize the class.
uart_msg_status_reply_t _status
Keep up the UART status reply.
Definition: cs_UartConnection.h:112
void handleEvent(event_t &event)
Handle events.
bool _isConnectionEncrypted
Whether the connection heartbeats are encrypted.
Definition: cs_UartConnection.h:121
bool isAlive()
Returns whether the connection is considered to be alive (receiving heartbeats).
bool _sessionNonceValid
Whether the RX and TX session nonce are valid.
Definition: cs_UartConnection.h:142
uint8_t _sessionNonceTx[SESSION_NONCE_LENGTH]
Session nonce used to encrypt outgoing uart msgs.
Definition: cs_UartConnection.h:137
uint32_t _connectionTimeoutCountdown
Timeout (in tick events) set by heartbeat.
Definition: cs_UartConnection.h:127
uint32_t _sessionNonceTimeoutCountdown
Timeout (in tick events) set by the received session nonce.
Definition: cs_UartConnection.h:148
UartConnection(UartConnection const &)=delete
This class is singleton, deny implementation.
const uart_msg_status_reply_t & getSelfStatus()
Returns the UART status reply.
uart_msg_status_user_t _userStatus
Keep up the UART user status.
Definition: cs_UartConnection.h:115
bool _isConnectionAlive
Keep up whether the connection is considered to be alive.
Definition: cs_UartConnection.h:118
void onHeartBeat(uint16_t timeoutSeconds, bool encrypted)
To be called on UART heartbeat command.
cs_ret_code_t getSessionNonceTx(cs_data_t data)
Get the session nonce for TX.
uint8_t _sessionNonceRx[SESSION_NONCE_LENGTH]
Session nonce used to decrypt incoming uart msgs.
Definition: cs_UartConnection.h:132
void operator=(UartConnection const &)=delete
This class is singleton, deny implementation.
const uart_msg_status_user_t & getUserStatus()
Returns the status of the UART user.
UartConnection()
Constructor.
static UartConnection & getInstance()
Gets a static singleton (no dynamic memory allocation) of this class.
Definition: cs_UartConnection.h:22
cs_ret_code_t getSessionNonceRx(cs_data_t data)
Get the session nonce for RX.
void onSessionNonce(const uart_msg_session_nonce_t &sessionNonce)
To be called on UART session nonce command.
void onHello(const uart_msg_status_user_flags_t &flags)
To be called on UART hello command.
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
#define SESSION_NONCE_LENGTH
Definition: cs_Packets.h:25
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27
Definition: cs_UartMsgTypes.h:58
Definition: cs_UartMsgTypes.h:45
Definition: cs_UartMsgTypes.h:39
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Jan 17,...
Definition: cs_UartMsgTypes.h:14