void Codec_HasConnected(CiscoCodec codec) { foreach (XElement element in Codec.RequestPath("Status/Audio").Elements().Where(e => !e.HasElements)) { switch (element.XName.LocalName) { case "Volume": _Volume = int.Parse(element.Value); break; case "VolumeMute": if (element.Value == "On") { _Mute = true; } else { _Mute = false; } break; } } #if DEBUG CrestronConsole.PrintLine("Volume = {0}", Volume); CrestronConsole.PrintLine("Volume Mute = {0}", Mute); #endif }
void Codec_HasConnected(CiscoCodec codec) { try { foreach (XElement element in Codec.RequestPath("Status/Capabilities/Conference").Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("Capabilities.Conference.{0} = {1}", element.XName.LocalName, element.Value); #endif switch (element.XName.LocalName) { case "MaxActiveCalls": MaxActiveCalls = int.Parse(element.Value); break; case "MaxAudioCalls": MaxAudioCalls = int.Parse(element.Value); break; case "MaxCalls": MaxCalls = int.Parse(element.Value); break; case "MaxVideoCalls": MaxVideoCalls = int.Parse(element.Value); break; } } } catch (Exception e) { ErrorLog.Exception("Error in Conference.Capabilities.Codec_HasConnected", e); } }
void Codec_HasConnected(CiscoCodec codec) { try { IEnumerable <XElement> status = Codec.RequestPath("Status/Cameras/SpeakerTrack"); if (status != null) { foreach (XElement element in status.FirstOrDefault().Elements()) { if (element.HasElements) { if (element.XName.LocalName == "LeftCamera") { LeftCamera = new SpeakerTrackCamera(uint.Parse(element.Element("VideoInputConnector").Value)); } else if (element.XName.LocalName == "RightCamera") { RightCamera = new SpeakerTrackCamera(uint.Parse(element.Element("VideoInputConnector").Value)); } } else { #if DEBUG CrestronConsole.PrintLine("Status.Cameras.SpeakerTrack.{0} = {1}", element.XName.LocalName, element.Value); #endif switch (element.XName.LocalName) { case "Availability": Availability = (SpeakerTrackAvailability)Enum.Parse(typeof(SpeakerTrackAvailability), element.Value, true); break; case "Status": if (element.Value.ToLower() == "active") { this.Active = true; } else { this.Active = false; } break; } } } #if DEBUG if (LeftCamera != null) { CrestronConsole.PrintLine("Status.Cameras.SpeakerTrack.LeftCamera.VideoInputConnector = {0}", LeftCamera.VideoInputConnector); } if (RightCamera != null) { CrestronConsole.PrintLine("Status.Cameras.SpeakerTrack.RightCamera.VideoInputConnector = {0}", RightCamera.VideoInputConnector); } #endif } } catch (Exception e) { ErrorLog.Error("Error in {0}.Codec_HasConnected, {1}", this.GetType(), e.Message); } }
void Codec_HasConnected(CiscoCodec codec) { try { string standbyStatus = codec.RequestPath("Status/Standby").FirstOrDefault().Elements().FirstOrDefault().Value; _StandbyState = (StandbyState)Enum.Parse(typeof(StandbyState), standbyStatus, true); } catch (Exception e) { ErrorLog.Exception("Error in CiscoCodec.Standby.Codec_HasConnected", e); } }
void Codec_HasConnected(CiscoCodec codec) { foreach (XElement element in Codec.RequestPath("Status/SystemUnit").Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("SystemUnit.{0} = {1}", element.XName.LocalName, element.Value); #endif switch (element.XName.LocalName) { case "ProductId": ProductId = element.Value; break; case "ProductPlatform": ProductPlatform = element.Value; break; case "ProductType": ProductType = element.Value; break; case "Uptime": Uptime = TimeSpan.FromSeconds(double.Parse(element.Value)); break; } } }
void Codec_HasConnected(CiscoCodec codec) { foreach (XElement element in Codec.RequestPath("Status/SystemUnit/State").Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("SystemUnit.State.{0} = {1}", element.XName.LocalName, element.Value); #endif switch (element.XName.LocalName) { case "NumberOfActiveCalls": NumberOfActiveCalls = int.Parse(element.Value); break; case "NumberOfInProgressCalls": NumberOfInProgressCalls = int.Parse(element.Value); break; case "NumberOfSuspendedCalls": NumberOfSuspendedCalls = int.Parse(element.Value); break; case "System": System = (SystemState)Enum.Parse(typeof(SystemState), element.Value, false); break; } } }
void Codec_HasConnected(CiscoCodec codec) { XElement element = Codec.RequestPath("Status/Audio/Microphones").Elements().FirstOrDefault(); if (element.XName.LocalName == "Mute") { if (element.Value == "On") { _Mute = true; } else { _Mute = false; } } #if DEBUG CrestronConsole.PrintLine("Mic Mute = {0}", Mute); #endif }
void Codec_HasConnected(CiscoCodec codec) { foreach (XElement element in Codec.RequestPath("Status/SystemUnit/Hardware") .Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("SystemUnit.Software.{0} = {1}", element.XName.LocalName, element.Value); #endif switch (element.XName.LocalName) { case "Hardware": foreach (XElement e in element.Element("Module").Elements()) { if (e.XName.LocalName == "SerialNumber") { ModuleSerialNumber = e.Value; } } Codec.FusionUpdate(); break; } } }
void Codec_HasConnected(CiscoCodec codec) { foreach (XElement element in Codec.RequestPath("Status/UserInterface").Elements()) { switch (element.XName.LocalName) { case "ContactInfo": foreach (XElement contactInfoElement in element.Elements()) { switch (contactInfoElement.XName.LocalName) { case "Name": this.ContactInfo.Name = contactInfoElement.Value; break; case "ContactMethod": uint index = uint.Parse(contactInfoElement.Attribute("item").Value); this.ContactInfo._ContactMethods[index] = new UserInterfaceContactInfoMethod(contactInfoElement.Element("Number").Value); break; } } break; } } }
void Codec_HasConnected(CiscoCodec codec) { foreach (XElement element in Codec.RequestPath("Status/SystemUnit/Software") .Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("SystemUnit.Software.{0} = {1}", element.XName.LocalName, element.Value); #endif switch (element.XName.LocalName) { case "Application": Application = element.Value; break; case "MaxAudioCalls": MaxAudioCalls = int.Parse(element.Value); break; case "MaxVideoCalls": MaxVideoCalls = int.Parse(element.Value); break; case "Name": Name = element.Value; break; case "ReleaseDate": ReleaseDate = DateTime.Parse(element.Value); break; case "Version": Version = element.Value; break; } } }
object UpdateCallsThread(object obj) { Stopwatch sw = new Stopwatch(); sw.Start(); #if DEBUG CrestronConsole.Print("Checking for calls..."); #endif IEnumerable <XElement> xCalls = Codec.RequestPath("Status/Call"); if (xCalls != null) { #if DEBUG CrestronConsole.PrintLine(" Call count = {0}", xCalls.Count()); #endif Dictionary <int, Call> receivedCalls = new Dictionary <int, Call>(); foreach (XElement xCall in xCalls) { bool statusChanged = false; int callID = int.Parse(xCall.Attribute("item").Value); Call call; if (_Calls.ContainsKey(callID)) { call = _Calls[callID]; } else { call = new Call(Codec, callID); _Calls.Add(callID, call); } receivedCalls.Add(call.ID, call); foreach (XElement e in xCall.Elements()) { switch (e.XName.LocalName) { case "AnswerState": CallAnswerState _AnswerState = (CallAnswerState)Enum.Parse(typeof(CallAnswerState), e.Value, false); if (_AnswerState != call.AnswerState) { call.AnswerState = _AnswerState; statusChanged = true; } break; case "CallType": CallType _Type = (CallType)Enum.Parse(typeof(CallType), e.Value, false); if (_Type != call.Type) { call.Type = _Type; statusChanged = true; } break; case "CallbackNumber": call.CallbackNumber = e.Value; if (call.CallbackNumber != e.Value) { call.CallbackNumber = e.Value; statusChanged = true; } break; case "DeviceType": CallDeviceType _DeviceType = (CallDeviceType)Enum.Parse(typeof(CallDeviceType), e.Value, false); if (call.DeviceType != _DeviceType) { call.DeviceType = _DeviceType; statusChanged = true; } break; case "Direction": CallDirection _Direction = (CallDirection)Enum.Parse(typeof(CallDirection), e.Value, false); if (call.Direction != _Direction) { call.Direction = _Direction; statusChanged = true; } break; case "Duration": TimeSpan duration = TimeSpan.Parse(e.Value); call.StartTime = DateTime.Now - duration; break; case "DisplayName": call.DisplayName = e.Value; if (call.DisplayName != e.Value) { call.DisplayName = e.Value; statusChanged = true; } break; case "Protocol": call.Protocol = e.Value; if (call.Protocol != e.Value) { call.Protocol = e.Value; statusChanged = true; } break; case "RemoteNumber": call.RemoteNumber = e.Value; if (call.RemoteNumber != e.Value) { call.RemoteNumber = e.Value; statusChanged = true; } break; case "Status": CallStatus _Status = (CallStatus)Enum.Parse(typeof(CallStatus), e.Value, false); if (_Status != call.Status && !(_Status == CallStatus.Disconnecting && call.Status == CallStatus.Idle)) { call.Status = _Status; statusChanged = true; } break; } } if (statusChanged) { OnCallStatusChange(call, CallInfoChangeNotificationSource.UpdateRequest); } } foreach (Call call in this.Active) { if (!receivedCalls.ContainsKey(call.ID)) { call.Status = CallStatus.Idle; OnCallStatusChange(call, CallInfoChangeNotificationSource.UpdateRequest); call.Ghost = true; if (this.Codec.LoggingEnabled) { this.Codec.Logger.Log("Call id {0} was found in Codec.Calls but not present in an Update Request, Call was removed and notified as idle", call.ID); } } } } else { #if DEBUG CrestronConsole.PrintLine(" No Calls"); #endif } return(null); }
void Codec_HasConnected(CiscoCodec codec) { try { IEnumerable <XElement> statusInfo = Codec.RequestPath("Status/Cameras"); foreach (XElement element in statusInfo.Elements("Camera")) { uint cameraId = uint.Parse(element.Attribute("item").Value); #if DEBUG CrestronConsole.PrintLine("Info for Camera {0}:", cameraId); foreach (XElement innerElement in element.Elements().Where(e => !e.HasElements)) { CrestronConsole.PrintLine(" Camera.{0} = {1}", innerElement.XName.LocalName, innerElement.Value); } #endif if (bool.Parse(element.Element("Connected").Value)) { if (!this.Contains(cameraId)) { Camera newCamera = new Camera(Codec, cameraId, bool.Parse(element.Element("Connected").Value), element.Element("Manufacturer").Value, element.Element("Model").Value); foreach (XElement property in element.Elements()) { switch (property.XName.LocalName) { case "MacAddress": newCamera.MacAddress = property.Value; break; case "SerialNumber": newCamera.SerialNumber = property.Value; break; case "SoftwareID": newCamera.SoftwareID = property.Value; break; } } this[cameraId] = newCamera; } else { foreach (XElement property in element.Elements()) { switch (property.XName.LocalName) { case "Connected": bool.Parse(property.Value); break; case "MacAddress": this[cameraId].MacAddress = property.Value; break; case "Manufacturer": this[cameraId].Manufacturer = property.Value; break; case "Model": this[cameraId].Model = property.Value; break; case "SerialNumber": this[cameraId].SerialNumber = property.Value; break; case "SoftwareID": this[cameraId].SoftwareID = property.Value; break; } } } } } } catch (Exception e) { ErrorLog.Exception("Error parsing camera information for CiscoCodec", e); } }
void Codec_HasConnected(CiscoCodec codec) { try { #if DEBUG CrestronConsole.PrintLine("Getting codec network info..."); #endif IEnumerable <XElement> response = Codec.RequestPath("Status/Network"); #if DEBUG CrestronConsole.PrintLine(response.ToString()); #endif foreach (XElement networkInfo in response.FirstOrDefault().Elements()) { switch (networkInfo.XName.LocalName) { case "Ethernet": foreach (XElement e in networkInfo.Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("{0} = {1}", e.XName.LocalName, e.Value); #endif switch (e.XName.LocalName) { case "Speed": Speed = e.Value; break; case "MacAddress": MacAddress = e.Value; break; } } break; case "IPv4": foreach (XElement e in networkInfo.Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("{0} = {1}", e.XName.LocalName, e.Value); #endif switch (e.XName.LocalName) { case "Address": Address = e.Value; break; case "SubnetMask": SubnetMask = e.Value; break; case "Gateway": Gateway = e.Value; break; } } break; case "CDP": foreach (XElement e in networkInfo.Elements().Where(e => !e.HasElements)) { #if DEBUG CrestronConsole.PrintLine("{0} = {1}", e.XName.LocalName, e.Value); #endif if (e.Value.Length > 0) { switch (e.XName.LocalName) { case "Platform": Platform = e.Value; break; case "DeviceId": DeviceId = e.Value; break; case "PortID": PortID = e.Value; break; case "VoIPApplianceVlanID": VoIPApplianceVlanID = int.Parse(e.Value); break; } } } break; } } } catch (Exception e) { ErrorLog.Exception("Error in Network.Codec_HasConnected", e); } }