public void OnPairDevice()
        {
            var devices = BhapticsAndroidManager.GetDevices();
            int rssi    = -9999;
            int index   = -1;

            for (int i = 0; i < devices.Count; i++)
            {
                if (AndroidUtils.CanPair(devices[i], DeviceType))
                {
                    if (rssi < devices[i].Rssi)
                    {
                        rssi  = devices[i].Rssi;
                        index = i;
                    }
                }
            }

            if (index != -1)
            {
                if (DeviceType == PositionType.Vest)
                {
                    BhapticsAndroidManager.Pair(devices[index].Address);
                }
                else
                {
                    BhapticsAndroidManager.Pair(devices[index].Address, DeviceType.ToString());
                }
            }
        }
Exemple #2
0
        public static void Pair(PositionType deviceType)
        {
            var devices = GetDevices();
            int rssi    = -9999;
            int index   = -1;

            for (int i = 0; i < devices.Count; i++)
            {
                if (AndroidUtils.CanPair(devices[i], deviceType))
                {
                    if (rssi < devices[i].Rssi)
                    {
                        rssi  = devices[i].Rssi;
                        index = i;
                    }
                }
            }

            if (index != -1)
            {
                if (deviceType == PositionType.Vest)
                {
                    Pair(devices[index].Address);
                }
                else
                {
                    Pair(devices[index].Address, deviceType.ToString());
                }
            }
        }
Exemple #3
0
        public static bool CanPairDevice(PositionType position)
        {
            var deviceList = GetDevices();

            foreach (var device in deviceList)
            {
                if (AndroidUtils.CanPair(device, position))
                {
                    return(true);
                }
            }
            return(false);
        }