Re-added VC/CiscoCodec classes

This commit is contained in:
Neil Dorin
2017-09-13 16:05:19 -06:00
parent 57dee6153b
commit b6965fac0b
10 changed files with 88 additions and 32 deletions

View File

@@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core
void AcceptCall();
void RejectCall();
void SendDtmf();
void SendDtmf(string digit);
BoolFeedback InCallFeedback { get; }
BoolFeedback IncomingCallFeedback { get; }

View File

@@ -127,7 +127,11 @@
<Compile Include="SetTopBox\IRSetTopBoxBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Streaming\Roku.cs" />
<Compile Include="VC\CiscoCodec\CiscoCodec.cs" />
<Compile Include="VC\CiscoCodec\Configuration.cs" />
<Compile Include="VC\CiscoCodec\HttpApiServer.cs" />
<Compile Include="VC\MockVC\MockVC.cs" />
<Compile Include="VC\CiscoCodec\Status.cs" />
<Compile Include="VC\VideoCodecBase.cs" />
<None Include="Properties\ControlSystem.cfg" />
</ItemGroup>

View File

@@ -13,13 +13,14 @@ using Cisco_SX80_Corporate_Phone_Book;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
public class CiscoCodec : VideoCodecBase
{
public IBasicCommunication Communication { get; private set; }
public CommunicationGather PortGather { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
@@ -48,6 +49,10 @@ namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
: base(key, name)
{
Communication = comm;
PortGather = new CommunicationGather(Communication, "\x0d\x0a");
PortGather.LineReceived += this.Port_LineReceived;
Communication.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
ServerPort = serverPort;
@@ -66,12 +71,18 @@ namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
}
/// <summary>
/// Starts the HTTP feedback server and syncronizes state of codec
/// </summary>
/// <returns></returns>
public override bool CustomActivate()
{
CrestronConsole.AddNewConsoleCommand(SendText, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
Communication.Connect();
Debug.Console(1, this, "Starting Cisco API Server");
Server.Start(ServerPort);
@@ -113,6 +124,19 @@ namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
return base.CustomActivate();
}
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
{
if (Debug.Level == 1)
Debug.Console(1, this, "RX: '{0}'",
ComTextHelper.GetEscapedText(args.Text));
}
public void SendText(string command)
{
Debug.Console(1, this, "Sending: '{{0}'", command);
Communication.SendText(command + "\0xd\0xa");
}
private void StartHttpsSession()
{
SendHttpCommand("", eCommandType.SessionStart);
@@ -190,7 +214,7 @@ namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
Client.DispatchAsync(request, PostConnectionCallback);
}
void PostConnectionCallback(HttpsClientResponse resp, HTTP_CALLBACK_ERROR err)
void PostConnectionCallback(HttpsClientResponse resp, HTTPS_CALLBACK_ERROR err)
{
try
{
@@ -310,11 +334,11 @@ namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
protected override Func<bool> PrivacyModeFeedbackFunc { get { return () => false; } }
public override void Dial()
public override void Dial(string s)
{
}
}
public override void EndCall()
{
@@ -330,6 +354,21 @@ namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
}
public override void SendDtmf(string s)
{
}
public override void StartSharing()
{
}
public override void StopSharing()
{
}
public override void ReceiveMuteOff()
{

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
public class CiscoCodecConfiguration
{

View File

@@ -8,7 +8,7 @@ using Crestron.SimplSharp.Net.Http;
using PepperDash.Core;
namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
public class HttpApiServer
{

View File

@@ -5,7 +5,7 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronXml.Serialization;
namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
public class CiscoCodecStatus
{

View File

@@ -60,13 +60,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <summary>
/// Makes horrible tones go out on the wire!
/// </summary>
/// <param name="s"></param>
public void SendDTMF(string s)
{
/// <param name="s"></param>
public override void SendDtmf(string s)
{
}
public override void EndCall()
{
_InCall = false;
@@ -87,10 +86,18 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public override void RejectCall()
{
}
public override void StartSharing()
{
}
public override void StopSharing()
{
}
public override void ExecuteSwitch(object selector)
{

View File

@@ -7,7 +7,7 @@ using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.VideoCodec
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, IHasSharing //, ICodecAudio
{
@@ -56,11 +56,15 @@ namespace PepperDash.Essentials.Devices.VideoCodec
UsageTracker.EndDeviceUsage();
}
}
#region IHasDialer Members
public abstract void Dial();
public abstract void Dial(string s);
public abstract void EndCall();
public abstract void AcceptCall();
public abstract void RejectCall();
public abstract void SendDtmf(string s);
#endregion
public virtual List<Feedback> Feedbacks
{
@@ -104,7 +108,10 @@ namespace PepperDash.Essentials.Devices.VideoCodec
#region IHasSharing Members
public BoolFeedback SharingSourceFeedback { get; private set; }
public abstract void StartSharing();
public abstract void StopSharing();
public StringFeedback SharingSourceFeedback { get; private set; }
#endregion
}

View File

@@ -57,17 +57,6 @@ namespace PepperDash.Essentials
//PortalSync = new PepperDashPortalSyncClient();
// CODEC TESTING
//GenericSshClient TestCodecClient = new GenericSshClient("TestCodec-1--SshClient", "10.11.50.135", 22, "crestron", "2H3Zu&OvgXp6");
//PepperDash.Essentials.Devices.VideoCodec.Cisco.CiscoCodec TestCodec =
// new PepperDash.Essentials.Devices.VideoCodec.Cisco.CiscoCodec("TestCodec-1", "Cisco Spark Room Kit", TestCodecClient, 8080);
//TestCodec.CustomActivate();
// CODEC TESTING
Debug.Console(0, "Starting Essentials load from configuration");
ConfigReader.LoadConfig2();
LoadDevices();
@@ -137,6 +126,16 @@ namespace PepperDash.Essentials
else
Debug.Console(0, "WARNING: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key);
}
// CODEC TESTING
GenericSshClient TestCodecClient = new GenericSshClient("TestCodec-1--SshClient", "10.11.50.135", 22, "crestron", "2H3Zu&OvgXp6");
PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodec TestCodec =
new PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.CiscoCodec("TestCodec-1", "Cisco Spark Room Kit", TestCodecClient, 8080);
TestCodec.CustomActivate();
// CODEC TESTING
}
/// <summary>

View File

@@ -8,7 +8,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials.UIDrivers.VC