Cleans out classes moved to plugins (Evertz). Adds example configs, removes old #warning statements.

This commit is contained in:
Neil Dorin
2020-02-12 10:27:27 -07:00
parent 704bcc974b
commit 9a2c001a93
16 changed files with 21 additions and 575 deletions

View File

@@ -1,8 +1,6 @@
{
"system_url": "",
"template": {},
"template_url": "",
"system": {
"template": {
"info": {
"comment": "",
"requiredControlSofwareVersion": "",
@@ -434,5 +432,8 @@
"rooms": [],
"sourceLists": {},
"tieLines": []
},
"template_url": "",
"system": {
}
}

View File

@@ -1,9 +1,6 @@
{
"system_url": "",
"template": {
},
"template_url": "",
"system": {
"template": {
"info": {
"comment": "",
"requiredControlSofwareVersion": "",
@@ -64,6 +61,10 @@
},
"tieLines": [
]
]
},
"template_url": "",
"system": {
}
}

View File

@@ -189,7 +189,6 @@
<Compile Include="Room\Types\EssentialsDualDisplayRoom.cs" />
<Compile Include="Room\Types\EssentialsHuddleVtc1Room.cs" />
<Compile Include="Room\Types\EssentialsNDisplayRoomBase.cs" />
<Compile Include="Room\Types\EssentialsPresentationRoom.cs" />
<Compile Include="Room\Config\EssentialsRoomConfig.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsEnvironmentDriver.cs" />
<Compile Include="UIDrivers\Environment Drivers\EssentialsLightingDriver.cs" />

View File

@@ -7,7 +7,7 @@ using Crestron.SimplSharp.Net.Http;
using PepperDash.Core;
using PepperDash.Core.DebugThings;
namespace PepperDash.Essentials.Devices.Common
namespace PepperDash.Essentials.Core
{
public class GenericHttpClient : Device, IBasicCommunication
{

View File

@@ -113,6 +113,7 @@
<ItemGroup>
<Compile Include="Config\Comm and IR\CecPortController.cs" />
<Compile Include="Config\Comm and IR\GenericComm.cs" />
<Compile Include="Config\Comm and IR\GenericHttpClient.cs" />
<Compile Include="Config\Essentials\ConfigUpdater.cs" />
<Compile Include="Config\Essentials\ConfigReader.cs" />
<Compile Include="Config\Essentials\ConfigWriter.cs" />

View File

@@ -62,7 +62,6 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// In BiAmp: Instance Tag, QSC: Named Control, Polycom:
/// </summary>
string ControlPointTag { get; }
#warning I dont think index1 and index2 should be a part of the interface. JTA 2018-07-17
int Index1 { get; }
int Index2 { get; }
bool HasMute { get; }

View File

@@ -112,11 +112,6 @@
<Compile Include="Occupancy\GlsOdtOccupancySensorController.cs" />
<Compile Include="Power Controllers\Digitallogger.cs" />
<Compile Include="Power Controllers\DigitalLoggerPropertiesConfig.cs" />
<Compile Include="Evertz\EvertsEndpointStatusServer.cs" />
<Compile Include="Evertz\EvertzEndpointVarIds.cs" />
<Compile Include="Evertz\EvertzEndpoint.cs" />
<Compile Include="Evertz\EvertzEndpointPropertiesConfig.cs" />
<Compile Include="Evertz\GenericHttpClient.cs" />
<Compile Include="ImageProcessors\AnalogWay\AnalongWayLiveCore.cs" />
<Compile Include="ImageProcessors\AnalogWay\AnalogWayLiveCorePropertiesConfig.cs" />
<Compile Include="VideoCodec\CiscoCodec\CiscoCamera.cs" />

View File

@@ -1,152 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using System.Text.RegularExpressions;
using Crestron.SimplSharp.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using Crestron.SimplSharp.CrestronSockets;
namespace PepperDash.Essentials.Devices.Common
{
/*****
* TODO JTA: Add Polling
* TODO JTA: Move all the registration commnads to the EvertEndpoint class.
*
*
*
*
*
*/
public class EvertzEndpointStatusServer : Device
{
public IBasicCommunication Communication { get; private set; }
public CommunicationGather PortGather { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
public bool isSubscribed;
public string Address;
public GenericUdpServer Server;
/// <summary>
/// Shows received lines as hex
/// </summary>
public bool ShowHexResponse { get; set; }
public Dictionary<string, EvertzEndpoint> Endpoints;
public Dictionary<string, string> ServerIdByEndpointIp;
public EvertzEndpointStatusServer(string key, string name, GenericUdpServer server, EvertzEndpointStatusServerPropertiesConfig props) :
base(key, name)
{
Server = server;
Address = props.serverHostname;
Server.DataRecievedExtra += new EventHandler<GenericUdpReceiveTextExtraArgs>(_Server_DataRecievedExtra);
Server.Connect();
Endpoints = new Dictionary<string,EvertzEndpoint>();
//CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
}
//TODO JTA: Move this method and process over to the endpoint itself. return a bool.
public bool RegisterEvertzEndpoint (EvertzEndpoint device)
{
if (Endpoints.ContainsKey(device.Address) == false)
{
Endpoints.Add(device.Address, device);
}
return true;
}
void _Server_DataRecievedExtra(object sender, GenericUdpReceiveTextExtraArgs e)
{
Debug.Console(2, this, "_Server_DataRecievedExtra:\nIP:{0}\nPort:{1}\nText{2}\nBytes:{3} ", e.IpAddress, e.Port, e.Text, e.Bytes);
}
public override bool CustomActivate()
{
/*
Communication.Connect();
CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
CommunicationMonitor.Start();
*/
return true;
}
}
public class EvertzPortRestResponse
{
public string id;
public string name;
public string type;
public string value;
}
public class EvertsStatusRequesstResponse
{
public EvertzStatusDataResponse data;
public string error;
}
public class EvertzStatusDataResponse
{
public List<EvertzServerStatusResponse> servers;
}
public class EvertzServerStatusResponse
{
public string id;
public string name;
public EvertsServerStausNotificationsResponse notify;
}
public class EvertsServerStausNotificationsResponse
{
public string ip;
public List<string> parameters;
public string port;
public string protocol;
}
public class EvertzEndpointStatusServerPropertiesConfig
{
public ControlPropertiesConfig control { get; set; }
public string serverHostname { get; set; }
}
}

View File

@@ -1,337 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using System.Text.RegularExpressions;
using Crestron.SimplSharp.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Devices.Common
{
public class EvertzEndpoint : Device
{
public IBasicCommunication Communication { get; private set; }
public CommunicationGather PortGather { get; private set; }
public GenericCommunicationMonitor CommunicationMonitor { get; private set; }
private GenericHttpClient Client;
public string userName;
public string password;
public string Address;
private bool OnlineStatus;
public BoolFeedback OnlineFeedback;
public IntFeedback PresetFeedback;
public bool isSubscribed;
CrestronQueue CommandQueue;
public Dictionary<string, EvertzEndpointPort> Ports;
private string _ControllerKey;
private EvertzEndpointStatusServer StatusServer;
private String StatusServerId;
/// <summary>
/// Shows received lines as hex
/// </summary>
public bool ShowHexResponse { get; set; }
public EvertzEndpoint(string key, string name, EvertzEndpointPropertiesConfig props, string type) :
base(key, name)
{
this.Address = props.address;
Client = new GenericHttpClient(string.Format("{0}-GenericWebClient", name), string.Format("{0}-GenericWebClient", name), this.Address);
Client.ResponseRecived += new EventHandler<GenericHttpClientEventArgs>(Client_ResponseRecived);
Ports = new Dictionary<string, EvertzEndpointPort>();
if (type.ToLower() == "mma10g-trs4k")
{
//create port hdmi 01
EvertzEndpointPort hdmi1 = new EvertzEndpointPort("HDMI01", "131.0@s", "136.0@s");
EvertzEndpointPort hdmi2 = new EvertzEndpointPort("HDMI02", "131.1@s", "136.1@s");
// add to dictionay with all keys
addPortToDictionary(hdmi1);
addPortToDictionary(hdmi2);
}
_ControllerKey = null;
if (props.controllerKey != null)
{
_ControllerKey = props.controllerKey;
}
AddPostActivationAction( () => {PostActivation();});
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
if (props.CommunicationMonitorProperties != null)
{
CommunicationMonitor = new GenericCommunicationMonitor(this, Client, props.CommunicationMonitorProperties);
}
else
{
CommunicationMonitor = new GenericCommunicationMonitor(this, Client, 40000, 120000, 300000, "v.api/apis/EV/SERVERSTATUS");
}
}
/// <summary>
/// Helper method
/// </summary>
/// <param name="port"></param>
private void addPortToDictionary(EvertzEndpointPort port)
{
Ports.Add(port.PortName, port);
Ports.Add(port.ResolutionVarID, port);
Ports.Add(port.SyncVarID, port);
//PollForState(port.SyncVarID);
//PollForState(port.ResolutionVarID);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public override bool CustomActivate()
{
// Create Device -> Constructor fires
// PreActivations get called
// CustomActivate Gets Called Anything that is involved with this single class Ex: Connection, Setup Feedback, Etc.
// After this point all devices are ready for interaction
// PostActivation gets called. Use this for interClass activation.
CommunicationMonitor.Start();
OnlineFeedback = new BoolFeedback(() => { return OnlineStatus; });
//CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
return true;
}
/// <summary>
///
/// </summary>
private void PostActivation()
{
Debug.Console(2, this, "EvertzEndpoint Post Activation");
if (_ControllerKey != null)
{
StatusServer = DeviceManager.GetDeviceForKey(_ControllerKey) as EvertzEndpointStatusServer;
StatusServer.RegisterEvertzEndpoint(this);
// RegisterStatusServer();
// SendStatusRequest();
}
// PollAll();
}
void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType)
{
if (programEventType == eProgramStatusEventType.Stopping)
{
Debug.Console(1, this, "Program stopping. Disabling EvertzStatusServer");
if (StatusServerId != null)
{
//UnregisterServer();
}
}
}
private void ProcessServerStatusRequest(EvertsStatusRequesstResponse status)
{
// var status = JsonConvert.DeserializeObject<EvertsStatusRequesstResponse>(SendStatusRequest());
if (status.error != null)
{
}
else if (status.data != null)
{
foreach (var server in status.data.servers)
{
if (server.name == string.Format("{0}-{1}", this.Name, StatusServer.Address))
{
StatusServerId = server.id;
Debug.Console(2, this, "EvertzEndpoint {0} StatusServer {1} Registered ID {2}", Name, StatusServer.Name, StatusServerId);
/*
foreach (var port in Ports)
{
// TODO JTA: This needs a better check
// you get a {"status": "success"} or "error": "error to register notification- Variable exists.."
if (!server.notify.parameters.Contains(port.Value.ResolutionVarID))
{
RegisterForNotification(StatusServerId, port.Value.ResolutionVarID);
}
if (!server.notify.parameters.Contains(port.Value.ResolutionVarID))
{
RegisterForNotification(StatusServerId, port.Value.SyncVarID);
}
}
*/
break;
}
}
StatusServerId = null;
}
}
private void RegisterServerWithEndpoint()
{
/*
var registrationResult = RegisterServer(StatusServer.Address, string.Format("{0}-{1}", this.Name, StatusServer.Address), StatusServer.Server.Port.ToString());
Debug.Console(2, this, "EvertzEndpointStatusServer Registration Result with device {0}\n{1}", Address, registrationResult);
if (registrationResult.Contains("success"))
{
RegisterStatusServer();
}
else
{
Debug.Console(0, this, "EvertzEndpointStatusServer RegisterServerWithEndpoint with device {0}\n{1}", Address, registrationResult);
}
* */
}
public void PollAll()
{
string collection = "";
foreach (var parameter in Ports)
{
if (parameter.Key.Contains("@"))
{
collection = collection + parameter.Key + ",";
}
}
collection = collection.Substring(0, collection.Length - 1);
SendGetRequest(collection);
}
public void PollForState(string varId)
{
try
{
SendGetRequest(varId);
//var returnState = JsonConvert.DeserializeObject<EvertzPortRestResponse>(SendGetRequest(varId));
}
catch (Exception e)
{
Debug.Console(0, this, "PollForState {0}", e);
}
}
public void ProcessGetParameterResponse(EvertzPortRestResponse response)
{
var PortObject = Ports[response.id];
if (response.name == "Input Status")
{
if (response.value == "Missing") { PortObject.SyncDetected = false; }
else { PortObject.SyncDetected = true; }
}
}
public void SendGetRequest(string s)
{
Client.SendText("v.api/apis/EV/GET/parameter/{0}", s);
}
public void SendStatusRequest()
{
Client.SendText("/v.api/apis/EV/SERVERSTATUS");
}
public void RegisterServer(string hostname, string servername, string port)
{
Client.SendText("v.api/apis/EV/SERVERADD/server/{0}/{1}/{2}/udp", hostname, servername, port);
}
public void UnregisterServer()
{
if (StatusServerId != null)
{
Client.SendTextNoResponse("v.api/apis/EV/SERVERDEL/server/{0}", StatusServerId);
}
}
// TODO JTA: Craete a UnregisterServerFast using DispatchASync.
public void RegisterForNotification(string varId)
{
Client.SendText("v.api/apis/EV/NOTIFYADD/parameter/{0}/{1}", StatusServerId, varId);
}
void Client_ResponseRecived(object sender, GenericHttpClientEventArgs e)
{
if (e.Error == HTTP_CALLBACK_ERROR.COMPLETED)
{
if (e.RequestPath.Contains("GET/parameter/"))
{
// Get Parameter response
if (!e.ResponseText.Contains("["))
ProcessGetParameterResponse(JsonConvert.DeserializeObject<EvertzPortRestResponse>(e.ResponseText));
else if (e.ResponseText.Contains("["))
{
List<EvertzPortRestResponse> test = JsonConvert.DeserializeObject<List<EvertzPortRestResponse>>(e.ResponseText);
foreach (var thing in test)
{
ProcessGetParameterResponse(thing);
}
}
}
else if (e.RequestPath.Contains("SERVERSTATUS"))
{
PollAll();
ProcessServerStatusRequest(JsonConvert.DeserializeObject<EvertsStatusRequesstResponse>(e.ResponseText));
}
}
}
public class EvertzPortsRestResponse
{
List<EvertzPortRestResponse> test;
}
public class EvertzPortRestResponse
{
public string id;
public string name;
public string type;
public string value;
}
public class EvertzEndpointPort
{
public string PortName;
public string SyncVarID;
public string ResolutionVarID;
public bool SyncDetected;
public string Resolution;
public BoolFeedback SyncDetectedFeedback;
public EvertzEndpointPort (string portName, string syncVarId, string resolutionVarId)
{
PortName = portName;
SyncVarID = syncVarId;
ResolutionVarID = resolutionVarId;
SyncDetectedFeedback = new BoolFeedback(() => { return SyncDetected; });
}
}
}
}

View File

@@ -1,26 +0,0 @@
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
{
/// <summary>
///
/// </summary>
public class EvertzEndpointPropertiesConfig
{
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
public ControlPropertiesConfig Control { get; set; }
public string userName { get; set; }
public string password { get; set; }
public string address { get; set; }
public string controllerKey { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Devices.Common
{
public class EvertzEndpointVarIds
{
private string HdmiPort01SyncStatus = "136.0";
}
}

View File

@@ -107,21 +107,6 @@ namespace PepperDash.Essentials.Devices.Common
properties.ToString());
return new DigitalLogger(key, name, props);
}
else if (groupName == "evertzendpoint")
{
// var comm = CommFactory.CreateCommForDevice(dc);
var props = JsonConvert.DeserializeObject<EvertzEndpointPropertiesConfig>(
properties.ToString());
return new EvertzEndpoint(key, name, props, typeName);
}
else if (typeName == "evertzendpointstatusserver")
{
var server = CommFactory.CreateCommForDevice(dc) as GenericUdpServer;
var props = JsonConvert.DeserializeObject<EvertzEndpointStatusServerPropertiesConfig>(
properties.ToString());
return new EvertzEndpointStatusServer(key, name, server, props);
}
else if (typeName == "genericaudiooutwithvolume")
{
var zone = dc.Properties.Value<uint>("zone");
@@ -395,13 +380,6 @@ namespace PepperDash.Essentials.Devices.Common
}
}
//else if (typeName == "qscdsp")
//{
// var comm = CommFactory.CreateCommForDevice(dc);
// var props = JsonConvert.DeserializeObject<QscDspPropertiesConfig>(
// properties.ToString());
// return new QscDsp(key, name, comm, props);
//}
return null;
}

View File

@@ -26,7 +26,7 @@ namespace PepperDash.Essentials.Devices.Common
public string address;
private bool OnlineStatus;
public BoolFeedback OnlineFeedback;
private ushort CurrentPreset;
//private ushort CurrentPreset;
public IntFeedback PresetFeedback;
public Dictionary<uint, DigitalLoggerCircuit> CircuitStatus;
@@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Devices.Common
});
CircuitIsCritical[circuit] = new BoolFeedback(() =>
{
if (CircuitStatus[circuit].critical != null)
if (CircuitStatus.ContainsKey(circuit))
{
return CircuitStatus[circuit].critical;
}
@@ -114,7 +114,7 @@ namespace PepperDash.Essentials.Devices.Common
});
CircuitState[circuit] = new BoolFeedback(() =>
{
if (CircuitStatus[circuit].state != null)
if (CircuitStatus.ContainsKey(circuit))
{
return CircuitStatus[circuit].state;
}

View File

@@ -979,8 +979,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
meeting.StartTime = b.StartTime;
if (b.EndTime != null)
meeting.EndTime = b.EndTime;
if (b.IsPrivate != null)
meeting.Privacy = b.IsPrivate ? eMeetingPrivacy.Private : eMeetingPrivacy.Public;
meeting.Privacy = b.IsPrivate ? eMeetingPrivacy.Private : eMeetingPrivacy.Public;
// No meeting.Calls data exists for Zoom Rooms. Leaving out for now.

View File

@@ -43,8 +43,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public bool CommDebuggingIsOn;
CTimer LoginMessageReceivedTimer;
CTimer RetryConnectionTimer;
//CTimer LoginMessageReceivedTimer;
//CTimer RetryConnectionTimer;
/// <summary>
/// Gets and returns the scaled volume of the codec

View File

@@ -47,13 +47,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
private bool isZooming;
private bool isFocusing;
//private bool isFocusing;
private bool isMoving
{
get
{
return isPanning || isTilting || isZooming || isFocusing;
return isPanning || isTilting || isZooming;
}
}