mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-06 00:05:05 +00:00
feat: removed rooms and cisco codec
This commit is contained in:
@@ -1,448 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
public class CiscoCodecBookings
|
||||
{
|
||||
public class TotalRows
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ResultInfo
|
||||
{
|
||||
public TotalRows TotalRows { get; set; }
|
||||
}
|
||||
|
||||
public class LastUpdated
|
||||
{
|
||||
string _value;
|
||||
|
||||
public DateTime Value {
|
||||
get
|
||||
{
|
||||
DateTime _valueDateTime;
|
||||
try
|
||||
{
|
||||
_valueDateTime = DateTime.Parse(_value);
|
||||
return _valueDateTime;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new DateTime();
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Id
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Title
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Agenda
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Privacy
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class FirstName
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class LastName
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Email
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Id2
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Organizer
|
||||
{
|
||||
public FirstName FirstName { get; set; }
|
||||
public LastName LastName { get; set; }
|
||||
public Email Email { get; set; }
|
||||
public Id2 Id { get; set; }
|
||||
|
||||
public Organizer()
|
||||
{
|
||||
FirstName = new FirstName();
|
||||
LastName = new LastName();
|
||||
Email = new Email();
|
||||
}
|
||||
}
|
||||
|
||||
public class StartTime
|
||||
{
|
||||
public DateTime Value { get; set; }
|
||||
}
|
||||
|
||||
public class StartTimeBuffer
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class EndTime
|
||||
{
|
||||
public DateTime Value { get; set; }
|
||||
}
|
||||
|
||||
public class EndTimeBuffer
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Time
|
||||
{
|
||||
public StartTime StartTime { get; set; }
|
||||
public StartTimeBuffer StartTimeBuffer { get; set; }
|
||||
public EndTime EndTime { get; set; }
|
||||
public EndTimeBuffer EndTimeBuffer { get; set; }
|
||||
|
||||
public Time()
|
||||
{
|
||||
StartTime = new StartTime();
|
||||
EndTime = new EndTime();
|
||||
}
|
||||
}
|
||||
|
||||
public class MaximumMeetingExtension
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class MeetingExtensionAvailability
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class BookingStatus
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class BookingStatusMessage
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Enabled
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Url
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class MeetingNumber
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Password
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class HostKey
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class DialInNumbers
|
||||
{
|
||||
}
|
||||
|
||||
public class Webex
|
||||
{
|
||||
public Enabled Enabled { get; set; }
|
||||
public Url Url { get; set; }
|
||||
public MeetingNumber MeetingNumber { get; set; }
|
||||
public Password Password { get; set; }
|
||||
public HostKey HostKey { get; set; }
|
||||
public DialInNumbers DialInNumbers { get; set; }
|
||||
}
|
||||
|
||||
public class Encryption
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Role
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Recording
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Number
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Protocol
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CallRate
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CallType
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Call
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Number Number { get; set; }
|
||||
public Protocol Protocol { get; set; }
|
||||
public CallRate CallRate { get; set; }
|
||||
public CallType CallType { get; set; }
|
||||
}
|
||||
|
||||
public class Calls
|
||||
{
|
||||
public List<Call> Call {get; set;}
|
||||
}
|
||||
|
||||
public class ConnectMode
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class DialInfo
|
||||
{
|
||||
public Calls Calls { get; set; }
|
||||
public ConnectMode ConnectMode { get; set; }
|
||||
|
||||
public DialInfo()
|
||||
{
|
||||
Calls = new Calls();
|
||||
ConnectMode = new ConnectMode();
|
||||
}
|
||||
}
|
||||
|
||||
public class Booking
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Id Id { get; set; }
|
||||
public Title Title { get; set; }
|
||||
public Agenda Agenda { get; set; }
|
||||
public Privacy Privacy { get; set; }
|
||||
public Organizer Organizer { get; set; }
|
||||
public Time Time { get; set; }
|
||||
public MaximumMeetingExtension MaximumMeetingExtension { get; set; }
|
||||
public MeetingExtensionAvailability MeetingExtensionAvailability { get; set; }
|
||||
public BookingStatus BookingStatus { get; set; }
|
||||
public BookingStatusMessage BookingStatusMessage { get; set; }
|
||||
public Webex Webex { get; set; }
|
||||
public Encryption Encryption { get; set; }
|
||||
public Role Role { get; set; }
|
||||
public Recording Recording { get; set; }
|
||||
public DialInfo DialInfo { get; set; }
|
||||
|
||||
public Booking()
|
||||
{
|
||||
Time = new Time();
|
||||
Id = new Id();
|
||||
Organizer = new Organizer();
|
||||
Title = new Title();
|
||||
Agenda = new Agenda();
|
||||
Privacy = new Privacy();
|
||||
DialInfo = new DialInfo();
|
||||
}
|
||||
}
|
||||
|
||||
public class BookingsListResult
|
||||
{
|
||||
public string status { get; set; }
|
||||
public ResultInfo ResultInfo { get; set; }
|
||||
//public LastUpdated LastUpdated { get; set; }
|
||||
public List<Booking> Booking { get; set; }
|
||||
}
|
||||
|
||||
public class CommandResponse
|
||||
{
|
||||
public BookingsListResult BookingsListResult { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public CommandResponse CommandResponse { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the necessary meeting values from the Cisco bookings response ans converts them to the generic class
|
||||
/// </summary>
|
||||
/// <param name="bookings"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Meeting> GetGenericMeetingsFromBookingResult(List<Booking> bookings)
|
||||
{
|
||||
var meetings = new List<Meeting>();
|
||||
|
||||
if (Debug.Level > 0)
|
||||
{
|
||||
Debug.Console(1, "Meetings List:\n");
|
||||
}
|
||||
|
||||
foreach(Booking b in bookings)
|
||||
{
|
||||
var meeting = new Meeting();
|
||||
|
||||
if(b.Id != null)
|
||||
meeting.Id = b.Id.Value;
|
||||
if(b.Organizer != null)
|
||||
meeting.Organizer = string.Format("{0}, {1}", b.Organizer.LastName.Value, b.Organizer.FirstName.Value);
|
||||
if(b.Title != null)
|
||||
meeting.Title = b.Title.Value;
|
||||
if(b.Agenda != null)
|
||||
meeting.Agenda = b.Agenda.Value;
|
||||
if(b.Time != null)
|
||||
{
|
||||
meeting.StartTime = b.Time.StartTime.Value;
|
||||
meeting.EndTime = b.Time.EndTime.Value;
|
||||
}
|
||||
if(b.Privacy != null)
|
||||
meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value);
|
||||
|
||||
//#warning Update this ConnectMode conversion after testing onsite. Expected value is "OBTP", but in PD NYC Test scenarios, "Manual" is being returned for OBTP meetings
|
||||
if (b.DialInfo.ConnectMode != null)
|
||||
if (b.DialInfo.ConnectMode.Value.ToLower() == "obtp" || b.DialInfo.ConnectMode.Value.ToLower() == "manual")
|
||||
meeting.IsOneButtonToPushMeeting = true;
|
||||
|
||||
meeting.Dialable = b.DialInfo.Calls.Call.Count > 0;
|
||||
|
||||
if (b.DialInfo.Calls.Call != null)
|
||||
{
|
||||
foreach (Call c in b.DialInfo.Calls.Call)
|
||||
{
|
||||
meeting.Calls.Add(new PepperDash.Essentials.Devices.Common.Codec.Call()
|
||||
{
|
||||
Number = c.Number.Value,
|
||||
Protocol = c.Protocol.Value,
|
||||
CallRate = c.CallRate.Value,
|
||||
CallType = c.CallType.Value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
meetings.Add(meeting);
|
||||
|
||||
if(Debug.Level > 0)
|
||||
{
|
||||
Debug.Console(1, "Title: {0}, ID: {1}, Organizer: {2}, Agenda: {3}", meeting.Title, meeting.Id, meeting.Organizer, meeting.Agenda);
|
||||
Debug.Console(1, " Start Time: {0}, End Time: {1}, Duration: {2}", meeting.StartTime, meeting.EndTime, meeting.Duration);
|
||||
Debug.Console(1, " Joinable: {0}\n", meeting.Joinable);
|
||||
}
|
||||
}
|
||||
|
||||
meetings.OrderBy(m => m.StartTime);
|
||||
|
||||
return meetings;
|
||||
}
|
||||
|
||||
public static List<Meeting> GetGenericMeetingsFromBookingResult(List<Booking> bookings, int joinableCooldownSeconds)
|
||||
{
|
||||
var meetings = new List<Meeting>();
|
||||
|
||||
if (Debug.Level > 0)
|
||||
{
|
||||
Debug.Console(1, "Meetings List:\n");
|
||||
}
|
||||
|
||||
foreach (Booking b in bookings)
|
||||
{
|
||||
var meeting = new Meeting(joinableCooldownSeconds);
|
||||
|
||||
if (b.Id != null)
|
||||
meeting.Id = b.Id.Value;
|
||||
if (b.Organizer != null)
|
||||
meeting.Organizer = string.Format("{0}, {1}", b.Organizer.LastName.Value, b.Organizer.FirstName.Value);
|
||||
if (b.Title != null)
|
||||
meeting.Title = b.Title.Value;
|
||||
if (b.Agenda != null)
|
||||
meeting.Agenda = b.Agenda.Value;
|
||||
if (b.Time != null)
|
||||
{
|
||||
meeting.StartTime = b.Time.StartTime.Value;
|
||||
meeting.EndTime = b.Time.EndTime.Value;
|
||||
}
|
||||
if (b.Privacy != null)
|
||||
meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value);
|
||||
|
||||
//#warning Update this ConnectMode conversion after testing onsite. Expected value is "OBTP", but in PD NYC Test scenarios, "Manual" is being returned for OBTP meetings
|
||||
if (b.DialInfo.ConnectMode != null)
|
||||
if (b.DialInfo.ConnectMode.Value.ToLower() == "obtp" || b.DialInfo.ConnectMode.Value.ToLower() == "manual")
|
||||
meeting.IsOneButtonToPushMeeting = true;
|
||||
|
||||
if (b.DialInfo.Calls.Call != null)
|
||||
{
|
||||
foreach (Call c in b.DialInfo.Calls.Call)
|
||||
{
|
||||
meeting.Calls.Add(new PepperDash.Essentials.Devices.Common.Codec.Call()
|
||||
{
|
||||
Number = c.Number.Value,
|
||||
Protocol = c.Protocol.Value,
|
||||
CallRate = c.CallRate.Value,
|
||||
CallType = c.CallType.Value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
meetings.Add(meeting);
|
||||
|
||||
if (Debug.Level > 0)
|
||||
{
|
||||
Debug.Console(1, "Title: {0}, ID: {1}, Organizer: {2}, Agenda: {3}", meeting.Title, meeting.Id, meeting.Organizer, meeting.Agenda);
|
||||
Debug.Console(1, " Start Time: {0}, End Time: {1}, Duration: {2}", meeting.StartTime, meeting.EndTime, meeting.Duration);
|
||||
Debug.Console(1, " Joinable: {0}\n", meeting.Joinable);
|
||||
}
|
||||
}
|
||||
|
||||
meetings.OrderBy(m => m.StartTime);
|
||||
|
||||
return meetings;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,323 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
public class CiscoFarEndCamera : CameraBase, IHasCameraPtzControl, IAmFarEndCamera, IBridgeAdvanced
|
||||
{
|
||||
protected CiscoSparkCodec ParentCodec { get; private set; }
|
||||
|
||||
protected string CallId {
|
||||
get
|
||||
{
|
||||
return (ParentCodec as CiscoSparkCodec).GetCallId();
|
||||
}
|
||||
}
|
||||
|
||||
public CiscoFarEndCamera(string key, string name, CiscoSparkCodec codec)
|
||||
: base(key, name)
|
||||
{
|
||||
Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom;
|
||||
|
||||
ParentCodec = codec;
|
||||
}
|
||||
|
||||
#region IHasCameraPtzControl Members
|
||||
|
||||
public void PositionHome()
|
||||
{
|
||||
// Not supported on far end camera
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraPanControl Members
|
||||
|
||||
public void PanLeft()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Left CallId: {0}", CallId));
|
||||
}
|
||||
|
||||
public void PanRight()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Right CallId: {0}", CallId));
|
||||
}
|
||||
|
||||
public void PanStop()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraTiltControl Members
|
||||
|
||||
public void TiltDown()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Down CallId: {0}", CallId));
|
||||
}
|
||||
|
||||
public void TiltUp()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: Up CallId: {0}", CallId));
|
||||
}
|
||||
|
||||
public void TiltStop()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraZoomControl Members
|
||||
|
||||
public void ZoomIn()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: ZoomIn CallId: {0}", CallId));
|
||||
}
|
||||
|
||||
public void ZoomOut()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Move Value: ZoomOut CallId: {0}", CallId));
|
||||
}
|
||||
|
||||
public void ZoomStop()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
void Stop()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Call FarEndControl Camera Stop CallId: {0}", CallId));
|
||||
}
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
public class CiscoSparkCamera : CameraBase, IHasCameraPtzControl, IHasCameraFocusControl, IBridgeAdvanced
|
||||
{
|
||||
/// <summary>
|
||||
/// The codec this camera belongs to
|
||||
/// </summary>
|
||||
protected CiscoSparkCodec ParentCodec { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the camera on the codec
|
||||
/// </summary>
|
||||
public uint CameraId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valid range 1-15
|
||||
/// </summary>
|
||||
protected uint PanSpeed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valid range 1-15
|
||||
/// </summary>
|
||||
protected uint TiltSpeed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valid range 1-15
|
||||
/// </summary>
|
||||
protected uint ZoomSpeed { get; private set; }
|
||||
|
||||
private bool isPanning;
|
||||
|
||||
private bool isTilting;
|
||||
|
||||
private bool isZooming;
|
||||
|
||||
private bool isFocusing;
|
||||
|
||||
private bool isMoving
|
||||
{
|
||||
get
|
||||
{
|
||||
return isPanning || isTilting || isZooming || isFocusing;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public CiscoSparkCamera(string key, string name, CiscoSparkCodec codec, uint id)
|
||||
: base(key, name)
|
||||
{
|
||||
// Default to all capabilties
|
||||
Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom | eCameraCapabilities.Focus;
|
||||
|
||||
ParentCodec = codec;
|
||||
|
||||
CameraId = id;
|
||||
|
||||
// Set default speeds
|
||||
PanSpeed = 7;
|
||||
TiltSpeed = 7;
|
||||
ZoomSpeed = 7;
|
||||
}
|
||||
|
||||
|
||||
// Takes a string from the camera capabilities value and converts from "ptzf" to enum bitmask
|
||||
public void SetCapabilites(string capabilites)
|
||||
{
|
||||
var c = capabilites.ToLower();
|
||||
|
||||
if (c.Contains("p"))
|
||||
Capabilities = Capabilities | eCameraCapabilities.Pan;
|
||||
|
||||
if (c.Contains("t"))
|
||||
Capabilities = Capabilities | eCameraCapabilities.Tilt;
|
||||
|
||||
if (c.Contains("z"))
|
||||
Capabilities = Capabilities | eCameraCapabilities.Zoom;
|
||||
|
||||
if (c.Contains("f"))
|
||||
Capabilities = Capabilities | eCameraCapabilities.Focus;
|
||||
}
|
||||
|
||||
#region IHasCameraPtzControl Members
|
||||
|
||||
public void PositionHome()
|
||||
{
|
||||
// Not supported on Internal Spark Camera
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraPanControl Members
|
||||
|
||||
public void PanLeft()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Pan: Left PanSpeed: {1}", CameraId, PanSpeed));
|
||||
isPanning = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void PanRight()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Pan: Right PanSpeed: {1}", CameraId, PanSpeed));
|
||||
isPanning = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void PanStop()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Pan: Stop", CameraId));
|
||||
isPanning = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region IHasCameraTiltControl Members
|
||||
|
||||
public void TiltDown()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Tilt: Down TiltSpeed: {1}", CameraId, TiltSpeed));
|
||||
isTilting = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void TiltUp()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Tilt: Up TiltSpeed: {1}", CameraId, TiltSpeed));
|
||||
isTilting = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void TiltStop()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Tilt: Stop", CameraId));
|
||||
isTilting = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraZoomControl Members
|
||||
|
||||
public void ZoomIn()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Zoom: In ZoomSpeed: {1}", CameraId, ZoomSpeed));
|
||||
isZooming = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ZoomOut()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Zoom: Out ZoomSpeed: {1}", CameraId, ZoomSpeed));
|
||||
isZooming = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ZoomStop()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Zoom: Stop", CameraId));
|
||||
isZooming = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHasCameraFocusControl Members
|
||||
|
||||
public void FocusNear()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Focus: Near", CameraId));
|
||||
isFocusing = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void FocusFar()
|
||||
{
|
||||
if (!isMoving)
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Focus: Far", CameraId));
|
||||
isFocusing = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void FocusStop()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera Ramp CameraId: {0} Focus: Stop", CameraId));
|
||||
isFocusing = false;
|
||||
}
|
||||
|
||||
public void TriggerAutoFocus()
|
||||
{
|
||||
ParentCodec.EnqueueCommand(string.Format("xCommand Camera TriggerAutofocus CameraId: {0}", CameraId));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkCameraToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
using System;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges.JoinMaps;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
public class CiscoCodecJoinMap : VideoCodecControllerJoinMap
|
||||
{
|
||||
#region Digital
|
||||
|
||||
[JoinName("PresentationLocalOnly")]
|
||||
public JoinDataComplete PresentationLocalOnly = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 205,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Presentation Local Only Feedback",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("PresentationLocalRemote")]
|
||||
public JoinDataComplete PresentationLocalRemote = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 206,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Presentation Local and Remote Feedback",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("ActivateDoNotDisturbMode")]
|
||||
public JoinDataComplete ActivateDoNotDisturbMode = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 241,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Activates Do Not Disturb Mode. FB High if active.",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DeactivateDoNotDisturbMode")]
|
||||
public JoinDataComplete DeactivateDoNotDisturbMode = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 242,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Deactivates Do Not Disturb Mode. FB High if deactivated.",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("ToggleDoNotDisturbMode")]
|
||||
public JoinDataComplete ToggleDoNotDisturbMode = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 243,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Toggles Do Not Disturb Mode.",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("ActivateStandby")]
|
||||
public JoinDataComplete ActivateStandby = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 246,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Activates Standby Mode. FB High if active.",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("DeactivateStandby")]
|
||||
public JoinDataComplete DeactivateStandby = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 247,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Deactivates Standby Mode. FB High if deactivated.",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("ActivateHalfWakeMode")]
|
||||
public JoinDataComplete ActivateHalfWakeMode = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 248,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Activates Half Wake Mode. FB High if active.",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
[JoinName("EnteringStandbyMode")]
|
||||
public JoinDataComplete EnteringStandbyMode = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 249,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "High to indicate that the codec is entering standby mode",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Digital
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Analog
|
||||
|
||||
[JoinName("RingtoneVolume")]
|
||||
public JoinDataComplete RingtoneVolume = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 21,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Ringtone volume set/FB. Valid values are 0 - 100 in increments of 5 (5, 10, 15, 20, etc.)",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
[JoinName("PresentationSource")]
|
||||
public JoinDataComplete PresentationSource = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 201,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Presentation set/FB. Valid values are 0 - 6 depending on the codec model.",
|
||||
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
|
||||
JoinType = eJoinType.Analog
|
||||
});
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Serials
|
||||
|
||||
[JoinName("CommandToDevice")]
|
||||
public JoinDataComplete CommandToDevice = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 5,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Sends a serial command to the device. Do not include the delimiter, it will be added automatically.",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public CiscoCodecJoinMap(uint joinStart)
|
||||
: base(joinStart, typeof(CiscoCodecJoinMap))
|
||||
{
|
||||
}
|
||||
|
||||
public CiscoCodecJoinMap(uint joinStart, Type type)
|
||||
: base(joinStart, type)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,91 +0,0 @@
|
||||
extern alias Full;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
using Full.Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public class CiscoSparkCodecPropertiesConfig
|
||||
{
|
||||
[JsonProperty("communicationMonitorProperties")]
|
||||
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
|
||||
|
||||
[JsonProperty("favorites")]
|
||||
public List<CodecActiveCallItem> Favorites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Valid values: "Local" or "Corporate"
|
||||
/// </summary>
|
||||
[JsonProperty("phonebookMode")]
|
||||
public string PhonebookMode { get; set; }
|
||||
|
||||
[JsonProperty("showSelfViewByDefault")]
|
||||
public bool ShowSelfViewByDefault { get; set; }
|
||||
|
||||
[JsonProperty("sharing")]
|
||||
public SharingProperties Sharing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables external source switching capability
|
||||
/// </summary>
|
||||
[JsonProperty("externalSourceListEnabled")]
|
||||
public bool ExternalSourceListEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the routing input port on the codec to which the external switch is connected
|
||||
/// </summary>
|
||||
[JsonProperty("externalSourceInputPort")]
|
||||
public string ExternalSourceInputPort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optionsal property to set the limit of any phonebook queries for directory or searching
|
||||
/// </summary>
|
||||
[JsonProperty("phonebookResultsLimit")]
|
||||
public uint PhonebookResultsLimit { get; set; }
|
||||
|
||||
[JsonProperty("UiBranding")]
|
||||
public BrandingLogoProperties UiBranding { get; set; }
|
||||
|
||||
[JsonProperty("cameraInfo")]
|
||||
public List<CameraInfo> CameraInfo { get; set; }
|
||||
|
||||
|
||||
public CiscoSparkCodecPropertiesConfig()
|
||||
{
|
||||
CameraInfo = new List<CameraInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
public class SharingProperties
|
||||
{
|
||||
[JsonProperty("autoShareContentWhileInCall")]
|
||||
public bool AutoShareContentWhileInCall { get; set; }
|
||||
}
|
||||
|
||||
public class BrandingLogoProperties
|
||||
{
|
||||
[JsonProperty("enable")]
|
||||
public bool Enable { get; set; }
|
||||
|
||||
[JsonProperty("brandingUrl")]
|
||||
public string BrandingUrl { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes configuration information for the near end cameras
|
||||
/// </summary>
|
||||
public class CameraInfo
|
||||
{
|
||||
public int CameraNumber { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int SourceId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.Net.Http;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
public class HttpApiServer
|
||||
{
|
||||
public static Dictionary<string, string> ExtensionContentTypes;
|
||||
|
||||
public event EventHandler<OnHttpRequestArgs> ApiRequest;
|
||||
public Crestron.SimplSharp.Net.Http.HttpServer HttpServer { get; private set; }
|
||||
|
||||
public string HtmlRoot { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SIMPL+ can only execute the default constructor. If you have variables that require initialization, please
|
||||
/// use an Initialize method
|
||||
/// </summary>
|
||||
public HttpApiServer()
|
||||
{
|
||||
ExtensionContentTypes = new Dictionary<string, string>
|
||||
{
|
||||
{ ".css", "text/css" },
|
||||
{ ".htm", "text/html" },
|
||||
{ ".html", "text/html" },
|
||||
{ ".jpg", "image/jpeg" },
|
||||
{ ".jpeg", "image/jpeg" },
|
||||
{ ".js", "application/javascript" },
|
||||
{ ".json", "application/json" },
|
||||
{ ".xml", "text/xml" },
|
||||
{ ".map", "application/x-navimap" },
|
||||
{ ".pdf", "application.pdf" },
|
||||
{ ".png", "image/png" },
|
||||
{ ".txt", "text/plain" },
|
||||
};
|
||||
HtmlRoot = @"\HTML";
|
||||
}
|
||||
|
||||
|
||||
public void Start(int port)
|
||||
{
|
||||
// TEMP - this should be inserted by configuring class
|
||||
|
||||
HttpServer = new Crestron.SimplSharp.Net.Http.HttpServer();
|
||||
HttpServer.ServerName = "Cisco API Server";
|
||||
HttpServer.KeepAlive = true;
|
||||
HttpServer.Port = port;
|
||||
HttpServer.OnHttpRequest += Server_Request;
|
||||
HttpServer.Open();
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += (a) =>
|
||||
{
|
||||
if (a == eProgramStatusEventType.Stopping)
|
||||
{
|
||||
HttpServer.Close();
|
||||
Debug.Console(1, "Shutting down HTTP Server on port {0}", HttpServer.Port);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void Server_Request(object sender, OnHttpRequestArgs args)
|
||||
{
|
||||
if (args.Request.Header.RequestType == "OPTIONS")
|
||||
{
|
||||
Debug.Console(2, "Asking for OPTIONS");
|
||||
args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*");
|
||||
args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS");
|
||||
return;
|
||||
}
|
||||
|
||||
string path = Uri.UnescapeDataString(args.Request.Path);
|
||||
var host = args.Request.DataConnection.RemoteEndPointAddress;
|
||||
//string authToken;
|
||||
|
||||
Debug.Console(2, "HTTP Request: {2}: Path='{0}' ?'{1}'", path, args.Request.QueryString, host);
|
||||
|
||||
// ----------------------------------- ADD AUTH HERE
|
||||
if (path.StartsWith("/cisco/api"))
|
||||
{
|
||||
var handler = ApiRequest;
|
||||
if (ApiRequest != null)
|
||||
ApiRequest(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetContentType(string extension)
|
||||
{
|
||||
string type;
|
||||
if (ExtensionContentTypes.ContainsKey(extension))
|
||||
type = ExtensionContentTypes[extension];
|
||||
else
|
||||
type = "text/plain";
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,397 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
public class CiscoCodecPhonebook
|
||||
{
|
||||
public class Offset
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Limit
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class TotalRows
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ResultInfo
|
||||
{
|
||||
public Offset Offset { get; set; }
|
||||
public Limit Limit { get; set; }
|
||||
public TotalRows TotalRows { get; set; }
|
||||
}
|
||||
|
||||
public class LocalId
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class FolderId
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ParentFolderId
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Name
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Folder
|
||||
{
|
||||
public string id { get; set; }
|
||||
public LocalId LocalId { get; set; }
|
||||
public FolderId FolderId { get; set; }
|
||||
public Name Name { get; set; }
|
||||
public ParentFolderId ParentFolderId { get; set; }
|
||||
}
|
||||
|
||||
public class Name2
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ContactId
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class FolderId2
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Title
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ContactMethodId
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Number
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Device
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CallType
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ContactMethod
|
||||
{
|
||||
public string id { get; set; }
|
||||
public ContactMethodId ContactMethodId { get; set; }
|
||||
public Number Number { get; set; }
|
||||
public Device Device { get; set; }
|
||||
public CallType CallType { get; set; }
|
||||
|
||||
public ContactMethod()
|
||||
{
|
||||
ContactMethodId = new ContactMethodId();
|
||||
Number = new Number();
|
||||
Device = new Device();
|
||||
CallType = new CallType();
|
||||
}
|
||||
}
|
||||
|
||||
public class Contact
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Name2 Name { get; set; }
|
||||
public ContactId ContactId { get; set; }
|
||||
public FolderId2 FolderId { get; set; }
|
||||
public Title Title { get; set; }
|
||||
public List<ContactMethod> ContactMethod { get; set; }
|
||||
|
||||
public Contact()
|
||||
{
|
||||
Name = new Name2();
|
||||
ContactId = new ContactId();
|
||||
FolderId = new FolderId2();
|
||||
Title = new Title();
|
||||
ContactMethod = new List<ContactMethod>();
|
||||
}
|
||||
}
|
||||
|
||||
public class PhonebookSearchResult
|
||||
{
|
||||
public string status { get; set; }
|
||||
public ResultInfo ResultInfo { get; set; }
|
||||
public List<Folder> Folder { get; set; }
|
||||
public List<Contact> Contact { get; set; }
|
||||
|
||||
public PhonebookSearchResult()
|
||||
{
|
||||
Folder = new List<Folder>();
|
||||
Contact = new List<Contact>();
|
||||
ResultInfo = new ResultInfo();
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandResponse
|
||||
{
|
||||
public PhonebookSearchResult PhonebookSearchResult { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public CommandResponse CommandResponse { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the folders with no ParentFolder and returns them sorted alphabetically
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
public static List<DirectoryItem> GetRootFoldersFromSearchResult(PhonebookSearchResult result)
|
||||
{
|
||||
var rootFolders = new List<DirectoryItem>();
|
||||
|
||||
if (result.Folder.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (result.Folder.Count > 0)
|
||||
{
|
||||
if (Debug.Level > 0)
|
||||
Debug.Console(1, "Phonebook Folders:\n");
|
||||
|
||||
foreach (Folder f in result.Folder)
|
||||
{
|
||||
var folder = new DirectoryFolder();
|
||||
|
||||
folder.Name = f.Name.Value;
|
||||
folder.FolderId = f.FolderId.Value;
|
||||
|
||||
if (f.ParentFolderId == null)
|
||||
rootFolders.Add(folder);
|
||||
|
||||
if (Debug.Level > 0)
|
||||
Debug.Console(1, "+ {0}", folder.Name);
|
||||
}
|
||||
}
|
||||
|
||||
rootFolders.OrderBy(f => f.Name);
|
||||
|
||||
return rootFolders;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the contacts with no FolderId and returns them sorted alphabetically
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
public static List<DirectoryItem> GetRootContactsFromSearchResult(PhonebookSearchResult result)
|
||||
{
|
||||
var rootContacts = new List<DirectoryItem>();
|
||||
|
||||
if (result.Contact.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (result.Contact.Count > 0)
|
||||
{
|
||||
if (Debug.Level > 0)
|
||||
Debug.Console(1, "Root Contacts:\n");
|
||||
|
||||
foreach (Contact c in result.Contact)
|
||||
{
|
||||
var contact = new DirectoryContact();
|
||||
|
||||
if (string.IsNullOrEmpty(c.FolderId.Value))
|
||||
{
|
||||
contact.Name = c.Name.Value;
|
||||
contact.ContactId = c.ContactId.Value;
|
||||
|
||||
if(!string.IsNullOrEmpty(c.Title.Value))
|
||||
contact.Title = c.Title.Value;
|
||||
|
||||
if (Debug.Level > 0)
|
||||
Debug.Console(1, "{0}\nContact Methods:", contact.Name);
|
||||
|
||||
foreach (ContactMethod m in c.ContactMethod)
|
||||
{
|
||||
|
||||
var tempContactMethod = new PepperDash.Essentials.Devices.Common.Codec.ContactMethod();
|
||||
|
||||
eContactMethodCallType callType = eContactMethodCallType.Unknown;
|
||||
if (!string.IsNullOrEmpty(m.CallType.Value))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m.CallType.Value))
|
||||
{
|
||||
if (m.CallType.Value.ToLower() == "audio")
|
||||
callType = eContactMethodCallType.Audio;
|
||||
else if (m.CallType.Value.ToLower() == "video")
|
||||
callType = eContactMethodCallType.Video;
|
||||
|
||||
tempContactMethod.CallType = callType;
|
||||
}
|
||||
}
|
||||
|
||||
eContactMethodDevice device = eContactMethodDevice.Unknown;
|
||||
if (!string.IsNullOrEmpty(m.Device.Value))
|
||||
{
|
||||
|
||||
if (m.Device.Value.ToLower() == "mobile")
|
||||
device = eContactMethodDevice.Mobile;
|
||||
else if (m.Device.Value.ToLower() == "telephone")
|
||||
device = eContactMethodDevice.Telephone;
|
||||
else if (m.Device.Value.ToLower() == "video")
|
||||
device = eContactMethodDevice.Video;
|
||||
else if (m.Device.Value.ToLower() == "other")
|
||||
device = eContactMethodDevice.Other;
|
||||
|
||||
tempContactMethod.Device = device;
|
||||
}
|
||||
|
||||
if (Debug.Level > 0)
|
||||
Debug.Console(1, "Number: {0}", m.Number.Value);
|
||||
|
||||
tempContactMethod.Number = m.Number.Value;
|
||||
tempContactMethod.ContactMethodId = m.ContactMethodId.Value;
|
||||
|
||||
contact.ContactMethods.Add(tempContactMethod);
|
||||
}
|
||||
rootContacts.Add(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootContacts.OrderBy(f => f.Name);
|
||||
|
||||
return rootContacts;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts data returned from a cisco codec to the generic Directory format.
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <param name="resultFolder"></param>
|
||||
/// <returns></returns>
|
||||
public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result)
|
||||
{
|
||||
var directory = new Codec.CodecDirectory();
|
||||
|
||||
var folders = new List<Codec.DirectoryItem>();
|
||||
|
||||
var contacts = new List<Codec.DirectoryItem>();
|
||||
|
||||
try
|
||||
{
|
||||
if (result.Folder.Count > 0)
|
||||
{
|
||||
foreach (Folder f in result.Folder)
|
||||
{
|
||||
var folder = new DirectoryFolder();
|
||||
|
||||
folder.Name = f.Name.Value;
|
||||
folder.FolderId = f.FolderId.Value;
|
||||
|
||||
if (f.ParentFolderId != null)
|
||||
{
|
||||
folder.ParentFolderId = f.ParentFolderId.Value;
|
||||
}
|
||||
|
||||
folders.Add(folder);
|
||||
}
|
||||
|
||||
folders.OrderBy(f => f.Name);
|
||||
|
||||
directory.AddFoldersToDirectory(folders);
|
||||
}
|
||||
|
||||
if (result.Contact.Count > 0)
|
||||
{
|
||||
foreach (Contact c in result.Contact)
|
||||
{
|
||||
var contact = new DirectoryContact();
|
||||
|
||||
contact.Name = c.Name.Value;
|
||||
contact.ContactId = c.ContactId.Value;
|
||||
if (!string.IsNullOrEmpty(c.Title.Value))
|
||||
contact.Title = c.Title.Value;
|
||||
|
||||
if (c.FolderId != null)
|
||||
{
|
||||
contact.FolderId = c.FolderId.Value;
|
||||
}
|
||||
|
||||
foreach (ContactMethod m in c.ContactMethod)
|
||||
{
|
||||
eContactMethodCallType callType = eContactMethodCallType.Unknown;
|
||||
if (!string.IsNullOrEmpty(m.CallType.Value))
|
||||
{
|
||||
if (m.CallType.Value.ToLower() == "audio")
|
||||
callType = eContactMethodCallType.Audio;
|
||||
else if (m.CallType.Value.ToLower() == "video")
|
||||
callType = eContactMethodCallType.Video;
|
||||
}
|
||||
|
||||
eContactMethodDevice device = eContactMethodDevice.Unknown;
|
||||
|
||||
if (!string.IsNullOrEmpty(m.Device.Value))
|
||||
{
|
||||
if (m.Device.Value.ToLower() == "mobile")
|
||||
device = eContactMethodDevice.Mobile;
|
||||
else if (m.Device.Value.ToLower() == "telephone")
|
||||
device = eContactMethodDevice.Telephone;
|
||||
else if (m.Device.Value.ToLower() == "video")
|
||||
device = eContactMethodDevice.Video;
|
||||
else if (m.Device.Value.ToLower() == "other")
|
||||
device = eContactMethodDevice.Other;
|
||||
}
|
||||
|
||||
contact.ContactMethods.Add(new PepperDash.Essentials.Devices.Common.Codec.ContactMethod()
|
||||
{
|
||||
Number = m.Number.Value,
|
||||
ContactMethodId = m.ContactMethodId.Value,
|
||||
CallType = callType,
|
||||
Device = device
|
||||
});
|
||||
}
|
||||
contacts.Add(contact);
|
||||
}
|
||||
|
||||
contacts.OrderBy(c => c.Name);
|
||||
|
||||
directory.AddContactsToDirectory(contacts);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(1, "Error converting Cisco Phonebook results to generic: {0}", e);
|
||||
}
|
||||
|
||||
return directory;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
public enum eExternalSourceMode {Ready, NotReady, Hidden, Error}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
public enum eExternalSourceType {camera, desktop, document_camera, mediaplayer, PC, whiteboard, other}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,166 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
/// <summary>
|
||||
/// This class exists to capture serialized data sent back by a Cisco codec in JSON output mode
|
||||
/// </summary>
|
||||
public class CiscoCodecEvents
|
||||
{
|
||||
public class CauseValue
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CauseType
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CauseString
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class OrigCallDirection
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class RemoteURI
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class DisplayName
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CallId
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CauseCode
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CauseOrigin
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Protocol
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Duration
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CallType
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CallRate
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Encryption
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class RequestedURI
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class PeopleCountAverage
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class CallDisconnect
|
||||
{
|
||||
public string id { get; set; }
|
||||
public CauseValue CauseValue { get; set; }
|
||||
public CauseType CauseType { get; set; }
|
||||
public CauseString CauseString { get; set; }
|
||||
public OrigCallDirection OrigCallDirection { get; set; }
|
||||
public RemoteURI RemoteURI { get; set; }
|
||||
public DisplayName DisplayName { get; set; }
|
||||
public CallId CallId { get; set; }
|
||||
public CauseCode CauseCode { get; set; }
|
||||
public CauseOrigin CauseOrigin { get; set; }
|
||||
public Protocol Protocol { get; set; }
|
||||
public Duration Duration { get; set; }
|
||||
public CallType CallType { get; set; }
|
||||
public CallRate CallRate { get; set; }
|
||||
public Encryption Encryption { get; set; }
|
||||
public RequestedURI RequestedURI { get; set; }
|
||||
public PeopleCountAverage PeopleCountAverage { get; set; }
|
||||
}
|
||||
public class UserInterface
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Presentation Presentation { get; set; }
|
||||
}
|
||||
public class Presentation
|
||||
{
|
||||
public string id { get; set; }
|
||||
public ExternalSource ExternalSource { get; set; }
|
||||
}
|
||||
public class ExternalSource
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Selected Selected { get; set; }
|
||||
}
|
||||
public class Selected
|
||||
{
|
||||
public string id { get; set; }
|
||||
public SourceIdentifier SourceIdentifier { get; set; }
|
||||
}
|
||||
public class SourceIdentifier
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
public class Event
|
||||
{
|
||||
public CallDisconnect CallDisconnect { get; set; }
|
||||
public UserInterface UserInterface { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public Event Event { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user