Exemple #1
0
    public void InitializeBluetoothProxy()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.Android:
            if (BluetoothDeviceType == EBluetoothDeviceType.BLUETOOTH_CLASSIC)
            {
                m_device = new AndroidBluetoothClassicDevice();
            }
            else
            {
                m_device = new AndroidBLEDevice();
            }
            break;

        default:
            throw new System.Exception($"Platform{Application.platform.ToString()} BluetoothDevice Not Implememt");
        }

        if (m_device != null)
        {
            m_device.InitializeBluetoothDevice();

            if (m_skateMessageHandler != null)
            {
                m_skateMessageHandler.SetBluetoothDevice(m_device);
            }
            else
            {
                m_skateMessageHandler = new SkateMessageHandler(m_device);
            }

            BluetoothEvents.OnBluetoothDeviceStateChangedEvent += OnBluetoothStateChangedCallback;
        }
    }