Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile
# Conflicts: # Assets/Scripts/Scenes/MainController.cs
This commit is contained in:
commit
85130ce6c3
16 files changed
+135
-69
No files matched your search
Binary file not shown.
@@ -23,8 +23,9 @@ public class BluetoothDeviceScript : MonoBehaviour
|
||||
public Action<string, string> RetrievedConnectedPeripheralAction;
|
||||
public Action<string, byte[]> PeripheralReceivedWriteDataAction;
|
||||
public Action<string> ConnectedPeripheralAction;
|
||||
public Action<string> ConnectedDisconnectPeripheralAction;
|
||||
public Action<string> ConnectedDisconnectPeripheralAction { get; set; }
|
||||
public Action<string> DisconnectedPeripheralAction;
|
||||
public Action<string> DeviceBleStatusDisconnectedAction;
|
||||
public Action<string, string> DiscoveredServiceAction;
|
||||
public Action<string, string, string> DiscoveredCharacteristicAction;
|
||||
public Action<string> DidWriteCharacteristicAction;
|
||||
@@ -80,11 +81,14 @@ public class BluetoothDeviceScript : MonoBehaviour
|
||||
{
|
||||
char[] delim = new char[] { '~' };
|
||||
string[] parts = message.Split (delim);
|
||||
if (parts[0].Equals("DeviceStateChanged"))
|
||||
{
|
||||
//throw new Exception("test");
|
||||
}
|
||||
if (parts[0].Equals(bleStatusChanged))
|
||||
if (parts[0].Equals("DeviceStateChanged"))
|
||||
{
|
||||
if (DeviceBleStatusDisconnectedAction != null && parts[1].Equals("0"))
|
||||
{
|
||||
DeviceBleStatusDisconnectedAction(parts[2]);
|
||||
}
|
||||
}
|
||||
if (parts[0].Equals(bleStatusChanged))
|
||||
{
|
||||
if (BleStatusChangedAction != null)
|
||||
{
|
||||
@@ -231,12 +235,12 @@ public class BluetoothDeviceScript : MonoBehaviour
|
||||
{
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
if (ConnectedDisconnectPeripheralAction != null)
|
||||
ConnectedDisconnectPeripheralAction (parts[1]);
|
||||
if (ConnectedDisconnectPeripheralAction != null)
|
||||
ConnectedDisconnectPeripheralAction(parts[1]);
|
||||
|
||||
if (DisconnectedPeripheralAction != null)
|
||||
DisconnectedPeripheralAction (parts[1]);
|
||||
}
|
||||
if (DisconnectedPeripheralAction != null)
|
||||
DisconnectedPeripheralAction(parts[1]);
|
||||
}
|
||||
}
|
||||
else if (message.Length >= deviceDiscoveredService.Length && message.Substring (0, deviceDiscoveredService.Length) == deviceDiscoveredService)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ using UnityEngine;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
#if UNITY_ANDROID
|
||||
@@ -605,6 +606,7 @@ public class BluetoothLEHardwareInterface
|
||||
|
||||
public static void ConnectToPeripheral (string name, Action<string> connectAction, Action<string, string> serviceAction, Action<string, string, string> characteristicAction, Action<string> disconnectAction = null)
|
||||
{
|
||||
|
||||
#if !UNITY_EDITOR_OSX || !EXPERIMENTAL_MACOS_EDITOR
|
||||
if (!Application.isEditor)
|
||||
{
|
||||
@@ -614,7 +616,8 @@ public class BluetoothLEHardwareInterface
|
||||
bluetoothDeviceScript.ConnectedPeripheralAction = connectAction;
|
||||
bluetoothDeviceScript.DiscoveredServiceAction = serviceAction;
|
||||
bluetoothDeviceScript.DiscoveredCharacteristicAction = characteristicAction;
|
||||
bluetoothDeviceScript.ConnectedDisconnectPeripheralAction = disconnectAction;
|
||||
//bluetoothDeviceScript.ConnectedDisconnectPeripheralAction = disconnectAction;
|
||||
bluetoothDeviceScript.DeviceBleStatusDisconnectedAction = disconnectAction;
|
||||
}
|
||||
|
||||
#if EXPERIMENTAL_MACOS_EDITOR && (UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX)
|
||||
|
||||
@@ -12,19 +12,19 @@ PluginImporter:
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
'': Linux
|
||||
: Linux
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
'': OSXIntel
|
||||
: OSXIntel
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
'': OSXIntel64
|
||||
: OSXIntel64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
|
||||
@@ -47,7 +47,7 @@ PluginImporter:
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
|
||||
Reference in new issue
Block a user