private async void _notifyCommandCharacteristic_ValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args) { if (DateTime.Now - _lastButtonReceived < TimeSpan.FromSeconds(5)) { return; // ignore } _lastButtonReceived = DateTime.Now; try{ if (args?.CharacteristicValue?.Length > 0) { byte[] bytes = new byte[args.CharacteristicValue.Length]; DataReader.FromBuffer(args.CharacteristicValue).ReadBytes(bytes); var str = BitConverter.ToString(bytes); Debug.WriteLine($"*** BUTTON *** {str}"); if (SensorKit.Settings.IsExperimentOn) { Controller.Stop(); } else { if (SensorKit.Settings.IsTrackingOn) { Controller.Start(); } else { Debug.WriteLine($"Please, enable tracking first"); } } } }catch (Exception x) { Debug.WriteLine(x); } }