using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Devices.Common.VideoCodec { public class MockVC : VideoCodecBase { public MockVC(string key, string name) : base(key, name) { // Debug helpers ActiveCallCountFeedback.OutputChange += (o, a) => Debug.Console(1, this, "InCall={0}", ActiveCallCountFeedback.IntValue); IncomingCallFeedback.OutputChange += (o, a) => Debug.Console(1, this, "IncomingCall={0}", _IncomingCall); MuteFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Mute={0}", _IsMuted); PrivacyModeIsOnFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Privacy={0}", _PrivacyModeIsOn); SharingSourceFeedback.OutputChange += (o, a) => Debug.Console(1, this, "SharingSource={0}", _SharingSource); VolumeLevelFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Volume={0}", _VolumeLevel); } protected override Func ActiveCallCountFeedbackFunc { get { return () => ActiveCalls.Count; } } protected override Func IncomingCallFeedbackFunc { get { return () => _IncomingCall; } } bool _IncomingCall; protected override Func MuteFeedbackFunc { get { return () => _IsMuted; } } bool _IsMuted; protected override Func PrivacyModeIsOnFeedbackFunc { get { return () => _PrivacyModeIsOn; } } bool _PrivacyModeIsOn; protected override Func SharingSourceFeedbackFunc { get { return () => _SharingSource; } } string _SharingSource; protected override Func VolumeLevelFeedbackFunc { get { return () => _VolumeLevel; } } int _VolumeLevel; /// /// Dials, yo! /// public override void Dial(string s) { Debug.Console(1, this, "Dial: {0}", s); ActiveCalls.Add(new CodecActiveCallItem(s,s, eCodecCallType.Video)); ActiveCallCountFeedback.FireUpdate(); } /// /// /// public override void EndCall(CodecActiveCallItem activeCall) { Debug.Console(1, this, "EndCall"); ActiveCalls.RemoveAll(i => i.Name == s); ActiveCallCountFeedback.FireUpdate(); //_InCall = false; //IsInCall.FireUpdate(); } public override void EndAllCalls() { } /// /// For a call from the test methods below /// public override void AcceptCall() { Debug.Console(1, this, "AcceptCall"); } /// /// For a call from the test methods below /// public override void RejectCall() { Debug.Console(1, this, "RejectCall"); } /// /// Makes horrible tones go out on the wire! /// /// public override void SendDtmf(string s) { Debug.Console(1, this, "SendDTMF: {0}", s); } /// /// /// public override void StartSharing() { } /// /// /// public override void StopSharing() { } /// /// Called by routing to make it happen /// /// public override void ExecuteSwitch(object selector) { Debug.Console(1, this, "ExecuteSwitch"); _SharingSource = selector.ToString(); } /// /// /// public override void MuteOff() { _IsMuted = false; MuteFeedback.FireUpdate(); } /// /// /// public override void MuteOn() { _IsMuted = true; MuteFeedback.FireUpdate(); } /// /// /// public override void MuteToggle() { _IsMuted = !_IsMuted; MuteFeedback.FireUpdate(); } /// /// /// /// public override void SetVolume(ushort level) { _VolumeLevel = level; VolumeLevelFeedback.FireUpdate(); } /// /// /// /// public override void VolumeDown(bool pressRelease) { } /// /// /// /// public override void VolumeUp(bool pressRelease) { } /// /// /// public override void PrivacyModeOn() { Debug.Console(1, this, "PrivacyMuteOn"); if (_PrivacyModeIsOn) return; _PrivacyModeIsOn = true; PrivacyModeIsOnFeedback.FireUpdate(); } /// /// /// public override void PrivacyModeOff() { Debug.Console(1, this, "PrivacyMuteOff"); if (!_PrivacyModeIsOn) return; _PrivacyModeIsOn = false; PrivacyModeIsOnFeedback.FireUpdate(); } /// /// /// public override void PrivacyModeToggle() { _PrivacyModeIsOn = !_PrivacyModeIsOn; Debug.Console(1, this, "PrivacyMuteToggle: {0}", _PrivacyModeIsOn); PrivacyModeIsOnFeedback.FireUpdate(); } //******************************************************** // SIMULATION METHODS /// /// /// /// public void TestIncomingCall(string url) { Debug.Console(1, this, "TestIncomingCall"); _IncomingCall = true; IncomingCallFeedback.FireUpdate(); } /// /// /// public void TestFarEndHangup() { Debug.Console(1, this, "TestFarEndHangup"); } } }