MuteTypeScreensaverActive,
MuteTypeRemoteSession,
MuteTypeDisplayStandby,
+ MuteTypeBluetoothDisconnect,
// Without restore
MuteTypeLogout,
muteConfig_[MuteTypeDisplayStandby].shouldMute = enable;
}
+void MuteControl::SetMuteOnBluetoothDisconnect(bool enable)
+{
+ muteConfig_[MuteTypeBluetoothDisconnect].shouldMute = enable;
+}
+
bool MuteControl::GetRestoreVolume()
{
return restoreVolume_;
}
-bool MuteControl::GetMuteOnWorkstationLock()
+bool MuteControl::GetMuteOnWorkstationLock() const
{
return muteConfig_[MuteTypeWorkstationLock].shouldMute;
}
-bool MuteControl::GetMuteOnScreensaverActivation()
+bool MuteControl::GetMuteOnScreensaverActivation() const
{
return muteConfig_[MuteTypeScreensaverActive].shouldMute;
}
-bool MuteControl::GetMuteOnRemoteSession()
+bool MuteControl::GetMuteOnRemoteSession() const
{
return muteConfig_[MuteTypeRemoteSession].shouldMute;
}
-bool MuteControl::GetMuteOnDisplayStandby()
+bool MuteControl::GetMuteOnDisplayStandby() const
{
return muteConfig_[MuteTypeDisplayStandby].shouldMute;
}
-bool MuteControl::GetMuteOnLogout()
+bool MuteControl::GetMuteOnBluetoothDisconnect() const
+{
+ return muteConfig_[MuteTypeBluetoothDisconnect].shouldMute;
+}
+
+bool MuteControl::GetMuteOnLogout() const
{
return muteConfig_[MuteTypeLogout].shouldMute;
}
-bool MuteControl::GetMuteOnSuspend()
+bool MuteControl::GetMuteOnSuspend() const
{
return muteConfig_[MuteTypeSuspend].shouldMute;
}
-bool MuteControl::GetMuteOnShutdown()
+bool MuteControl::GetMuteOnShutdown() const
{
return muteConfig_[MuteTypeShutdown].shouldMute;
}
}
}
+void MuteControl::NotifyBluetoothConnected(bool connected)
+{
+ WMLog::GetInstance().Write(
+ L"Mute Event: Bluetooth audio device %s",
+ connected ? L"connected" : L"disconnected");
+ NotifyRestoreCondition(MuteTypeBluetoothDisconnect, !connected);
+}
+
void MuteControl::NotifyLogout()
{
WMLog::GetInstance().Write(L"Mute Event: Logout start");
void SetMuteOnScreensaverActivation(bool enable);
void SetMuteOnRemoteSession(bool enable);
void SetMuteOnDisplayStandby(bool enable);
+ void SetMuteOnBluetoothDisconnect(bool enable);
void SetMuteOnLogout(bool enable);
void SetMuteOnSuspend(bool enable);
bool GetRestoreVolume();
- bool GetMuteOnWorkstationLock();
- bool GetMuteOnScreensaverActivation();
- bool GetMuteOnRemoteSession();
- bool GetMuteOnDisplayStandby();
+ bool GetMuteOnWorkstationLock() const;
+ bool GetMuteOnScreensaverActivation() const;
+ bool GetMuteOnRemoteSession() const;
+ bool GetMuteOnDisplayStandby() const;
+ bool GetMuteOnBluetoothDisconnect() const;
- bool GetMuteOnLogout();
- bool GetMuteOnSuspend();
- bool GetMuteOnShutdown();
+ bool GetMuteOnLogout() const;
+ bool GetMuteOnSuspend() const;
+ bool GetMuteOnShutdown() const;
void NotifyScreensaver(bool active);
void NotifyWorkstationLock(bool active);
void NotifyRemoteSession(bool active);
- void NotifyDisplayStandby(bool enable);
+ void NotifyDisplayStandby(bool active);
+ void NotifyBluetoothConnected(bool connected);
void NotifyLogout();
void NotifySuspend(bool active);
muteConfig_.muteOnBluetooth = settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH);
if (!muteConfig_.muteOnBluetooth) {
+ muteCtrl_.SetMuteOnBluetoothDisconnect(false);
btDetector_.Unload();
} else {
if (!btDetector_.Init(hWnd_)) {
L"Bluetooth muting will be disabled on this computer");
settings_.SetValue(SettingsKey::MUTE_ON_BLUETOOTH, FALSE);
} else {
+ muteCtrl_.SetMuteOnBluetoothDisconnect(true);
bool muteOnWithDeviceList = settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST);
btDetector_.SetDeviceList(settings_.GetBluetoothDevicesA(), muteOnWithDeviceList);
}
if (muteConfig_.muteOnBluetooth) {
const auto btStatus = btDetector_.GetBluetoothStatus(msg, wParam, lParam);
if (btStatus == BluetoothDetector::BluetoothStatus::Connected) {
- if (settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED)) {
- trayIcon_.ShowPopup(
- L"Bluetooth muting",
- L"Bluetooth device connected: Restoring audio");
- }
- muteCtrl_.SetMute(false);
+ muteCtrl_.NotifyBluetoothConnected(true);
} else if (btStatus == BluetoothDetector::BluetoothStatus::Disconnected) {
- if (settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED)) {
- trayIcon_.ShowPopup(
- L"Bluetooth muting",
- L"Bluetooth device disconnected: Muting");
- }
- muteCtrl_.SetMute(true);
+ muteCtrl_.NotifyBluetoothConnected(false);
}
}
return TRUE;