def get(self): cmds = Res.init("init.json")["command"] for key in cmds: self.write("%s: " % (key, )) for cmd in cmds[key]: self.write("%s, " % (cmd, )) self.write("\n")
def __init__(self): init_json = Res.init("init.json") self.server_ip = init_json["connection"]["sensor_server"] self.name2addr = init_json["sensors"] self._send_lock = threading.Lock() self.init_sensors()
def __init__(self): init_json = Res.init("init.json") self.scan_ip = SwitchHelper.BOARDCAST_ADDRESS self.name2ip = init_json["switchs"] self._send_lock = threading.Lock() self.switchs = {} self._init_heartbeat()
def __init__(self): self._sock = None init_json = Res.init("init.json") try: self.place2ip = init_json["sensor"] except Exception, e: ERROR(e) ERROR("invaild SensorHelper init json.") self.place2ip = {}
def __init__(self): self.devices = {} self._queues = {} settings = Res.init("init.json") self.server_ip = "tcp://*:8005" self._device_addrs = [] addrs = settings['ping']['device'] for name in addrs: self._device_addrs.append(addrs[name])
def __init__(self, address): if not address is None: INFO("connect to server: %s " % (address)) self._home_address = address settings = Res.init("init.json") self._device_id = settings['id'] self._trigger_cmd = settings['command']['trigger'][0].encode("utf-8") self._finish_cmd = settings['command']['finish'][0].encode("utf-8") INFO("load device id:%s" % self._device_id) else: ERROR("address is empty")
def __init__(self, address): if not address is None: INFO("connect to server: %s " % (address)) self._home_address = address settings = Res.init("init.json") self._device_id = settings['id'] self._trigger_cmd = settings['command']['trigger'][0].encode( "utf-8") self._finish_cmd = settings['command']['finish'][0].encode("utf-8") INFO("load device id:%s" % self._device_id) else: ERROR("address is empty")
def __init__(self, address): if not address is None: INFO("connect to server: %s " % (address)) context = zmq.Context() self._sock = context.socket(zmq.SUB) self._sock.connect(address) self._sock.setsockopt(zmq.SUBSCRIBE, '') self.channel = Channel(PUSH_apiKey, PUSH_secretKey) self.xinge_app = xinge.XingeApp(XINGE_ACCESS_ID, XINGE_SECRET_KEY) self._msg_queue = Queue() settings = Res.init("init.json") self._device_id = settings['id'] else: ERROR("address is empty")
def __init__(self, address): if not address is None: INFO("connect to server: %s " % (address)) context = zmq.Context() self._sock = context.socket(zmq.SUB) self._sock.connect(address) self._sock.setsockopt(zmq.SUBSCRIBE, '') self.channel = Channel(PUSH_apiKey, PUSH_secretKey) self._mipush = mipush.MIPush(MIPUSH_SECRET_KEY) self._msg_queue = Queue() settings = Res.init("init.json") self._device_id = settings['id'] else: ERROR("address is empty")
def __init__(self): init_json = Res.init("init.json") self._address = init_json["ril_address"] self._send_lock = threading.Lock()