示例#1
0
def check_and_resume_configuration():
    configuration = ConfigurationStore().get()
    device_status = configuration.get_device_status()
    system_platform = platform.system()
    Logger.info(LOCATION, "Detected Platform System: " + system_platform)
    if device_status is DeviceStatus.ACTIVE:
        Logger.info(LOCATION,
                    "Device is already active, no need to further configure")
        Logger.info(LOCATION, "Server is waiting for requests to serve...")
        Logger.info(
            LOCATION,
            "Supported Endpoints: /qrcode    /actions    /pairing    /activate"
        )
    elif device_status is DeviceStatus.PAIRED:
        Logger.info(LOCATION,
                    "Device state is PAIRED, resuming the configuration")
        ConfigurationService().resume_configuration()
    elif device_status is DeviceStatus.MULTIPAIR and PairingService().pair():
        Logger.info(
            LOCATION,
            "Device is paired as MULTIPAIR, Server is waiting for requests to serve..."
        )
    else:
        Logger.info(
            LOCATION,
            "Pair the device either using QRCode or Bluetooth Service through FINN Mobile App"
        )
        if system_platform != 'Darwin' and configuration.is_bluetooth_enabled(
        ):
            from bot_python_sdk.bluetooth_service import BluetoothService
            # Handle BLE specific events and callbacks
            BluetoothService().initialize()
            ConfigurationService().resume_configuration()
示例#2
0
 def __init__(self):
     configuration = ConfigurationStore().get()
     self.maker_id = configuration.get_maker_id()
     self.device_id = configuration.get_device_id()
     self.device_status = configuration.get_device_status()
     self.bot_service = BoTService()