15#if BUILD_MESH_TOPOLOGY_RESEARCH == 1
179#if BUILD_MESH_TOPOLOGY_RESEARCH == 1
Event listener.
Definition: cs_EventListener.h:17
Definition: cs_MeshMsgEvent.h:71
This class/component keeps track of the rssi distance of a crownstone to its neighbors (i....
Definition: cs_MeshTopologyResearch.h:28
Definition: cs_MeshTopology.h:19
static constexpr uint8_t TIMEOUT_SECONDS
Time after last seen, before a neighbour is removed from the list.
Definition: cs_MeshTopology.h:29
static constexpr uint16_t FAST_INTERVAL_TIMEOUT_SECONDS
After a reset, the FAST intervals will be used instead, for this amount of seconds.
Definition: cs_MeshTopology.h:48
cs_ret_code_t onStoneMacMsg(MeshMsgEvent &meshMsg)
cs_ret_code_t getMacAddress(stone_id_t stoneId)
Get the MAC address of a neighbouring crownstone.
void sendNoop()
Send a no-hop noop mesh message.
void getRssi(stone_id_t stoneId, cs_result_t &result)
Get the RSSI of given stone ID and put it in the result buffer.
uint16_t _sendCountdown
Countdown in seconds until sending the next mesh message.
Definition: cs_MeshTopology.h:105
void reset()
Resets the stored topology.
uint16_t _fastIntervalCountdown
Countdown in seconds until sending at regular interval again.
Definition: cs_MeshTopology.h:115
neighbour_node_t * _neighbours
A list of all known neighbours, allocated on init.
Definition: cs_MeshTopology.h:90
static constexpr uint16_t SEND_INTERVAL_SECONDS_PER_NEIGHBOUR
Interval at which a mesh messages is sent for each neighbour.
Definition: cs_MeshTopology.h:34
void onNeighbourRssi(stone_id_t id, cs_mesh_model_msg_neighbour_rssi_t &packet)
uint16_t _sendNoopCountdown
Countdown in seconds until sending the next no hop ping mesh message.
Definition: cs_MeshTopology.h:110
static constexpr uint16_t SEND_NOOP_INTERVAL_SECONDS_FAST
Definition: cs_MeshTopology.h:43
stone_id_t _myId
Stone ID of this crownstone, read on init.
Definition: cs_MeshTopology.h:85
static constexpr uint8_t INDEX_NOT_FOUND
Definition: cs_MeshTopology.h:70
uint8_t _msgCount
Overflowing message counter.
Definition: cs_MeshTopology.h:120
uint8_t find(stone_id_t id)
Find a neighbour in the list.
void handleEvent(event_t &evt)
Internal usage.
void sendNext()
Sends the RSSI of 1 neighbour over the mesh and UART.
static constexpr uint8_t MAX_NEIGHBOURS
Maximum number of neighbours in the list.
Definition: cs_MeshTopology.h:24
static constexpr uint16_t SEND_INTERVAL_SECONDS_PER_NEIGHBOUR_FAST
Definition: cs_MeshTopology.h:35
cs_ret_code_t init()
Initializes the class:
static constexpr int8_t RSSI_INIT
Definition: cs_MeshTopology.h:72
void print()
Print all neighbours.
uint8_t _nextSendIndex
Next index of the neighbours list to send via the mesh.
Definition: cs_MeshTopology.h:100
static constexpr uint16_t SEND_NOOP_INTERVAL_SECONDS
Interval at which a no-hop noop message is sent.
Definition: cs_MeshTopology.h:42
void add(stone_id_t id, int8_t rssi, uint8_t channel)
Add a neighbour to the list.
void updateNeighbour(neighbour_node_t &node, stone_id_t id, int8_t rssi, uint8_t channel)
Update the data of a node in the list.
void onMeshMsg(MeshMsgEvent &packet, cs_result_t &result)
uint8_t _neighbourCount
Number of neighbours in the list.
Definition: cs_MeshTopology.h:95
void sendRssiToUart(stone_id_t reveiverId, cs_mesh_model_msg_neighbour_rssi_t &packet)
Sends the RSSI to a neighbour over UART.
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
uint8_t stone_id_t
Definition: cs_Typedefs.h:23
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
Definition: cs_MeshTopology.h:74
stone_id_t id
Definition: cs_MeshTopology.h:75
int8_t rssiChannel37
Definition: cs_MeshTopology.h:76
int8_t rssiChannel39
Definition: cs_MeshTopology.h:78
int8_t rssiChannel38
Definition: cs_MeshTopology.h:77
uint8_t lastSeenSecondsAgo
Definition: cs_MeshTopology.h:79
Definition: cs_PacketsInternal.h:46