Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
Mesh utils without dependencies on mesh SDK. More...
Classes | |
struct | cs_mesh_queue_item_meta_data_t |
Data needed in each model queue. More... | |
struct | cs_mesh_queue_item_t |
Struct to queue an item. More... | |
Functions | |
int8_t | getRssi (const nrf_mesh_rx_metadata_t *metaData) |
Get the RSSI from meta data. More... | |
uint8_t | getChannel (const nrf_mesh_rx_metadata_t *metaData) |
MeshMsgEvent | fromAccessMessageRX (const access_message_rx_t &accessMsg) |
Factory method because a constructor would pollute the struct. More... | |
void | printMeshAddress (const char *prefix, const nrf_mesh_address_t *addr) |
Print a mesh address. More... | |
bool | isValidMeshMessage (cs_mesh_msg_t *meshMsg) |
bool | isValidMeshMessage (uint8_t *meshMsg, size16_t msgSize) |
bool | isValidMeshPayload (cs_mesh_model_msg_type_t type, uint8_t *payload, size16_t payloadSize) |
bool | testIsValid (const cs_mesh_model_msg_test_t *packet, size16_t size) |
bool | ackIsValid (const uint8_t *packet, size16_t size) |
bool | timeIsValid (const cs_mesh_model_msg_time_t *packet, size16_t size) |
bool | noopIsValid (const uint8_t *packet, size16_t size) |
bool | multiSwitchIsValid (const uint8_t *packet, size16_t size) |
bool | state0IsValid (const cs_mesh_model_msg_state_0_t *packet, size16_t size) |
bool | state1IsValid (const cs_mesh_model_msg_state_1_t *packet, size16_t size) |
bool | profileLocationIsValid (const cs_mesh_model_msg_profile_location_t *packet, size16_t size) |
bool | setBehaviourSettingsIsValid (const behaviour_settings_t *packet, size16_t size) |
cs_mesh_model_msg_type_t | getType (const uint8_t *meshMsg) |
void | getPayload (uint8_t *meshMsg, size16_t meshMsgSize, uint8_t *&payload, size16_t &payloadSize) |
Get payload of a mesh message. More... | |
cs_data_t | getPayload (uint8_t *meshMsg, size16_t meshMsgSize) |
Get payload of a mesh message. More... | |
size16_t | getMeshMessageSize (size16_t payloadSize) |
bool | setMeshMessage (cs_mesh_model_msg_type_t type, const uint8_t *payload, size16_t payloadSize, uint8_t *meshMsg, size16_t meshMsgSize) |
Create a mesh message. More... | |
bool | setMeshPayload (uint8_t *meshMsg, size16_t meshMsgSize, const uint8_t *payload, size16_t payloadSize) |
Set payload of a mesh message. More... | |
bool | canShortenStateType (uint16_t type) |
bool | canShortenStateId (uint16_t id) |
bool | canShortenPersistenceMode (uint8_t id) |
bool | canShortenAccessLevel (EncryptionAccessLevel accessLevel) |
bool | canShortenSource (const cmd_source_with_counter_t &source) |
bool | canShortenRetCode (cs_ret_code_t retCode) |
uint8_t | getShortenedRetCode (cs_ret_code_t retCode) |
cs_ret_code_t | getInflatedRetCode (uint8_t retCode) |
uint8_t | getShortenedAccessLevel (EncryptionAccessLevel accessLevel) |
EncryptionAccessLevel | getInflatedAccessLevel (uint8_t accessLevel) |
uint8_t | getShortenedSource (const cmd_source_with_counter_t &source) |
cmd_source_with_counter_t | getInflatedSource (uint8_t sourceId) |
Mesh utils without dependencies on mesh SDK.
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: 10 May., 2019 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
Mesh utils with dependencies on mesh SDK.
bool MeshUtil::ackIsValid | ( | const uint8_t * | packet, |
size16_t | size | ||
) |
bool MeshUtil::canShortenAccessLevel | ( | EncryptionAccessLevel | accessLevel | ) |
bool MeshUtil::canShortenPersistenceMode | ( | uint8_t | id | ) |
bool MeshUtil::canShortenRetCode | ( | cs_ret_code_t | retCode | ) |
bool MeshUtil::canShortenSource | ( | const cmd_source_with_counter_t & | source | ) |
bool MeshUtil::canShortenStateId | ( | uint16_t | id | ) |
bool MeshUtil::canShortenStateType | ( | uint16_t | type | ) |
MeshMsgEvent MeshUtil::fromAccessMessageRX | ( | const access_message_rx_t & | accessMsg | ) |
Factory method because a constructor would pollute the struct.
uint8_t MeshUtil::getChannel | ( | const nrf_mesh_rx_metadata_t * | metaData | ) |
EncryptionAccessLevel MeshUtil::getInflatedAccessLevel | ( | uint8_t | accessLevel | ) |
cs_ret_code_t MeshUtil::getInflatedRetCode | ( | uint8_t | retCode | ) |
cmd_source_with_counter_t MeshUtil::getInflatedSource | ( | uint8_t | sourceId | ) |
Get payload of a mesh message.
Assumes message is valid.
[in] | meshMsg | Mesh message.. |
[in] | meshMsgSize | Size of the mesh message. |
void MeshUtil::getPayload | ( | uint8_t * | meshMsg, |
size16_t | meshMsgSize, | ||
uint8_t *& | payload, | ||
size16_t & | payloadSize | ||
) |
Get payload of a mesh message.
Assumes message is valid.
[in] | meshMsg | Mesh message.. |
[in] | meshMsgSize | Size of the mesh message. |
[out] | payload | Set to payload. |
[out] | payloadSize | Set to size of the payload. |
int8_t MeshUtil::getRssi | ( | const nrf_mesh_rx_metadata_t * | metaData | ) |
Get the RSSI from meta data.
uint8_t MeshUtil::getShortenedAccessLevel | ( | EncryptionAccessLevel | accessLevel | ) |
uint8_t MeshUtil::getShortenedRetCode | ( | cs_ret_code_t | retCode | ) |
uint8_t MeshUtil::getShortenedSource | ( | const cmd_source_with_counter_t & | source | ) |
cs_mesh_model_msg_type_t MeshUtil::getType | ( | const uint8_t * | meshMsg | ) |
bool MeshUtil::isValidMeshMessage | ( | cs_mesh_msg_t * | meshMsg | ) |
bool MeshUtil::isValidMeshMessage | ( | uint8_t * | meshMsg, |
size16_t | msgSize | ||
) |
bool MeshUtil::isValidMeshPayload | ( | cs_mesh_model_msg_type_t | type, |
uint8_t * | payload, | ||
size16_t | payloadSize | ||
) |
bool MeshUtil::multiSwitchIsValid | ( | const uint8_t * | packet, |
size16_t | size | ||
) |
bool MeshUtil::noopIsValid | ( | const uint8_t * | packet, |
size16_t | size | ||
) |
void MeshUtil::printMeshAddress | ( | const char * | prefix, |
const nrf_mesh_address_t * | addr | ||
) |
Print a mesh address.
bool MeshUtil::profileLocationIsValid | ( | const cs_mesh_model_msg_profile_location_t * | packet, |
size16_t | size | ||
) |
bool MeshUtil::setBehaviourSettingsIsValid | ( | const behaviour_settings_t * | packet, |
size16_t | size | ||
) |
bool MeshUtil::setMeshMessage | ( | cs_mesh_model_msg_type_t | type, |
const uint8_t * | payload, | ||
size16_t | payloadSize, | ||
uint8_t * | meshMsg, | ||
size16_t | meshMsgSize | ||
) |
Create a mesh message.
Copies the payload into the mesh message. Assumes payload is valid.
[in] | type | Payload type. |
[in] | payload | Payload packet. |
[in] | payloadSize | Size of the payload. |
[in,out] | meshMsg | Mesh message, must already be allocated. |
[in] | meshMsgSize | Size of allocated the mesh message. |
True | on success. |
bool MeshUtil::setMeshPayload | ( | uint8_t * | meshMsg, |
size16_t | meshMsgSize, | ||
const uint8_t * | payload, | ||
size16_t | payloadSize | ||
) |
Set payload of a mesh message.
Copies the payload into the mesh message. Assumes payload is valid.
[in] | payload | Payload packet. |
[in] | payloadSize | Size of the payload. |
[in,out] | meshMsg | Mesh message, must already be allocated. |
[in,out] | meshMsgSize | Size of allocated the mesh message, set to size of the message on success. |
True | on success. |
bool MeshUtil::state0IsValid | ( | const cs_mesh_model_msg_state_0_t * | packet, |
size16_t | size | ||
) |
bool MeshUtil::state1IsValid | ( | const cs_mesh_model_msg_state_1_t * | packet, |
size16_t | size | ||
) |
bool MeshUtil::testIsValid | ( | const cs_mesh_model_msg_test_t * | packet, |
size16_t | size | ||
) |
bool MeshUtil::timeIsValid | ( | const cs_mesh_model_msg_time_t * | packet, |
size16_t | size | ||
) |