UniSaSA
1.0
Python Gateway
|
Public Member Functions | |
def | __init__ (self) |
def | addConnector (self, newConnector) |
def | removeConnectors (self) |
def | loadTable (self, filePath, findConnector=True) |
def | getConnector (self, address, typeConnector) |
def | addReservedID (self, ID, addr, connector) |
def | verifyTable (self) |
def | verifyDevices (self) |
def | discoveryAndCreateTable (self) |
def | discoveryAndUpdateTable (self) |
def | discovery (self) |
def | updateTable (self, devices) |
def | addDevice (self, newDev) |
def | addDevices (self, newNodes) |
def | removeDevice (self, idDevice) |
def | deleteTable (self) |
def | getTable (self) |
def | saveTable (self, path, verboseFile=True) |
def | createTCPServer (self, IP, port) |
def | waitTCPClient (self) |
def | managerCommunication (self, client) |
def | manageCommunicationThread (self, client) |
Gateway implementation. This class can: create/load/save/manage a routing table routing between IP network and other networks
Definition at line 52 of file gateway.py.
def gateway.Gateway.__init__ | ( | self | ) |
Constructor.
Definition at line 60 of file gateway.py.
def gateway.Gateway.addConnector | ( | self, | |
newConnector | |||
) |
Add a connector. Since now the gateway can communicate with this device.
Definition at line 70 of file gateway.py.
def gateway.Gateway.addDevice | ( | self, | |
newDev | |||
) |
Add a new nodes. :type newNode :param newNode [ address, connector, sizeIODevice, byteIDSen, {IDSen : (type S, Size Out, Type OUT)}, byteIDAct, {IDAct : (type A, Size In, Type IN)} ]
Definition at line 205 of file gateway.py.
def gateway.Gateway.addDevices | ( | self, | |
newNodes | |||
) |
Add new nodes. :type newNodes :param newNodes [ [ address, connector, sizeIODevice, byteIDSen, {IDSen : (type S, Size Out, Type OUT)}, byteIDAct, {IDAct : (type A, Size In, Type IN)} ] ]
Definition at line 217 of file gateway.py.
def gateway.Gateway.addReservedID | ( | self, | |
ID, | |||
addr, | |||
connector | |||
) |
Bind a device Address with a table ID.
Definition at line 136 of file gateway.py.
def gateway.Gateway.createTCPServer | ( | self, | |
IP, | |||
port | |||
) |
Create a socket to receive TCP request from UniSaSA library.
Definition at line 319 of file gateway.py.
def gateway.Gateway.deleteTable | ( | self | ) |
Set current table to zero device.
Definition at line 235 of file gateway.py.
def gateway.Gateway.discovery | ( | self | ) |
Discovery new devices. This is the parent of all discovery function. :return [ [ address, connector, sizeIODevice, byteIDSen, {IDSen : (type S, Size Out, Type OUT)}, byteIDAct, {IDAct : (type A, Size In, Type IN)} ] ]
Definition at line 164 of file gateway.py.
def gateway.Gateway.discoveryAndCreateTable | ( | self | ) |
Discovery Devices and create a new table.
Definition at line 154 of file gateway.py.
def gateway.Gateway.discoveryAndUpdateTable | ( | self | ) |
Discovery new devices and update currentTable.
Definition at line 159 of file gateway.py.
def gateway.Gateway.getConnector | ( | self, | |
address, | |||
typeConnector | |||
) |
Internal use only. Try to swap a 'Type Connector' field with an instanced Connector object (addConnector())
Definition at line 124 of file gateway.py.
def gateway.Gateway.getTable | ( | self | ) |
Return current table :return {ID: [address, connector, sizeIODevice, byteIDSen, { IDSen : (type S, Size Out, Type Out) }, byteIDAct, { IDAct : (type A, Size In/, Type IN) } ] }
Definition at line 240 of file gateway.py.
def gateway.Gateway.loadTable | ( | self, | |
filePath, | |||
findConnector = True |
|||
) |
Load a table from a file. :type filePath string :param filePath path ot the file :type: fineConnector boolean :param findConnector try to find the right device connector (see addConnector())
Definition at line 83 of file gateway.py.
def gateway.Gateway.manageCommunicationThread | ( | self, | |
client | |||
) |
MultiThread version of manageCommunication().
Definition at line 472 of file gateway.py.
def gateway.Gateway.managerCommunication | ( | self, | |
client | |||
) |
Start to serve requests from an UniSaSA Library. It is possible to use a multithread version.
Definition at line 342 of file gateway.py.
def gateway.Gateway.removeConnectors | ( | self | ) |
Remove all connectors.
Definition at line 79 of file gateway.py.
def gateway.Gateway.removeDevice | ( | self, | |
idDevice | |||
) |
Romove a device from the table. :type idDevice unsigned int :param idDevice
Definition at line 227 of file gateway.py.
def gateway.Gateway.saveTable | ( | self, | |
path, | |||
verboseFile = True |
|||
) |
Save current table. :type path string :param path new file :type verboseFile boolean :param: verboseFile=True print a human readable file
Definition at line 249 of file gateway.py.
def gateway.Gateway.updateTable | ( | self, | |
devices | |||
) |
Add new devices to the table :type devices list [ [ address, connector, sizeIODevice, byteIDSen, {IDSen : (type S, Size Out, Type OUT)}, byteIDAct, {IDAct : (type A, Size In, Type IN)} ] ]
Definition at line 179 of file gateway.py.
def gateway.Gateway.verifyDevices | ( | self | ) |
Alias to verifyTable().
Definition at line 150 of file gateway.py.
def gateway.Gateway.verifyTable | ( | self | ) |
Verify table consistency.
Definition at line 140 of file gateway.py.
def gateway.Gateway.waitTCPClient | ( | self | ) |
Blocking to wait a 'UniSaSA library' client.
Definition at line 332 of file gateway.py.