/// <summary> /// Initiate a service discovery on the device /// </summary> public void DiscoverServices() { Action action = () => _gatt.DiscoverServices(); if (Configuration.DiscoverServicesOnMainThread) { var handler = new Handler(Looper.MainLooper); handler.PostAtFrontOfQueue(action); } else { action.Invoke(); } }
/// <summary> /// Discconnect from a device. /// </summary> /// <param name="device">The device.</param> public void DisconnectDevice(IDevice device) { if (_gatt == null) return; Action action = () => PerformDisconnect(device); if (Configuration.DisconnectOnMainThread) { var handler = new Handler(Looper.MainLooper); handler.PostAtFrontOfQueue(action); } else { action.Invoke(); } }
/// <summary> /// Connect to a device. /// </summary> /// <param name="device">The device.</param> public void ConnectToDevice(IDevice device) { Action action = () => PerformConnectToDevice(device); if (Configuration.ConnectOnMainThread) { var handler = new Handler(Looper.MainLooper); handler.PostAtFrontOfQueue(action); } else { action.Invoke(); } }