Beispiel #1
0
        internal void CreateOrUpdate(string macAddress, DeviceType type, string statusString)
        {
            ZeeVeeDeviceBase device = null;

            if (_devices.ContainsKey(macAddress))
            {
                _devices[macAddress].UpdateFromStatusString(statusString);
            }
            else
            {
                switch (type)
                {
                case DeviceType.Encoder:
                    device = new ZeeVeeEncoder(_server, macAddress, type);
                    break;

                case DeviceType.Decoder:
                    device = new ZeeVeeDecoder(_server, macAddress, type);
                    break;
                }

                if (device == null)
                {
                    return;
                }
                device.UpdateFromStatusString(statusString);

                CloudLog.Debug("Discovered {0}, MAC: {1}, Name: {2}, State: {3}",
                               device.GetType().Name, device.MacAddress, device.Name, device.State, device.UpTime);

                OnNewDeviceDiscovered(device, type);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Fast switch a decoder to an encoder
        /// </summary>
        /// <param name="encoder">The ZyperHD Encoder, use null for none</param>
        /// <param name="decoder">The ZyperHD Decoder</param>
        public void JoinFastSwitched(ZeeVeeEncoder encoder, ZeeVeeDecoder decoder)
        {
            var encoderName = encoder != null ? encoder.Name : "none";

            CloudLog.Debug("ZeeVee switch: \"{0}\" => \"{1}\"", encoderName, decoder.Name);
            _socket.Send(string.Format("join {0} {1} fast-switched",
                                       encoderName,
                                       decoder.Name));
            _socket.Send(string.Format("show device status {0}", decoder.Name));
        }
Beispiel #3
0
        internal override void UpdateProperties(Dictionary <string, Dictionary <string, string> > properties)
        {
            base.UpdateProperties(properties);

            try
            {
                if (properties.ContainsKey("connectedEncoder"))
                {
                    var values = properties["connectedEncoder"];

                    if (Server.Devices.Any(d => d.MacAddress == values["mac"]))
                    {
                        _connectedEncoder = Server.Devices[values["mac"]] as ZeeVeeEncoder;
                    }
                    else
                    {
                        _connectedEncoder = null;
                    }
                    ReceivingVideoFromEncoder = (values["receivingVideoFromEncoder"] == "yes");
                }

                if (properties.ContainsKey("hdmiOutput"))
                {
                    HdmiOutput.UpdateFromProperties(properties["hdmiOutput"]);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception("Error processing property values", e);
            }

#if DEBUG
            CrestronConsole.PrintLine("Updated {0}, \"{1}\": State: {2}", GetType().Name, Name, State);
            if (State != DeviceState.Up)
            {
                return;
            }
            CrestronConsole.PrintLine("   Uptime: {0}", UpTime.ToPrettyFormat());
            if (ConnectedEncoder != null)
            {
                CrestronConsole.PrintLine("   Connected Encoder: {0}, Receiving Video: {1}", ConnectedEncoder.Name,
                                          ReceivingVideoFromEncoder);
            }
            CrestronConsole.PrintLine("   HdmiOutput: {0}{1}{2}",
                                      HdmiOutput.Connected ? "Connected" : "Disconnected",
                                      HdmiOutput.Connected ? " " + HdmiOutput.Format : "",
                                      HdmiOutput.Connected ? " HDCP: " + HdmiOutput.Hdcp : "",
                                      HdmiOutput.Connected ? " HDMI 2.0: " + HdmiOutput.Hdmi2Point0 : "");
            if (HdmiOutput.Connected)
            {
                CrestronConsole.PrintLine("   Edid Status: {0}", HdmiOutput.EdidStatus);
            }
#endif
        }