diff --git a/PepperDashEssentials/AppServer/Messengers/CameraBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/CameraBaseMessenger.cs index 338bc86b..e1a3468a 100644 --- a/PepperDashEssentials/AppServer/Messengers/CameraBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/CameraBaseMessenger.cs @@ -56,11 +56,73 @@ namespace PepperDash.Essentials.AppServer.Messengers if (ptzCamera != null) { + // 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((p) => presetsCamera.PresetSelect(preset))); + } + } } /// diff --git a/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs index fd36389a..5c82d488 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/MobileControlEssentialsHuddleSpaceRoomBridge.cs @@ -25,6 +25,8 @@ namespace PepperDash.Essentials public AudioCodecBaseMessenger ACMessenger { get; private set; } + public Dictionary DeviceMessengers { get; private set; } + /// /// @@ -115,6 +117,8 @@ namespace PepperDash.Essentials ACMessenger.RegisterWithAppServer(Parent); } + SetupDeviceMessengers(); + var defCallRm = Room as IRunDefaultCallRoute; if (defCallRm != null) { @@ -134,6 +138,27 @@ namespace PepperDash.Essentials Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; } + /// + /// Set up the messengers for each device type + /// + void SetupDeviceMessengers() + { + DeviceMessengers = new Dictionary(); + + 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)); + } + } + } + /// /// ///