public void UpdateDashboard(BaseMessageParser parser) { if (parser.GetType() == typeof(ExtendedStatusUpdateParser)) { var p = (ExtendedStatusUpdateParser)parser; UpdateBatteryPercentage(p.BatteryL, Side.L); UpdateBatteryPercentage(p.BatteryR, Side.R); DisableEarbudIcon(p.BatteryL <= 0, p.BatteryR <= 0); EarbudWarning(p.WearState == WearStates.L || p.WearState == WearStates.Both, p.WearState == WearStates.R || p.WearState == WearStates.Both); } else if (parser.GetType() == typeof(StatusUpdateParser)) { var p = (StatusUpdateParser)parser; UpdateBatteryPercentage(p.BatteryL, Side.L); UpdateBatteryPercentage(p.BatteryR, Side.R); DisableEarbudIcon(p.BatteryL <= 0, p.BatteryR <= 0); EarbudWarning(p.WearState == WearStates.L || p.WearState == WearStates.Both, p.WearState == WearStates.R || p.WearState == WearStates.Both); } }
public void UpdateDashboard(BaseMessageParser parser) { if (parser.GetType() == typeof(ExtendedStatusUpdateParser)) { if (_allowGetAllResponse) { BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetAllData()); } } else if (parser.GetType() == typeof(StatusUpdateParser)) { if (_allowGetAllResponse) { BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetAllData()); } } else if (parser.GetType() == typeof(DebugGetAllDataParser)) { var p = (DebugGetAllDataParser)parser; UpdateBatteryPercentage((int)Math.Round(p.LeftAdcSOC), Side.L); UpdateBatteryPercentage((int)Math.Round(p.RightAdcSOC), Side.R); Dispatcher.Invoke(() => { UpdateDetails(p); }); } }
public void UpdateDashboard(BaseMessageParser parser) { if (parser.GetType() == typeof(ExtendedStatusUpdateParser)) { if (_allowGetAllResponse) { BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetAllData()); } Dispatcher.Invoke(() => { if (BluetoothService.Instance.ActiveModel == Model.BudsPlus || BluetoothService.Instance.ActiveModel == Model.BudsLive) { ExtendedStatusUpdateParser p = (ExtendedStatusUpdateParser)parser; UpdatePlusPlacement(p.PlacementL, p.PlacementR); _lastPlacementL = p.PlacementL; _lastPlacementR = p.PlacementR; BatteryCase.Content = BluetoothService.Instance.ActiveModel == Model.Buds ? "" : $"{p.BatteryCase}%"; CaseLabel.Visibility = BluetoothService.Instance.ActiveModel == Model.Buds ? Visibility.Hidden : Visibility.Visible; } if (BluetoothService.Instance.ActiveModel == Model.BudsLive) { ExtendedStatusUpdateParser p = (ExtendedStatusUpdateParser)parser; AncToggle.SetChecked(p.NoiceCancelling); } }); } else if (parser.GetType() == typeof(StatusUpdateParser)) { if (_allowGetAllResponse) { BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetAllData()); } Dispatcher.Invoke(() => { if (BluetoothService.Instance.ActiveModel == Model.BudsPlus || BluetoothService.Instance.ActiveModel == Model.BudsLive) { StatusUpdateParser p = (StatusUpdateParser)parser; UpdatePlusPlacement(p.PlacementL, p.PlacementR); _lastPlacementL = p.PlacementL; _lastPlacementR = p.PlacementR; BatteryCase.Content = BluetoothService.Instance.ActiveModel == Model.Buds ? "" : $"{p.BatteryCase}%"; CaseLabel.Visibility = BluetoothService.Instance.ActiveModel == Model.Buds ? Visibility.Hidden : Visibility.Visible; } }); } else if (parser.GetType() == typeof(DebugGetAllDataParser)) { var p = (DebugGetAllDataParser)parser; UpdateBatteryPercentage((int)Math.Round(p.LeftAdcSOC), Side.L); UpdateBatteryPercentage((int)Math.Round(p.RightAdcSOC), Side.R); Dispatcher.Invoke(() => { UpdateDetails(p); }); } }
public void UpdateDashboard(BaseMessageParser parser) { if (parser.GetType() == typeof(ExtendedStatusUpdateParser)) { if (_allowGetAllResponse) { BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetAllData()); } Dispatcher.Invoke(() => { if (BluetoothService.Instance.ActiveModel == Model.BudsPlus) { ExtendedStatusUpdateParser p = (ExtendedStatusUpdateParser)parser; BatteryTemperatureLeft.Content = p.PlacementL.ToString(); BatteryTemperatureRight.Content = p.PlacementR.ToString(); BatteryCase.Content = p.BatteryCase <= 0 ? "" : $"{p.BatteryCase}%"; CaseLabel.Visibility = p.BatteryCase <= 0 ? Visibility.Hidden : Visibility.Visible; } }); } else if (parser.GetType() == typeof(StatusUpdateParser)) { if (_allowGetAllResponse) { BluetoothService.Instance.SendAsync(SPPMessageBuilder.Info.GetAllData()); } Dispatcher.Invoke(() => { if (BluetoothService.Instance.ActiveModel == Model.BudsPlus) { StatusUpdateParser p = (StatusUpdateParser)parser; BatteryTemperatureLeft.Content = p.PlacementL.ToString(); BatteryTemperatureRight.Content = p.PlacementR.ToString(); BatteryCase.Content = p.BatteryCase <= 0 ? "" : $"{p.BatteryCase}%"; CaseLabel.Visibility = p.BatteryCase <= 0 ? Visibility.Hidden : Visibility.Visible; } }); } else if (parser.GetType() == typeof(DebugGetAllDataParser)) { var p = (DebugGetAllDataParser)parser; UpdateBatteryPercentage((int)Math.Round(p.LeftAdcSOC), Side.L); UpdateBatteryPercentage((int)Math.Round(p.RightAdcSOC), Side.R); Dispatcher.Invoke(() => { UpdateDetails(p); }); } }