Skip to content

Commit

Permalink
feat: Adds support for IBasicVolumeWithFeedbackAdvanced (needs more t…
Browse files Browse the repository at this point in the history
…esting)
  • Loading branch information
ndorin committed Mar 22, 2024
1 parent a9c4f4b commit 1d5988f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions 3-series/Messengers/DeviceVolumeMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using static Crestron.SimplSharpPro.Lighting.ZumWired.ZumNetBridgeRoom.ZumWiredRoomInterface;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand All @@ -16,7 +17,7 @@ public DeviceVolumeMessenger(string key, string messagePath) : base(key, message
}

public DeviceVolumeMessenger(string key, string messagePath, IBasicVolumeWithFeedback device)
: base(key, messagePath, device as Device)
: base(key, messagePath, device as PepperDash.Core.Device)
{
_localDevice = device;
}
Expand All @@ -32,6 +33,13 @@ private void SendStatus()
}
};

if (_localDevice is IBasicVolumeWithFeedbackAdvanced volumeAdvanced)
{
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "************************DeviceVolumeMessenger - SendStatus - VolumeAdvanced device detected. Adding RawValue and Units to message.");
messageObj.Volume.RawValue = volumeAdvanced.RawVolumeLevel.ToString();
messageObj.Volume.Units = volumeAdvanced.Units;
}

PostStatusMessage(messageObj);
}

Expand Down Expand Up @@ -73,7 +81,6 @@ protected override void CustomRegisterWithAppServer(MobileControlSystemControlle

AddAction("/volumeUp", (id, content) => PressAndHoldHandler.HandlePressAndHold(content, (b) =>
{
Debug.Console(2, this, "volumeUp: {0}", b);
_localDevice.VolumeUp(b);
}));

Expand Down

0 comments on commit 1d5988f

Please sign in to comment.