public bool Start() { try { if (BlinkDevices.Any()) { BluetoothDevice device = BlinkDevices.First(); if (!Connect(adapter.GetRemoteDevice(device.Address))) { return(false); } try { Sensors.Start(); } catch (System.Exception e) { Functions.ShowToast($"센서를 불러오는 도중 오류가 발생했습니다."); Log.Debug(Name, "Sensor Failed {0}", e); return(false); } return(true); } else { Functions.ShowToast($"BLINK 기기를 찾을 수 없습니다.\n기기를 켜고 페어링 한 후 앱을 다시 켜주세요."); Sensors.Dispose(); Sensors = null; } } catch (System.Exception e) { Log.Error("BLINK", "Bluetooth Error!", e); } return(false); }
public Bluetooth() { Singleton = this; try { if (Sensors == null) { Sensors = new Sensors(this); } this.State = BluetoothState.None; if (!adapter.IsEnabled) { adapter.Enable(); } adapter.StartDiscovery(); } catch (System.Exception e) { Log.Error("BLINK", "Bluetooth Error!", e); } }