|
|
@@ -74,11 +74,11 @@ public class BluetoothAim : MonoBehaviour
|
|
|
userDoConnect = false;
|
|
|
doConnect = false;
|
|
|
OnDisconnect();
|
|
|
-#if UNITY_ANDROID && !UNITY_EDITOR
|
|
|
- DisconnectBleHelper();
|
|
|
-#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
|
|
|
+ #if UNITY_STANDALONE_WIN || UNITY_EDITOR
|
|
|
BleUDP.ins.Disconnect();
|
|
|
-#endif
|
|
|
+ #else
|
|
|
+ DisconnectBleHelper();
|
|
|
+ #endif
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -142,11 +142,11 @@ public class BluetoothAim : MonoBehaviour
|
|
|
scanLock = true;
|
|
|
canConnect = false;
|
|
|
SetStatus(BluetoothStatusEnum.Connecting);
|
|
|
-#if UNITY_ANDROID && !UNITY_EDITOR
|
|
|
- ConnectBleHelper();
|
|
|
-#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
|
|
|
+ #if UNITY_STANDALONE_WIN || UNITY_EDITOR
|
|
|
ConnectBleByUDP();
|
|
|
-#endif
|
|
|
+ #else
|
|
|
+ ConnectBleHelper();
|
|
|
+ #endif
|
|
|
}
|
|
|
|
|
|
void ConnectBleHelper()
|
|
|
@@ -499,15 +499,14 @@ public class BluetoothAim : MonoBehaviour
|
|
|
|
|
|
public void WriteData(string data)
|
|
|
{
|
|
|
-#if UNITY_ANDROID && !UNITY_EDITOR
|
|
|
+ #if UNITY_STANDALONE_WIN || UNITY_EDITOR
|
|
|
+ BleUDP.ins.SendMsg(data);
|
|
|
+ #else
|
|
|
if (DebugDeviceCMD.ins) DebugDeviceCMD.ins.ShowCMD(data);
|
|
|
BluetoothHelperCharacteristic ch = new BluetoothHelperCharacteristic(characteristicWrite.getName());
|
|
|
ch.setService(bluetoothService.getName());
|
|
|
bluetoothHelper.WriteCharacteristic(ch, data);
|
|
|
-#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
|
|
|
- BleUDP.ins.SendMsg(data);
|
|
|
-#endif
|
|
|
-
|
|
|
+ #endif
|
|
|
}
|
|
|
|
|
|
void Log(string text)
|