Merge remote-tracking branch 'origin/feature/cisco-spark' into feature/ecs-407

This commit is contained in:
Heath Volmer
2017-09-14 10:23:15 -06:00
15 changed files with 4185 additions and 3403 deletions

View File

@@ -18,8 +18,28 @@ namespace PepperDash.Essentials.Core
void AcceptCall(); void AcceptCall();
void RejectCall(); void RejectCall();
void SendDtmf(string digit);
BoolFeedback InCallFeedback { get; } BoolFeedback InCallFeedback { get; }
BoolFeedback IncomingCallFeedback { get; } BoolFeedback IncomingCallFeedback { get; }
}
public interface IHasCallHistory
{
// Add recent calls list
}
public interface IHasDirectory
{
}
public interface IHasObtp
{
// Upcoming Meeting warning event
} }
} }

View File

@@ -11,7 +11,9 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public interface IHasSharing public interface IHasSharing
{ {
void StartSharing();
void StopSharing();
BoolFeedback SharingSourceFeedback { get; } StringFeedback SharingSourceFeedback { get; }
} }
} }

View File

@@ -103,7 +103,7 @@
<Reference Include="System.Data" /> <Reference Include="System.Data" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Devices\IHasDialer.cs" /> <Compile Include="Devices\CodecInterfaces.cs" />
<Compile Include="Devices\IHasSharing.cs" /> <Compile Include="Devices\IHasSharing.cs" />
<Compile Include="Ramps and Increments\ActionIncrementer.cs" /> <Compile Include="Ramps and Increments\ActionIncrementer.cs" />
<Compile Include="Comm and IR\CommFactory.cs" /> <Compile Include="Comm and IR\CommFactory.cs" />

View File

@@ -46,9 +46,9 @@
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Cisco One Button To Push, Version=1.0.0.29558, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Cisco One Button To Push, Version=1.0.0.26373, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Crestron Cisco OBTP\OBTP\bin\Cisco One Button To Push.dll</HintPath> <HintPath>..\..\..\PTD_Cisco_One_Button_To_Push\bin\Cisco One Button To Push.dll</HintPath>
</Reference> </Reference>
<Reference Include="Cisco SX80 Corporate Phone Book, Version=1.0.0.15355, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Cisco SX80 Corporate Phone Book, Version=1.0.0.15355, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
@@ -127,7 +127,11 @@
<Compile Include="SetTopBox\IRSetTopBoxBase.cs" /> <Compile Include="SetTopBox\IRSetTopBoxBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Streaming\Roku.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\MockVC\MockVC.cs" />
<Compile Include="VC\CiscoCodec\Status.cs" />
<Compile Include="VC\VideoCodecBase.cs" /> <Compile Include="VC\VideoCodecBase.cs" />
<None Include="Properties\ControlSystem.cfg" /> <None Include="Properties\ControlSystem.cfg" />
</ItemGroup> </ItemGroup>

View File

@@ -1,388 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Net.Https;
using Crestron.SimplSharp.CrestronXml;
using Crestron.SimplSharp.CrestronXml.Serialization;
using Newtonsoft.Json;
using Cisco_One_Button_To_Push;
using Cisco_SX80_Corporate_Phone_Book;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
{
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
public class CiscoCodec : VideoCodecBase
{
public IBasicCommunication Communication { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
private CiscoOneButtonToPush CodecObtp;
private Corporate_Phone_Book PhoneBook;
private CiscoCodecConfiguration.Configuration CodecConfiguration;
private CiscoCodecStatus.Status CodecStatus;
private HttpsClient Client;
private HttpApiServer Server;
private int ServerPort;
private string CodecUrl;
private string HttpSessionId;
private string FeedbackRegistrationExpression;
// Constructor for IBasicCommunication
public CiscoCodec(string key, string name, IBasicCommunication comm, int serverPort)
: base(key, name)
{
Communication = comm;
Communication.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
ServerPort = serverPort;
CodecObtp = new CiscoOneButtonToPush();
PhoneBook = new Corporate_Phone_Book();
CodecConfiguration = new CiscoCodecConfiguration.Configuration();
CodecStatus = new CiscoCodecStatus.Status();
Client = new HttpsClient();
Server = new HttpApiServer();
}
/// <summary>
/// Starts the HTTP feedback server and syncronizes state of codec
/// </summary>
/// <returns></returns>
public override bool CustomActivate()
{
Debug.Console(1, this, "Starting Cisco API Server");
Server.Start(ServerPort);
Server.ApiRequest += new EventHandler<Crestron.SimplSharp.Net.Http.OnHttpRequestArgs>(Server_ApiRequest);
CodecUrl = string.Format("http://{0}", (Communication as GenericSshClient).Hostname);
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 2000, 120000, 300000, "xStatus SystemUnit Software Version\r");
DeviceManager.AddDevice(CommunicationMonitor);
Client = new HttpsClient();
Client.Verbose = true;
Client.KeepAlive = true;
// Temp feedback registration
FeedbackRegistrationExpression =
"<Command><HttpFeedback><Register command=\"True\"><FeedbackSlot>1</FeedbackSlot>" +
string.Format("<ServerUrl>http://{0}:{1}/cisco/api</ServerUrl>", CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0), ServerPort) +
"<Format>JSON</Format>" +
"<Expression item=\"1\">/Configuration</Expression>" +
"<Expression item=\"2\">/Event/CallDisconnect</Expression>" +
"<Expression item=\"3\">/Status/Call</Expression>" +
"</Register>" +
"</HttpFeedback>" +
"</Command>";
StartHttpsSession();
//CodecObtp.Initialize();
//CodecObtp.GetMeetings();
//PhoneBook.DownloadPhoneBook(Corporate_Phone_Book.ePhoneBookLocation.Corporate);
return base.CustomActivate();
}
private void StartHttpsSession()
{
SendHttpCommand("", eCommandType.SessionStart);
}
private void EndHttpsSession()
{
SendHttpCommand("", eCommandType.SessionEnd);
}
private void SendHttpCommand(string command, eCommandType commandType)
{
HttpsClientRequest request = new HttpsClientRequest();
string urlSuffix = null;
Client.UserName = null;
Client.Password = null;
Client.PeerVerification = false;
Client.HostVerification = false;
request.RequestType = RequestType.Post;
if(!string.IsNullOrEmpty(HttpSessionId))
request.Header.SetHeaderValue("Cookie", HttpSessionId);
switch (commandType)
{
case eCommandType.Command:
{
urlSuffix = "/putxml";
request.ContentString = command;
request.Header.SetHeaderValue("Content-Type", "text/xml");
break;
}
case eCommandType.SessionStart:
{
urlSuffix = "/xmlapi/session/begin";
Client.UserName = (Communication as GenericSshClient).Username;
Client.Password = (Communication as GenericSshClient).Password;
break;
}
case eCommandType.SessionEnd:
{
urlSuffix = "/xmlapi/session/end";
request.Header.SetHeaderValue("Cookie", HttpSessionId);
break;
}
case eCommandType.GetStatus:
{
request.RequestType = RequestType.Get;
request.Header.SetHeaderValue("Content-Type", "text/xml");
urlSuffix = "/getxml?location=/Status";
break;
}
case eCommandType.GetConfiguration:
{
request.RequestType = RequestType.Get;
request.Header.SetHeaderValue("Content-Type", "text/xml");
urlSuffix = "/getxml?location=/Configuration";
break;
}
}
var requestUrl = CodecUrl + urlSuffix;
request.Header.RequestVersion = "HTTP/1.1";
request.Url.Parse(requestUrl);
Debug.Console(1, this, "Sending HTTP request to Cisco Codec at {0}\nHeader:\n{1}\nContent:\n{2}", requestUrl, request.Header, request.ContentString);
Client.DispatchAsync(request, PostConnectionCallback);
}
void PostConnectionCallback(HttpsClientResponse resp, HTTP_CALLBACK_ERROR err)
{
try
{
if (resp != null)
{
if (resp.Code == 200)
{
Debug.Console(1, this, "Http Post to Cisco Codec Successful. Code: {0}\nContent: {1}", resp.Code, resp.ContentString);
if (resp.ContentString.IndexOf("<HttpFeedbackRegisterResult status=\"OK\">") > 1)
{
// Get the initial configruation for sync purposes
SendHttpCommand("", eCommandType.GetConfiguration);
}
else
{
try
{
if (resp.ContentString.IndexOf("</Configuration>") > -1)
{
XmlReaderSettings settings = new XmlReaderSettings();
XmlReader reader = new XmlReader(resp.ContentString, settings);
CodecConfiguration = CrestronXMLSerialization.DeSerializeObject<CiscoCodecConfiguration.Configuration>(reader);
Debug.Console(1, this, "Product Name: {0} Software Version: {1} ApiVersion: {2}", CodecConfiguration.Product, CodecConfiguration.Version, CodecConfiguration.ApiVersion);
// Get the initial status for sync purposes
SendHttpCommand("", eCommandType.GetStatus);
}
else if (resp.ContentString.IndexOf("</Status>") > -1)
{
XmlReaderSettings settings = new XmlReaderSettings();
XmlReader reader = new XmlReader(resp.ContentString, settings);
CodecStatus = CrestronXMLSerialization.DeSerializeObject<CiscoCodecStatus.Status>(reader);
Debug.Console(1, this, "Product Name: {0} Software Version: {1} ApiVersion: {2} Volume: {3}", CodecStatus.Product, CodecStatus.Version, CodecStatus.ApiVersion, CodecStatus.Audio.Volume);
}
}
catch (Exception ex)
{
Debug.Console(1, this, "Error Deserializing XML document from codec: {0}", ex);
}
}
}
else if (resp.Code == 204)
{
Debug.Console(1, this, "Response Code: {0}\nHeader:\n{1}Content:\n{1}", resp.Code, resp.Header, resp.ContentString);
HttpSessionId = resp.Header.GetHeaderValue("Set-Cookie");
//var chunks = HttpSessionId.Split(';');
//HttpSessionId = chunks[0];
//HttpSessionId = HttpSessionId.Substring(HttpSessionId.IndexOf("=") + 1);
// Register for feedbacks once we have a valid session
SendHttpCommand(FeedbackRegistrationExpression, eCommandType.Command);
}
else
{
Debug.Console(1, this, "Response Code: {0}\nHeader:\n{1}Content:\n{1}Err:\n{2}", resp.Code, resp.Header, resp.ContentString, err);
}
}
else
Debug.Console(1, this, "Null response received from server");
}
catch (Exception e)
{
Debug.Console(1, this, "Error Initializing HTTPS Client: {0}", e);
}
}
void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs e)
{
Debug.Console(1, this, "Api Reqeust from Codec: {0}", e.Request.ContentString);
e.Response.Code = 200;
e.Response.ContentString = "OK";
try
{
// Serializer settings. We want to ignore null values and mising members
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.NullValueHandling = NullValueHandling.Ignore;
settings.MissingMemberHandling = MissingMemberHandling.Ignore;
if (e.Request.ContentString.IndexOf("\"Configuration\":{") > -1)
CodecConfiguration = JsonConvert.DeserializeObject<CiscoCodecConfiguration.Configuration>(e.Request.ContentString, settings);
else if (e.Request.ContentString.IndexOf("\"Status\":{") > -1)
CodecStatus = JsonConvert.DeserializeObject<CiscoCodecStatus.Status>(e.Request.ContentString, settings);
}
catch (Exception ex)
{
Debug.Console(1, this, "Error Deserializing feedback from codec: {0}", ex);
}
}
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
{
//CodecObtp.
}
public override void ExecuteSwitch(object selector)
{
throw new NotImplementedException();
}
protected override Func<bool> InCallFeedbackFunc { get { return () => false; } }
protected override Func<bool> IncomingCallFeedbackFunc { get { return () => false; } }
protected override Func<bool> TransmitMuteFeedbackFunc { get { return () => false; } }
protected override Func<bool> ReceiveMuteFeedbackFunc { get { return () => false; } }
protected override Func<bool> PrivacyModeFeedbackFunc { get { return () => false; } }
public override void Dial()
{
}
public override void EndCall()
{
}
public override void AcceptCall()
{
}
public override void RejectCall()
{
}
public override void ReceiveMuteOff()
{
}
public override void ReceiveMuteOn()
{
}
public override void ReceiveMuteToggle()
{
}
public override void SetReceiveVolume(ushort level)
{
}
public override void TransmitMuteOff()
{
}
public override void TransmitMuteOn()
{
}
public override void TransmitMuteToggle()
{
}
public override void SetTransmitVolume(ushort level)
{
}
public override void PrivacyModeOn()
{
}
public override void PrivacyModeOff()
{
}
public override void PrivacyModeToggle()
{
}
}
}

