Skip to content

Commit

Permalink
Merge pull request #102 from PepperDash/feature/move-messengers-out
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-welker authored Jan 30, 2024
2 parents f46cea9 + 64a56f7 commit d35277f
Show file tree
Hide file tree
Showing 56 changed files with 958 additions and 618 deletions.
323 changes: 136 additions & 187 deletions .github/workflows/docker.yml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,6 @@ MigrationBackup/

# VS Code settings folders
.vscode/

# Build Outputs
output/
34 changes: 34 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{ "scope": "force-patch", "release": "patch" },
{ "scope": "no-release", "release": false }
]
}
],
"@semantic-release/release-notes-generator",
["@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/exec",
{
"verifyReleaseCmd": "echo \"newVersion=true\" >> $GITHUB_OUTPUT",
"publishCmd": "echo \"version=${nextRelease.version}\" >> $GITHUB_OUTPUT && echo \"tag=${nextRelease.gitTag}\" >> $GITHUB_OUTPUT && echo \"type=${nextRelease.type}\" >> $GITHUB_OUTPUT && echo \"channel=${nextRelease.channel}\" >> $GITHUB_OUTPUT"
}
]
],
"branches": [
"main",
{
"name": "replace-me-feature-branch",
"prerelease": "replace-me-prerelease",
"channel": "replace-me-prerelease"
}
]
}
4 changes: 3 additions & 1 deletion 3-series/DeviceTypeInterfaces/IChannelExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using PepperDash.Essentials.Core;
using PepperDash.Core;

#if SERIES4
using PepperDash.Essentials.AppServer;
#endif
namespace PepperDash.Essentials.Room.MobileControl
{
public static class ChannelExtensions
Expand Down
3 changes: 3 additions & 0 deletions 3-series/DeviceTypeInterfaces/IColorExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using PepperDash.Essentials.Core;
using PepperDash.Core;
#if SERIES4
using PepperDash.Essentials.AppServer;
#endif

namespace PepperDash.Essentials.Room.MobileControl
{
Expand Down
3 changes: 3 additions & 0 deletions 3-series/DeviceTypeInterfaces/IDPadExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using PepperDash.Core;
using PepperDash.Essentials.Core;
#if SERIES4
using PepperDash.Essentials.AppServer;
#endif

namespace PepperDash.Essentials.Room.MobileControl
{
Expand Down
6 changes: 6 additions & 0 deletions 3-series/Messengers/AudioCodecBaseMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.AudioCodec;

using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
Expand Down Expand Up @@ -31,7 +33,11 @@ public AudioCodecBaseMessenger(string key, AudioCodecBase codec, string messageP
codec.CallStatusChange += codec_CallStatusChange;
}

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
base.CustomRegisterWithAppServer(appServerController);

Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/CameraBaseMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand Down Expand Up @@ -49,7 +50,11 @@ private void presetsCamera_PresetsListHasChanged(object sender, EventArgs e)
});
}

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
base.CustomRegisterWithAppServer(appServerController);

Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/CommMonitorMessenger.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand Down Expand Up @@ -38,7 +39,11 @@ private void SendStatus()

#region Overrides of MessengerBase

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendStatus));

Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/ConfigMessenger.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand All @@ -21,7 +22,11 @@ private void ConfigUpdater_ConfigStatusChanged(object sender, ConfigStatusEventA
PostUpdateStatus(e.UpdateStatus.ToString());
}

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
appServerController.AddAction(MessagePath + "/updateConfig", new Action<string>(GetConfigFile));
}
Expand Down
4 changes: 4 additions & 0 deletions 3-series/Messengers/DevicePresetsModelMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ private void SavePresets(List<PresetChannel> presets )

#region Overrides of MessengerBase

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendPresets));
appServerController.AddAction(MessagePath + "/recall", new Action<PresetChannelMessage>((p) =>
Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/DeviceVolumeMessenger.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand Down Expand Up @@ -35,7 +36,11 @@ private void SendStatus()

#region Overrides of MessengerBase

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendStatus));
appServerController.AddAction(MessagePath + "/level", new Action<ushort>(_device.SetVolume));
Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/GenericMessenger.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using PepperDash.Essentials.Core;
using System;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand All @@ -17,7 +18,11 @@ public GenericMessenger(string key, EssentialsDevice device, string messagePath)
_device = device;
}

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
base.CustomRegisterWithAppServer(appServerController);

Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/IHasScheduleAwarenessMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand All @@ -24,7 +25,11 @@ public IHasScheduleAwarenessMessenger(string key, IHasScheduleAwareness schedule
ScheduleSource.CodecSchedule.MeetingEventChange += new EventHandler<MeetingEventArgs>(CodecSchedule_MeetingEventChange);
}

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullScheduleObject));

