Ejemplo n.º 1
0
        /// <summary>
        /// Create an instance of a server controlled video distribution system
        /// </summary>
        /// <param name="address">The IP Address or Hostname to connect using telnet</param>
        public ZeeVeeServer(string address)
        {
            _socket = new ZeeVeeServerSocket(address, 23);
            _socket.ReceivedData += SocketOnReceivedData;
            Devices = new ZeeVeeDeviceCollection(this);

            CrestronConsole.AddNewConsoleCommand(ConsoleRoute, "ZVRoute", "Route an encoder to a decoder",
                                                 ConsoleAccessLevelEnum.AccessOperator);
        }
Ejemplo n.º 2
0
 protected virtual void OnReceivedData(ZeeVeeServerSocket socket, string data)
 {
     try
     {
         var handler = ReceivedData;
         if (handler != null)
         {
             handler(socket, data);
         }
     }
     catch (Exception e)
     {
         CloudLog.Exception("Error raising data received event for ZeeVee", e);
     }
 }
Ejemplo n.º 3
0
        private void SocketOnReceivedData(ZeeVeeServerSocket socket, string data)
        {
            if (data.StartsWith("show device status "))
            {
                var matches = Regex.Matches(data,
                                            @"device\(([\w\:]+)\);[\s]+device.gen; model=(?:[\w]+), type=([\w]+)[\s\w\.\:\;\=\,\-//]+(?:(?=device\()|(?=lastChangeIdMax))",
                                            RegexOptions.Multiline);
#if DEBUG
                //CrestronConsole.PrintLine("Received status update for {0} devices", matches.Count);
#endif
                foreach (Match match in matches)
                {
                    var macAddress = match.Groups[1].Value;
                    var type       = (DeviceType)Enum.Parse(typeof(DeviceType), match.Groups[2].Value, true);

                    Devices.CreateOrUpdate(macAddress, type, match.ToString());
                }
            }
        }