View File

@@ -1,872 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronXml.Serialization;
namespace PepperDash.Essentials.Devices.VideoCodec.Cisco
{
public class CiscoCodecStatus
{
//[XmlRoot(ElementName="Microphone")]
public class Microphone {
//[XmlElement(ElementName="ConnectionStatus")]
public string ConnectionStatus { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="Connectors")]
public class Connectors {
//[XmlElement(ElementName="Microphone")]
public List<Microphone> Microphone { get; set; }
//[XmlElement(ElementName="Line")]
public Line Line { get; set; }
}
//[XmlRoot(ElementName="Input")]
public class Input {
//[XmlElement(ElementName="Connectors")]
public Connectors Connectors { get; set; }
//[XmlElement(ElementName="Connector")]
public List<Connector> Connector { get; set; }
//[XmlElement(ElementName="MainVideoSource")]
public string MainVideoSource { get; set; }
//[XmlElement(ElementName="Source")]
public List<Source> Source { get; set; }
}
//[XmlRoot(ElementName="Microphones")]
public class Microphones {
//[XmlElement(ElementName="Mute")]
public string Mute { get; set; }
}
//[XmlRoot(ElementName="Line")]
public class Line {
//[XmlElement(ElementName="ConnectionStatus")]
public string ConnectionStatus { get; set; }
//[XmlElement(ElementName="DelayMs")]
public string DelayMs { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="Output")]
public class Output {
//[XmlElement(ElementName="Connectors")]
public Connectors Connectors { get; set; }
//[XmlElement(ElementName="Connector")]
public List<Connector> Connector { get; set; }
}
//[XmlRoot(ElementName="Audio")]
public class Audio {
//[XmlElement(ElementName="Input")]
public Input Input { get; set; }
//[XmlElement(ElementName="Microphones")]
public Microphones Microphones { get; set; }
//[XmlElement(ElementName="Output")]
public Output Output { get; set; }
//[XmlElement(ElementName="Volume")]
public string Volume { get; set; }
//[XmlElement(ElementName="VolumeMute")]
public string VolumeMute { get; set; }
}
//[XmlRoot(ElementName="Current")]
public class Current {
//[XmlElement(ElementName="Id")]
public string Id { get; set; }
//[XmlElement(ElementName="CompletedAt")]
public string CompletedAt { get; set; }
//[XmlElement(ElementName="URL")]
public string URL { get; set; }
//[XmlElement(ElementName="VersionId")]
public string VersionId { get; set; }
}
//[XmlRoot(ElementName="Bookings")]
public class Bookings {
//[XmlElement(ElementName="Current")]
public Current Current { get; set; }
}
//[XmlRoot(ElementName="Capabilities")]
public class Capabilities {
//[XmlElement(ElementName="Options")]
public string Options { get; set; }
//[XmlElement(ElementName="Conference")]
public Conference Conference { get; set; }
}
//[XmlRoot(ElementName="Position")]
public class Position {
//[XmlElement(ElementName="Pan")]
public string Pan { get; set; }
//[XmlElement(ElementName="Tilt")]
public string Tilt { get; set; }
//[XmlElement(ElementName="Zoom")]
public string Zoom { get; set; }
}
//[XmlRoot(ElementName="Camera")]
public class Camera {
//[XmlElement(ElementName="Capabilities")]
public Capabilities Capabilities { get; set; }
//[XmlElement(ElementName="Connected")]
public string Connected { get; set; }
//[XmlElement(ElementName="Framerate")]
public string Framerate { get; set; }
//[XmlElement(ElementName="Manufacturer")]
public string Manufacturer { get; set; }
//[XmlElement(ElementName="Model")]
public string Model { get; set; }
//[XmlElement(ElementName="Position")]
public Position Position { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="SpeakerTrack")]
public class SpeakerTrack {
//[XmlElement(ElementName="Availability")]
public string Availability { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
}
//[XmlRoot(ElementName="Cameras")]
public class Cameras {
//[XmlElement(ElementName="Camera")]
public Camera Camera { get; set; }
//[XmlElement(ElementName="SpeakerTrack")]
public SpeakerTrack SpeakerTrack { get; set; }
}
//[XmlRoot(ElementName="Conference")]
public class Conference {
//[XmlElement(ElementName="MaxActiveCalls")]
public string MaxActiveCalls { get; set; }
//[XmlElement(ElementName="MaxAudioCalls")]
public string MaxAudioCalls { get; set; }
//[XmlElement(ElementName="MaxCalls")]
public string MaxCalls { get; set; }
//[XmlElement(ElementName="MaxVideoCalls")]
public string MaxVideoCalls { get; set; }
//[XmlElement(ElementName="ActiveSpeaker")]
public ActiveSpeaker ActiveSpeaker { get; set; }
//[XmlElement(ElementName="DoNotDisturb")]
public string DoNotDisturb { get; set; }
//[XmlElement(ElementName="Multipoint")]
public Multipoint Multipoint { get; set; }
//[XmlElement(ElementName="Presentation")]
public Presentation Presentation { get; set; }
//[XmlElement(ElementName="SpeakerLock")]
public SpeakerLock SpeakerLock { get; set; }
}
//[XmlRoot(ElementName="ActiveSpeaker")]
public class ActiveSpeaker {
//[XmlElement(ElementName="CallId")]
public string CallId { get; set; }
//[XmlElement(ElementName="PIPPosition")]
public string PIPPosition { get; set; }
}
//[XmlRoot(ElementName="Multipoint")]
public class Multipoint {
//[XmlElement(ElementName="Mode")]
public string Mode { get; set; }
}
//[XmlRoot(ElementName="Whiteboard")]
public class Whiteboard {
//[XmlElement(ElementName="Mode")]
public string Mode { get; set; }
//[XmlElement(ElementName="ReleaseFloorAvailability")]
public string ReleaseFloorAvailability { get; set; }
//[XmlElement(ElementName="RequestFloorAvailability")]
public string RequestFloorAvailability { get; set; }
}
//[XmlRoot(ElementName="Presentation")]
public class Presentation {
//[XmlElement(ElementName="CallId")]
public string CallId { get; set; }
//[XmlElement(ElementName="Mode")]
public string Mode { get; set; }
//[XmlElement(ElementName="Whiteboard")]
public Whiteboard Whiteboard { get; set; }
//[XmlElement(ElementName="PIPPosition")]
public string PIPPosition { get; set; }
}
//[XmlRoot(ElementName="SpeakerLock")]
public class SpeakerLock {
//[XmlElement(ElementName="CallId")]
public string CallId { get; set; }
//[XmlElement(ElementName="Mode")]
public string Mode { get; set; }
}
//[XmlRoot(ElementName="Message")]
public class Message {
//[XmlElement(ElementName="Description")]
public string Description { get; set; }
//[XmlElement(ElementName="Level")]
public string Level { get; set; }
//[XmlElement(ElementName="References")]
public string References { get; set; }
//[XmlElement(ElementName="Type")]
public string Type { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="Diagnostics")]
public class Diagnostics {
//[XmlElement(ElementName="Message")]
public List<Message> Message { get; set; }
}
//[XmlRoot(ElementName="Experimental")]
public class Experimental {
//[XmlElement(ElementName="Conference")]
public string Conference { get; set; }
}
//[XmlRoot(ElementName="Gatekeeper")]
public class Gatekeeper {
//[XmlElement(ElementName="Address")]
public string Address { get; set; }
//[XmlElement(ElementName="Port")]
public string Port { get; set; }
//[XmlElement(ElementName="Reason")]
public string Reason { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
}
//[XmlRoot(ElementName="Mode")]
public class Mode {
//[XmlElement(ElementName="Reason")]
public string Reason { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
}
//[XmlRoot(ElementName="H323")]
public class H323 {
//[XmlElement(ElementName="Gatekeeper")]
public Gatekeeper Gatekeeper { get; set; }
//[XmlElement(ElementName="Mode")]
public Mode Mode { get; set; }
}
//[XmlRoot(ElementName="Expression")]
public class Expression {
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
//[XmlText]
public string Text { get; set; }
}
//[XmlRoot(ElementName="HttpFeedback")]
public class HttpFeedback {
//[XmlElement(ElementName="Expression")]
public List<Expression> Expression { get; set; }
//[XmlElement(ElementName="Format")]
public string Format { get; set; }
//[XmlElement(ElementName="URL")]
public string URL { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="CDP")]
public class CDP {
//[XmlElement(ElementName="Address")]
public string Address { get; set; }
//[XmlElement(ElementName="Capabilities")]
public string Capabilities { get; set; }
//[XmlElement(ElementName="DeviceId")]
public string DeviceId { get; set; }
//[XmlElement(ElementName="Duplex")]
public string Duplex { get; set; }
//[XmlElement(ElementName="Platform")]
public string Platform { get; set; }
//[XmlElement(ElementName="PortID")]
public string PortID { get; set; }
//[XmlElement(ElementName="PrimaryMgmtAddress")]
public string PrimaryMgmtAddress { get; set; }
//[XmlElement(ElementName="SysName")]
public string SysName { get; set; }
//[XmlElement(ElementName="SysObjectID")]
public string SysObjectID { get; set; }
//[XmlElement(ElementName="VTPMgmtDomain")]
public string VTPMgmtDomain { get; set; }
//[XmlElement(ElementName="Version")]
public string Version { get; set; }
//[XmlElement(ElementName="VoIPApplianceVlanID")]
public string VoIPApplianceVlanID { get; set; }
}
//[XmlRoot(ElementName="Domain")]
public class Domain {
//[XmlElement(ElementName="Name")]
public string Name { get; set; }
}
//[XmlRoot(ElementName="Server")]
public class Server {
//[XmlElement(ElementName="Address")]
public string Address { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="DNS")]
public class DNS {
//[XmlElement(ElementName="Domain")]
public Domain Domain { get; set; }
//[XmlElement(ElementName="Server")]
public List<Server> Server { get; set; }
}
//[XmlRoot(ElementName="Ethernet")]
public class Ethernet {
//[XmlElement(ElementName="MacAddress")]
public string MacAddress { get; set; }
//[XmlElement(ElementName="Speed")]
public string Speed { get; set; }
}
//[XmlRoot(ElementName="IPv4")]
public class IPv4 {
//[XmlElement(ElementName="Address")]
public string Address { get; set; }
//[XmlElement(ElementName="Gateway")]
public string Gateway { get; set; }
//[XmlElement(ElementName="SubnetMask")]
public string SubnetMask { get; set; }
}
//[XmlRoot(ElementName="IPv6")]
public class IPv6 {
//[XmlElement(ElementName="Address")]
public string Address { get; set; }
//[XmlElement(ElementName="Gateway")]
public string Gateway { get; set; }
}
//[XmlRoot(ElementName="Voice")]
public class Voice {
//[XmlElement(ElementName="VlanId")]
public string VlanId { get; set; }
}
//[XmlRoot(ElementName="VLAN")]
public class VLAN {
//[XmlElement(ElementName="Voice")]
public Voice Voice { get; set; }
}
//[XmlRoot(ElementName="Network")]
public class Network {
//[XmlElement(ElementName="CDP")]
public CDP CDP { get; set; }
//[XmlElement(ElementName="DNS")]
public DNS DNS { get; set; }
//[XmlElement(ElementName="Ethernet")]
public Ethernet Ethernet { get; set; }
//[XmlElement(ElementName="IPv4")]
public IPv4 IPv4 { get; set; }
//[XmlElement(ElementName="IPv6")]
public IPv6 IPv6 { get; set; }
//[XmlElement(ElementName="VLAN")]
public VLAN VLAN { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="NTP")]
public class NTP {
//[XmlElement(ElementName="CurrentAddress")]
public string CurrentAddress { get; set; }
//[XmlElement(ElementName="Server")]
public List<Server> Server { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
}
//[XmlRoot(ElementName="NetworkServices")]
public class NetworkServices {
//[XmlElement(ElementName="NTP")]
public NTP NTP { get; set; }
}
//[XmlRoot(ElementName="ConnectedDevice")]
public class ConnectedDevice {
//[XmlElement(ElementName="HardwareInfo")]
public string HardwareInfo { get; set; }
//[XmlElement(ElementName="ID")]
public string ID { get; set; }
//[XmlElement(ElementName="Name")]
public string Name { get; set; }
//[XmlElement(ElementName="SoftwareInfo")]
public string SoftwareInfo { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
//[XmlElement(ElementName="Type")]
public string Type { get; set; }
//[XmlElement(ElementName="UpgradeStatus")]
public string UpgradeStatus { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
//[XmlElement(ElementName="PreferredFormat")]
public string PreferredFormat { get; set; }
}
//[XmlRoot(ElementName="Peripherals")]
public class Peripherals {
//[XmlElement(ElementName="ConnectedDevice")]
public ConnectedDevice ConnectedDevice { get; set; }
}
//[XmlRoot(ElementName="ExtensionMobility")]
public class ExtensionMobility {
//[XmlElement(ElementName="Enabled")]
public string Enabled { get; set; }
//[XmlElement(ElementName="LastLoggedInUserId")]
public string LastLoggedInUserId { get; set; }
//[XmlElement(ElementName="LoggedIn")]
public string LoggedIn { get; set; }
}
//[XmlRoot(ElementName="CUCM")]
public class CUCM {
//[XmlElement(ElementName="ExtensionMobility")]
public ExtensionMobility ExtensionMobility { get; set; }
}
//[XmlRoot(ElementName="UpgradeStatus")]
public class UpgradeStatus {
//[XmlElement(ElementName="LastChange")]
public string LastChange { get; set; }
//[XmlElement(ElementName="Message")]
public string Message { get; set; }
//[XmlElement(ElementName="Phase")]
public string Phase { get; set; }
//[XmlElement(ElementName="SessionId")]
public string SessionId { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
//[XmlElement(ElementName="URL")]
public string URL { get; set; }
//[XmlElement(ElementName="VersionId")]
public string VersionId { get; set; }
}
//[XmlRoot(ElementName="Software")]
public class Software {
//[XmlElement(ElementName="Current")]
public Current Current { get; set; }
//[XmlElement(ElementName="UpgradeStatus")]
public UpgradeStatus UpgradeStatus { get; set; }
//[XmlElement(ElementName="DisplayName")]
public string DisplayName { get; set; }
//[XmlElement(ElementName="Name")]
public string Name { get; set; }
//[XmlElement(ElementName="OptionKeys")]
public OptionKeys OptionKeys { get; set; }
//[XmlElement(ElementName="ReleaseDate")]
public string ReleaseDate { get; set; }
//[XmlElement(ElementName="Version")]
public string Version { get; set; }
}
//[XmlRoot(ElementName="Provisioning")]
public class Provisioning {
//[XmlElement(ElementName="CUCM")]
public CUCM CUCM { get; set; }
//[XmlElement(ElementName="Software")]
public Software Software { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
}
//[XmlRoot(ElementName="Services")]
public class Services {
//[XmlElement(ElementName="Availability")]
public string Availability { get; set; }
}
//[XmlRoot(ElementName="Proximity")]
public class Proximity {
//[XmlElement(ElementName="Services")]
public Services Services { get; set; }
}
//[XmlRoot(ElementName="PeopleCount")]
public class PeopleCount {
//[XmlElement(ElementName="Current")]
public string Current { get; set; }
}
//[XmlRoot(ElementName="RoomAnalytics")]
public class RoomAnalytics {
//[XmlElement(ElementName="PeopleCount")]
public PeopleCount PeopleCount { get; set; }
//[XmlElement(ElementName="PeoplePresence")]
public string PeoplePresence { get; set; }
}
//[XmlRoot(ElementName="CallForward")]
public class CallForward {
//[XmlElement(ElementName="DisplayName")]
public string DisplayName { get; set; }
//[XmlElement(ElementName="Mode")]
public string Mode { get; set; }
//[XmlElement(ElementName="URI")]
public string URI { get; set; }
}
//[XmlRoot(ElementName="Mailbox")]
public class Mailbox {
//[XmlElement(ElementName="MessagesWaiting")]
public string MessagesWaiting { get; set; }
//[XmlElement(ElementName="URI")]
public string URI { get; set; }
}
//[XmlRoot(ElementName="Proxy")]
public class Proxy {
//[XmlElement(ElementName="Address")]
public string Address { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="Registration")]
public class Registration {
//[XmlElement(ElementName="Reason")]
public string Reason { get; set; }
//[XmlElement(ElementName="Status")]
public string Status { get; set; }
//[XmlElement(ElementName="URI")]
public string URI { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="SIP")]
public class SIP {
//[XmlElement(ElementName="Authentication")]
public string Authentication { get; set; }
//[XmlElement(ElementName="CallForward")]
public CallForward CallForward { get; set; }
//[XmlElement(ElementName="Mailbox")]
public Mailbox Mailbox { get; set; }
//[XmlElement(ElementName="Proxy")]
public Proxy Proxy { get; set; }
//[XmlElement(ElementName="Registration")]
public Registration Registration { get; set; }
//[XmlElement(ElementName="Secure")]
public string Secure { get; set; }
//[XmlElement(ElementName="Verified")]
public string Verified { get; set; }
}
//[XmlRoot(ElementName="FIPS")]
public class FIPS {
//[XmlElement(ElementName="Mode")]
public string Mode { get; set; }
}
//[XmlRoot(ElementName="Persistency")]
public class Persistency {
//[XmlElement(ElementName="CallHistory")]
public string CallHistory { get; set; }
//[XmlElement(ElementName="Configurations")]
public string Configurations { get; set; }
//[XmlElement(ElementName="DHCP")]
public string DHCP { get; set; }
//[XmlElement(ElementName="InternalLogging")]
public string InternalLogging { get; set; }
//[XmlElement(ElementName="LocalPhonebook")]
public string LocalPhonebook { get; set; }
}
//[XmlRoot(ElementName="Security")]
public class Security {
//[XmlElement(ElementName="FIPS")]
public FIPS FIPS { get; set; }
//[XmlElement(ElementName="Persistency")]
public Persistency Persistency { get; set; }
}
//[XmlRoot(ElementName="Standby")]
public class Standby {
//[XmlElement(ElementName="State")]
public string State { get; set; }
}
//[XmlRoot(ElementName="Module")]
public class Module {
//[XmlElement(ElementName="CompatibilityLevel")]
public string CompatibilityLevel { get; set; }
//[XmlElement(ElementName="SerialNumber")]
public string SerialNumber { get; set; }
}
//[XmlRoot(ElementName="Hardware")]
public class Hardware {
//[XmlElement(ElementName="Module")]
public Module Module { get; set; }
}
//[XmlRoot(ElementName="OptionKeys")]
public class OptionKeys {
//[XmlElement(ElementName="Encryption")]
public string Encryption { get; set; }
//[XmlElement(ElementName="MultiSite")]
public string MultiSite { get; set; }
//[XmlElement(ElementName="RemoteMonitoring")]
public string RemoteMonitoring { get; set; }
}
//[XmlRoot(ElementName="State")]
public class State {
//[XmlElement(ElementName="NumberOfActiveCalls")]
public string NumberOfActiveCalls { get; set; }
//[XmlElement(ElementName="NumberOfInProgressCalls")]
public string NumberOfInProgressCalls { get; set; }
//[XmlElement(ElementName="NumberOfSuspendedCalls")]
public string NumberOfSuspendedCalls { get; set; }
}
//[XmlRoot(ElementName="SystemUnit")]
public class SystemUnit {
//[XmlElement(ElementName="Hardware")]
public Hardware Hardware { get; set; }
//[XmlElement(ElementName="ProductId")]
public string ProductId { get; set; }
//[XmlElement(ElementName="ProductPlatform")]
public string ProductPlatform { get; set; }
//[XmlElement(ElementName="ProductType")]
public string ProductType { get; set; }
//[XmlElement(ElementName="Software")]
public Software Software { get; set; }
//[XmlElement(ElementName="State")]
public State State { get; set; }
//[XmlElement(ElementName="Uptime")]
public string Uptime { get; set; }
}
//[XmlRoot(ElementName="Time")]
public class Time {
//[XmlElement(ElementName="SystemTime")]
public string SystemTime { get; set; }
}
//[XmlRoot(ElementName="ContactMethod")]
public class ContactMethod {
//[XmlElement(ElementName="Number")]
public string Number { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="ContactInfo")]
public class ContactInfo {
//[XmlElement(ElementName="ContactMethod")]
public List<ContactMethod> ContactMethod { get; set; }
//[XmlElement(ElementName="Name")]
public string Name { get; set; }
}
//[XmlRoot(ElementName="UserInterface")]
public class UserInterface {
//[XmlElement(ElementName="ContactInfo")]
public ContactInfo ContactInfo { get; set; }
}
//[XmlRoot(ElementName="Connector")]
public class Connector {
//[XmlElement(ElementName="Connected")]
public string Connected { get; set; }
//[XmlElement(ElementName="SignalState")]
public string SignalState { get; set; }
//[XmlElement(ElementName="SourceId")]
public string SourceId { get; set; }
//[XmlElement(ElementName="Type")]
public string Type { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
//[XmlElement(ElementName="ConnectedDevice")]
public ConnectedDevice ConnectedDevice { get; set; }
//[XmlElement(ElementName="MonitorRole")]
public string MonitorRole { get; set; }
//[XmlElement(ElementName="Resolution")]
public Resolution Resolution { get; set; }
}
//[XmlRoot(ElementName="Resolution")]
public class Resolution {
//[XmlElement(ElementName="Height")]
public string Height { get; set; }
//[XmlElement(ElementName="RefreshRate")]
public string RefreshRate { get; set; }
//[XmlElement(ElementName="Width")]
public string Width { get; set; }
}
//[XmlRoot(ElementName="Source")]
public class Source {
//[XmlElement(ElementName="ConnectorId")]
public string ConnectorId { get; set; }
//[XmlElement(ElementName="FormatStatus")]
public string FormatStatus { get; set; }
//[XmlElement(ElementName="FormatType")]
public string FormatType { get; set; }
//[XmlElement(ElementName="MediaChannelId")]
public string MediaChannelId { get; set; }
//[XmlElement(ElementName="Resolution")]
public Resolution Resolution { get; set; }
//[XmlAttribute(AttributeName="item")]
public string Item { get; set; }
//[XmlAttribute(AttributeName="maxOccurrence")]
public string MaxOccurrence { get; set; }
}
//[XmlRoot(ElementName="LayoutFamily")]
public class LayoutFamily {
//[XmlElement(ElementName="Local")]
public string Local { get; set; }
}
//[XmlRoot(ElementName="Layout")]
public class Layout {
//[XmlElement(ElementName="LayoutFamily")]
public LayoutFamily LayoutFamily { get; set; }
}
//[XmlRoot(ElementName="Selfview")]
public class Selfview {
//[XmlElement(ElementName="FullscreenMode")]
public string FullscreenMode { get; set; }
//[XmlElement(ElementName="Mode")]
public string Mode { get; set; }
//[XmlElement(ElementName="OnMonitorRole")]
public string OnMonitorRole { get; set; }
//[XmlElement(ElementName="PIPPosition")]
public string PIPPosition { get; set; }
}
//[XmlRoot(ElementName="Video")]
public class Video {
//[XmlElement(ElementName="ActiveSpeaker")]
public ActiveSpeaker ActiveSpeaker { get; set; }
//[XmlElement(ElementName="Input")]
public Input Input { get; set; }
//[XmlElement(ElementName="Layout")]
public Layout Layout { get; set; }
//[XmlElement(ElementName="Monitors")]
public string Monitors { get; set; }
//[XmlElement(ElementName="Output")]
public Output Output { get; set; }
//[XmlElement(ElementName="Presentation")]
public Presentation Presentation { get; set; }
//[XmlElement(ElementName="Selfview")]
public Selfview Selfview { get; set; }
}
//[XmlRoot(ElementName="Status")]
public class Status {
//[XmlElement(ElementName="Audio")]
public Audio Audio { get; set; }
//[XmlElement(ElementName="Bookings")]
public Bookings Bookings { get; set; }
//[XmlElement(ElementName="Cameras")]
public Cameras Cameras { get; set; }
//[XmlElement(ElementName="Capabilities")]
public Capabilities Capabilities { get; set; }
//[XmlElement(ElementName="Conference")]
public Conference Conference { get; set; }
//[XmlElement(ElementName="Diagnostics")]
public Diagnostics Diagnostics { get; set; }
//[XmlElement(ElementName="Experimental")]
public Experimental Experimental { get; set; }
//[XmlElement(ElementName="H323")]
public H323 H323 { get; set; }
//[XmlElement(ElementName="HttpFeedback")]
public HttpFeedback HttpFeedback { get; set; }
//[XmlElement(ElementName="MediaChannels")]
public string MediaChannels { get; set; }
//[XmlElement(ElementName="Network")]
public Network Network { get; set; }
//[XmlElement(ElementName="NetworkServices")]
public NetworkServices NetworkServices { get; set; }
//[XmlElement(ElementName="Peripherals")]
public Peripherals Peripherals { get; set; }
//[XmlElement(ElementName="Provisioning")]
public Provisioning Provisioning { get; set; }
//[XmlElement(ElementName="Proximity")]
public Proximity Proximity { get; set; }
//[XmlElement(ElementName="RoomAnalytics")]
public RoomAnalytics RoomAnalytics { get; set; }
//[XmlElement(ElementName="SIP")]
public SIP SIP { get; set; }
//[XmlElement(ElementName="Security")]
public Security Security { get; set; }
//[XmlElement(ElementName="Standby")]
public Standby Standby { get; set; }
//[XmlElement(ElementName="SystemUnit")]
public SystemUnit SystemUnit { get; set; }
//[XmlElement(ElementName="Time")]
public Time Time { get; set; }
//[XmlElement(ElementName="UserInterface")]
public UserInterface UserInterface { get; set; }
//[XmlElement(ElementName="Video")]
public Video Video { get; set; }
//[XmlAttribute(AttributeName="product")]
public string Product { get; set; }
//[XmlAttribute(AttributeName="version")]
public string Version { get; set; }
//[XmlAttribute(AttributeName="apiVersion")]
public string ApiVersion { get; set; }
}
}
}

View File

@@ -0,0 +1,642 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Net.Https;
using Crestron.SimplSharp.CrestronXml;
using Crestron.SimplSharp.CrestronXml.Serialization;
using Newtonsoft.Json;
using Cisco_One_Button_To_Push;
using Cisco_SX80_Corporate_Phone_Book;
using PepperDash.Core;
using PepperDash.Essentials.Core;
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 CommunicationGather JsonGather { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
private CiscoOneButtonToPush CodecObtp;
private Corporate_Phone_Book PhoneBook;
private CiscoCodecConfiguration.RootObject CodecConfiguration;
private CiscoCodecStatus.RootObject CodecStatus;
protected override Func<int> VolumeLevelFeedbackFunc
{
get
{
return () => CodecStatus.Status.Audio.Volume.IntValue;
}
}
//private HttpsClient Client;
//private HttpApiServer Server;
//private int ServerPort;
//private string CodecUrl;
//private string HttpSessionId;
//private string FeedbackRegistrationExpression;
private string CliFeedbackRegistrationExpression;
private CodecSyncState SyncState;
private StringBuilder JsonMessage;
private bool JsonFeedbackMessageIsIncoming;
string Delimiter = "\r\n";
// Constructor for IBasicCommunication
public CiscoCodec(string key, string name, IBasicCommunication comm, int serverPort)
: base(key, name)
{
Communication = comm;
SyncState = new CodecSyncState(key + "--sync");
PortGather = new CommunicationGather(Communication, "\r\n");
PortGather.IncludeDelimiter = true;
PortGather.LineReceived += this.Port_LineReceived;
//JsonGather = new CommunicationGather(Communication, "}\r\n\r\n");
//JsonGather.IncludeDelimiter = true;
//JsonGather.LineReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(JsonGather_LineReceived);
Communication.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
//ServerPort = serverPort;
CodecObtp = new CiscoOneButtonToPush();
PhoneBook = new Corporate_Phone_Book();
CodecConfiguration = new CiscoCodecConfiguration.RootObject();
CodecStatus = new CiscoCodecStatus.RootObject();
CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate;
//Client = new HttpsClient();
//Server = new HttpApiServer();
}
/// <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();
var socket = Communication as ISocketStatus;
if (socket != null)
{
socket.ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
}
Debug.Console(1, this, "Starting Cisco API Server");
//Server.Start(ServerPort);
//Server.ApiRequest += new EventHandler<Crestron.SimplSharp.Net.Http.OnHttpRequestArgs>(Server_ApiRequest);
//CodecUrl = string.Format("http://{0}", (Communication as GenericSshClient).Hostname);
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 2000, 120000, 300000, "xStatus SystemUnit Software Version\r");
DeviceManager.AddDevice(CommunicationMonitor);
//Client = new HttpsClient();
//Client.Verbose = true;
//Client.KeepAlive = true;
// Temp feedback registration
//FeedbackRegistrationExpression =
// "<Command><HttpFeedback><Register command=\"True\"><FeedbackSlot>1</FeedbackSlot>" +
// string.Format("<ServerUrl>http://{0}:{1}/cisco/api</ServerUrl>", CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0), ServerPort) +
// "<Format>JSON</Format>" +
// "<Expression item=\"1\">/Configuration</Expression>" +
// "<Expression item=\"2\">/Event/CallDisconnect</Expression>" +
// "<Expression item=\"3\">/Status/Call</Expression>" +
// "</Register>" +
// "</HttpFeedback>" +
// "</Command>";
string prefix = "xFeedback register ";
CliFeedbackRegistrationExpression =
prefix + "/Configuration" + Delimiter +
prefix + "/Status/Audio" + Delimiter +
prefix + "/Status/Call" + Delimiter +
prefix + "/Status/Cameras/SpeakerTrack" + Delimiter +
prefix + "/Status/RoomAnalytics" + Delimiter +
prefix + "/Status/Standby" + Delimiter +
prefix + "/Status/Video/Selfview" + Delimiter +
prefix + "/Bookings" + Delimiter +
prefix + "/Event/CallDisconnect" + Delimiter;
//StartHttpsSession();
//CodecObtp.Initialize();
//CodecObtp.GetMeetings();
//PhoneBook.DownloadPhoneBook(Corporate_Phone_Book.ePhoneBookLocation.Corporate);
return base.CustomActivate();
}
void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
{
// Reset sync status on disconnect
if (!e.Client.IsConnected)
SyncState.CodecDisconnected();
}
/// <summary>
/// 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.
/// </summary>
/// <param name="dev"></param>
/// <param name="args"></param>
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
{
if (Debug.Level == 1)
{
if(!JsonFeedbackMessageIsIncoming)
Debug.Console(1, this, "RX: '{0}'", args.Text);
}
if (args.Text == "{" + Delimiter) // Check for the beginning of a new JSON message
{
JsonFeedbackMessageIsIncoming = true;
Debug.Console(1, this, "Incoming JSON message...");
JsonMessage = new StringBuilder();
}
else if (args.Text == "}" + Delimiter) // Check for the end of a JSON message
{
JsonFeedbackMessageIsIncoming = false;
JsonMessage.Append(args.Text);
Debug.Console(1, this, "Complete JSON Received:\n{0}", JsonMessage.ToString());
// Forward the complete message to be deserialized
DeserializeResponse(JsonMessage.ToString());
return;
}
if(JsonFeedbackMessageIsIncoming)
{
JsonMessage.Append(args.Text);
//Debug.Console(1, this, "Building JSON:\n{0}", JsonMessage.ToString());
return;
}
if (!SyncState.InitialSyncComplete)
{
switch (args.Text.Trim())
{
case "*r Login successful":
{
SendText("xPreferences outputmode json");
break;
}
case "xPreferences outputmode json":
{
if(!SyncState.InitialStatusMessageWasReceived)
SendText("xStatus");
break;
}
case "xFeedback register":
{
SyncState.FeedbackRegistered();
break;
}
}
}
}
void JsonGather_LineReceived(object sender, GenericCommMethodReceiveTextArgs e)
{
//Debug.Console(1, this, "JSON repsonse length: {0}", e.Text.Length);
var startPos = e.Text.IndexOf("{");
var json = e.Text.Substring(startPos, e.Text.Length - startPos);
//Debug.Console(1, this, "First curly brace found at position {0}. Substring will start at position {1} and continue for {2} characters", startPos, startPos, e.Text.Length - startPos);
Debug.Console(1, this, "JSON received:\n{0}", json);
DeserializeResponse(json);
}
public void SendText(string command)
{
Debug.Console(1, this, "Sending: '{0}'", command);
Communication.SendText(command + "\x0d\x0a");
}
//private void StartHttpsSession()
//{
// SendHttpCommand("", eCommandType.SessionStart);
//}
//private void EndHttpsSession()
//{
// SendHttpCommand("", eCommandType.SessionEnd);
//}
//private void SendHttpCommand(string command, eCommandType commandType)
//{
// //HttpsClientRequest request = new HttpsClientRequest();
// //string urlSuffix = null;
// //Client.UserName = null;
// //Client.Password = null;
// //Client.PeerVerification = false;
// //Client.HostVerification = false;
// //request.RequestType = RequestType.Post;
// //if(!string.IsNullOrEmpty(HttpSessionId))
// // request.Header.SetHeaderValue("Cookie", HttpSessionId);
// //switch (commandType)
// //{
// // case eCommandType.Command:
// // {
// // urlSuffix = "/putxml";
// // request.ContentString = command;
// // request.Header.SetHeaderValue("Content-Type", "text/xml");
// // break;
// // }
// // case eCommandType.SessionStart:
// // {
// // urlSuffix = "/xmlapi/session/begin";
// // Client.UserName = (Communication as GenericSshClient).Username;
// // Client.Password = (Communication as GenericSshClient).Password;
// // break;
// // }
// // case eCommandType.SessionEnd:
// // {
// // urlSuffix = "/xmlapi/session/end";
// // request.Header.SetHeaderValue("Cookie", HttpSessionId);
// // break;
// // }
// // case eCommandType.GetStatus:
// // {
// // request.RequestType = RequestType.Get;
// // request.Header.SetHeaderValue("Content-Type", "text/xml");
// // urlSuffix = "/getxml?location=/Status";
// // break;
// // }
// // case eCommandType.GetConfiguration:
// // {
// // request.RequestType = RequestType.Get;
// // request.Header.SetHeaderValue("Content-Type", "text/xml");
// // urlSuffix = "/getxml?location=/Configuration";
// // break;
// // }
// //}
// //var requestUrl = CodecUrl + urlSuffix;
// //request.Header.RequestVersion = "HTTP/1.1";
// //request.Url.Parse(requestUrl);
// //Debug.Console(1, this, "Sending HTTP request to Cisco Codec at {0}\nHeader:\n{1}\nContent:\n{2}", requestUrl, request.Header, request.ContentString);
// //Client.DispatchAsync(request, PostConnectionCallback);
//}
//void PostConnectionCallback(HttpsClientResponse resp, HTTPS_CALLBACK_ERROR err)
//{
// //try
// //{
// // if (resp != null)
// // {
// // if (resp.Code == 200)
// // {
// // Debug.Console(1, this, "Http Post to Cisco Codec Successful. Code: {0}\nContent: {1}", resp.Code, resp.ContentString);
// // if (resp.ContentString.IndexOf("<HttpFeedbackRegisterResult status=\"OK\">") > 1)
// // {
// // // Get the initial configruation for sync purposes
// // SendHttpCommand("", eCommandType.GetConfiguration);
// // }
// // else
// // {
// // try
// // {
// // if (resp.ContentString.IndexOf("</Configuration>") > -1)
// // {
// // XmlReaderSettings settings = new XmlReaderSettings();
// // XmlReader reader = new XmlReader(resp.ContentString, settings);
// // CodecConfiguration = CrestronXMLSerialization.DeSerializeObject<CiscoCodecConfiguration.RootObject>(reader);
// // //Debug.Console(1, this, "Product Name: {0} Software Version: {1} ApiVersion: {2}", CodecConfiguration.Configuration.Product, CodecConfiguration.Version, CodecConfiguration.ApiVersion);
// // // Get the initial status for sync purposes
// // SendHttpCommand("", eCommandType.GetStatus);
// // }
// // else if (resp.ContentString.IndexOf("</Status>") > -1)
// // {
// // XmlReaderSettings settings = new XmlReaderSettings();
// // XmlReader reader = new XmlReader(resp.ContentString, settings);
// // CodecStatus = CrestronXMLSerialization.DeSerializeObject<CiscoCodecStatus.RootObject>(reader);
// // //Debug.Console(1, this, "Product Name: {0} Software Version: {1} ApiVersion: {2} Volume: {3}", CodecStatus.Product, CodecStatus.Version, CodecStatus.ApiVersion, CodecStatus.Audio.Volume);
// // }
// // }
// // catch (Exception ex)
// // {
// // Debug.Console(1, this, "Error Deserializing XML document from codec: {0}", ex);
// // }
// // }
// // }
// // else if (resp.Code == 204)
// // {
// // Debug.Console(1, this, "Response Code: {0}\nHeader:\n{1}Content:\n{1}", resp.Code, resp.Header, resp.ContentString);
// // HttpSessionId = resp.Header.GetHeaderValue("Set-Cookie");
// // //var chunks = HttpSessionId.Split(';');
// // //HttpSessionId = chunks[0];
// // //HttpSessionId = HttpSessionId.Substring(HttpSessionId.IndexOf("=") + 1);
// // // Register for feedbacks once we have a valid session
// // SendHttpCommand(FeedbackRegistrationExpression, eCommandType.Command);
// // }
// // else
// // {
// // Debug.Console(1, this, "Response Code: {0}\nHeader:\n{1}Content:\n{1}Err:\n{2}", resp.Code, resp.Header, resp.ContentString, err);
// // }
// // }
// // else
// // Debug.Console(1, this, "Null response received from server");
// //}
// //catch (Exception e)
// //{
// // Debug.Console(1, this, "Error Initializing HTTPS Client: {0}", e);
// //}
//}
//void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs e)
//{
// Debug.Console(1, this, "Api Reqeust from Codec: {0}", e.Request.ContentString);
// e.Response.Code = 200;
// e.Response.ContentString = "OK";
// DeserializeResponse(e.Request.ContentString);
//}
void DeserializeResponse(string response)
{
try
{
// Serializer settings. We want to ignore null values and mising members
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.NullValueHandling = NullValueHandling.Ignore;
settings.MissingMemberHandling = MissingMemberHandling.Ignore;
settings.ObjectCreationHandling = ObjectCreationHandling.Auto;
if (response.IndexOf("\"Status\":{") > -1)
{
JsonConvert.PopulateObject(response, CodecStatus);
if (!SyncState.InitialStatusMessageWasReceived)
{
SyncState.InitialStatusMessageReceived();
if(!SyncState.InitialConfigurationMessageWasReceived)
SendText("xConfiguration");
}
}
else if (response.IndexOf("\"Configuration\":{") > -1)
{
JsonConvert.PopulateObject(response, CodecConfiguration);
if (!SyncState.InitialConfigurationMessageWasReceived)
{
SyncState.InitialConfigurationMessageReceived();
if (!SyncState.FeedbackWasRegistered)
{
SendText(CliFeedbackRegistrationExpression);
}
}
}
}
catch (Exception ex)
{
Debug.Console(1, this, "Error Deserializing feedback from codec: {0}", ex);
}
}
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
{
//CodecObtp.
}
public override void ExecuteSwitch(object selector)
{
throw new NotImplementedException();
}
protected override Func<bool> InCallFeedbackFunc { get { return () => false; } }
protected override Func<bool> IncomingCallFeedbackFunc { get { return () => false; } }
protected override Func<bool> TransmitMuteFeedbackFunc { get { return () => false; } }
protected override Func<bool> ReceiveMuteFeedbackFunc { get { return () => false; } }
protected override Func<bool> PrivacyModeFeedbackFunc { get { return () => false; } }
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()
{
}
public override void RejectCall()
{
}
public override void SendDtmf(string s)
{
}
public override void StartSharing()
{
}
public override void StopSharing()
{
}
public override void ReceiveMuteOff()
{
}
public override void ReceiveMuteOn()
{
}
public override void ReceiveMuteToggle()
{
}
public override void SetReceiveVolume(ushort level)
{
}
public override void TransmitMuteOff()
{
}
public override void TransmitMuteOn()
{
}
public override void TransmitMuteToggle()
{
}
public override void SetTransmitVolume(ushort level)
{
}
public override void PrivacyModeOn()
{
}
public override void PrivacyModeOff()
{
}
public override void PrivacyModeToggle()
{
}
}
/// <summary>
/// Tracks the initial sycnronization state of the codec when making a connection
/// </summary>
public class CodecSyncState : IKeyed
{
public string Key { get; private set; }
public bool InitialSyncComplete { get; private set; }
public bool InitialStatusMessageWasReceived { get; private set; }
public bool InitialConfigurationMessageWasReceived { get; private set; }
public bool FeedbackWasRegistered { get; private set; }
public CodecSyncState(string key)
{
Key = key;
CodecDisconnected();
}
public void InitialStatusMessageReceived()
{
InitialStatusMessageWasReceived = true;
Debug.Console(1, this, "Initial Codec Status Message Received.");
CheckSyncStatus();
}
public void InitialConfigurationMessageReceived()
{
InitialConfigurationMessageWasReceived = true;
Debug.Console(1, this, "Initial Codec Configuration Message Received.");
CheckSyncStatus();
}
public void FeedbackRegistered()
{
FeedbackWasRegistered = true;
Debug.Console(1, this, "Initial Codec Feedback Registration Successful.");
CheckSyncStatus();
}
public void CodecDisconnected()
{
InitialConfigurationMessageWasReceived = false;
InitialStatusMessageWasReceived = false;
FeedbackWasRegistered = false;
InitialSyncComplete = false;
}
void CheckSyncStatus()
{
if (InitialConfigurationMessageWasReceived && InitialStatusMessageWasReceived && FeedbackWasRegistered)
{
InitialSyncComplete = true;
Debug.Console(1, this, "Initial Codec Sync Complete!");
}
else
InitialSyncComplete = false;
}
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,231 +1,245 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.VideoCodec namespace PepperDash.Essentials.Devices.Common.VideoCodec
{ {
public class MockVC : VideoCodecBase public class MockVC : VideoCodecBase
{ {
public MockVC(string key, string name) public MockVC(string key, string name)
: base(key, name) : base(key, name)
{ {
} }
protected override Func<bool> InCallFeedbackFunc protected override Func<bool> InCallFeedbackFunc
{ {
get { return () => _InCall; } get { return () => _InCall; }
} }
bool _InCall; bool _InCall;
protected override Func<bool> IncomingCallFeedbackFunc protected override Func<bool> IncomingCallFeedbackFunc
{ {
get { return () => _IncomingCall; } get { return () => _IncomingCall; }
} }
bool _IncomingCall; bool _IncomingCall;
protected override Func<bool> TransmitMuteFeedbackFunc protected override Func<bool> TransmitMuteFeedbackFunc
{ {
get { return () => _TransmitMute; } get { return () => _TransmitMute; }
} }
bool _TransmitMute; bool _TransmitMute;
protected override Func<bool> ReceiveMuteFeedbackFunc protected override Func<bool> ReceiveMuteFeedbackFunc
{ {
get { return () => _ReceiveMute; } get { return () => _ReceiveMute; }
} }
bool _ReceiveMute; bool _ReceiveMute;
protected override Func<bool> PrivacyModeFeedbackFunc protected override Func<bool> PrivacyModeFeedbackFunc
{ {
get { return () => _PrivacyModeIsOn; } get { return () => _PrivacyModeIsOn; }
} }
bool _PrivacyModeIsOn; bool _PrivacyModeIsOn;
/// <summary> protected override Func<int> VolumeLevelFeedbackFunc
/// Dials, yo! {
/// </summary> get { throw new NotImplementedException(); }
public override void Dial(string s) }
{
Debug.Console(1, this, "Dial: {0}", s); /// <summary>
/// Dials, yo!
_InCall = true; /// </summary>
InCallFeedback.FireUpdate(); public override void Dial(string s)
} {
Debug.Console(1, this, "Dial: {0}", s);
/// <summary>
/// Makes horrible tones go out on the wire! _InCall = true;
/// </summary> InCallFeedback.FireUpdate();
/// <param name="s"></param> }
public void SendDTMF(string s)
{ /// <summary>
Debug.Console(1, this, "SendDTMF: {0}", s); ///
} /// </summary>
public override void EndCall()
/// <summary> {
/// Debug.Console(1, this, "EndCall");
/// </summary> _InCall = false;
public override void EndCall() InCallFeedback.FireUpdate();
{ }
Debug.Console(1, this, "EndCall");
_InCall = false; /// <summary>
InCallFeedback.FireUpdate(); /// For a call from the test methods below
} /// </summary>
public override void AcceptCall()
/// <summary> {
/// For a call from the test methods below Debug.Console(1, this, "AcceptCall");
/// </summary> }
public override void AcceptCall()
{ /// <summary>
Debug.Console(1, this, "AcceptCall"); /// For a call from the test methods below
} /// </summary>
public override void RejectCall()
/// <summary> {
/// For a call from the test methods below Debug.Console(1, this, "RejectCall");
/// </summary> }
public override void RejectCall()
{ /// <summary>
Debug.Console(1, this, "RejectCall"); /// Makes horrible tones go out on the wire!
} /// </summary>
/// <param name="s"></param>
public override void SendDtmf(string s)
/// <summary> {
/// Called by routing to make it happen Debug.Console(1, this, "SendDTMF: {0}", s);
/// </summary> }
/// <param name="selector"></param>
public override void ExecuteSwitch(object selector) public override void StartSharing()
{ {
Debug.Console(1, this, "ExecuteSwitch");
}
}
public override void StopSharing()
/// <summary> {
///
/// </summary> }
public override void ReceiveMuteOff()
{ /// <summary>
Debug.Console(1, this, "ReceiveMuteOff"); /// Called by routing to make it happen
/// </summary>
if (!_ReceiveMute) /// <param name="selector"></param>
return; public override void ExecuteSwitch(object selector)
_ReceiveMute = false; {
ReceiveMuteIsOnFeedback.FireUpdate(); Debug.Console(1, this, "ExecuteSwitch");
}
}
/// <summary>
/// /// <summary>
/// </summary> ///
public override void ReceiveMuteOn() /// </summary>
{ public override void ReceiveMuteOff()
Debug.Console(1, this, "ReceiveMuteOn"); {
if (_ReceiveMute) Debug.Console(1, this, "ReceiveMuteOff");
return;
ReceiveMuteIsOnFeedback.FireUpdate(); if (!_ReceiveMute)
} return;
_ReceiveMute = false;
/// <summary> ReceiveMuteIsOnFeedback.FireUpdate();
/// }
/// </summary>
public override void ReceiveMuteToggle() /// <summary>
{ ///
Debug.Console(1, this, "ReceiveMuteToggle"); /// </summary>
public override void ReceiveMuteOn()
_ReceiveMute = !_ReceiveMute; {
ReceiveMuteIsOnFeedback.FireUpdate(); Debug.Console(1, this, "ReceiveMuteOn");
} if (_ReceiveMute)
return;
/// <summary> ReceiveMuteIsOnFeedback.FireUpdate();
/// }
/// </summary>
/// <param name="level"></param> /// <summary>
public override void SetReceiveVolume(ushort level) ///
{ /// </summary>
Debug.Console(1, this, "SetReceiveVolume: {0}", level); public override void ReceiveMuteToggle()
{
} Debug.Console(1, this, "ReceiveMuteToggle");
/// <summary> _ReceiveMute = !_ReceiveMute;
/// ReceiveMuteIsOnFeedback.FireUpdate();
/// </summary> }
public override void TransmitMuteOff()
{ /// <summary>
Debug.Console(1, this, "TransmitMuteOff"); ///
/// </summary>
if (!_TransmitMute) /// <param name="level"></param>
return; public override void SetReceiveVolume(ushort level)
_TransmitMute = false; {
TransmitMuteIsOnFeedback.FireUpdate(); Debug.Console(1, this, "SetReceiveVolume: {0}", level);
}
}
/// <summary>
/// /// <summary>
/// </summary> ///
public override void TransmitMuteOn() /// </summary>
{ public override void TransmitMuteOff()
Debug.Console(1, this, "TransmitMuteOn"); {
if (_TransmitMute) Debug.Console(1, this, "TransmitMuteOff");
return;
TransmitMuteIsOnFeedback.FireUpdate(); if (!_TransmitMute)
} return;
_TransmitMute = false;
public override void TransmitMuteToggle() TransmitMuteIsOnFeedback.FireUpdate();
{ }
_TransmitMute = !_TransmitMute;
Debug.Console(1, this, "TransmitMuteToggle: {0}", _TransmitMute); /// <summary>
TransmitMuteIsOnFeedback.FireUpdate(); ///
} /// </summary>
public override void TransmitMuteOn()
public override void SetTransmitVolume(ushort level) {
{ Debug.Console(1, this, "TransmitMuteOn");
Debug.Console(1, this, "SetTransmitVolume: {0}", level); if (_TransmitMute)
} return;
TransmitMuteIsOnFeedback.FireUpdate();
public override void PrivacyModeOn() }
{
Debug.Console(1, this, "PrivacyMuteOn"); public override void TransmitMuteToggle()
if (_PrivacyModeIsOn) {
return; _TransmitMute = !_TransmitMute;
_PrivacyModeIsOn = true; Debug.Console(1, this, "TransmitMuteToggle: {0}", _TransmitMute);
PrivacyModeIsOnFeedback.FireUpdate(); TransmitMuteIsOnFeedback.FireUpdate();
}
}
public override void SetTransmitVolume(ushort level)
public override void PrivacyModeOff() {
{ Debug.Console(1, this, "SetTransmitVolume: {0}", level);
Debug.Console(1, this, "PrivacyMuteOff"); }
if (!_PrivacyModeIsOn)
return; public override void PrivacyModeOn()
_PrivacyModeIsOn = false; {
PrivacyModeIsOnFeedback.FireUpdate(); Debug.Console(1, this, "PrivacyMuteOn");
} if (_PrivacyModeIsOn)
return;
public override void PrivacyModeToggle() _PrivacyModeIsOn = true;
{ PrivacyModeIsOnFeedback.FireUpdate();
_PrivacyModeIsOn = !_PrivacyModeIsOn;
Debug.Console(1, this, "PrivacyMuteToggle: {0}", _PrivacyModeIsOn); }
PrivacyModeIsOnFeedback.FireUpdate();
} public override void PrivacyModeOff()
{
//******************************************************** Debug.Console(1, this, "PrivacyMuteOff");
// SIMULATION METHODS if (!_PrivacyModeIsOn)
return;
public void TestIncomingCall(string url) _PrivacyModeIsOn = false;
{ PrivacyModeIsOnFeedback.FireUpdate();
Debug.Console(1, this, "TestIncomingCall"); }
_IncomingCall = true; public override void PrivacyModeToggle()
IncomingCallFeedback.FireUpdate(); {
} _PrivacyModeIsOn = !_PrivacyModeIsOn;
Debug.Console(1, this, "PrivacyMuteToggle: {0}", _PrivacyModeIsOn);
public void TestFarEndHangup() PrivacyModeIsOnFeedback.FireUpdate();
{ }
Debug.Console(1, this, "TestFarEndHangup");
//********************************************************
} // SIMULATION METHODS
}
public void TestIncomingCall(string url)
{
Debug.Console(1, this, "TestIncomingCall");
_IncomingCall = true;
IncomingCallFeedback.FireUpdate();
}
public void TestFarEndHangup()
{
Debug.Console(1, this, "TestFarEndHangup");
}
}
} }

View File

@@ -9,7 +9,7 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.VideoCodec namespace PepperDash.Essentials.Devices.Common.VideoCodec
{ {
public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, ICodecAudio public abstract class VideoCodecBase : Device, IRoutingSinkWithSwitching, IUsageTracking, IHasDialer, IHasSharing, IBasicVolumeWithFeedback //, ICodecAudio
{ {
#region IUsageTracking Members #region IUsageTracking Members
@@ -32,6 +32,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
abstract protected Func<bool> ReceiveMuteFeedbackFunc { get; } abstract protected Func<bool> ReceiveMuteFeedbackFunc { get; }
abstract protected Func<bool> PrivacyModeFeedbackFunc { get; } abstract protected Func<bool> PrivacyModeFeedbackFunc { get; }
abstract protected Func<int> VolumeLevelFeedbackFunc { get; }
public VideoCodecBase(string key, string name) public VideoCodecBase(string key, string name)
: base(key, name) : base(key, name)
{ {
@@ -41,6 +43,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
TransmitMuteIsOnFeedback = new BoolFeedback(TransmitMuteFeedbackFunc); TransmitMuteIsOnFeedback = new BoolFeedback(TransmitMuteFeedbackFunc);
PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeFeedbackFunc); PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeFeedbackFunc);
VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc);
InputPorts = new RoutingPortCollection<RoutingInputPort>(); InputPorts = new RoutingPortCollection<RoutingInputPort>();
InCallFeedback.OutputChange += new EventHandler<EventArgs>(InCallFeedback_OutputChange); InCallFeedback.OutputChange += new EventHandler<EventArgs>(InCallFeedback_OutputChange);
@@ -56,11 +60,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
UsageTracker.EndDeviceUsage(); UsageTracker.EndDeviceUsage();
} }
} }
#region IHasDialer Members
public abstract void Dial(string s); public abstract void Dial(string s);
public abstract void EndCall(); public abstract void EndCall();
public abstract void AcceptCall(); public abstract void AcceptCall();
public abstract void RejectCall(); public abstract void RejectCall();
public abstract void SendDtmf(string s);
#endregion
public virtual List<Feedback> Feedbacks public virtual List<Feedback> Feedbacks
{ {
@@ -101,5 +109,56 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public BoolFeedback PrivacyModeIsOnFeedback { get; private set; } public BoolFeedback PrivacyModeIsOnFeedback { get; private set; }
#endregion #endregion
#region IHasSharing Members
public abstract void StartSharing();
public abstract void StopSharing();
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
} }
} }

View File

@@ -57,17 +57,6 @@ namespace PepperDash.Essentials
//PortalSync = new PepperDashPortalSyncClient(); //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"); Debug.Console(0, "Starting Essentials load from configuration");
ConfigReader.LoadConfig2(); ConfigReader.LoadConfig2();
LoadDevices(); LoadDevices();
@@ -137,6 +126,16 @@ namespace PepperDash.Essentials
else else
Debug.Console(0, "WARNING: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key); 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> /// <summary>

View File

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