mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Wrapped up CameraBaseMessenger
This commit is contained in:
@@ -56,11 +56,73 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
if (ptzCamera != null)
|
if (ptzCamera != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Need to evaluate how to pass through these P&H actions. Need a method that takes a bool maybe?
|
// Need to evaluate how to pass through these P&H actions. Need a method that takes a bool maybe?
|
||||||
AppServerController.AddAction(MessagePath + "/cameraUp", new PressAndHoldAction(ptzCamera.TiltUp));
|
AppServerController.AddAction(MessagePath + "/cameraUp", new PressAndHoldAction((b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
ptzCamera.TiltUp();
|
||||||
|
else
|
||||||
|
ptzCamera.TiltStop();
|
||||||
|
}));
|
||||||
|
AppServerController.AddAction(MessagePath + "/cameraDown", new PressAndHoldAction((b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
ptzCamera.TiltDown();
|
||||||
|
else
|
||||||
|
ptzCamera.TiltStop();
|
||||||
|
}));
|
||||||
|
AppServerController.AddAction(MessagePath + "/cameraLeft", new PressAndHoldAction((b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
ptzCamera.PanLeft();
|
||||||
|
else
|
||||||
|
ptzCamera.PanStop();
|
||||||
|
}));
|
||||||
|
AppServerController.AddAction(MessagePath + "/cameraRight", new PressAndHoldAction((b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
ptzCamera.PanRight();
|
||||||
|
else
|
||||||
|
ptzCamera.PanStop();
|
||||||
|
}));
|
||||||
|
AppServerController.AddAction(MessagePath + "/cameraZoomIn", new PressAndHoldAction((b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
ptzCamera.ZoomIn();
|
||||||
|
else
|
||||||
|
ptzCamera.ZoomStop();
|
||||||
|
}));
|
||||||
|
AppServerController.AddAction(MessagePath + "/cameraZoomOut", new PressAndHoldAction((b) =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
ptzCamera.ZoomOut();
|
||||||
|
else
|
||||||
|
ptzCamera.ZoomStop();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Camera is IHasCameraAutoMode)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/cameraModeAuto", new Action((Camera as IHasCameraAutoMode).CameraAutoModeOn));
|
||||||
|
appServerController.AddAction(MessagePath + "/cameraModeManual", new Action((Camera as IHasCameraAutoMode).CameraAutoModeOff));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Camera is IPower)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/cameraModeOff", new Action((Camera as IPower).PowerOff));
|
||||||
|
}
|
||||||
|
|
||||||
|
var presetsCamera = Camera as IHasCameraPresets;
|
||||||
|
|
||||||
|
if (presetsCamera != null)
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= 6; i++)
|
||||||
|
{
|
||||||
|
var preset = i;
|
||||||
|
appServerController.AddAction(MessagePath + "/cameraPreset" + i, new Action<int>((p) => presetsCamera.PresetSelect(preset)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public AudioCodecBaseMessenger ACMessenger { get; private set; }
|
public AudioCodecBaseMessenger ACMessenger { get; private set; }
|
||||||
|
|
||||||
|
public Dictionary<string, MessengerBase> DeviceMessengers { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -115,6 +117,8 @@ namespace PepperDash.Essentials
|
|||||||
ACMessenger.RegisterWithAppServer(Parent);
|
ACMessenger.RegisterWithAppServer(Parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetupDeviceMessengers();
|
||||||
|
|
||||||
var defCallRm = Room as IRunDefaultCallRoute;
|
var defCallRm = Room as IRunDefaultCallRoute;
|
||||||
if (defCallRm != null)
|
if (defCallRm != null)
|
||||||
{
|
{
|
||||||
@@ -134,6 +138,27 @@ namespace PepperDash.Essentials
|
|||||||
Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
|
Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set up the messengers for each device type
|
||||||
|
/// </summary>
|
||||||
|
void SetupDeviceMessengers()
|
||||||
|
{
|
||||||
|
DeviceMessengers = new Dictionary<string,MessengerBase>();
|
||||||
|
|
||||||
|
foreach (var device in DeviceManager.AllDevices)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Attempting to set up device messenger for device: {0}", device.Key);
|
||||||
|
|
||||||
|
if (device is Essentials.Devices.Common.Cameras.CameraBase)
|
||||||
|
{
|
||||||
|
var camDevice = device as Essentials.Devices.Common.Cameras.CameraBase;
|
||||||
|
var devKey = device.Key;
|
||||||
|
Debug.Console(2, this, "Adding CameraBaseMessenger for device: {0}", devKey);
|
||||||
|
DeviceMessengers.Add(devKey, new CameraBaseMessenger(devKey + "-" + Parent.Key, camDevice, "/device/" + devKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user