Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_MeshMsgHandler.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyright: Crownstone (https://crownstone.rocks)
4 * Date: Mar 10, 2020
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7
8#pragma once
9
10#include <common/cs_Types.h>
12
18public:
19 void init();
21
22protected:
43
45
46private:
48
53 };
54
59
60 // /**
61 // * Cache last received switch command, so it can be ignored.
62 // */
63 // cs_mesh_model_msg_multi_switch_item_t _lastReceivedMultiSwitch = {0xFF};
64
68 TYPIFY(CMD_SET_TIME) _lastReveivedSetTime = 0;
69
70#if MESH_MODEL_TEST_MSG == 1
71 uint32_t _lastReceivedCounter = 0;
72 uint32_t _received = 0;
73 uint32_t _dropped = 0;
74#endif
75
79 bool isFromSameState(stone_id_t srcId, stone_id_t id, uint16_t partialTimestamp);
80
86
91
95 void sendResultToUart(uart_msg_mesh_result_packet_header_t& resultHeader, const cs_data_t& resultData);
96};
Definition: cs_MeshMsgEvent.h:71
Class that:
Definition: cs_MeshMsgHandler.h:17
cs_ret_code_t handleAck(MeshMsgEvent &msg)
cs_ret_code_t dispatchEventForMeshMsg(CS_TYPE evtType, MeshMsgEvent &msg)
cs_ret_code_t handleTrackedDeviceToken(MeshMsgEvent &msg)
cs_ret_code_t handleRssiData(MeshMsgEvent &msg)
cs_ret_code_t handleResult(MeshMsgEvent &msg)
cs_mesh_model_ext_state_t _lastReceivedState
Cache part(s) of the last received state, so it can be combined.
Definition: cs_MeshMsgHandler.h:58
void handleControlCommand(MeshMsgEvent &msg)
cs_ret_code_t handleTest(MeshMsgEvent &msg)
cs_ret_code_t handleCmdTime(MeshMsgEvent &msg)
bool isFromSameState(stone_id_t srcId, stone_id_t id, uint16_t partialTimestamp)
Whether a state message is from the same state as last received part.
void sendResultToUart(uart_msg_mesh_result_packet_header_t &resultHeader, const cs_data_t &resultData)
Send the given result to UART.
cs_ret_code_t handleCmdMultiSwitch(MeshMsgEvent &msg)
cs_ret_code_t handleRssiPing(MeshMsgEvent &msg)
void handleStateSet(MeshMsgEvent &msg)
void checkStateReceived()
Check if all parts of a state are received.
cs_ret_code_t handleTimeSync(MeshMsgEvent &msg)
TYPIFY(CONFIG_CROWNSTONE_ID) _ownId=0
cs_ret_code_t handleSetIbeaconConfigId(MeshMsgEvent &msg)
cs_ret_code_t handleState1(MeshMsgEvent &msg)
cs_ret_code_t handleCmdNoop(MeshMsgEvent &msg)
TYPIFY(CMD_SET_TIME) _lastReveivedSetTime=0
Cache last received set time command, so it can be ignored.
cs_ret_code_t handleTrackedDeviceListSize(MeshMsgEvent &msg)
cs_ret_code_t handleState0(MeshMsgEvent &msg)
cs_ret_code_t handleTrackedDeviceHeartbeat(MeshMsgEvent &msg)
cs_ret_code_t handleProfileLocation(MeshMsgEvent &msg)
cs_ret_code_t handleSyncRequest(MeshMsgEvent &msg)
void replyWithRetCode(cs_mesh_model_msg_type_t type, cs_ret_code_t retCode, mesh_reply_t *reply)
Set the reply to a result message with given mesh message type and return code as payload.
cs_ret_code_t handleTrackedDeviceRegister(MeshMsgEvent &msg)
void handleMsg(MeshMsgEvent &msg)
cs_mesh_model_msg_type_t
Definition: cs_MeshModelPackets.h:61
uint8_t stone_id_t
Definition: cs_Typedefs.h:23
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
CS_TYPE
Types:
Definition: cs_Types.h:79
@ CMD_SET_TIME
@ CONFIG_CROWNSTONE_ID
@ EVT_STATE_EXTERNAL_STONE
Definition: cs_MeshMsgHandler.h:49
uint8_t partsReceivedBitmask
Definition: cs_MeshMsgHandler.h:51
TYPIFY(EVT_STATE_EXTERNAL_STONE) state
stone_id_t srcId
Definition: cs_MeshMsgHandler.h:50
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27
Definition: cs_MeshMsgEvent.h:7
Definition: cs_UartMsgTypes.h:72