UniSaSA  1.0
Python Gateway
Public Member Functions | List of all members
gateway.Gateway Class Reference

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

def gateway.Gateway.__init__ (   self)
Constructor.

Definition at line 60 of file gateway.py.

Member Function Documentation

◆ addConnector()

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.

◆ addDevice()

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.

◆ addDevices()

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.

◆ addReservedID()

def gateway.Gateway.addReservedID (   self,
  ID,
  addr,
  connector 
)
Bind a device Address with a table ID.

Definition at line 136 of file gateway.py.

◆ createTCPServer()

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.

◆ deleteTable()

def gateway.Gateway.deleteTable (   self)
Set current table to zero device.

Definition at line 235 of file gateway.py.

◆ discovery()

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.

◆ discoveryAndCreateTable()

def gateway.Gateway.discoveryAndCreateTable (   self)
Discovery Devices and create a new table.

Definition at line 154 of file gateway.py.

◆ discoveryAndUpdateTable()

def gateway.Gateway.discoveryAndUpdateTable (   self)
Discovery new devices and update currentTable.

Definition at line 159 of file gateway.py.

◆ getConnector()

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.

◆ getTable()

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.

◆ loadTable()

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.

◆ manageCommunicationThread()

def gateway.Gateway.manageCommunicationThread (   self,
  client 
)
MultiThread version of manageCommunication().

Definition at line 472 of file gateway.py.

◆ managerCommunication()

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.

◆ removeConnectors()

def gateway.Gateway.removeConnectors (   self)
Remove all connectors.

Definition at line 79 of file gateway.py.

◆ removeDevice()

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.

◆ saveTable()

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.

◆ updateTable()

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.

◆ verifyDevices()

def gateway.Gateway.verifyDevices (   self)
Alias to verifyTable().

Definition at line 150 of file gateway.py.

◆ verifyTable()

def gateway.Gateway.verifyTable (   self)
Verify table consistency.

Definition at line 140 of file gateway.py.

◆ waitTCPClient()

def gateway.Gateway.waitTCPClient (   self)
Blocking to wait a 'UniSaSA library' client.

Definition at line 332 of file gateway.py.


The documentation for this class was generated from the following file: