diff --git a/Assets/Plugins/Android/unityandroidbluetoothlelib.jar b/Assets/Plugins/Android/unityandroidbluetoothlelib.jar index ec45ca2a..f8e9e386 100644 Binary files a/Assets/Plugins/Android/unityandroidbluetoothlelib.jar and b/Assets/Plugins/Android/unityandroidbluetoothlelib.jar differ diff --git a/Assets/Plugins/BluetoothDeviceScript.cs b/Assets/Plugins/BluetoothDeviceScript.cs index 362dcfcc..2bf6dec4 100644 --- a/Assets/Plugins/BluetoothDeviceScript.cs +++ b/Assets/Plugins/BluetoothDeviceScript.cs @@ -96,7 +96,7 @@ public class BluetoothDeviceScript : MonoBehaviour } } for (int i = 0; i < parts.Length; ++i) - BluetoothLEHardwareInterface.Log(string.Format("Part: {0} - {1}", i, parts[i])); + Debug.Log(string.Format("Part: {0} - {1}", i, parts[i])); if (message.Length >= deviceInitializedString.Length && message.Substring (0, deviceInitializedString.Length) == deviceInitializedString) { diff --git a/Assets/Resources/UI/Prefab/Panel/Mobile/DevicePanel.prefab b/Assets/Resources/UI/Prefab/Panel/Mobile/DevicePanel.prefab index 84e66f3d..84f25dd8 100644 --- a/Assets/Resources/UI/Prefab/Panel/Mobile/DevicePanel.prefab +++ b/Assets/Resources/UI/Prefab/Panel/Mobile/DevicePanel.prefab @@ -1317,8 +1317,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 20, y: -201} - m_SizeDelta: {x: 160, y: 30} + m_AnchoredPosition: {x: 51, y: -204.5} + m_SizeDelta: {x: 132, y: 23} m_Pivot: {x: 0, y: 1} --- !u!222 &5054656622091827353 CanvasRenderer: @@ -2127,7 +2127,7 @@ PrefabInstance: - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_SizeDelta.x - value: 154.09998 + value: 126.099945 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} @@ -2137,12 +2137,12 @@ PrefabInstance: - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.x - value: 77.99998 + value: 109 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.y - value: -76.86 + value: -74.430016 objectReference: {fileID: 0} - target: {fileID: 9182849809646276971, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} @@ -2565,7 +2565,7 @@ PrefabInstance: - target: {fileID: 7414013380646078914, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_SizeDelta.y - value: 14 + value: 14.425751 objectReference: {fileID: 0} - target: {fileID: 7414013380646078914, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} @@ -2640,22 +2640,22 @@ PrefabInstance: - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_SizeDelta.x - value: 162.14935 + value: 134.14935 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_SizeDelta.y - value: 22.477173 + value: 23 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.x - value: 78 + value: 109 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.y - value: -77.523 + value: -74.5 objectReference: {fileID: 0} - target: {fileID: 9182849809646276971, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} @@ -3568,6 +3568,11 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, + type: 3} + propertyPath: m_SizeDelta.x + value: 132 + objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_SizeDelta.y @@ -3576,12 +3581,12 @@ PrefabInstance: - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.x - value: 78 + value: 109 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.y - value: -81.89999 + value: -76.95 objectReference: {fileID: 0} - target: {fileID: 9182849809646276971, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} @@ -4007,6 +4012,21 @@ PrefabInstance: propertyPath: m_Color.r value: 1 objectReference: {fileID: 0} + - target: {fileID: 4527791653199611421, guid: 95d5b69c6ebb5f34bb864b2c0756d442, + type: 3} + propertyPath: m_Color.b + value: 0.5254902 + objectReference: {fileID: 0} + - target: {fileID: 4527791653199611421, guid: 95d5b69c6ebb5f34bb864b2c0756d442, + type: 3} + propertyPath: m_Color.g + value: 0.1882353 + objectReference: {fileID: 0} + - target: {fileID: 4527791653199611421, guid: 95d5b69c6ebb5f34bb864b2c0756d442, + type: 3} + propertyPath: m_Color.r + value: 0.9764706 + objectReference: {fileID: 0} - target: {fileID: 4634260803276928508, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_Pivot.x @@ -4227,20 +4247,25 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, + type: 3} + propertyPath: m_SizeDelta.x + value: 132 + objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_SizeDelta.y - value: 22.707062 + value: 23 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.x - value: 78.00002 + value: 109 objectReference: {fileID: 0} - target: {fileID: 9180225337925263917, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} propertyPath: m_AnchoredPosition.y - value: -77.29294 + value: -74.646 objectReference: {fileID: 0} - target: {fileID: 9182849809646276971, guid: 95d5b69c6ebb5f34bb864b2c0756d442, type: 3} diff --git a/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs b/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs index 69bc5335..ee75bf51 100644 --- a/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs +++ b/Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs @@ -211,6 +211,7 @@ namespace Assets.Scripts.Ble { this.callbacks.Add(info, callback); } + Debug.Log("try connect device" + info.Name + this.callbacks.Count.ToString()); if (this.callbacks.Count == 1) { BleResponse s = new BleResponse(); @@ -221,6 +222,7 @@ namespace Assets.Scripts.Ble { callback?.Invoke(self, info, s); this.callbacks.Remove(info); + Debug.Log("连接成功!"); if (this.callbacks.Any()) { this.ConnectPeripheral(this.callbacks.First().Key, this.callbacks.First().Value); @@ -233,6 +235,7 @@ namespace Assets.Scripts.Ble CharacteristicsDiscovered(address, service, characteristic); }, (address) => { + Debug.Log("disconnect device:" + address); PeripheralDisconnected(address, info); }); } @@ -311,6 +314,7 @@ namespace Assets.Scripts.Ble { BluetoothLEHardwareInterface.DisconnectPeripheral(peripheral.Address, (address) => { + Debug.Log("断开回调"+ address); peripheralDisconnectedEvent(this, peripheral, null, true); callback?.Invoke(); }); diff --git a/Assets/Scripts/Scenes/MainController.cs b/Assets/Scripts/Scenes/MainController.cs index d8e867b2..10a37608 100644 --- a/Assets/Scripts/Scenes/MainController.cs +++ b/Assets/Scripts/Scenes/MainController.cs @@ -37,7 +37,7 @@ public class MainController : BaseScene //rect1.offsetMax = Vector2.zero; //transform.Find("ModalPanel").GetComponent().sizeDelta = new Vector2(844, 390); #endif - App.MainDeviceAdapter.StartScan(); + //App.MainDeviceAdapter.StartScan(); } @@ -110,8 +110,8 @@ public class MainController : BaseScene scanTicks++; if (scanTicks == 10) { - App.MainDeviceAdapter.StopScan(); - Debug.Log("StopScan"); + //App.MainDeviceAdapter.StopScan(); + //Debug.Log("StopScan"); } } } diff --git a/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs b/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs index aa66e8c0..fa63ea0a 100644 --- a/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs +++ b/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs @@ -90,7 +90,7 @@ public class ConnectDeviceModal : PFUIPanel { if (item.Value.DeviceInfo.Sensor == SensorType.SpeedCadence || item.Value.DeviceInfo.Sensor == SensorType.Cadence) { - //Debug.Log("断开设备" + item.Value.DeviceInfo.Name); + Debug.Log("断开设备" + item.Value.DeviceInfo.Name); item.Value.DeviceInfo.Disconnect(); DeviceCache.Remove(item.Value.DeviceInfo); } diff --git a/Assets/Scripts/UI/Prefab/Device/DeviceView.cs b/Assets/Scripts/UI/Prefab/Device/DeviceView.cs index eeb96732..4295505a 100644 --- a/Assets/Scripts/UI/Prefab/Device/DeviceView.cs +++ b/Assets/Scripts/UI/Prefab/Device/DeviceView.cs @@ -244,7 +244,7 @@ public class DeviceView : MonoBehaviour mSearchButton.SetActive(false); mPairButton.SetActive(true); #if UNITY_IOS || UNITY_ANDROID - searchState.gameObject.SetActive(false); + //searchState.gameObject.SetActive(false); #endif logo.sprite = sprite1; @@ -275,8 +275,13 @@ public class DeviceView : MonoBehaviour //noDevice.enabled = true; noDevice.text = connectedDevice.Name +" "+ connectedDevice.DeviceNumber.ToString(); } +#if (UNITY_IOS || UNITY_ANDROID) + mPairButton.SetActive(true); + searchState.gameObject.SetActive(true); +#endif searchState.text = "Connecting..."; + } else if (connectedDevice.State == DeviceState.Connected) {