mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
Started working on Room Occupancy
This commit is contained in:
@@ -142,6 +142,7 @@
|
|||||||
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
|
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
|
||||||
<Compile Include="Ramps and Increments\NumericalHelpers.cs" />
|
<Compile Include="Ramps and Increments\NumericalHelpers.cs" />
|
||||||
<Compile Include="Ramps and Increments\UshortSigIncrementer.cs" />
|
<Compile Include="Ramps and Increments\UshortSigIncrementer.cs" />
|
||||||
|
<Compile Include="Room\iHasOccupancyAwareness.cs" />
|
||||||
<Compile Include="Routing\ICardPortsDevice.cs" />
|
<Compile Include="Routing\ICardPortsDevice.cs" />
|
||||||
<Compile Include="InUseTracking\IInUseTracking.cs" />
|
<Compile Include="InUseTracking\IInUseTracking.cs" />
|
||||||
<Compile Include="InUseTracking\InUseTracking.cs" />
|
<Compile Include="InUseTracking\InUseTracking.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Room
|
||||||
|
{
|
||||||
|
public interface IHasOccupancyAwareness
|
||||||
|
{
|
||||||
|
OccupancyStatus RoomOccupancy { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OccupancyStatus
|
||||||
|
{
|
||||||
|
BoolFeedback RoomIsOccupied { get; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,15 @@ using Crestron.SimplSharp;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common.Codec
|
namespace PepperDash.Essentials.Devices.Common.Codec
|
||||||
{
|
{
|
||||||
|
public enum eMeetingEventChangeType
|
||||||
|
{
|
||||||
|
Unkown = 0,
|
||||||
|
MeetingStartWarning,
|
||||||
|
MeetingStart,
|
||||||
|
MeetingEndWarning,
|
||||||
|
MeetingEnd
|
||||||
|
}
|
||||||
|
|
||||||
public interface IHasScheduleAwareness
|
public interface IHasScheduleAwareness
|
||||||
{
|
{
|
||||||
CodecScheduleAwareness CodecSchedule { get; }
|
CodecScheduleAwareness CodecSchedule { get; }
|
||||||
@@ -13,11 +22,70 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
|||||||
|
|
||||||
public class CodecScheduleAwareness
|
public class CodecScheduleAwareness
|
||||||
{
|
{
|
||||||
public List<Meeting> Meetings { get; set; }
|
List<Meeting> _Meetings;
|
||||||
|
|
||||||
|
public event EventHandler<MeetingEventArgs> MeetingEventChange;
|
||||||
|
|
||||||
|
public event EventHandler<EventArgs> MeetingsListHasChanged;
|
||||||
|
|
||||||
|
public List<Meeting> Meetings
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Meetings;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_Meetings = value;
|
||||||
|
|
||||||
|
var handler = MeetingsListHasChanged;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
handler(this, new EventArgs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CTimer ScheduleChecker;
|
||||||
|
|
||||||
public CodecScheduleAwareness()
|
public CodecScheduleAwareness()
|
||||||
{
|
{
|
||||||
Meetings = new List<Meeting>();
|
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 +94,26 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Meeting
|
public class Meeting
|
||||||
{
|
{
|
||||||
|
public TimeSpan MeetingWarningMinutes = TimeSpan.FromMinutes(5);
|
||||||
|
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Organizer { get; set; }
|
public string Organizer { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Agenda { 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 StartTime { get; set; }
|
||||||
public DateTime EndTime { get; set; }
|
public DateTime EndTime { get; set; }
|
||||||
public TimeSpan Duration
|
public TimeSpan Duration
|
||||||
@@ -51,4 +135,11 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
|||||||
public string ConferenceNumberToDial { get; set; }
|
public string ConferenceNumberToDial { get; set; }
|
||||||
public string ConferencePassword { get; set; }
|
public string ConferencePassword { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MeetingEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public eMeetingEventChangeType ChangeType { get; set; }
|
||||||
|
public Meeting Meeting { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -130,6 +130,8 @@
|
|||||||
<Compile Include="DSP\PolycomSoundStructure\SoundStructureBasics.cs" />
|
<Compile Include="DSP\PolycomSoundStructure\SoundStructureBasics.cs" />
|
||||||
<Compile Include="Factory\DeviceFactory.cs" />
|
<Compile Include="Factory\DeviceFactory.cs" />
|
||||||
<Compile Include="Generic\GenericSource.cs" />
|
<Compile Include="Generic\GenericSource.cs" />
|
||||||
|
<Compile Include="Occupancy\GlsOirCsmExBatt.cs" />
|
||||||
|
<Compile Include="Occupancy\iOccupancyStatusProvider.cs" />
|
||||||
<Compile Include="PC\InRoomPc.cs" />
|
<Compile Include="PC\InRoomPc.cs" />
|
||||||
<Compile Include="PC\Laptop.cs" />
|
<Compile Include="PC\Laptop.cs" />
|
||||||
<Compile Include="SetTopBox\SetTopBoxPropertiesConfig.cs" />
|
<Compile Include="SetTopBox\SetTopBoxPropertiesConfig.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||||
|
{
|
||||||
|
public class EssentialsGlsOirCsmExBatt : GlsOccupancySensorBase, IOccupancyStatusProvider
|
||||||
|
{
|
||||||
|
public GlsOirCsmExBatt OccSensor { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||||
|
{
|
||||||
|
public interface IOccupancyStatusProvider
|
||||||
|
{
|
||||||
|
// Need to define a common interface that can be applied to Crestron Occ sensor as well as 3rd party devices. How to accomplish?
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -288,8 +288,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
|||||||
|
|
||||||
meetings.OrderBy(m => m.StartTime);
|
meetings.OrderBy(m => m.StartTime);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return meetings;
|
return meetings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharp.Net.Https;
|
using Crestron.SimplSharp.Net.Https;
|
||||||
using Crestron.SimplSharp.CrestronXml;
|
using Crestron.SimplSharp.CrestronXml;
|
||||||
using Crestron.SimplSharp.CrestronXml.Serialization;
|
using Crestron.SimplSharp.CrestronXml.Serialization;
|
||||||
|
//using Crestron.SimplSharpPro;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Cisco_One_Button_To_Push;
|
using Cisco_One_Button_To_Push;
|
||||||
using Cisco_SX80_Corporate_Phone_Book;
|
using Cisco_SX80_Corporate_Phone_Book;
|
||||||
@@ -34,6 +35,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||||
|
|
||||||
|
//public BoolOutputSig OccupancyDetectedFeedback { get; private set; }
|
||||||
|
|
||||||
public IntFeedback PeopleCountFeedback { get; private set; }
|
public IntFeedback PeopleCountFeedback { get; private set; }
|
||||||
|
|
||||||
public BoolFeedback SpeakerTrackIsOnFeedback { get; private set; }
|
public BoolFeedback SpeakerTrackIsOnFeedback { get; private set; }
|
||||||
@@ -628,6 +631,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
JsonConvert.PopulateObject(response, codecBookings);
|
JsonConvert.PopulateObject(response, codecBookings);
|
||||||
|
|
||||||
CodecSchedule.Meetings = CiscoCodecBookings.GetGenericMeetingsFromBookingResult(codecBookings.CommandResponse.BookingsListResult.Booking);
|
CodecSchedule.Meetings = CiscoCodecBookings.GetGenericMeetingsFromBookingResult(codecBookings.CommandResponse.BookingsListResult.Booking);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user