General code cleanup and updates to Huddle UI drivers to comply with Vtc1 changes

This commit is contained in:
Neil Dorin
2017-10-30 11:50:22 -06:00
parent 5f5c963fa4
commit 0ede2e9973
13 changed files with 1319 additions and 1017 deletions

View File

@@ -21,7 +21,9 @@ namespace PepperDash.Essentials.Devices.Common.Codec
{
public abstract bool MultiSiteOptionIsEnabled { get; }
public abstract string IpAddress { get; }
public abstract string PhoneNumber { get; }
public abstract string SipPhoneNumber { get; }
public abstract string E164Alias { get; }
public abstract string H323Id { get; }
public abstract string SipUri { get; }
public abstract bool AutoAnswerEnabled { get; }
}

View File

@@ -1285,7 +1285,27 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
return string.Empty;
}
}
public override string PhoneNumber
public override string E164Alias
{
get
{
if (CodecConfiguration.Configuration.H323.H323Alias.E164 != null)
return CodecConfiguration.Configuration.H323.H323Alias.E164.Value;
else
return string.Empty;
}
}
public override string H323Id
{
get
{
if (CodecConfiguration.Configuration.H323.H323Alias.ID != null)
return CodecConfiguration.Configuration.H323.H323Alias.E164.Value;
else
return string.Empty;
}
}
public override string SipPhoneNumber
{
get
{

View File

@@ -5,7 +5,10 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
@@ -212,9 +215,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Mode7 Mode { get; set; }
}
public class Framerate
{
public string valueSpaceRef { get; set; }
public string Value { get; set; }
}
public class Camera
{
public string id { get; set; }
public Framerate Framerate { get; set; }
public Backlight Backlight { get; set; }
public Brightness Brightness { get; set; }
public Focus Focus { get; set; }
@@ -243,9 +253,68 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public class Cameras
{
//[JsonConverter(typeof(CameraConverter))]
//public List<Camera> Camera { get; set; }
//[JsonConverter(typeof(CameraConverter)), JsonProperty("Camera")]
//public List<Camera> Camera { get; set; }
//[JsonProperty("SpeakerTrack")]
public SpeakerTrack SpeakerTrack { get; set; }
public Cameras()
{
//Camera = new List<Camera>();
SpeakerTrack = new SpeakerTrack();
}
}
public class CameraConverter : JsonConverter
{
// this is currently not working
public override bool CanConvert(System.Type objectType)
{
return objectType == typeof(Camera) || objectType == typeof(List<Camera>); // This should not be called but is required for implmentation
}
public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
{
try
{
if (reader.TokenType == JsonToken.StartArray)
{
var l = new List<Camera>();
reader.Read();
while (reader.TokenType != JsonToken.EndArray)
{
l.Add(reader.Value as Camera);
reader.Read();
}
Debug.Console(1, "[xConfiguration]: Cameras converted as list");
return l;
}
else
{
Debug.Console(1, "[xConfiguration]: Camera converted as single object and added to list");
return new List<Camera> { reader.Value as Camera };
}
}
catch (Exception e)
{
Debug.Console(1, "[xConfiguration]: Unable to convert JSON for camera objects: {0}", e);
return new List<Camera>();
}
}
public override bool CanWrite
{
get
{
return false;
}
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException("Write not implemented");
}
}
public class Delay

View File

@@ -315,17 +315,70 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public class Cameras
{
//[JsonConverter(typeof(CameraConverter))]
//public List<Camera> Camera { get; set; }
// [JsonConverter(typeof(CameraConverter))]
public List<Camera> Camera { get; set; }
public SpeakerTrack SpeakerTrack { get; set; }
public Cameras()
{
//Camera = new List<Camera>();
Camera = new List<Camera>();
SpeakerTrack = new SpeakerTrack();
}
}
//public class CameraConverter : JsonConverter
//{
// public override bool CanConvert(System.Type objectType)
// {
// return true; // objectType == typeof(Camera) || objectType == typeof(List<Camera>); // This should not be called but is required for implmentation
// }
// public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
// {
// try
// {
// if (reader.TokenType == JsonToken.StartArray)
// {
// var l = new List<Camera>();
// reader.Read();
// while (reader.TokenType != JsonToken.EndArray)
// {
// l.Add(reader.Value as Camera);
// reader.Read();
// }
// Debug.Console(1, "[xStatus]: Cameras converted as list");
// return l;
// }
// else
// {
// Debug.Console(1, "[xStatus]: Camera converted as single object and added to list");
// return new List<Camera> { reader.Value as Camera };
// }
// }
// catch (Exception e)
// {
// Debug.Console(1, "[xStatus]: Unable to convert JSON for camera objects: {0}", e);
// return new List<Camera>();
// }
// }
// public override bool CanWrite
// {
// get
// {
// return false;
// }
// }
// public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
// {
// throw new NotImplementedException("Write not implemented");
// }
//}
public class MaxActiveCalls
{
public string Value { get; set; }

View File

@@ -402,12 +402,22 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
get { return true; }
}
public override string IpAddress
public override string E164Alias
{
get { return "xx.xx.xx.xx"; }
get { return "someE164alias"; }
}
public override string PhoneNumber
public override string H323Id
{
get { return "someH323Id"; }
}
public override string IpAddress
{
get { return "xxx.xxx.xxx.xxx"; }
}
public override string SipPhoneNumber
{
get { return "333-444-5555"; }
}

View File

@@ -43,8 +43,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
bool wasIsInCall;
/// <summary>
/// Returns true when any call is not in state Unknown, Disconnecting, Disconnected
/// </summary>