Exemple #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);
            }
        }
Exemple #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));
        }