Expand Down
12 changes: 12 additions & 0 deletions 3-series/Messengers/IMobileControlMessenger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
public interface IMobileControlMessenger
{
IMobileControl3 AppServerController { get; }
string MessagePath { get; }

void RegisterWithAppServer(IMobileControl3 appServerController);
}
}
5 changes: 5 additions & 0 deletions 3-series/Messengers/IRunRouteActionMessenger.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using PepperDash.Essentials.Core;
using PepperDash.Core;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;


namespace PepperDash.Essentials.AppServer.Messengers
Expand Down Expand Up @@ -33,7 +34,11 @@ private void routingSink_CurrentSourceChange(SourceListItem info, ChangeType typ
SendRoutingFullMessageObject();
}

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendRoutingFullMessageObject));

Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/LightingBaseMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using PepperDash.Essentials.Core.Lighting;

using Newtonsoft.Json;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand Down Expand Up @@ -38,7 +39,11 @@ void LightingDevice_LightingSceneChange(object sender, LightingSceneChangeEventA
PostStatusMessage(state);
}

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
base.CustomRegisterWithAppServer(appServerController);

Expand Down
32 changes: 26 additions & 6 deletions 3-series/Messengers/MessengerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Provides a messaging bridge
/// </summary>
public abstract class MessengerBase : EssentialsDevice
#if SERIES4
public abstract class MessengerBase : EssentialsDevice, IMobileControlMessenger
#else
public abstract class MessengerBase: EssentialsDevice
#endif
{
private Device _device;

Expand All @@ -20,7 +25,11 @@ public abstract class MessengerBase : EssentialsDevice
/// <summary>
///
/// </summary>
#if SERIES4
public IMobileControl3 AppServerController { get; private set; }
#else
public MobileControlSystemController AppServerController { get; private set; }
#endif

public string MessagePath { get; private set; }

Expand All @@ -41,7 +50,7 @@ protected MessengerBase(string key, string messagePath)
}

protected MessengerBase(string key, string messagePath, Device device)
:this(key, messagePath)
: this(key, messagePath)
{
_device = device;

Expand Down Expand Up @@ -70,7 +79,11 @@ private List<string> GetInterfaces(Device device)
/// Registers this messenger with appserver controller
/// </summary>
/// <param name="appServerController"></param>
#if SERIES4
public void RegisterWithAppServer(IMobileControl3 appServerController)
#else
public void RegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
if (appServerController == null)
throw new ArgumentNullException("appServerController");
Expand All @@ -83,7 +96,11 @@ public void RegisterWithAppServer(MobileControlSystemController appServerControl
/// Implemented in extending classes. Wire up API calls and feedback here
/// </summary>
/// <param name="appServerController"></param>
#if SERIES4
protected virtual void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected virtual void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
var commMonitor = _device as ICommunicationMonitor;

Expand All @@ -97,7 +114,7 @@ protected virtual void CustomRegisterWithAppServer(MobileControlSystemController
}

private void CommunicationMonitor_StatusChange(object sender, MonitorStatusChangeEventArgs e)
{
{
var message = new DeviceStateMessageBase();
message.CommMonitor = GetCommunicationMonitorState();

Expand All @@ -114,7 +131,7 @@ protected CommunicationMonitorState GetCommunicationMonitorState()
state.IsOnline = commMonitor.CommunicationMonitor.IsOnline;
state.Status = commMonitor.CommunicationMonitor.Status;
//Debug.Console(2, this, "******************GetCommunitcationMonitorState() IsOnline: {0} Status: {1}", state.IsOnline, state.Status);
return state;
return state;
}
else
{
Expand Down Expand Up @@ -163,7 +180,9 @@ protected void PostStatusMessage(DeviceStateMessageBase message)
}
}

protected void PostStatusMessage(MobileControlResponseMessage message)
#if SERIES4
protected void PostStatusMessage(IMobileControlResponseMessage message)

{
if (AppServerController == null)
{
Expand All @@ -185,8 +204,9 @@ protected void PostStatusMessage(MobileControlResponseMessage message)
// Debug.Console(2, this, "*********************Content is not DeviceStateMessageBase");
//}

AppServerController.SendMessageObject(message);
AppServerController.SendMessageObject(message);
}
#endif

protected void PostEventMessage(DeviceEventMessageBase message)
{
Expand Down
5 changes: 5 additions & 0 deletions 3-series/Messengers/RoomEventScheduleMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using PepperDash.Core;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;

namespace PepperDash.Essentials.AppServer.Messengers
{
Expand All @@ -20,7 +21,11 @@ public RoomEventScheduleMessenger(string key, string messagePath, EssentialsTech

#region Overrides of MessengerBase

#if SERIES4
protected override void CustomRegisterWithAppServer(IMobileControl3 appServerController)
#else
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
#endif
{
appServerController.AddAction(MessagePath + "/save", new Action<List<ScheduledEventConfig>>(SaveScheduledEvents));
appServerController.AddAction(MessagePath + "/fullStatus", new Action(() =>
Expand Down
Loading

0 comments on commit d35277f

Please sign in to comment.