Am 22.12.2012 13:45, schrieb prilisa...@googlemail.com:
> Ps.: The Socket, the DB has to be kept allways open, because of it's Server 
> functionality, A lot of Sensors, Timers, User interaction, must recived , 
> Calculated, etc so a reaction must be send in about 16~100 ms, different 
> modules opens and closes Sockets or files, could result in a dead situation.
> 
> 
> Or do i didn't see any Tree's in the Wood?

I would strongly recommend an object oriented view:

Suppose Datastore.py contains a Class Datastore. You can instantiate
that class once in the beginning of your main file and the resulting
object has methods to store and retrieve data in/from the store.

ModbusClient.py contains a Class Modbus. This also can be instantiated
just once which opens a TCP connection to be used many times and you can
hand over a reference to the Instance of Datastore you created earlier,
so it can speak with the Datastore. The object has methods to do the
things you want it to do.

The Same for DaliBusClient.

Now your main.py could look something linke

from Datastore import Datastore
from ModbusClient import Modbus
from DaliBusClient import DaliBus

def main():
    datastore = Datastore(...)
    modbus = Modbus(..., datastore)
    dalibus = DaliBus(..., datastore)

    modbus.read_data_and_save_to_store()
    dalibus.read_data_and_save_to_store()

if __name__=="__main__":
    main()

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to