mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-04 07:14:58 +00:00
Added mechanism for Meetings list to notify UI layer of meeting events
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
@@ -15,7 +16,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
void RemoveCallHistoryEntry(CodecCallHistory.CallHistoryEntry entry);
|
||||
}
|
||||
|
||||
public enum eCodecOccurrenctType
|
||||
public enum eCodecOccurrenceType
|
||||
{
|
||||
Unknown = 0,
|
||||
Placed,
|
||||
@@ -28,7 +29,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
/// </summary>
|
||||
public class CodecCallHistory
|
||||
{
|
||||
event EventHandler<EventArgs> RecentCallsListHasChanged;
|
||||
public event EventHandler<EventArgs> RecentCallsListHasChanged;
|
||||
|
||||
public List<CallHistoryEntry> RecentCalls { get; private set; }
|
||||
|
||||
@@ -78,7 +79,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
public class CallHistoryEntry : CodecActiveCallItem
|
||||
{
|
||||
public DateTime StartTime { get; set; }
|
||||
public eCodecOccurrenctType OccurenceType { get; set; }
|
||||
public eCodecOccurrenceType OccurenceType { get; set; }
|
||||
public string OccurrenceHistoryId { get; set; }
|
||||
}
|
||||
|
||||
@@ -115,117 +116,27 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
/// Takes the Cisco occurence type and converts it to the matching enum
|
||||
/// </summary>
|
||||
/// <param name="s"></para
|
||||
public eCodecOccurrenctType ConvertToOccurenceTypeEnum(string s)
|
||||
public eCodecOccurrenceType ConvertToOccurenceTypeEnum(string s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "Placed":
|
||||
{
|
||||
return eCodecOccurrenctType.Placed;
|
||||
return eCodecOccurrenceType.Placed;
|
||||
}
|
||||
case "Received":
|
||||
{
|
||||
return eCodecOccurrenctType.Received;
|
||||
return eCodecOccurrenceType.Received;
|
||||
}
|
||||
case "NoAnswer":
|
||||
{
|
||||
return eCodecOccurrenctType.NoAnswer;
|
||||
return eCodecOccurrenceType.NoAnswer;
|
||||
}
|
||||
default:
|
||||
return eCodecOccurrenctType.Unknown;
|
||||
return eCodecOccurrenceType.Unknown;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CiscoCallHistory
|
||||
{
|
||||
|
||||
public class CallbackNumber
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class DisplayName
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class LastOccurrenceStartTime
|
||||
{
|
||||
public DateTime Value { get; set; }
|
||||
}
|
||||
|
||||
public class LastOccurrenceDaysAgo
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class LastOccurrenceHistoryId
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class OccurrenceType
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class IsAcknowledged
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class OccurrenceCount
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Entry
|
||||
{
|
||||
public string id { get; set; }
|
||||
public CallbackNumber CallbackNumber { get; set; }
|
||||
public DisplayName DisplayName { get; set; }
|
||||
public LastOccurrenceStartTime LastOccurrenceStartTime { get; set; }
|
||||
public LastOccurrenceDaysAgo LastOccurrenceDaysAgo { get; set; }
|
||||
public LastOccurrenceHistoryId LastOccurrenceHistoryId { get; set; }
|
||||
public OccurrenceType OccurrenceType { get; set; }
|
||||
public IsAcknowledged IsAcknowledged { get; set; }
|
||||
public OccurrenceCount OccurrenceCount { get; set; }
|
||||
}
|
||||
|
||||
public class Offset
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Limit
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ResultInfo
|
||||
{
|
||||
public Offset Offset { get; set; }
|
||||
public Limit Limit { get; set; }
|
||||
}
|
||||
|
||||
public class CallHistoryRecentsResult
|
||||
{
|
||||
public string status { get; set; }
|
||||
public List<Entry> Entry { get; set; }
|
||||
public ResultInfo ResultInfo { get; set; }
|
||||
}
|
||||
|
||||
public class CommandResponse
|
||||
{
|
||||
public CallHistoryRecentsResult CallHistoryRecentsResult { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public CommandResponse CommandResponse { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,15 @@ using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
public enum eMeetingEventChangeType
|
||||
{
|
||||
Unkown = 0,
|
||||
MeetingStartWarning,
|
||||
MeetingStart,
|
||||
MeetingEndWarning,
|
||||
MeetingEnd
|
||||
}
|
||||
|
||||
public interface IHasScheduleAwareness
|
||||
{
|
||||
CodecScheduleAwareness CodecSchedule { get; }
|
||||
@@ -13,11 +22,52 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
|
||||
public class CodecScheduleAwareness
|
||||
{
|
||||
public event EventHandler<MeetingEventArgs> MeetingEventChange;
|
||||
|
||||
public event EventHandler<EventArgs> MeetingsListHasChanged;
|
||||
|
||||
public List<Meeting> Meetings { get; set; }
|
||||
|
||||
private CTimer ScheduleChecker;
|
||||
|
||||
public CodecScheduleAwareness()
|
||||
{
|
||||
Meetings = new List<Meeting>();
|
||||
|
||||
ScheduleChecker = new CTimer(CheckSchedule, null, 1000, 1000);
|
||||
}
|
||||
|
||||
private void OnMeetingChange(eMeetingEventChangeType changeType, Meeting meeting)
|
||||
{
|
||||
var handler = MeetingEventChange;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new MeetingEventArgs() { ChangeType = changeType, Meeting = meeting });
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckSchedule(object o)
|
||||
{
|
||||
// Iterate the meeting list and check if any meeting need to do anythingk
|
||||
|
||||
foreach (Meeting m in Meetings)
|
||||
{
|
||||
eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown;
|
||||
|
||||
if (m.TimeToMeetingStart.TotalMinutes == m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start
|
||||
changeType = eMeetingEventChangeType.MeetingStartWarning;
|
||||
else if (m.TimeToMeetingStart.TotalMinutes == 0) // Meeting Start
|
||||
changeType = eMeetingEventChangeType.MeetingStart;
|
||||
else if (m.TimeToMeetingEnd.TotalMinutes == m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to end
|
||||
changeType = eMeetingEventChangeType.MeetingEndWarning;
|
||||
else if (m.TimeToMeetingEnd.TotalMinutes == 0) // Meeting has ended
|
||||
changeType = eMeetingEventChangeType.MeetingEnd;
|
||||
|
||||
if(changeType != eMeetingEventChangeType.Unkown)
|
||||
OnMeetingChange(changeType, m);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +76,25 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
/// </summary>
|
||||
public class Meeting
|
||||
{
|
||||
public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5);
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Organizer { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Agenda { get; set; }
|
||||
public TimeSpan TimeToMeetingStart {
|
||||
get
|
||||
{
|
||||
return StartTime - DateTime.Now;
|
||||
}
|
||||
}
|
||||
public TimeSpan TimeToMeetingEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndTime - DateTime.Now;
|
||||
}
|
||||
}
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
public TimeSpan Duration
|
||||
@@ -44,12 +109,8 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
{
|
||||
get
|
||||
{
|
||||
var timeToMeetingStart = StartTime - DateTime.Now;
|
||||
|
||||
var timetoMeetingEnd = DateTime.Now - EndTime;
|
||||
|
||||
// Meeting is joinable from 5 minutes before start until 5 minutes before end
|
||||
if (timeToMeetingStart.Minutes <= 5 && timetoMeetingEnd.Minutes >= 5)
|
||||
if (TimeToMeetingStart.TotalMinutes <= MeetingWarningMinutes.TotalMinutes && TimeToMeetingEnd.TotalMinutes >= MeetingWarningMinutes.TotalMinutes)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -58,4 +119,10 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
||||
public string ConferenceNumberToDial { get; set; }
|
||||
public string ConferencePassword { get; set; }
|
||||
}
|
||||
|
||||
public class MeetingEventArgs : EventArgs
|
||||
{
|
||||
public eMeetingEventChangeType ChangeType { get; set; }
|
||||
public Meeting Meeting { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Streaming\Roku.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\BookingsDataClasses.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\CallHistoryDataClasses.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\CiscoCodec.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\CiscoCodecPropertiesConfig.cs" />
|
||||
<Compile Include="VideoCodec\CiscoCodec\PhonebookDataClasses.cs" />
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
public class CiscoCallHistory
|
||||
{
|
||||
public class CallbackNumber
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class DisplayName
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class LastOccurrenceStartTime
|
||||
{
|
||||
public DateTime Value { get; set; }
|
||||
}
|
||||
|
||||
public class LastOccurrenceDaysAgo
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class LastOccurrenceHistoryId
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class OccurrenceType
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class IsAcknowledged
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class OccurrenceCount
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Entry
|
||||
{
|
||||
public string id { get; set; }
|
||||
public CallbackNumber CallbackNumber { get; set; }
|
||||
public DisplayName DisplayName { get; set; }
|
||||
public LastOccurrenceStartTime LastOccurrenceStartTime { get; set; }
|
||||
public LastOccurrenceDaysAgo LastOccurrenceDaysAgo { get; set; }
|
||||
public LastOccurrenceHistoryId LastOccurrenceHistoryId { get; set; }
|
||||
public OccurrenceType OccurrenceType { get; set; }
|
||||
public IsAcknowledged IsAcknowledged { get; set; }
|
||||
public OccurrenceCount OccurrenceCount { get; set; }
|
||||
}
|
||||
|
||||
public class Offset
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class Limit
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class ResultInfo
|
||||
{
|
||||
public Offset Offset { get; set; }
|
||||
public Limit Limit { get; set; }
|
||||
}
|
||||
|
||||
public class CallHistoryRecentsResult
|
||||
{
|
||||
public string status { get; set; }
|
||||
public List<Entry> Entry { get; set; }
|
||||
public ResultInfo ResultInfo { get; set; }
|
||||
}
|
||||
|
||||
public class CommandResponse
|
||||
{
|
||||
public CallHistoryRecentsResult CallHistoryRecentsResult { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public CommandResponse CommandResponse { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
public class CiscoCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory, IHasScheduleAwareness
|
||||
{
|
||||
public event EventHandler<EventArgs> UpcomingMeetingWarning;
|
||||
|
||||
public event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
|
||||
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
|
||||
Reference in New Issue
Block a user