Ejemplo n.º 1
0
    def __init__(self):
        self.running = True
        self.objectname = ""
        self.devicesList = []
        self.interpreterVer = ""
        self.queue = Queue.Queue()
        self.helpers = Helpers.Helpers()
        self.maapiDB = Db_connection.MaaPiDBConnection()
        self.config = Config.MaapiVars()
        self.board_id = self.helpers.updateBoardLocation(
            self.config.maapiLocation,
            self.maapiDB.table("maapi_machine_locations").filters_eq(
                ml_enabled=True).get())
        self.socketClient = SocketClient.socketClient()
        self.maapilogger = MaapiLogger.Logger()
        self.maapilogger.name = self.objectname
        self.selectorHost = self.config.selectorHost
        self.selectorPort = self.config.selectorPort
        self.watcherHost = self.config.watcherHost
        self.watcherPort = self.config.watcherPort
        #    self.selecorName = self.config.selectorName
        self.payload_StopUDP = bytes(
            f"777_0_0_0_{self.watcherHost}_{self.watcherPort}", "utf-8")
        self.payload_StopTCP = self.helpers.pyloadToPicke(
            777, " ", " ", " ", self.watcherHost, self.watcherPort)
        self.payloadTcpStatus = self.helpers.pyloadToPicke(
            00, " ", " ", " ", self.watcherHost, self.watcherPort)
        self.payloadUdpStatus = bytes(
            f"0_0_0_0_{self.watcherHost}_{self.watcherPort}", "utf-8")

        self.servicePids = {}
        self.libraryPID = {}
        self.libraryList = []
        self.libraryLastResponce = 600  # seconds
Ejemplo n.º 2
0
 def __init__(self, owner, host, port):
     self.owner = owner
     self.checkDev = CheckDev.CheckDevCond()
     self.host = host
     self.port = port
     self.maapiDB = Db_connection.MaaPiDBConnection()
     self.maapilogger = MaapiLogger.Logger()
     self.maapilogger.name = f"Read - {self.owner}"
     self.helpers = Helpers.Helpers()
Ejemplo n.º 3
0
 def __init__(self):
     self.seqSRnr = 0
     self.seqSRnr2 = 0
     self.queue_tcp_radings = {}
     self.socketReadings = queue.Queue()
     self.socketStatus = queue.Queue()
     self.queueDevList = {}
     self.maapilogger = MaapiLogger.Logger()
     self.add = 0
     self.selfkill = False
 def __init__(self):
     self.objectname = "ServicesTools"
     self.maapilogger = MaapiLogger.Logger()
     self.maapilogger.name = self.objectname
     self.socketClient = SocketClient.socketClient()
     self.maapiDB = Db_connection.MaaPiDBConnection()
     self.helpers = Helpers.Helpers()
     self.payload_StopTCP = self.helpers.pyloadToPicke(
         777, " ", " ", " ", "xxx", 0)
     self.payload_StopUDP = "777_0_0_0"
Ejemplo n.º 5
0
    def __init__(self):
        self.objectname = "none"
        self.host = ""
        self.ssProto = ""
        self.port = 0
        self.id_ = ""
        self.readings = object
        self.socketServer = object
        self.isRunning = True
        self.queue = Queue.Queue()
        self.helpers = Helpers.Helpers()
        self.socketClient = SocketClient.socketClient()
        self.maapilogger = MaapiLogger.Logger()
        self.maapiDB = Db_connection.MaaPiDBConnection()

        signal.signal(signal.SIGTERM, self.service_shutdown)
        signal.signal(signal.SIGINT, self.service_shutdown)
Ejemplo n.º 6
0
 def __init__(self):
     # objects
     self.queue = Queue.Queue()
     self.config = Config.MaapiVars()
     self.socketClient = SocketClient.socketClient()
     self.objectname = "Selector"
     self.maapiDB = Db_connection.MaaPiDBConnection()
     self.helpers = Helpers.Helpers()
     self.checkDev = CheckDev.CheckDevCond()
     self.maapilogger = MaapiLogger.Logger()
     self.maapilogger.name = self.objectname
     self.interpreterVer = f"{sys.executable}"
     self.selectorPort = self.config.selectorPort
     self.selectorHost = self.config.selectorHost
     self.board_id = self.helpers.updateBoardLocation(
         self.config.maapiLocation,
         self.maapiDB.table("maapi_machine_locations").filters_eq(
             ml_enabled=True).get())
     self.payload_Status = self.helpers.pyloadToPicke(
         0xff, " ", " ", " ", self.selectorHost, self.selectorPort)
     self.maapiLocation = self.config.maapiLocation
     self.timeToRead = 0.05  # 0.05 = 5%  interval - time to read
     self.timer_1 = dt.now()
     self.timer_2 = dt.now()
     self.timer_3 = dt.now()
     self.deviceList = []
     self.libraryList = []
     self.libraryList_id = []
     self.runningServices = []
     self.devicesGroupedBylib = {}
     self.localQueue = {}
     self.libraryLastResponce = 10  # seconds
     self.socketServer = SocketServer.SocketServer(self.objectname,
                                                   self.queue, 1)
     self.socketServer.runTcpServer(self.selectorHost, self.selectorPort)
     self.maapilogger.log("INFO", "Initialising Selector Module ")
     self.skippDev = []
     self.skippDevlib = {}
     self.pid = os.getpid()
     self.sendingQueryToSocket = 0
     signal.signal(signal.SIGTERM, self.service_shutdown)
     signal.signal(signal.SIGINT, self.service_shutdown)
     self.isRunning = True
Ejemplo n.º 7
0
    def __init__(self, objectname, queue, object_id):
        self.objectname = objectname

        self.config = Config.MaapiVars()
        self.helpers = Helpers.Helpers()
        self.maapilogger = MaapiLogger.Logger()
        self.maapilogger.name = f"Socket {self.objectname }"
        self.object_id = object_id
        self.maapiDB = Db_connection.MaaPiDBConnection()
        self.maapiLocation = self.config.maapiLocation
        self.pid = os.getpid()
        self.queue = queue
        self.threads = {}
        self.sockTCP = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sockUDP = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.selfkill = False
        self.board_id = self.helpers.updateBoardLocation(
            self.config.maapiLocation,
            self.maapiDB.table("maapi_machine_locations").filters_eq(
                ml_enabled=True).get())
 def __init__(self):
     self.helpers = Helpers.Helpers()
     self.maapilogger = MaapiLogger.Logger()
     self.maapilogger.name = f"CheckDevCond"
Ejemplo n.º 9
0
    def __init__(self):
        self.maapiDB = Db_connection.MaaPiDBConnection()

        self.maapilogger = MaapiLogger.Logger()