diff --git a/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/CiscoCodec.cs b/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/CiscoCodec.cs index bc3ee7b8..048462a6 100644 --- a/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/CiscoCodec.cs +++ b/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/CiscoCodec.cs @@ -33,6 +33,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco private CiscoCodecStatus.RootObject CodecStatus; + protected override Func VolumeLevelFeedbackFunc + { + get + { + return () => CodecStatus.Status.Audio.Volume.IntValue; + } + } + //private HttpsClient Client; //private HttpApiServer Server; @@ -83,6 +91,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco CodecStatus = new CiscoCodecStatus.RootObject(); + CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate; + //Client = new HttpsClient(); //Server = new HttpApiServer(); @@ -162,7 +172,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco SyncState.CodecDisconnected(); } - + /// + /// Gathers responses from the codec (including the delimiter. Responses are checked to see if they contain JSON data and if so, the data is collected until a complete JSON + /// message is received before forwarding the message to be deserialized. + /// + /// + /// void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args) { if (Debug.Level == 1) @@ -215,7 +230,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco SendText("xStatus"); break; } - case "xFeedback Register": + case "xFeedback register": { SyncState.FeedbackRegistered(); break; @@ -473,12 +488,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public override void Dial(string s) { - + SendText(string.Format("xCommand Dial Number: {0}", s)); } public override void EndCall() { - + //SendText(string.Format("xCommand Accept CallId: {0}", CodecStatus.Status.)); + } public override void AcceptCall() diff --git a/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/Status.cs b/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/Status.cs index 5633a2a1..fb1070b4 100644 --- a/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/Status.cs +++ b/Essentials Devices Common/Essentials Devices Common/VC/CiscoCodec/Status.cs @@ -9,6 +9,22 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { public class CiscoCodecStatus { + // Helper Classes for Proerties + public abstract class ValueProperty + { + /// + /// Triggered when Value is set + /// + public Action ValueChangedAction { get; set; } + + protected void OnValueChanged() + { + var a = ValueChangedAction; + if (a != null) + a(); + } + + } public class ConnectionStatus { @@ -31,9 +47,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public Connectors Connectors { get; set; } } - public class Mute + public class Mute : ValueProperty { - public string Value { get; set; } + public bool BoolValue { get; private set; } + + public string Value + { + set + { + // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false + BoolValue = value == "On"; + OnValueChanged(); + } + } } public class Microphones @@ -68,23 +94,68 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public Connectors2 Connectors { get; set; } } - public class Volume + public class Volume : ValueProperty { - public string Value { get; set; } + string _Value; + + /// + /// Sets Value and triggers the action when set + /// + public string Value + { + get + { + return _Value; + } + set + { + _Value = value; + OnValueChanged(); + } + } + + /// + /// Converted value of _Value for use as feedback + /// + public int IntValue + { + get + { + if (!string.IsNullOrEmpty(_Value)) + return Convert.ToInt32(_Value); + else + return 0; + } + } } - public class VolumeMute + public class VolumeMute : ValueProperty { - public string Value { get; set; } + public bool BoolValue { get; private set; } + + public string Value + { + set + { + // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false + BoolValue = value == "On"; + OnValueChanged(); + } + } } public class Audio { public Input Input { get; set; } - public Microphones Microphones { get; set; } + public Microphones Microphones { get; set; } // Can we have this setter fire the update on the CiscoCodec feedback? public Output Output { get; set; } - public Volume Volume { get; set; } - public VolumeMute VolumeMute { get; set; } + public Volume Volume { get; set; } + public VolumeMute VolumeMute { get; set; } + + public Audio() + { + Volume = new Volume(); + } } public class Id @@ -1438,11 +1509,21 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public Time Time { get; set; } public UserInterface UserInterface { get; set; } public Video Video { get; set; } + + public Status() + { + Audio = new Audio(); + } } public class RootObject { public Status Status { get; set; } + + public RootObject() + { + Status = new Status(); + } } } } diff --git a/Essentials Devices Common/Essentials Devices Common/VC/MockVC/MockVC.cs b/Essentials Devices Common/Essentials Devices Common/VC/MockVC/MockVC.cs index 29484ab9..a6033b0d 100644 --- a/Essentials Devices Common/Essentials Devices Common/VC/MockVC/MockVC.cs +++ b/Essentials Devices Common/Essentials Devices Common/VC/MockVC/MockVC.cs @@ -47,6 +47,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec } bool _PrivacyModeIsOn; + protected override Func VolumeLevelFeedbackFunc + { + get { throw new NotImplementedException(); } + } + /// /// Dials, yo! /// diff --git a/Essentials Devices Common/Essentials Devices Common/VC/VideoCodecBase.cs b/Essentials Devices Common/Essentials Devices Common/VC/VideoCodecBase.cs index 61e00b86..68de18e1 100644 --- a/Essentials Devices Common/Essentials Devices Common/VC/VideoCodecBase.cs +++ b/Essentials Devices Common/Essentials Devices Common/VC/VideoCodecBase.cs @@ -9,7 +9,7 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Devices.Common.VideoCodec { - public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, IHasSharing //, ICodecAudio + public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, IHasSharing, IBasicVolumeWithFeedback //, ICodecAudio { #region IUsageTracking Members @@ -32,6 +32,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec abstract protected Func ReceiveMuteFeedbackFunc { get; } abstract protected Func PrivacyModeFeedbackFunc { get; } + abstract protected Func VolumeLevelFeedbackFunc { get; } + public VideoCodecBase(string key, string name) : base(key, name) { @@ -41,6 +43,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec TransmitMuteIsOnFeedback = new BoolFeedback(TransmitMuteFeedbackFunc); PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeFeedbackFunc); + VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc); + InputPorts = new RoutingPortCollection(); InCallFeedback.OutputChange += new EventHandler(InCallFeedback_OutputChange); @@ -114,5 +118,47 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public StringFeedback SharingSourceFeedback { get; private set; } #endregion + + #region IBasicVolumeWithFeedback Members + + public BoolFeedback MuteFeedback { get; private set; } + + public void MuteOff() + { + + } + + public void MuteOn() + { + + } + + public void SetVolume(ushort level) + { + + } + + public IntFeedback VolumeLevelFeedback { get; private set; } + + #endregion + + #region IBasicVolumeControls Members + + public void MuteToggle() + { + + } + + public void VolumeDown(bool pressRelease) + { + + } + + public void VolumeUp(bool pressRelease) + { + + } + + #endregion } } \ No newline at end of file