mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Adds CustomUnregisterWithAppServer method to allow unregistration at runtime
This commit is contained in:
@@ -109,10 +109,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
var asc = appServerController;
|
var asc = appServerController;
|
||||||
|
|
||||||
|
asc.AddAction(MessagePath + "/fullStatus", new Action(SendCameraFullMessageObject));
|
||||||
|
|
||||||
// Add press and holds using helper action
|
// Add press and holds using helper action
|
||||||
Action<string, uint> addPHAction = (s, u) =>
|
Action<string, uint> addPHAction = (s, u) =>
|
||||||
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
asc.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
||||||
addPHAction("/cameraUp", BoolJoin.CameraControlUp + JoinStart);
|
addPHAction("/cameraUp", BoolJoin.CameraControlUp + JoinStart);
|
||||||
addPHAction("/cameraDown", BoolJoin.CameraControlDown + JoinStart);
|
addPHAction("/cameraDown", BoolJoin.CameraControlDown + JoinStart);
|
||||||
addPHAction("/cameraLeft", BoolJoin.CameraControlLeft + JoinStart);
|
addPHAction("/cameraLeft", BoolJoin.CameraControlLeft + JoinStart);
|
||||||
@@ -121,7 +122,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
addPHAction("/cameraZoomOut", BoolJoin.CameraControlZoomOut + JoinStart);
|
addPHAction("/cameraZoomOut", BoolJoin.CameraControlZoomOut + JoinStart);
|
||||||
|
|
||||||
Action<string, uint> addAction = (s, u) =>
|
Action<string, uint> addAction = (s, u) =>
|
||||||
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
asc.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
||||||
|
|
||||||
addAction("/cameraModeAuto", BoolJoin.CameraModeAuto);
|
addAction("/cameraModeAuto", BoolJoin.CameraModeAuto);
|
||||||
addAction("/cameraModeManual", BoolJoin.CameraModeManual);
|
addAction("/cameraModeManual", BoolJoin.CameraModeManual);
|
||||||
@@ -132,10 +133,27 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
addAction("/cameraPreset" + (i), BoolJoin.CameraPresetStart + i + JoinStart);
|
addAction("/cameraPreset" + (i), BoolJoin.CameraPresetStart + i + JoinStart);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
asc.AddAction(MessagePath + "/fullStatus", new Action(SendCameraFullMessageObject));
|
public void CustomUnregsiterWithAppServer(MobileControlSystemController appServerController)
|
||||||
|
{
|
||||||
|
appServerController.RemoveAction(MessagePath + "/fullStatus");
|
||||||
|
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraUp");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraDown");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraLeft");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraRight");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraZoomIn");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraZoomOut");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraModeAuto");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraModeManual");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/cameraModeOff");
|
||||||
|
|
||||||
|
EISC.SetUShortSigAction(UshortJoin.CameraPresetCount + JoinStart, null);
|
||||||
|
|
||||||
|
EISC.SetBoolSigAction(BoolJoin.CameraModeAuto, null);
|
||||||
|
EISC.SetBoolSigAction(BoolJoin.CameraModeManual, null);
|
||||||
|
EISC.SetBoolSigAction(BoolJoin.CameraModeOff, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
EISC.SetStringSigAction(JoinStart + StringJoin.CurrentSource, (s) => SendRoutingFullMessageObject(s));
|
EISC.SetStringSigAction(JoinStart + StringJoin.CurrentSource, (s) => SendRoutingFullMessageObject(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
|
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)
|
||||||
{
|
{
|
||||||
appServerController.AddAction(MessagePath + "/fullStatus", new Action(() =>
|
appServerController.AddAction(MessagePath + "/fullStatus", new Action(() =>
|
||||||
@@ -42,13 +41,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
SendRoutingFullMessageObject(EISC.GetString(JoinStart + StringJoin.CurrentSource));
|
SendRoutingFullMessageObject(EISC.GetString(JoinStart + StringJoin.CurrentSource));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
appServerController.AddAction(string.Format(@"/device/inRoomPc-1/source"), new Action<SourceSelectMessageContent>(c =>
|
appServerController.AddAction(MessagePath +"/source", new Action<SourceSelectMessageContent>(c =>
|
||||||
{
|
{
|
||||||
EISC.SetString(JoinStart + StringJoin.CurrentSource, c.SourceListItem);
|
EISC.SetString(JoinStart + StringJoin.CurrentSource, c.SourceListItem);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CustomUnregsiterWithAppServer(MobileControlSystemController appServerController)
|
||||||
|
{
|
||||||
|
appServerController.RemoveAction(MessagePath + "/fullStatus");
|
||||||
|
appServerController.RemoveAction(MessagePath + "/source");
|
||||||
|
|
||||||
|
EISC.SetStringSigAction(JoinStart + StringJoin.CurrentSource, null);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to update full status of the routing device
|
/// Helper method to update full status of the routing device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -776,13 +776,12 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
{
|
{
|
||||||
foreach (var device in ConfigReader.ConfigObject.Devices)
|
foreach (var device in ConfigReader.ConfigObject.Devices)
|
||||||
{
|
{
|
||||||
if (device.Group.Equals("appServerMessenger"))
|
if (device.Group.Equals("simplmessenger"))
|
||||||
{
|
{
|
||||||
var props = JsonConvert.DeserializeObject<SimplMessengerPropertiesConfig>(device.Properties.ToString());
|
var props = JsonConvert.DeserializeObject<SimplMessengerPropertiesConfig>(device.Properties.ToString());
|
||||||
|
|
||||||
var messengerKey = string.Format("device-{0}-{1}", this.Key, Parent.Key);
|
var messengerKey = string.Format("device-{0}-{1}", this.Key, Parent.Key);
|
||||||
|
|
||||||
MessengerBase messenger = null;
|
|
||||||
|
|
||||||
var dev = ConfigReader.ConfigObject.GetDeviceForKey(props.DeviceKey);
|
var dev = ConfigReader.ConfigObject.GetDeviceForKey(props.DeviceKey);
|
||||||
|
|
||||||
@@ -793,6 +792,7 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
var type = device.Type.ToLower();
|
var type = device.Type.ToLower();
|
||||||
|
MessengerBase messenger = null;
|
||||||
|
|
||||||
if (type.Equals("simplcameramessenger"))
|
if (type.Equals("simplcameramessenger"))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user