Exemplo n.º 1
0
 def onInit(self):
     log('IntegraService init.')
     self.model = self.config.get('model')
     self.ser_dev = self.config.get('serial')
     if self.ser_dev and self.model:
         self.topics, self.cmds = iscp.model_cmds(self.model)
     else:
         log.error('Service needs serial service and model to work.')
         sys.exit(1)
     self.act_desc = {
             'info': 'Integra/Onkyo model %s' % self.model,
             'actions': []
     }
     for cmd in self.cmds:
         for subcmd in cmd:
             newcmd = {
                 'name': cmd + subcmd,
                 'info': self.cmds[cmd][subcmd]['description'],
                 'args': [
                 ]
             }
             if 'type' in self.cmds[cmd][subcmd]:
                 param = self._type_desc(self.cmds[cmd][subcmd]['type'])
                 if param:
                     newcmd['args'].append(param)
             self.act_desc['actions'].append(newcmd)
     self.ser = serial.Serial(port=self.ser_dev,
                              baudrate=9600,
                              timeout=0.05,  # 50ms reponse time according to spec
                              bytesize=serial.EIGHTBITS,
                              parity=serial.PARITY_NONE,
                              stopbits=serial.STOPBITS_ONE,
                              )
Exemplo n.º 2
0
 def onInit(self):
     log('Starting Supervisor service')
     self.interval = self.config.getInt('interval') or 300  # seconds
     self.server = xmlrpclib.ServerProxy(
         'http://127.0.0.1',
         transport=supervisor.xmlrpc.SupervisorTransport(
             None, None, 'unix:///var/run/supervisor.sock'))
Exemplo n.º 3
0
 def onStart(self):
     log('IntegraService starting.')
     while not self._shutdown:
         # TODO: check for self.command variable, and run command here
         # rather than from runAction()?
         line = self.ser.readline()
         if line:
             self.sendEvent(line[1:4], {'value': line[4:]})
         # TODO: sleep probably not needed?
         time.sleep(0.1)
Exemplo n.º 4
0
 def onInit(self):
     log('Starting Supervisor service')
     self.interval = self.config.getInt('interval') or 300  # seconds
     self.server = xmlrpclib.ServerProxy(
         'http://127.0.0.1',
         transport=supervisor.xmlrpc.SupervisorTransport(
             None, None,
             'unix:///var/run/supervisor.sock'
         )
     )
Exemplo n.º 5
0
 def onStart(self):
     log('BenqService starting.')
     meta = {'type': 'screen', 'device': 'projector'}
     if self.location:
         meta.update({'location': self.location})
     while not self._shutdown:
         line = self.ser.readline()
         if line:
             change = benq.parse(line)
             self.sendEvent('change', change, meta)
         # TODO: sleep probably not needed?
         time.sleep(0.1)
Exemplo n.º 6
0
 def onStart(self):
     log('BenqService starting.')
     meta = {'type': 'screen', 'device': 'projector'}
     if self.location:
         meta.update({'location': self.location})
     while not self._shutdown:
         line = self.ser.readline()
         if line:
             change = benq.parse(line)
             self.sendEvent('change', change, meta)
         # TODO: sleep probably not needed?
         time.sleep(0.1)
Exemplo n.º 7
0
 def onInit(self):
     log('BenqService init.')
     self.model = self.config.get('model') or 'W6000'
     self.location = self.config.get('location')
     self.ser_dev = self.config.get('serial') or '/dev/ttyUSB0'
     self.ser = serial.Serial(port=self.ser_dev,
                              baudrate=115200,
                              timeout=0.05,  # TODO: What is spec?
                              bytesize=serial.EIGHTBITS,
                              parity=serial.PARITY_NONE,
                              stopbits=serial.STOPBITS_ONE,
                              )
Exemplo n.º 8
0
 def onInit(self):
     log('BenqService init.')
     self.model = self.config.get('model') or 'W6000'
     self.location = self.config.get('location')
     self.ser_dev = self.config.get('serial') or '/dev/ttyUSB0'
     self.ser = serial.Serial(
         port=self.ser_dev,
         baudrate=115200,
         timeout=0.05,  # TODO: What is spec?
         bytesize=serial.EIGHTBITS,
         parity=serial.PARITY_NONE,
         stopbits=serial.STOPBITS_ONE,
     )
Exemplo n.º 9
0
 def onInit(self):
     log("SensorTag init")
     self.interval = self.config.getInt("interval") or 1000  # milliseconds
Exemplo n.º 10
0
 def onInit(self):
     log('CV image init.')
Exemplo n.º 11
0
 def onStart(self):
     log('USBHub starting.')
     while not self._shutdown:
         # TODO: send port status every <interval> seconds
         time.sleep(self.interval)
Exemplo n.º 12
0
 def onInit(self):
     log('USBHub init.')
     self.interval = self.config.get('interval') or 60
Exemplo n.º 13
0
 def onInit(self):
     log('SensorTag init')
     self.interval = self.config.getInt('interval') or 1000  # milliseconds
Exemplo n.º 14
0
 def onStart(self):
     log('USBHub starting.')
     while not self._shutdown:
         # TODO: send port status every <interval> seconds
         time.sleep(self.interval)
Exemplo n.º 15
0
 def onInit(self):
     log('USBHub init.')
     self.interval = self.config.get('interval') or 60