Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
This class/component keeps track of the rssi distance of a crownstone to its neighbors (i.e. More...
#include <cs_MeshTopologyResearch.h>
Classes | |
struct | TimingSettings |
Public Member Functions | |
MeshTopologyResearch () | |
void | handleEvent (event_t &evt) |
Handles the following events: CS_TICK: Coroutine for rssi data updates. More... | |
void | init () |
Obtains the stone_id_t of this crownstone to use for forwarded ping messages. More... | |
![]() | |
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... | |
Private Member Functions | |
uint32_t | flushAggregatedRssiData () |
Coroutine method: To prevent the mesh from flooding, flushing is throttled. More... | |
uint8_t | getVarianceRepresentation (float standard_deviation) |
Returns the 3 bit descriptor of the given variance as defined in cs_PacketsInternal.h. More... | |
uint8_t | getMeanRssiRepresentation (float mean) |
Returns the 7 bit representation of the given mean as defined in cs_PacketsInternal.h. More... | |
uint8_t | getCountRepresentation (uint32_t count) |
Returns the 6 bit representation of the given count as defined in cs_PacketsInternal.h. More... | |
void | sendPingRequestOverMesh () |
Dispatches an event of type CMD_SEND_MESH_MSG in order to send a CS_MESH_MODEL_TYPE_RSSI_PING. More... | |
void | sendPingResponseOverMesh () |
Dispatches an event of type CMD_SEND_MESH_MSG in order to send a CMD_SEND_MESH_MSG_NOOP. More... | |
void | receivePingMessage (MeshMsgEvent &mesh_msg_evt) |
If the ping message is a request that has not hopped,. More... | |
void | sendRssiDataOverMesh (rssi_data_message_t *rssi_data_message) |
Dispatches an event of type CMD_SEND_MESH_MSG in order to send a CS_MESH_MODEL_TYPE_RSSI_DATA. More... | |
void | sendRssiDataOverUart (rssi_data_message_t *rssi_data_message) |
Writes a message of type UART_OPCODE_TX_RSSI_DATA_MESSAGE with the given parameter as data. More... | |
void | receiveRssiDataMessage (MeshMsgEvent &mesh_msg_evt) |
Any received rssi_data_message_t will be sendRssiDataOverUart. More... | |
void | receiveMeshMsgEvent (MeshMsgEvent &mesh_msg_evt) |
If the event was no-hop: More... | |
void | recordRssiValue (stone_id_t sender_id, int8_t rssi, uint8_t channel) |
Saves rssi value to last received map and variance recorder map. More... | |
Private Attributes | |
stone_id_t | my_id = 0xff |
std::map< stone_id_t, VarianceAggregator > | variance_map [CHANNEL_COUNT] = {} |
bool | boot_sequence_finished = false |
stone_id_t | last_stone_id_broadcasted_in_burst = 0 |
Coroutine | flushRoutine |
Static Private Attributes | |
static constexpr uint8_t | CHANNEL_COUNT = 3 |
static constexpr uint8_t | CHANNEL_START = 37 |
static constexpr TimingSettings | Settings |
This class/component keeps track of the rssi distance of a crownstone to its neighbors (i.e.
those within zero hop distance on the mesh).
At configurable intervals it will broadcast its acquired data in a burst over the mesh so that a hub, or other interested connected devices can retrieve it.
|
private |
Coroutine method: To prevent the mesh from flooding, flushing is throttled.
Broadcasts a rssi_data_message_t for each of the pairs of crownstones in the local maps, together with the (oriented) average rssi value between those stones. After that, clear all the maps.
|
inlineprivate |
Returns the 6 bit representation of the given count as defined in cs_PacketsInternal.h.
|
inlineprivate |
Returns the 7 bit representation of the given mean as defined in cs_PacketsInternal.h.
|
inlineprivate |
Returns the 3 bit descriptor of the given variance as defined in cs_PacketsInternal.h.
|
virtual |
Handles the following events: CS_TICK: Coroutine for rssi data updates.
CS_TYPE_EVT_RECV_MESH_MSG of types:
(Will propagate data over UART for the hub to use it.)
Implements EventListener.
void MeshTopologyResearch::init | ( | ) |
Obtains the stone_id_t of this crownstone to use for forwarded ping messages.
|
private |
If the event was no-hop:
|
private |
If the ping message is a request that has not hopped,.
|
private |
Any received rssi_data_message_t will be sendRssiDataOverUart.
Assumes mesh_msg_event is of type CS_MESH_MODEL_TYPE_RSSI_DATA.
|
private |
Saves rssi value to last received map and variance recorder map.
If the long term recorder has accumulated a lot of data, it will be reduced to prevent overflow.
|
private |
Dispatches an event of type CMD_SEND_MESH_MSG in order to send a CS_MESH_MODEL_TYPE_RSSI_PING.
|
private |
Dispatches an event of type CMD_SEND_MESH_MSG in order to send a CMD_SEND_MESH_MSG_NOOP.
(This nop will be handled by receiveGenericMeshMessage)
|
private |
Dispatches an event of type CMD_SEND_MESH_MSG in order to send a CS_MESH_MODEL_TYPE_RSSI_DATA.
|
private |
Writes a message of type UART_OPCODE_TX_RSSI_DATA_MESSAGE with the given parameter as data.
|
private |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
private |
|
private |
|
private |
|
staticconstexprprivate |
|
private |