got it building...

This commit is contained in:
Andrew Welker
2020-11-19 14:16:34 -07:00
parent ef215e8b16
commit f3ddce99d5
21 changed files with 1260 additions and 766 deletions

View File

@@ -46,6 +46,13 @@ namespace PepperDash.Essentials.Core.Devices.Codec
RecentCalls = new List<CallHistoryEntry> {_listEmptyEntry};
}
public void UpdateRecentCallsList(List<CallHistoryEntry> entries)
{
RecentCalls = entries;
OnRecentCallsListChange();
}
private void OnRecentCallsListChange()
{
var handler = RecentCallsListHasChanged;

View File

@@ -22,24 +22,32 @@ namespace PepperDash.Essentials.Core.Devices.Codec
public class CodecScheduleAwareness
{
List<Meeting> _Meetings;
List<Meeting> _meetings;
public event EventHandler<MeetingEventArgs> MeetingEventChange;
public event EventHandler<EventArgs> MeetingsListHasChanged;
/// <summary>
/// Setter triggers MeetingsListHasChanged event
/// </summary>
private int _meetingWarningMinutes = 5;
public int MeetingWarningMinutes
{
get { return _meetingWarningMinutes; }
set { _meetingWarningMinutes = value; }
}
/// <summary>
/// Setter triggers MeetingsListHasChanged event
/// </summary>
public List<Meeting> Meetings
{
get
{
return _Meetings;
return _meetings;
}
set
{
_Meetings = value;
_meetings = value;
var handler = MeetingsListHasChanged;
if (handler != null)
@@ -49,13 +57,20 @@ namespace PepperDash.Essentials.Core.Devices.Codec
}
}
private CTimer ScheduleChecker;
private CTimer _scheduleChecker;
public CodecScheduleAwareness()
{
Meetings = new List<Meeting>();
ScheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000);
_scheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000);
}
public CodecScheduleAwareness(long pollTime)
{
Meetings = new List<Meeting>();
_scheduleChecker = new CTimer(CheckSchedule, null, pollTime, pollTime);
}
private void OnMeetingChange(eMeetingEventChangeType changeType, Meeting meeting)
@@ -72,9 +87,9 @@ namespace PepperDash.Essentials.Core.Devices.Codec
// Iterate the meeting list and check if any meeting need to do anythingk
const double meetingTimeEpsilon = 0.0001;
foreach (Meeting m in Meetings)
foreach (var m in Meetings)
{
eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown;
var changeType = eMeetingEventChangeType.Unkown;
if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start
changeType = eMeetingEventChangeType.MeetingStartWarning;
@@ -98,12 +113,17 @@ namespace PepperDash.Essentials.Core.Devices.Codec
/// </summary>
public class Meeting
{
public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5);
public int MinutesBeforeMeeting;
public string Id { get; set; }
public string Organizer { get; set; }
public string Title { get; set; }
public string Agenda { get; set; }
public TimeSpan MeetingWarningMinutes
{
get { return TimeSpan.FromMinutes(MinutesBeforeMeeting); }
}
public TimeSpan TimeToMeetingStart
{
get
@@ -132,7 +152,7 @@ namespace PepperDash.Essentials.Core.Devices.Codec
{
get
{
return StartTime.AddMinutes(-5) <= DateTime.Now
return StartTime.AddMinutes(-MinutesBeforeMeeting) <= DateTime.Now
&& DateTime.Now <= EndTime; //.AddMinutes(-5);
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Devices.Common.Cameras
{
/// <summary>
/// Describes a camera with preset functionality
/// </summary>
public interface IHasCameraPresets
{
event EventHandler<EventArgs> PresetsListHasChanged;
List<CameraPreset> Presets { get; }
void PresetSelect(int preset);
void PresetStore(int preset, string description);
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Presets;
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
/// <summary>
/// Interface for camera presets
/// </summary>
public interface IHasCodecRoomPresets
{
event EventHandler<EventArgs> CodecRoomPresetsListHasChanged;
List<CodecRoomPreset> NearEndPresets { get; }
List<CodecRoomPreset> FarEndRoomPresets { get; }
void CodecRoomPresetSelect(int preset);
void CodecRoomPresetStore(int preset, string description);
}
/// <summary>
/// Represents a room preset on a video codec. Typically stores camera position(s) and video routing. Can be recalled by Far End if enabled.
/// </summary>
public class CodecRoomPreset : PresetBase
{
public CodecRoomPreset(int id, string description, bool def, bool isDef)
: base(id, description, def, isDef)
{
}
}
}

View File

@@ -199,11 +199,13 @@
<Compile Include="Devices\DeviceFeedbackExtensions.cs" />
<Compile Include="Devices\GenericIRController.cs" />
<Compile Include="Devices\IDspPreset.cs" />
<Compile Include="Devices\Interfaces\IHasCameraPresets.cs" />
<Compile Include="Devices\Interfaces\IProjectorInterfaces.cs" />
<Compile Include="Devices\PC\InRoomPc.cs" />
<Compile Include="Devices\PC\Laptop.cs" />
<Compile Include="Devices\Base Classes\ReconfigurableDevice.cs" />
<Compile Include="Devices\Base Classes\VideoCodecBase.cs" />
<Compile Include="Devices\RoomPresets.cs" />
<Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" />
<Compile Include="DeviceTypeInterfaces\Codec\IHasExternalSourceSwitching.cs" />
<Compile Include="DeviceTypeInterfaces\Codec\IHasParticipants.cs" />

View File

@@ -1,4 +1,4 @@
namespace PepperDash.Essentials
namespace PepperDash.Essentials.Core
{
/// <summary>
///

View File

@@ -5,6 +5,7 @@ using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Rooms.Config;
namespace PepperDash.Essentials.Core
@@ -20,6 +21,21 @@ namespace PepperDash.Essentials.Core
protected Func<bool> IsWarmingFeedbackFunc;
protected string LastSourceKey;
public string LogoUrlLightBkgnd { get; set; }
public string LogoUrlDarkBkgnd { get; set; }
/// <summary>
/// Indicates if this room is Mobile Control Enabled
/// </summary>
public bool IsMobileControlEnabled { get; private set; }
/// <summary>
/// The bridge for this room if Mobile Control is enabled
/// </summary>
public IMobileControlRoomBridge MobileControlRoomBridge { get; private set; }
/// <summary>
///
/// </summary>
@@ -222,6 +238,27 @@ namespace PepperDash.Essentials.Core
VacancyMode = eVacancyMode.None;
}
/// <summary>
/// If mobile control is enabled, sets the appropriate properties
/// </summary>
void SetUpMobileControl()
{
var mcBridgeKey = string.Format("mobileControlBridge-{0}", Key);
var mcBridge = DeviceManager.GetDeviceForKey(mcBridgeKey);
if (mcBridge == null)
{
Debug.Console(1, this, "*********************Mobile Control Bridge Not found for this room.");
IsMobileControlEnabled = false;
return;
}
else
{
MobileControlRoomBridge = mcBridge as IMobileControlRoomBridge;
Debug.Console(1, this, "*********************Mobile Control Bridge found and enabled for this room");
IsMobileControlEnabled = true;
}
}
private void SetupShutdownPrompt()
{
// Setup the ShutdownPromptTimer

View File

@@ -15,7 +15,7 @@ namespace PepperDash.Essentials.Devices.Common
/// <summary>
/// Represents and audio endpoint
/// </summary>
public class GenericAudioOut : EssentialsDevice, IRoutingSinkNoSwitching
public class GenericAudioOut : EssentialsDevice, IRoutingSink
{
public event SourceInfoChangeHandler CurrentSourceChange;

View File

@@ -98,7 +98,6 @@
<Compile Include="AudioCodec\MockAC\MockAC.cs" />
<Compile Include="AudioCodec\MockAC\MockAcPropertiesConfig.cs" />
<Compile Include="Cameras\CameraVisca.cs" />
<Compile Include="Cameras\IHasCameraPresets.cs" />
<Compile Include="ImageProcessors\TVOneCorio.cs" />
<Compile Include="ImageProcessors\TVOneCorioPropertiesConfig.cs" />
<Compile Include="Power Controllers\Digitallogger.cs" />
@@ -107,7 +106,6 @@
<Compile Include="ImageProcessors\AnalogWay\AnalogWayLiveCorePropertiesConfig.cs" />
<Compile Include="SoftCodec\BlueJeansPc.cs" />
<Compile Include="VideoCodec\CiscoCodec\CiscoCamera.cs" />
<Compile Include="VideoCodec\CiscoCodec\RoomPresets.cs" />
<Compile Include="Display\PanasonicThDisplay.cs" />
<Compile Include="Display\ComTcpDisplayBase.cs" />
<Compile Include="Display\AvocorVTFDisplay.cs" />

View File

@@ -94,9 +94,9 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec
/// <returns></returns>
bool DoRoute(SourceRouteListItem route)
{
IRoutingSinkNoSwitching dest = null;
IRoutingSink dest = null;
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching;
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink;
if (dest == null)
{

View File

@@ -289,6 +289,36 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public RoutingOutputPort HdmiOut1 { get; private set; }
public RoutingOutputPort HdmiOut2 { get; private set; }
public static List<CodecRoomPreset> GetGenericPresets(List<CiscoCodecStatus.RoomPreset> presets)
{
var cameraPresets = new List<CodecRoomPreset>();
if (Debug.Level > 0)
{
Debug.Console(1, "Presets List:");
}
foreach (CiscoCodecStatus.RoomPreset preset in presets)
{
try
{
var cameraPreset = new CodecRoomPreset(UInt16.Parse(preset.id), preset.Description.Value, preset.Defined.BoolValue, true);
cameraPresets.Add(cameraPreset);
if (Debug.Level > 0)
{
Debug.Console(1, "Added Preset ID: {0}, Description: {1}, IsDefined: {2}, isDefinable: {3}", cameraPreset.ID, cameraPreset.Description, cameraPreset.Defined, cameraPreset.IsDefinable);
}
}
catch (Exception e)
{
Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", preset.id, e);
}
}
return cameraPresets;
}
// Constructor for IBasicCommunication
public CiscoSparkCodec(DeviceConfig config, IBasicCommunication comm)
@@ -457,6 +487,57 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
TieLineCollection.Default.Add(tl);
}
public void ConvertCiscoCallHistoryToGeneric(List<CiscoCallHistory.Entry> entries)
{
var genericEntries = new List<CodecCallHistory.CallHistoryEntry>();
foreach (CiscoCallHistory.Entry entry in entries)
{
genericEntries.Add(new CodecCallHistory.CallHistoryEntry()
{
Name = entry.DisplayName.Value,
Number = entry.CallbackNumber.Value,
StartTime = entry.LastOccurrenceStartTime.Value,
OccurrenceHistoryId = entry.LastOccurrenceHistoryId.Value,
OccurrenceType = ConvertToOccurenceTypeEnum(entry.OccurrenceType.Value)
});
}
// Check if list is empty and if so, add an item to display No Recent Calls
if (genericEntries.Count == 0)
genericEntries.Add(CallHistory.ListEmptyEntry);
CallHistory.UpdateCallHistory(genericEntries);
}
/// <summary>
/// Takes the Cisco occurence type and converts it to the matching enum
/// </summary>
/// <param name="s"></para
public eCodecOccurrenceType ConvertToOccurenceTypeEnum(string s)
{
switch (s)
{
case "Placed":
{
return eCodecOccurrenceType.Placed;
}
case "Received":
{
return eCodecOccurrenceType.Received;
}
case "NoAnswer":
{
return eCodecOccurrenceType.NoAnswer;
}
default:
return eCodecOccurrenceType.Unknown;
}
}
public void InitializeBranding(string roomKey)
{
Debug.Console(1, this, "Initializing Branding for room {0}", roomKey);
@@ -902,7 +983,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CodecStatus.Status.RoomPreset = existingRoomPresets;
// Generecise the list
NearEndPresets = RoomPresets.GetGenericPresets(CodecStatus.Status.RoomPreset);
NearEndPresets = GetGenericPresets(CodecStatus.Status.RoomPreset);
var handler = CodecRoomPresetsListHasChanged;
if (handler != null)
@@ -976,7 +1057,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
JsonConvert.PopulateObject(response, codecCallHistory);
CallHistory.ConvertCiscoCallHistoryToGeneric(codecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry);
ConvertCiscoCallHistoryToGeneric(codecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry);
}
else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1 || response.IndexOf("\"CallHistoryDeleteEntryResult\": {") > -1)
{

View File

@@ -241,7 +241,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
foreach (ContactMethod m in c.ContactMethod)
{
var tempContactMethod = new Essentials.Core.Devices.Codec.ContactMethod();
var tempContactMethod = new Codec.ContactMethod();
eContactMethodCallType callType = eContactMethodCallType.Unknown;
if (!string.IsNullOrEmpty(m.CallType.Value))
@@ -300,11 +300,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <returns></returns>
public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result)
{
var directory = new Essentials.Core.Devices.Codec.CodecDirectory();
var directory = new CodecDirectory();
var folders = new List<Essentials.Core.Devices.Codec.DirectoryItem>();
var folders = new List<DirectoryItem>();
var contacts = new List<Essentials.Core.Devices.Codec.DirectoryItem>();
var contacts = new List<DirectoryItem>();
try
{
@@ -371,7 +371,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
device = eContactMethodDevice.Other;
}
contact.ContactMethods.Add(new Essentials.Core.Devices.Codec.ContactMethod()
contact.ContactMethods.Add(new Codec.ContactMethod()
{
Number = m.Number.Value,
ContactMethodId = m.ContactMethodId.Value,

View File

@@ -1,81 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Presets;
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
/// <summary>
/// Interface for camera presets
/// </summary>
public interface IHasCodecRoomPresets
{
event EventHandler<EventArgs> CodecRoomPresetsListHasChanged;
List<CodecRoomPreset> NearEndPresets { get; }
List<CodecRoomPreset> FarEndRoomPresets { get; }
void CodecRoomPresetSelect(int preset);
void CodecRoomPresetStore(int preset, string description);
}
public static class RoomPresets
{
/// <summary>
/// Converts Cisco RoomPresets to generic CameraPresets
/// </summary>
/// <param name="presets"></param>
/// <returns></returns>
public static List<CodecRoomPreset> GetGenericPresets(List<CiscoCodecStatus.RoomPreset> presets)
{
var cameraPresets = new List<CodecRoomPreset>();
if (Debug.Level > 0)
{
Debug.Console(1, "Presets List:");
}
foreach (CiscoCodecStatus.RoomPreset preset in presets)
{
try
{
var cameraPreset = new CodecRoomPreset(UInt16.Parse(preset.id), preset.Description.Value, preset.Defined.BoolValue, true);
cameraPresets.Add(cameraPreset);
if (Debug.Level > 0)
{
Debug.Console(1, "Added Preset ID: {0}, Description: {1}, IsDefined: {2}, isDefinable: {3}", cameraPreset.ID, cameraPreset.Description, cameraPreset.Defined, cameraPreset.IsDefinable);
}
}
catch (Exception e)
{
Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", preset.id, e);
}
}
return cameraPresets;
}
}
/// <summary>
/// Represents a room preset on a video codec. Typically stores camera position(s) and video routing. Can be recalled by Far End if enabled.
/// </summary>
public class CodecRoomPreset : PresetBase
{
public CodecRoomPreset(int id, string description, bool def, bool isDef)
: base(id, description, def, isDef)
{
}
}
}