def _deregister_active_device(self, eui64_hex):
     if self.event_sources.has_key(eui64_hex):
         self.command_logger.info('Issuing device_disconnect for %s' % eui64_hex)
         event = bridge_event.BridgeEvent(self.host_eui64_hex, {'name': 'device_disconnect',
          'device_address': eui64_hex})
         self.event_queue.put(event, False)
         del self.event_sources[eui64_hex]
Exemplo n.º 2
0
 def _weminucheLinkKeyRequiredCallback(self, eui64):
     event_payload = {'name': 'encryption_key_required',
      'device_address': byte_tuple.eui64ToHexString(eui64, False)}
     event = bridge_event.BridgeEvent(self.getHostEui64(), event_payload)
     try:
         self.event_queue.put(event, False)
     except Queue.Full:
         self.logger.warning('Received bridge event, but the event queue full')
     self.logger.info('Link key required for %s' % byte_tuple.eui64ToHexString(eui64))
     return True
 def _register_active_device(self, eui64_hex):
     current_time = time.time()
     if self.event_sources.has_key(eui64_hex):
         self.event_sources[eui64_hex][1] = current_time
     else:
         self.event_sources[eui64_hex] = [current_time, current_time]
         self.command_logger.info('Issuing device_connect for %s' % eui64_hex)
         event = bridge_event.BridgeEvent(self.host_eui64_hex, {'name': 'device_connect',
          'device_address': eui64_hex})
         self.event_queue.put(event, False)
 def onEstablishConnection(self):
     if self.networkUp():
         self.socket_logger.info('Sending bridge power_on handshake')
         event = bridge_event.BridgeEvent(self.host_eui64_hex, {'name': 'power_on'})
         event.append_payload(self.bridge.system_environment)
         ver_info = version.Version()
         version_dict = {'firmware_version': ver_info.firmware_version,
          'mac_address': ver_info.mac_address,
          'ncp_version': ver_info.ncp_stack_version,
          'model': ver_info.model}
         event.append_payload(version_dict)
         event_json = event.to_json()
         self.logger.debug('Posting event JSON %s' % event_json)
         result = self.sendJson(event_json)
         if result:
             self.handshake_sent = True
             self.event_sources = {}