cleaned out framework files; added framework submodule; referneced p.core to reference in framework; moved essentials.sln; changed paths in sln to match; test build

This commit is contained in:
Heath Volmer
2018-06-28 13:59:14 -06:00
parent 058ea730ed
commit 0e9d1e4c35
413 changed files with 33026 additions and 71338 deletions

View File

@@ -0,0 +1,354 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.Fusion;
using PepperDash.Core;
using PepperDash.Essentials;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Occupancy;
namespace PepperDash.Essentials.Fusion
{
public class EssentialsHuddleVtc1FusionController : EssentialsHuddleSpaceFusionSystemControllerBase
{
BooleanSigData CodecIsInCall;
public EssentialsHuddleVtc1FusionController(EssentialsHuddleVtc1Room room, uint ipId)
: base(room, ipId)
{
}
/// <summary>
/// Called in base class constructor before RVI and GUID files are built
/// </summary>
protected override void ExecuteCustomSteps()
{
SetUpCodec();
}
/// <summary>
/// Creates a static asset for the codec and maps the joins to the main room symbol
/// </summary>
void SetUpCodec()
{
try
{
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
if (codec == null)
{
Debug.Console(1, this, "Cannot link codec to Fusion because codec is null");
return;
}
codec.UsageTracker = new UsageTracking(codec);
codec.UsageTracker.UsageIsTracked = true;
codec.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
var codecPowerOnAction = new Action<bool>(b => { if (!b) codec.StandbyDeactivate(); });
var codecPowerOffAction = new Action<bool>(b => { if (!b) codec.StandbyActivate(); });
// Map FusionRoom Attributes:
// Codec volume
var codecVolume = FusionRoom.CreateOffsetUshortSig(50, "Volume - Fader01", eSigIoMask.InputOutputSig);
codecVolume.OutputSig.UserObject = new Action<ushort>(b => (codec as IBasicVolumeWithFeedback).SetVolume(b));
(codec as IBasicVolumeWithFeedback).VolumeLevelFeedback.LinkInputSig(codecVolume.InputSig);
// In Call Status
CodecIsInCall = FusionRoom.CreateOffsetBoolSig(69, "Conf - VC 1 In Call", eSigIoMask.InputSigOnly);
codec.CallStatusChange += new EventHandler<PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
// Online status
if (codec is ICommunicationMonitor)
{
var c = codec as ICommunicationMonitor;
var codecOnline = FusionRoom.CreateOffsetBoolSig(122, "Online - VC 1", eSigIoMask.InputSigOnly);
codecOnline.InputSig.BoolValue = c.CommunicationMonitor.Status == MonitorStatus.IsOk;
c.CommunicationMonitor.StatusChange += (o, a) =>
{
codecOnline.InputSig.BoolValue = a.Status == MonitorStatus.IsOk;
};
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", codec.Key, "Online - VC 1");
}
// Codec IP Address
bool codecHasIpInfo = false;
var codecComm = codec.Communication;
string codecIpAddress = string.Empty;
int codecIpPort = 0;
StringSigData codecIpAddressSig;
StringSigData codecIpPortSig;
if(codecComm is GenericSshClient)
{
codecIpAddress = (codecComm as GenericSshClient).Hostname;
codecIpPort = (codecComm as GenericSshClient).Port;
codecHasIpInfo = true;
}
else if (codecComm is GenericTcpIpClient)
{
codecIpAddress = (codecComm as GenericTcpIpClient).Hostname;
codecIpPort = (codecComm as GenericTcpIpClient).Port;
codecHasIpInfo = true;
}
if (codecHasIpInfo)
{
codecIpAddressSig = FusionRoom.CreateOffsetStringSig(121, "IP Address - VC", eSigIoMask.InputSigOnly);
codecIpAddressSig.InputSig.StringValue = codecIpAddress;
codecIpPortSig = FusionRoom.CreateOffsetStringSig(150, "IP Port - VC", eSigIoMask.InputSigOnly);
codecIpPortSig.InputSig.StringValue = codecIpPort.ToString();
}
var tempAsset = new FusionAsset();
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(c => c.Key.Equals(codec.Key));
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
{
tempAsset = FusionStaticAssets[deviceConfig.Uid];
}
else
{
// Create a new asset
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), codec.Name, "Codec", "");
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
}
var codecAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
codecAsset.PowerOn.OutputSig.UserObject = codecPowerOnAction;
codecAsset.PowerOff.OutputSig.UserObject = codecPowerOffAction;
codec.StandbyIsOnFeedback.LinkComplementInputSig(codecAsset.PowerOn.InputSig);
// TODO: Map relevant attributes on asset symbol
codecAsset.TrySetMakeModel(codec);
codecAsset.TryLinkAssetErrorToCommunication(codec);
}
catch (Exception e)
{
Debug.Console(1, this, "Error setting up codec in Fusion: {0}", e);
}
}
void codec_CallStatusChange(object sender, PepperDash.Essentials.Devices.Common.Codec.CodecCallStatusItemChangeEventArgs e)
{
var codec = (Room as EssentialsHuddleVtc1Room).VideoCodec;
CodecIsInCall.InputSig.BoolValue = codec.IsInCall;
}
// These methods are overridden because they access the room class which is of a different type
protected override void CreateSymbolAndBasicSigs(uint ipId)
{
Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid);
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
FusionRoom.ExtenderFusionRoomDataReservedSigs.Use();
FusionRoom.Register();
FusionRoom.FusionStateChange += FusionRoom_FusionStateChange;
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange;
FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange;
FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange;
CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);
// Room to fusion room
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
// Moved to
CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
(Room as EssentialsHuddleVtc1Room).CurrentSingleSourceChange += Room_CurrentSourceInfoChange;
FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"));
// NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);
FusionRoom.ErrorMessage.InputSig.StringValue =
"3: 7 Errors: This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;";
GetProcessorEthernetValues();
GetSystemInfo();
GetProcessorInfo();
CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
}
protected override void SetUpSources()
{
// Sources
var dict = ConfigReader.ConfigObject.GetSourceListForKey((Room as EssentialsHuddleVtc1Room).SourceListKey);
if (dict != null)
{
// NEW PROCESS:
// Make these lists and insert the fusion attributes by iterating these
var setTopBoxes = dict.Where(d => d.Value.SourceDevice is ISetTopBoxControls);
uint i = 1;
foreach (var kvp in setTopBoxes)
{
TryAddRouteActionSigs("Display 1 - Source TV " + i, 188 + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
break;
}
var discPlayers = dict.Where(d => d.Value.SourceDevice is IDiscPlayerControls);
i = 1;
foreach (var kvp in discPlayers)
{
TryAddRouteActionSigs("Display 1 - Source DVD " + i, 181 + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 5) // We only have five spots
break;
}
var laptops = dict.Where(d => d.Value.SourceDevice is Laptop);
i = 1;
foreach (var kvp in laptops)
{
TryAddRouteActionSigs("Display 1 - Source Laptop " + i, 166 + i, kvp.Key, kvp.Value.SourceDevice);
i++;
if (i > 10) // We only have ten spots???
break;
}
foreach (var kvp in dict)
{
var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
if (usageDevice != null)
{
usageDevice.UsageTracker = new UsageTracking(usageDevice as Device);
usageDevice.UsageTracker.UsageIsTracked = true;
usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
}
}
}
else
{
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
(Room as EssentialsHuddleVtc1Room).SourceListKey, Room.Key);
}
}
protected override void SetUpDisplay()
{
try
{
//Setup Display Usage Monitoring
var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase);
// Consider updating this in multiple display systems
foreach (DisplayBase display in displays)
{
display.UsageTracker = new UsageTracking(display);
display.UsageTracker.UsageIsTracked = true;
display.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
}
var defaultDisplay = (Room as EssentialsHuddleVtc1Room).DefaultDisplay as DisplayBase;
if (defaultDisplay == null)
{
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
return;
}
var dispPowerOnAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOn(); });
var dispPowerOffAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOff(); });
// Display to fusion room sigs
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
if (defaultDisplay is IDisplayUsage)
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
MapDisplayToRoomJoins(1, 158, defaultDisplay);
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
//Check for existing asset in GUIDs collection
var tempAsset = new FusionAsset();
if (FusionStaticAssets.ContainsKey(deviceConfig.Uid))
{
tempAsset = FusionStaticAssets[deviceConfig.Uid];
}
else
{
// Create a new asset
tempAsset = new FusionAsset(FusionRoomGuids.GetNextAvailableAssetNumber(FusionRoom), defaultDisplay.Name, "Display", "");
FusionStaticAssets.Add(deviceConfig.Uid, tempAsset);
}
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
// Use extension methods
dispAsset.TrySetMakeModel(defaultDisplay);
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
}
catch (Exception e)
{
Debug.Console(1, this, "Error setting up display in Fusion: {0}", e);
}
}
protected override void MapDisplayToRoomJoins(int displayIndex, int joinOffset, DisplayBase display)
{
string displayName = string.Format("Display {0} - ", displayIndex);
if (display == (Room as EssentialsHuddleVtc1Room).DefaultDisplay)
{
// Power on
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
// Power Off
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
// Current Source
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => { if (!b) (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"); }); ;
}
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Fusion
{
public class ScheduleChangeEventArgs : EventArgs
{
public RoomSchedule Schedule { get; set; }
}
public class MeetingChangeEventArgs : EventArgs
{
public Event Meeting { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Fusion
{
/// <summary>
/// When created, runs progcomments on every slot and stores the program names in a list
/// </summary>
public class ProcessorProgReg
{
//public static Dictionary<int, ProcessorProgramItem> Programs { get; private set; }
public static Dictionary<int, ProcessorProgramItem> GetProcessorProgReg()
{
var programs = new Dictionary<int, ProcessorProgramItem>();
for (int i = 1; i <= Global.ControlSystem.NumProgramsSupported; i++)
{
string response = null;
var success = CrestronConsole.SendControlSystemCommand("progcomments:" + i, ref response);
var item = new ProcessorProgramItem();
if (!success)
item.Name = "Error: PROGCOMMENTS failed";
else
{
if (response.ToLower().Contains("bad or incomplete"))
item.Name = "";
else
{
var startPos = response.IndexOf("Program File");
var colonPos = response.IndexOf(":", startPos) + 1;
var endPos = response.IndexOf(CrestronEnvironment.NewLine, colonPos);
item.Name = response.Substring(colonPos, endPos - colonPos).Trim();
item.Exists = true;
if (item.Name.Contains(".dll"))
{
startPos = response.IndexOf("Compiler Revision");
colonPos = response.IndexOf(":", startPos) + 1;
endPos = response.IndexOf(CrestronEnvironment.NewLine, colonPos);
item.Name = item.Name + "_v" + response.Substring(colonPos, endPos - colonPos).Trim();
}
}
}
programs[i] = item;
Debug.Console(1, "Program {0}: {1}", i, item.Name);
}
return programs;
}
}
/// <summary>
/// Used in ProcessorProgReg
/// </summary>
public class ProcessorProgramItem
{
public bool Exists { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,499 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.Fusion;
using PepperDash.Core;
namespace PepperDash.Essentials.Fusion
{
// Helper Classes for GUIDs
/// <summary>
/// Stores GUIDs to be written to a file in NVRAM
/// </summary>
public class FusionRoomGuids
{
public string RoomName { get; set; }
public uint IpId { get; set; }
public string RoomGuid { get; set; }
public FusionOccupancySensorAsset OccupancyAsset { get; set; }
public Dictionary<int, FusionAsset> StaticAssets { get; set; }
public FusionRoomGuids()
{
StaticAssets = new Dictionary<int, FusionAsset>();
OccupancyAsset = new FusionOccupancySensorAsset();
}
public FusionRoomGuids(string roomName, uint ipId, string roomGuid, Dictionary<int, FusionAsset> staticAssets)
{
RoomName = roomName;
IpId = ipId;
RoomGuid = roomGuid;
StaticAssets = staticAssets;
OccupancyAsset = new FusionOccupancySensorAsset();
}
public FusionRoomGuids(string roomName, uint ipId, string roomGuid, Dictionary<int, FusionAsset> staticAssets, FusionOccupancySensorAsset occAsset)
{
RoomName = roomName;
IpId = ipId;
RoomGuid = roomGuid;
StaticAssets = staticAssets;
OccupancyAsset = occAsset;
}
/// <summary>
/// Generates a new room GUID prefixed by the program slot number and NIC MAC address
/// </summary>
/// <param name="progSlot"></param>
/// <param name="mac"></param>
public string GenerateNewRoomGuid(uint progSlot, string mac)
{
Guid roomGuid = Guid.NewGuid();
return string.Format("{0}-{1}-{2}", progSlot, mac, roomGuid.ToString());
}
/// <summary>
/// Adds an asset to the StaticAssets collection and returns the new asset
/// </summary>
/// <param name="room"></param>
/// <param name="uid"></param>
/// <param name="assetName"></param>
/// <param name="type"></param>
/// <param name="instanceId"></param>
/// <returns></returns>
public FusionAsset AddStaticAsset(FusionRoom room, int uid, string assetName, string type, string instanceId)
{
var slotNum = GetNextAvailableAssetNumber(room);
Debug.Console(2, "Adding Fusion Asset: {0} of Type: {1} at Slot Number: {2} with GUID: {3}", assetName, type, slotNum, instanceId);
var tempAsset = new FusionAsset(slotNum, assetName, type, instanceId);
StaticAssets.Add(uid, tempAsset);
return tempAsset;
}
/// <summary>
/// Returns the next available slot number in the Fusion UserConfigurableAssetDetails collection
/// </summary>
/// <param name="room"></param>
/// <returns></returns>
public static uint GetNextAvailableAssetNumber(FusionRoom room)
{
uint slotNum = 0;
foreach (var item in room.UserConfigurableAssetDetails)
{
if(item.Number > slotNum)
slotNum = item.Number;
}
if (slotNum < 5)
{
slotNum = 5;
}
else
slotNum = slotNum + 1;
Debug.Console(2, "#Next available fusion asset number is: {0}", slotNum);
return slotNum;
}
}
public class FusionOccupancySensorAsset
{
// SlotNumber fixed at 4
public uint SlotNumber { get { return 4; } }
public string Name { get { return "Occupancy Sensor"; } }
public eAssetType Type { get; set; }
public string InstanceId { get; set; }
public FusionOccupancySensorAsset()
{
}
public FusionOccupancySensorAsset(eAssetType type)
{
Type = type;
InstanceId = Guid.NewGuid().ToString();
}
}
public class FusionAsset
{
public uint SlotNumber { get; set; }
public string Name { get; set; }
public string Type { get; set; }
public string InstanceId { get;set; }
public FusionAsset()
{
}
public FusionAsset(uint slotNum, string assetName, string type, string instanceId)
{
SlotNumber = slotNum;
Name = assetName;
Type = type;
if (string.IsNullOrEmpty(instanceId))
{
InstanceId = Guid.NewGuid().ToString();
}
else
{
InstanceId = instanceId;
}
}
}
//***************************************************************************************************
public class RoomSchedule
{
public List<Event> Meetings { get; set; }
public RoomSchedule()
{
Meetings = new List<Event>();
}
}
//****************************************************************************************************
// Helper Classes for XML API
/// <summary>
/// Data needed to request the local time from the Fusion server
/// </summary>
public class LocalTimeRequest
{
public string RequestID { get; set; }
}
/// <summary>
/// All the data needed for a full schedule request in a room
/// </summary>
/// //[XmlRoot(ElementName = "RequestSchedule")]
public class RequestSchedule
{
//[XmlElement(ElementName = "RequestID")]
public string RequestID { get; set; }
//[XmlElement(ElementName = "RoomID")]
public string RoomID { get; set; }
//[XmlElement(ElementName = "Start")]
public DateTime Start { get; set; }
//[XmlElement(ElementName = "HourSpan")]
public double HourSpan { get; set; }
public RequestSchedule(string requestID, string roomID)
{
RequestID = requestID;
RoomID = roomID;
Start = DateTime.Now;
HourSpan = 24;
}
}
//[XmlRoot(ElementName = "RequestAction")]
public class RequestAction
{
//[XmlElement(ElementName = "RequestID")]
public string RequestID { get; set; }
//[XmlElement(ElementName = "RoomID")]
public string RoomID { get; set; }
//[XmlElement(ElementName = "ActionID")]
public string ActionID { get; set; }
//[XmlElement(ElementName = "Parameters")]
public List<Parameter> Parameters { get; set; }
public RequestAction(string roomID, string actionID, List<Parameter> parameters)
{
RoomID = roomID;
ActionID = actionID;
Parameters = parameters;
}
}
//[XmlRoot(ElementName = "ActionResponse")]
public class ActionResponse
{
//[XmlElement(ElementName = "RequestID")]
public string RequestID { get; set; }
//[XmlElement(ElementName = "ActionID")]
public string ActionID { get; set; }
//[XmlElement(ElementName = "Parameters")]
public List<Parameter> Parameters { get; set; }
}
//[XmlRoot(ElementName = "Parameter")]
public class Parameter
{
//[XmlAttribute(AttributeName = "ID")]
public string ID { get; set; }
//[XmlAttribute(AttributeName = "Value")]
public string Value { get; set; }
}
////[XmlRoot(ElementName = "Parameters")]
//public class Parameters
//{
// //[XmlElement(ElementName = "Parameter")]
// public List<Parameter> Parameter { get; set; }
//}
/// <summary>
/// Data structure for a ScheduleResponse from Fusion
/// </summary>
/// //[XmlRoot(ElementName = "ScheduleResponse")]
public class ScheduleResponse
{
//[XmlElement(ElementName = "RequestID")]
public string RequestID { get; set; }
//[XmlElement(ElementName = "RoomID")]
public string RoomID { get; set; }
//[XmlElement(ElementName = "RoomName")]
public string RoomName { get; set; }
//[XmlElement("Event")]
public List<Event> Events { get; set; }
public ScheduleResponse()
{
Events = new List<Event>();
}
}
//[XmlRoot(ElementName = "Event")]
public class Event
{
//[XmlElement(ElementName = "MeetingID")]
public string MeetingID { get; set; }
//[XmlElement(ElementName = "RVMeetingID")]
public string RVMeetingID { get; set; }
//[XmlElement(ElementName = "Recurring")]
public string Recurring { get; set; }
//[XmlElement(ElementName = "InstanceID")]
public string InstanceID { get; set; }
//[XmlElement(ElementName = "dtStart")]
public DateTime dtStart { get; set; }
//[XmlElement(ElementName = "dtEnd")]
public DateTime dtEnd { get; set; }
//[XmlElement(ElementName = "Organizer")]
public string Organizer { get; set; }
//[XmlElement(ElementName = "Attendees")]
public Attendees Attendees { get; set; }
//[XmlElement(ElementName = "Resources")]
public Resources Resources { get; set; }
//[XmlElement(ElementName = "IsEvent")]
public string IsEvent { get; set; }
//[XmlElement(ElementName = "IsRoomViewMeeting")]
public string IsRoomViewMeeting { get; set; }
//[XmlElement(ElementName = "IsPrivate")]
public string IsPrivate { get; set; }
//[XmlElement(ElementName = "IsExchangePrivate")]
public string IsExchangePrivate { get; set; }
//[XmlElement(ElementName = "MeetingTypes")]
public MeetingTypes MeetingTypes { get; set; }
//[XmlElement(ElementName = "ParticipantCode")]
public string ParticipantCode { get; set; }
//[XmlElement(ElementName = "PhoneNo")]
public string PhoneNo { get; set; }
//[XmlElement(ElementName = "WelcomeMsg")]
public string WelcomeMsg { get; set; }
//[XmlElement(ElementName = "Subject")]
public string Subject { get; set; }
//[XmlElement(ElementName = "LiveMeeting")]
public LiveMeeting LiveMeeting { get; set; }
//[XmlElement(ElementName = "ShareDocPath")]
public string ShareDocPath { get; set; }
//[XmlElement(ElementName = "HaveAttendees")]
public string HaveAttendees { get; set; }
//[XmlElement(ElementName = "HaveResources")]
public string HaveResources { get; set; }
/// <summary>
/// Gets the duration of the meeting
/// </summary>
public string DurationInMinutes
{
get
{
string duration;
var timeSpan = dtEnd.Subtract(dtStart);
int hours = timeSpan.Hours;
double minutes = timeSpan.Minutes;
double roundedMinutes = Math.Round(minutes);
if (hours > 0)
{
duration = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
}
else
{
duration = string.Format("{0} minutes", roundedMinutes);
}
return duration;
}
}
/// <summary>
/// Gets the remaining time in the meeting. Returns null if the meeting is not currently in progress.
/// </summary>
public string RemainingTime
{
get
{
var now = DateTime.Now;
string remainingTime;
if (GetInProgress())
{
var timeSpan = dtEnd.Subtract(now);
int hours = timeSpan.Hours;
double minutes = timeSpan.Minutes;
double roundedMinutes = Math.Round(minutes);
if (hours > 0)
{
remainingTime = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
}
else
{
remainingTime = string.Format("{0} minutes", roundedMinutes);
}
return remainingTime;
}
else
return null;
}
}
/// <summary>
/// Indicates that the meeting is in progress
/// </summary>
public bool isInProgress
{
get
{
return GetInProgress();
}
}
/// <summary>
/// Determines if the meeting is in progress
/// </summary>
/// <returns>Returns true if in progress</returns>
bool GetInProgress()
{
var now = DateTime.Now;
if (now > dtStart && now < dtEnd)
{
return true;
}
else
return false;
}
}
//[XmlRoot(ElementName = "Resources")]
public class Resources
{
//[XmlElement(ElementName = "Rooms")]
public Rooms Rooms { get; set; }
}
//[XmlRoot(ElementName = "Rooms")]
public class Rooms
{
//[XmlElement(ElementName = "Room")]
public List<Room> Room { get; set; }
}
//[XmlRoot(ElementName = "Room")]
public class Room
{
//[XmlElement(ElementName = "Name")]
public string Name { get; set; }
//[XmlElement(ElementName = "ID")]
public string ID { get; set; }
//[XmlElement(ElementName = "MPType")]
public string MPType { get; set; }
}
//[XmlRoot(ElementName = "Attendees")]
public class Attendees
{
//[XmlElement(ElementName = "Required")]
public Required Required { get; set; }
//[XmlElement(ElementName = "Optional")]
public Optional Optional { get; set; }
}
//[XmlRoot(ElementName = "Required")]
public class Required
{
//[XmlElement(ElementName = "Attendee")]
public List<string> Attendee { get; set; }
}
//[XmlRoot(ElementName = "Optional")]
public class Optional
{
//[XmlElement(ElementName = "Attendee")]
public List<string> Attendee { get; set; }
}
//[XmlRoot(ElementName = "MeetingType")]
public class MeetingType
{
//[XmlAttribute(AttributeName = "ID")]
public string ID { get; set; }
//[XmlAttribute(AttributeName = "Value")]
public string Value { get; set; }
}
//[XmlRoot(ElementName = "MeetingTypes")]
public class MeetingTypes
{
//[XmlElement(ElementName = "MeetingType")]
public List<MeetingType> MeetingType { get; set; }
}
//[XmlRoot(ElementName = "LiveMeeting")]
public class LiveMeeting
{
//[XmlElement(ElementName = "URL")]
public string URL { get; set; }
//[XmlElement(ElementName = "ID")]
public string ID { get; set; }
//[XmlElement(ElementName = "Key")]
public string Key { get; set; }
//[XmlElement(ElementName = "Subject")]
public string Subject { get; set; }
}
//[XmlRoot(ElementName = "LiveMeetingURL")]
public class LiveMeetingURL
{
//[XmlElement(ElementName = "LiveMeeting")]
public LiveMeeting LiveMeeting { get; set; }
}
}

File diff suppressed because it is too large Load Diff