def __init__(self, handle=None): matrix = { EventId.CONNECTREQ: { self.__StateId.INIT: self.__init_connectreq, self.__StateId.CONNECTED: self.__connected_connectreq }, EventId.CONNECTCNF: { self.__StateId.INIT: self.__init_connectcnf, self.__StateId.CONNECTED: self.__connected_connectcnf }, EventId.SENDCNF: { self.__StateId.INIT: self.__init_sendcnf, self.__StateId.CONNECTED: self.__connected_sendcnf }, EventId.DATANOTIFY: { self.__StateId.INIT: self.__init_datanotify, self.__StateId.CONNECTED: self.__connected_datanotify }, EventId.DISCONNECTREQ: { self.__StateId.INIT: self.__init_disconnectreq, self.__StateId.CONNECTED: self.__connected_disconnectreq }, EventId.DISCONNECTCNF: { self.__StateId.INIT: self.__init_disconnectcnf, self.__StateId.CONNECTED: self.__connected_disconnectcnf } } MultiThreadClass.__init__(self, name=__name__, uniid=UnitId.UNITCTRL, matrix=matrix, daemon=False) self.__handle = handle self.__sync = { "lock": Wrapper.Lock(), "event": { "connect": Wrapper.Event(), "disconnect": Wrapper.Event() } } common_daemon_flug = False self.__session_mng = SessionMng(daemon=common_daemon_flug) self.__socket_ctrl = SocketCtrl(daemon=common_daemon_flug) self.__http_ctrl = HttpCtrl(daemon=common_daemon_flug) self.__parse_info = ParseInfo(daemon=common_daemon_flug) self.__timer_mng = TimerMng(daemon=common_daemon_flug) self.state = self.__StateId.INIT
def start(self): self.log.trace() self.__flag = Wrapper.Event() self.__job = Wrapper.Thread( group=None, target=self.__loop, name=None, kwargs={"stop_event": self.__flag}) self.__job.daemon = True self.__flag.set() self.__job.start()