diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index dd8f3d5a..9a48000a 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -195,6 +195,8 @@ namespace PepperDash.Essentials } else // Handles Linux OS (Virtual Control) { + Debug.SetDebugLevel(2); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", Global.AssemblyVersion); // Set path to User/ diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index e622983f..d04de3cc 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -745,6 +745,28 @@ namespace PepperDash.Essentials { //Implement this } + + protected override bool AllowVacancyTimerToStart() + { + bool allowVideo = true; + bool allowAudio = true; + + if (VideoCodec != null) + { + Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} {1} in a video call", Key, VideoCodec.IsInCall ? "is" : "is not"); + allowVideo = !VideoCodec.IsInCall; + } + + if (AudioCodec != null) + { + Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} {1} in an audio call", Key, AudioCodec.IsInCall ? "is" : "is not"); + allowAudio = !AudioCodec.IsInCall; + } + + Debug.Console(2, this, "Room {0} allowing vacancy timer to start: {1}", Key, allowVideo && allowAudio); + + return allowVideo && allowAudio; + } /// /// Does what it says diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index a1326770..252c9c48 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -394,35 +394,51 @@ namespace PepperDash.Essentials.Core.Bridges var controlProperties = CommFactory.GetControlPropertiesConfig(dc); + BasicTriList eisc; + switch (dc.Type.ToLower()) { case "eiscapiadv": case "eiscapiadvanced": { - var eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt, + eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem); - return new EiscApiAdvanced(dc, eisc); + break; } case "eiscapiadvancedserver": { - var eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem); - return new EiscApiAdvanced(dc, eisc); + eisc = new EISCServer(controlProperties.IpIdInt, Global.ControlSystem); + break; } case "eiscapiadvancedclient": { - var eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem); - return new EiscApiAdvanced(dc, eisc); + eisc = new EISCClient(controlProperties.IpIdInt, controlProperties.TcpSshProperties.Address, Global.ControlSystem); + break; } case "vceiscapiadv": case "vceiscapiadvanced": { - var eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, InitialParametersClass.RoomId, + if (string.IsNullOrEmpty(controlProperties.RoomId)) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key); + eisc = null; + break; + } + eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId, Global.ControlSystem); - return new EiscApiAdvanced(dc, eisc); + break; } default: - return null; + eisc = null; + break; } + + if (eisc == null) + { + return null; + } + + return new EiscApiAdvanced(dc, eisc); } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs index 352cbfcd..f5e3dee8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs @@ -343,7 +343,7 @@ namespace PepperDash.Essentials.Core void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e) { - if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false) + if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false && AllowVacancyTimerToStart()) { Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected"); // Trigger the timer when the room is vacant @@ -362,6 +362,15 @@ namespace PepperDash.Essentials.Core /// /// public abstract void RoomVacatedForTimeoutPeriod(object o); + + /// + /// Allow the vacancy event from an occupancy sensor to turn the room off. + /// + /// If the timer should be allowed. Defaults to true + protected virtual bool AllowVacancyTimerToStart() + { + return true; + } } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/UI/TouchpanelBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/UI/TouchpanelBase.cs index 36e0342e..c7be5048 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/UI/TouchpanelBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/UI/TouchpanelBase.cs @@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Core.UI :base(key, name) { - if (Panel == null) + if (panel == null) { Debug.Console(0, this, "Panel is not valid. Touchpanel class WILL NOT work correctly"); return; @@ -71,6 +71,8 @@ namespace PepperDash.Essentials.Core.UI return; } } + + Panel.LoadSmartObjects(sgdName); }); AddPostActivationAction(() => diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs index 1ef679ba..c5758108 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs @@ -223,7 +223,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras SendCameraPresetNamesToApi(presetsCamera, joinMap, trilist); - for (int i = 0; i < joinMap.NumberOfPresets.JoinNumber; i++) + for (int i = 0; i < joinMap.NumberOfPresets.JoinSpan; i++) { int tempNum = i; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index bea5862c..19c61b9f 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs @@ -1393,11 +1393,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, call.IsOnHold); //serials - tokenArray[arrayIndex + 1] = new XSigSerialToken(stringIndex + 1, call.Name ?? String.Empty); - tokenArray[arrayIndex + 2] = new XSigSerialToken(stringIndex + 2, call.Number ?? String.Empty); - tokenArray[arrayIndex + 3] = new XSigSerialToken(stringIndex + 3, call.Direction.ToString()); - tokenArray[arrayIndex + 4] = new XSigSerialToken(stringIndex + 4, call.Type.ToString()); - tokenArray[arrayIndex + 5] = new XSigSerialToken(stringIndex + 5, call.Status.ToString()); + tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, call.Name ?? String.Empty); + tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, call.Number ?? String.Empty); + tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, call.Direction.ToString()); + tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, call.Type.ToString()); + tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, call.Status.ToString()); if(call.Duration != null) { // May need to verify correct string format here @@ -1417,12 +1417,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec //serials - tokenArray[arrayIndex + 1] = new XSigSerialToken(stringIndex + 1, String.Empty); - tokenArray[arrayIndex + 2] = new XSigSerialToken(stringIndex + 2, String.Empty); - tokenArray[arrayIndex + 3] = new XSigSerialToken(stringIndex + 3, String.Empty); - tokenArray[arrayIndex + 4] = new XSigSerialToken(stringIndex + 4, String.Empty); - tokenArray[arrayIndex + 5] = new XSigSerialToken(stringIndex + 5, String.Empty); - tokenArray[arrayIndex + 6] = new XSigSerialToken(stringIndex + 6, String.Empty); + tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, String.Empty); + tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, String.Empty); + tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, String.Empty); + tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, String.Empty); + tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, String.Empty); + tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, String.Empty); arrayIndex += offset; stringIndex += maxStrings; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs index bcc3886e..aade5c0d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs @@ -62,6 +62,17 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom private readonly ZoomRoomPropertiesConfig _props; + private bool _meetingPasswordRequired; + + private bool _waitingForUserToAcceptOrRejectIncomingCall; + + public void Poll(string pollString) + { + if(_meetingPasswordRequired || _waitingForUserToAcceptOrRejectIncomingCall) return; + + SendText(string.Format("{0}{1}", pollString, SendDelimiter)); + } + public ZoomRoom(DeviceConfig config, IBasicCommunication comm) : base(config) { @@ -75,13 +86,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom if (_props.CommunicationMonitorProperties != null) { - CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, - _props.CommunicationMonitorProperties); + CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, _props.CommunicationMonitorProperties.PollInterval, _props.CommunicationMonitorProperties.TimeToWarning, _props.CommunicationMonitorProperties.TimeToError, + () => Poll(_props.CommunicationMonitorProperties.PollString)); } else { - CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, - "zStatus SystemUnit" + SendDelimiter); + CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, () => Poll("zStatus SystemUnit")); } DeviceManager.AddDevice(CommunicationMonitor); @@ -965,6 +975,18 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public void SendText(string command) { + if (_meetingPasswordRequired) + { + Debug.Console(2, this, "Blocking commands to ZoomRoom while waiting for user to enter meeting password"); + return; + } + + if (_waitingForUserToAcceptOrRejectIncomingCall) + { + Debug.Console(2, this, "Blocking commands to ZoomRoom while waiting for user to accept or reject incoming call"); + return; + } + if (CommDebuggingIsOn) { Debug.Console(1, this, "Sending: '{0}'", command); @@ -1589,6 +1611,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom Id = incomingCall.callerJID }; + _waitingForUserToAcceptOrRejectIncomingCall = true; + ActiveCalls.Add(newCall); OnCallStatusChange(newCall); @@ -1615,6 +1639,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom OnCallStatusChange(existingCall); } + _waitingForUserToAcceptOrRejectIncomingCall = false; + UpdateCallStatus(); } @@ -1997,6 +2023,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom /// private void GetBookings() { + if (_meetingPasswordRequired || _waitingForUserToAcceptOrRejectIncomingCall) return; + SendText("zCommand Bookings List"); } @@ -2184,6 +2212,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom ); } + _meetingPasswordRequired = false; base.OnCallStatusChange(item); Debug.Console(1, this, "[OnCallStatusChange] Current Call Status: {0}", @@ -2554,7 +2583,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom PasswordRequired += (devices, args) => { - Debug.Console(0, this, "***********************************PaswordRequired. Message: {0} Cancelled: {1} Last Incorrect: {2} Failed: {3}", args.Message, args.LoginAttemptCancelled, args.LastAttemptWasIncorrect, args.LoginAttemptFailed); + Debug.Console(2, this, "***********************************PaswordRequired. Message: {0} Cancelled: {1} Last Incorrect: {2} Failed: {3}", args.Message, args.LoginAttemptCancelled, args.LastAttemptWasIncorrect, args.LoginAttemptFailed); if (args.LoginAttemptCancelled) { @@ -2631,6 +2660,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public void AcceptCall() { + _waitingForUserToAcceptOrRejectIncomingCall = false; + var incomingCall = ActiveCalls.FirstOrDefault( c => c.Status.Equals(eCodecCallStatus.Ringing) && c.Direction.Equals(eCodecCallDirection.Incoming)); @@ -2640,6 +2671,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public override void AcceptCall(CodecActiveCallItem call) { + _waitingForUserToAcceptOrRejectIncomingCall = false; + SendText(string.Format("zCommand Call Accept callerJID: {0}", call.Id)); call.Status = eCodecCallStatus.Connected; @@ -2651,6 +2684,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public void RejectCall() { + _waitingForUserToAcceptOrRejectIncomingCall = false; + var incomingCall = ActiveCalls.FirstOrDefault( c => c.Status.Equals(eCodecCallStatus.Ringing) && c.Direction.Equals(eCodecCallDirection.Incoming)); @@ -2660,6 +2695,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public override void RejectCall(CodecActiveCallItem call) { + _waitingForUserToAcceptOrRejectIncomingCall = false; + SendText(string.Format("zCommand Call Reject callerJID: {0}", call.Id)); call.Status = eCodecCallStatus.Disconnected; @@ -2786,16 +2823,25 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public void LeaveMeeting() { - SendText("zCommand Call Leave"); + _meetingPasswordRequired = false; + _waitingForUserToAcceptOrRejectIncomingCall = false; + + SendText("zCommand Call Leave"); } public override void EndCall(CodecActiveCallItem call) { + _meetingPasswordRequired = false; + _waitingForUserToAcceptOrRejectIncomingCall = false; + SendText("zCommand Call Disconnect"); } public override void EndAllCalls() { + _meetingPasswordRequired = false; + _waitingForUserToAcceptOrRejectIncomingCall = false; + SendText("zCommand Call Disconnect"); } @@ -3445,17 +3491,21 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public void SubmitPassword(string password) { + _meetingPasswordRequired = false; Debug.Console(2, this, "Password Submitted: {0}", password); Dial(_lastDialedMeetingNumber, password); - //OnPasswordRequired(false, false, true, ""); } void OnPasswordRequired(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message) { + _meetingPasswordRequired = !loginFailed || !loginCancelled; + var handler = PasswordRequired; if (handler != null) - { - handler(this, new PasswordPromptEventArgs(lastAttemptIncorrect, loginFailed, loginCancelled, message)); + { + Debug.Console(2, this, "Meeting Password Required: {0}", _meetingPasswordRequired); + + handler(this, new PasswordPromptEventArgs(lastAttemptIncorrect, loginFailed, loginCancelled, message)); } } diff --git a/packages.config b/packages.config index 4c411add..e2f8b03b 100644 --- a/packages.config +++ b/packages.config @@ -1,3 +1,3 @@ - + \ No newline at end of file