Andrew Lindsay / Mbed 2 deprecated IoTGateway_Basic

Dependencies:   NetServices FatFileSystem csv_parser mbed MQTTClient RF12B DNSResolver SDFileSystem

Embed: (wiki syntax)

« Back to documentation index

IoTRouting Class Reference

IoTRouting Class Reference

Main IoT Gateway RFM12B payload routing class. More...

#include <IoTRouting.h>

Public Member Functions

 IoTRouting ()
 Default Constructor.
void initRouting ()
 Initialise routing class.
bool writeNodeList ()
 Write a list of nodes to IOTNODE.TXT Format is: group,node,length,type Where: group, node, length are first 3 bytes of received packet type is 99 for unknown, 0 for simple, 1 for Type 1, 2 for Type 2.
bool writeRoutingList ()
 Write main routing list to file IOTRTR.TXT Format is: nodeId,sensorId,factor,outputType,param1,param2,param3,param4 Where: nodeId is the Node ID of the node to the sensor is attached to sensorId is the ID of the sensor to define factor is a conversion factor to convert from integer to real value.
void addNodeToList (uint8_t groupId, uint8_t nodeId, uint8_t length, uint8_t type)
 Add a node to the nodelist.
void addRoutingToList (short nodeId, short sensorId, float factor, byte outType, char *param1, char *param2, char *param3, char *param4)
 Add an item to routing list.
short getPayloadType (uint8_t *data, short dataLen)
 get Payload type
PayloadRouting * getRouting (short nodeId, short sensorNum)
 Get routing data for specified node/sensor combination.
void addOutput (OutputDef *output, short outType)
 Add output definition to output list.
bool routePayload (uint8_t *payload, short payloadLen)
 Main payload routing function.

Detailed Description

Main IoT Gateway RFM12B payload routing class.

Definition at line 93 of file IoTRouting.h.


Constructor & Destructor Documentation

IoTRouting (  )

Default Constructor.

Definition at line 48 of file IoTRouting.cpp.


Member Function Documentation

void addNodeToList ( uint8_t  groupId,
uint8_t  nodeId,
uint8_t  length,
uint8_t  type 
)

Add a node to the nodelist.

Parameters:
groupIdGroup ID, byte 0 of received packet
nodeIdNode ID, byte 1
lengthLength of payload, byte 2
typeType of payload, simple, v1, v2 or undefined

Definition at line 51 of file IoTRouting.cpp.

void addOutput ( OutputDef output,
short  outType 
)

Add output definition to output list.

Parameters:
outputPointer to output object
outTypeNumeric value for the output type

Definition at line 240 of file IoTRouting.cpp.

void addRoutingToList ( short  nodeId,
short  sensorId,
float  factor,
byte  outType,
char *  param1,
char *  param2,
char *  param3,
char *  param4 
)

Add an item to routing list.

Parameters:
nodeIdID of the node payload came from
sensorIdID of the sensor within the node
factorSensor Reading conversion factor, 100, 10, 1, 0.1, 0.01, 0.001 etc
outTypeOutput type, 1 = Pachube, 2 = MQTT, 3 = emonCMS, 4 = Sen.Se
param1Parameter 1
param2Parameter 2
param3Parameter 3
param4Parameter 4

Definition at line 61 of file IoTRouting.cpp.

short getPayloadType ( uint8_t *  data,
short  dataLen 
)

get Payload type

Parameters:
dataPointer to start of payload data
dataLenLength of payload data
Returns:
payload type, either simple, v1, v2 or unknown

Definition at line 280 of file IoTRouting.cpp.

PayloadRouting * getRouting ( short  nodeId,
short  sensorNum 
)

Get routing data for specified node/sensor combination.

Parameters:
nodeIdThe ID of the node
sensorNumThe ID of the sensor
Returns:
pointer to routing data

Definition at line 259 of file IoTRouting.cpp.

void initRouting (  )

Initialise routing class.

Definition at line 102 of file IoTRouting.cpp.

bool routePayload ( uint8_t *  payload,
short  payloadLen 
)

Main payload routing function.

Parameters:
payloadPointer to payload data
payloadLenLength of th epayload
Returns:
flag to indicate payload routed to output or not.

Definition at line 300 of file IoTRouting.cpp.

bool writeNodeList (  )

Write a list of nodes to IOTNODE.TXT Format is: group,node,length,type Where: group, node, length are first 3 bytes of received packet type is 99 for unknown, 0 for simple, 1 for Type 1, 2 for Type 2.

Definition at line 188 of file IoTRouting.cpp.

bool writeRoutingList (  )

Write main routing list to file IOTRTR.TXT Format is: nodeId,sensorId,factor,outputType,param1,param2,param3,param4 Where: nodeId is the Node ID of the node to the sensor is attached to sensorId is the ID of the sensor to define factor is a conversion factor to convert from integer to real value.

can be 100.0,10.0,1.0,0.1,0.01,0.001. For no conversion use 1.0 outputType is the type of output, 1 is Pachube, 2 is MQTT param1 is Pachube feed number or MQTT topic param2 is Pachube datastream number param3 and 4 are currently unused

Definition at line 215 of file IoTRouting.cpp.