MySensors Library & Examples  2.3.2-36-g2e00bf6
Classes | Macros | Typedefs | Functions
MyTransport.h File Reference
#include "hal/transport/MyTransportHAL.h"
+ Include dependency graph for MyTransport.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  transportConfig_t
 Node configuration. More...
struct  transportState_t
 SM state. More...
struct  transportSM_t
 Status variables and SM state. More...
struct  routingTable_t
 RAM routing table. More...


 search for a new parent node after this many transmission failures, lower threshold for non-repeating nodes More...
 Max. number of consecutive TSM failure state entries (3bits)
 Duration failure state (in ms)
 Duration extended failure state (in ms)
#define MY_TRANSPORT_STATE_TIMEOUT_MS   (2*1000ul)
 general state timeout (in ms)
 Interval to re-check uplink (in ms)
 retries before switching to FAILURE
#define AUTO   (255u)
 ID 255 is reserved.
#define BROADCAST_ADDRESS   (255u)
 broadcasts are addressed to ID 255
#define DISTANCE_INVALID   (255u)
 invalid distance when searching for parent
#define MAX_HOPS   (254u)
 maximal number of hops for ping/pong
#define INVALID_HOPS   (255u)
 invalid hops
#define MAX_SUBSEQ_MSGS   (5u)
 Maximum number of subsequently processed messages in FIFO (to prevent transport deadlock if HW issue)
#define UPLINK_QUALITY_WEIGHT   (0.05f)
#define _autoFindParent   (bool)(MY_PARENT_NODE_ID == AUTO)
 returns true if static parent id is undefined
#define isValidDistance(_distance)   (bool)(_distance!=DISTANCE_INVALID)
 returns true if distance is valid
#define isValidParent(_parent)   (bool)(_parent != AUTO)
 returns true if parent is valid
#define transportInternalToRSSI(__value)   ((int16_t)__value >> 4)
 Convert internal RSSI to RSSI.
#define transportRSSItoInternal(__value)   ((transportRSSI_t)__value << 4)
 Convert RSSI to internal RSSI.


typedef void(* transportCallback_t) (void)
 Callback type.
typedef int16_t transportRSSI_t
 Datatype for internal RSSI storage. More...


void stInitTransition (void)
 Initialize SM variables and transport HW.
void stInitUpdate (void)
 Initialize transport.
void stParentTransition (void)
 Find parent.
void stParentUpdate (void)
 Verify find parent responses.
void stIDTransition (void)
 Send ID request.
void stIDUpdate (void)
 Verify ID response and GW link.
void stUplinkTransition (void)
 Send uplink ping request.
void stUplinkUpdate (void)
 Verify uplink response.
void stReadyTransition (void)
 Set transport OK.
void stReadyUpdate (void)
 Monitor transport link.
void stFailureTransition (void)
 Transport failure and power down radio.
void stFailureUpdate (void)
 Re-initialize transport after timeout.
void transportSwitchSM (transportState_t &newState)
 Switch SM state. More...
void transportUpdateSM (void)
 Update SM state.
uint32_t transportTimeInState (void)
 Request time in current SM state. More...
void transportInvokeSanityCheck (void)
 Call transport driver sanity check.
void transportProcessFIFO (void)
 Process all pending messages in RX FIFO.
void transportProcessMessage (void)
 Receive message from RX FIFO and process.
bool transportAssignNodeID (const uint8_t newNodeId)
 Assign node ID. More...
bool transportWait (const uint32_t waitingMS, const uint8_t cmd, const uint8_t msgType)
 Wait and process messages for a defined amount of time until specified message received. More...
uint8_t transportPingNode (const uint8_t targetId)
 Ping node. More...
bool transportRouteMessage (MyMessage &message)
 Send and route message according to destination. More...
bool transportSendRoute (MyMessage &message)
 Send and route message according to destination with transport state check. More...
bool transportSendWrite (const uint8_t to, MyMessage &message)
 Send message to recipient. More...
bool transportCheckUplink (const bool force=false)
 Check uplink to GW, includes flooding control. More...
bool transportWaitUntilReady (const uint32_t waitingMS=0)
 Wait until transport is ready. More...
void transportInitialise (void)
 Initialize transport and SM.
void transportProcess (void)
 Process FIFO msg and update SM.
bool isTransportReady (void)
 Flag transport ready. More...
bool isTransportSearchingParent (void)
 Flag searching parent ongoing. More...
bool isTransportExtendedFailure (void)
 Flag TSM extended failure. More...
bool isMessageReceived (void)
 Flag valid message received. More...
void resetMessageReceived (void)
 Reset message received flag.
void transportClearRoutingTable (void)
 Clear routing table.
uint32_t transportGetHeartbeat (void)
 Return heart beat. More...
void transportLoadRoutingTable (void)
 Load routing table from EEPROM to RAM. Only for GW devices with enough RAM, i.e. ESP8266, RPI Sensebender GW, etc. Atmega328 has only limited amount of RAM.
void transportSaveRoutingTable (void)
 Save routing table to EEPROM.
void transportSetRoute (const uint8_t node, const uint8_t route)
 Update routing table. More...
uint8_t transportGetRoute (const uint8_t node)
 Load route to node. More...
void transportReportRoutingTable (void)
 Reports content of routing table.
uint8_t transportGetNodeId (void)
 Get node ID. More...
uint8_t transportGetParentNodeId (void)
 Get parent node ID. More...
uint8_t transportGetDistanceGW (void)
 Get distance to GW. More...
void transportTogglePassiveMode (const bool OnOff)
 Toggle passive mode, i.e. transport does not wait for ACK. More...
void transportDisable (void)
 Disable transport, if xxx_POWER_PIN is defined, transport is powered down, else send to sleep.
void transportReInitialise (void)
 Reinitialise transport. Put transport to standby - If xxx_POWER_PIN set, power up and go to standby.
int16_t transportSignalReport (const char command) __attribute__((unused))
 Get transport signal report. More...
int16_t transportGetSignalReport (const signalReport_t signalReport) __attribute__((unused))
 Get transport signal report. More...