router_handler module

This Modules handles all the comunication to nodes.
It will routes the varius commands knowing where to send them based on the node address.

If the node_address of the given receiver is 0 the data will be written to the local OnosCenter pins.

if the node_address of the given receiver is 1 the data will be sent to the OnosCenter serial port to an arduino (not implemented yet)

If the node_address of the given receiver is between 2 to 255 :
OnosCenter will send the command to write the data to an arduino wich will then transmit it to the desired wireless node.(not implemented yet)

If the node_address of the given receiver is a string greater than 6 characters: The data will be sent over ethernet commmunication.

class router_handler.RouterHandler(hardwareModelDict, router_sn)[source]
composeChangeNodeOutputPinStatusQuery(pinNumbers, node_obj, objName, status_to_set, node_serial_number, node_address, out_type, user, priority, mail_report_list)[source]
Compose the correct query to change an output pin status on a remote node.
The examples are:

WARNING old documentation... todo update it
“onos_r”+pin0+pin1+”v”+status_to_set+”s”+node_serial_number+”_#]” to set a sr_relay to status_to_set (0 or 1)
onos_r0607v1sProminiS0001f000_#] pin6 and 7 used to control a s/r relay and turn it to set

“onos_d”+pin_number+”v”+”00”+status_to_set+”s”+node_serial_number+”_#]” to set a digital pin to 0 or 1
onos_d07v001sProminiS0001f000_#] set digital pin7 to 1

“onos_s”+pin_number+”v”+status_to_set+”s”+node_serial_number+”_#]” to set a servopin from 0 to 180
onos_s07v180sProminiS0001f000_#] set servo pin7 to 180

“onos_a”+pin_number+”v”+status_to_set+”s”+node_serial_number+”_#]” to set a analogpin from 0 to 255
onos_a05v100sProminiS0001f000_#] set analog pin5 to 100

The node_serial_number is a hexadecimal number refering to the node serial number
The node_address is a 3 byte ashii that rappresend the wireless node address(if the node is wireless,otherwise is ignored)
the value must be between 0 and 255 it will be setted to “999” if is not used..
Get a progressive id number to append it to the message in order to make it unique

outputWrite(node_serial_number, pinList, statusList, node_obj, objName, previous_status, statusToSetWebObject, output_type, user, priority, mail_report_list)[source]
Thread function to read changing of pin status on the embedded linux board (glinet,raspberry ecc)

searchObjectBaseName(obj_selected, node_serial_number)[source]
setAddressToNode(node_serial_number, new_address)[source]
setHwPinMode(node_address, pinNumber, mode)[source]
writeRawMsgToNode(node_serial_number, node_address, msg)[source]