def __init__(self, hp=('', 0), mac='', root=None, name='', key=PK_KEY, password='', deviceid='', clientsessionid='', hp2=('', 0)): Device.__init__(self, hp, mac, root, name) ManTimerManager.__init__(self, root) IrManager.__init__(self, hp, mac, root, name) self.key = key self.fid = 0 if len(clientsessionid) == 0: self.clientSessionId = generatestring(32) else: self.clientSessionId = clientsessionid if root is None: self.password = password self.deviceId = deviceid self.localPort = hp2[1] self.localIp = hp2[0] else: self.password = root.attributes['password'].value self.deviceId = root.attributes['deviceId'].value self.localPort = root.attributes['localPort'].value self.localIp = root.attributes['localIp'].value
def __init__(self, hp=('', 0), mac='', root=None, name='', conf=''): Device.__init__(self, hp, name, root, name) ManTimerManager.__init__(self, root) IrManager.__init__(self, hp, mac, root, name) self.remote = None self.last_init = 0 self.fill_ir_list() if root is None: self.conffile = conf else: self.conffile = root.attributes['conffile'].value self.config = None self.offt = -1 self.init_device()
def loadtables(fn, devn): out = dict() xmldoc = minidom.parse(fn) items = xmldoc.getElementsByTagName('device') outitem = None for item in items: nm = item.attributes['name'].value if nm == devn: outitem = item break if outitem is None: return out out['offafteron'] = None sub = outitem.getElementsByTagName('offafteron') for s in sub: out['offafteron'] = int(s.childNodes[0].nodeValue) if out['offafteron'] == DeviceUDP.OFF_AFTER_ON_NONE: out['offafteron'] = None break out['timezone'] = None sub = outitem.getElementsByTagName('timezone') for s in sub: out['timezone'] = int(s.childNodes[0].nodeValue) if out['timezone'] == DeviceUDP.TIMEZONE_NONE: out['timezone'] = None break out['timers'] = ManTimerManager.timer_xml_device_node_parse(outitem) return out
def __init__(self, hp=('', 0), mac='', root=None, name='', location='', deviceobj=None): DeviceUpnp.__init__(self, hp, mac, root, name, location, deviceobj) ManTimerManager.__init__(self, root) IrManager.__init__(self, hp, mac, root, name) self.a = None if root is not None and root.hasAttribute('remote_name'): self.remote_name = root.attributes['remote_name'].value self.ir_load = True else: self.ir_load = False self.remote_name = self.name self.offt = -1
def __init__(self, hp=('', 0), mac='', root=None, timeout=DEFAULT_RESUBSCRIPTION_TIMEOUT, name='', sec1900=0, lsa_timeout=DEFAULT_RESUBSCRIPTION_STIMEOUT): DeviceUDP.__init__(self, hp=hp, mac=mac, root=root, timeout=timeout, name=name, sec1900=sec1900, lsa_timeout=lsa_timeout) ManTimerManager.__init__(self, root) IrManager.__init__(self, hp, mac, root, name)
def xml_table_element(self, root, flag=0): el = self.xml_element( root, flag) if (flag & DEVICE_SAVE_FLAG_TABLE) and ( flag & DEVICE_SAVE_FLAG_MAIN) else self.__xml_basic(root) tables_el = SubElement(el, "tables") tv = {} if self.tablever is None else self.tablever for tn, tinfo in tv.copy().items(): table_el = SubElement(tables_el, "table", {"num": tn}) v = SubElement(table_el, "version") v.text = str(tinfo['vern']) v = SubElement(table_el, "flag") v.text = str(tinfo['flgn']) offafteron = SubElement(el, 'offafteron') offafteron.text = str(DeviceUDP.OFF_AFTER_ON_NONE ) if self.timer_off_after_on is None else str( self.timer_off_after_on) timezone = SubElement(el, 'timezone') timezone.text = str( DeviceUDP.TIMEZONE_NONE) if self.timezone is None else str( self.timezone) ManTimerManager.timer_xml_device_node_write(el, self.timers)
def to_json(self): rv = DeviceUpnp.to_json(self) rv.update(IrManager.to_json(self)) rv.update(ManTimerManager.to_json(self)) return rv
def on_stop(self): IrManager.on_stop(self) ManTimerManager.on_stop(self)
def xml_element(self, root, flag=0): el = IrManager.xml_element(self, root, flag) ManTimerManager.xml_element(self, el, flag) return el
def copy_extra_from(self, already_saved_device): DeviceUpnp.copy_extra_from(self, already_saved_device) IrManager.copy_extra_from(self, already_saved_device) ManTimerManager.copy_extra_from(self, already_saved_device) self.remote_name = already_saved_device.remote_name
def to_json(self): rv = IrManager.to_json(self) rv.update(ManTimerManager.to_json(self)) return rv
def copy_extra_from(self, already_saved_device): savep = self.port IrManager.copy_extra_from(self, already_saved_device) ManTimerManager.copy_extra_from(self, already_saved_device) self.deviceId = already_saved_device.deviceId self.port = savep
def copy_extra_from(self, already_saved_device): DeviceUDP.copy_extra_from(self, already_saved_device) IrManager.copy_extra_from(self, already_saved_device) ManTimerManager.copy_extra_from(self, already_saved_device)
def do_presend_operations(self, action, actionexec): if isinstance(self, ManTimerManager): return ManTimerManager.do_presend_operations( self, action, actionexec) return 1
def __init__(self, hp=('', 0), mac='', root=None, name='', inner=None): Device.__init__(self, hp, mac, root, name) ManTimerManager.__init__(self, root) IrManager.__init__(self, hp, mac, root, name) self.offt = -1 self.inner = inner