登录增加loading&赛事提醒修改

This commit is contained in:
lishuo committed 2021-09-13 18:21:43 +08:00
1 parent 51cea743be
commit dfb80658dd
23 files changed
+2137 -34355

No files matched your search

+1 -1
View File
@@ -76,7 +76,7 @@ namespace Assets.Scripts.Devices.Ble
{
return;
}
if(!this.hwInterface.BleState.Equals(BleState.On) || this.State != DeviceState.Disconnected)
if(!this.hwInterface.BleState.Equals(BleState.On) || (this.State != DeviceState.Disconnected && this.State != DeviceState.Connecting))
{
return;
}
@@ -35,20 +35,22 @@ namespace Assets.Scripts.Devices.Ble
this.managerStatusChanged -= value;
}
}
WclBleManagerStatus statusEnum = WclBleManagerStatus.RadioOff;
internal BleMobileThread() {
var self = this;
//初始蓝牙
BluetoothLEHardwareInterface.Initialize(true, false, () => {
statusEnum = WclBleManagerStatus.RadioOn;
managerInitialized?.Invoke(self);
},
(error) => {
statusEnum = WclBleManagerStatus.RadioOff;
BluetoothLEHardwareInterface.Log("Error: " + error);
if (error.Contains("Bluetooth LE Not Enabled"))
BluetoothLEHardwareInterface.BluetoothEnable(true);
}, (status) => {
var statusEnum = WclBleManagerStatus.RadioOn;
statusEnum = WclBleManagerStatus.RadioOn;
switch (status)
{
case 13:
@@ -66,11 +68,50 @@ namespace Assets.Scripts.Devices.Ble
}
public void StartWatcher() {
BluetoothLEHardwareInterface.ScanForPeripheralsWithServices(ServiceUuids.GetServiceUuidList().ToArray(), null, (address, name, rssi, bytes) =>
var self = this;
if (statusEnum == WclBleManagerStatus.RadioOff)
{
ScanInfoReceived?.Invoke(this, address, name, rssi, bytes);
}, true);
BluetoothLEHardwareInterface.BluetoothEnable(true);
BluetoothLEHardwareInterface.Initialize(true, false, () =>
{
managerInitialized?.Invoke(self);
BluetoothLEHardwareInterface.ScanForPeripheralsWithServices(ServiceUuids.GetServiceUuidList().ToArray(), null, (address, name, rssi, bytes) =>
{
ScanInfoReceived?.Invoke(self, address, name, rssi, bytes);
}, true);
},
(error) =>
{
statusEnum = WclBleManagerStatus.RadioOff;
BluetoothLEHardwareInterface.Log("Error: " + error);
if (error.Contains("Bluetooth LE Not Enabled"))
BluetoothLEHardwareInterface.BluetoothEnable(true);
}, (status) =>
{
statusEnum = WclBleManagerStatus.RadioOn;
switch (status)
{
case 13:
statusEnum = WclBleManagerStatus.RadioOff;
break;
case 11:
statusEnum = WclBleManagerStatus.RadioOn;
break;
}
if (managerStatusChanged != null)
{
managerStatusChanged.Invoke(self, statusEnum);
}
});
}
else
{
BluetoothLEHardwareInterface.ScanForPeripheralsWithServices(ServiceUuids.GetServiceUuidList().ToArray(), null, (address, name, rssi, bytes) =>
{
ScanInfoReceived?.Invoke(self, address, name, rssi, bytes);
}, true);
}
}
public void Stop()