/// <summary> /// CCDDisplay Plugin device constructor for ISerialComport transport /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="config"></param> /// <param name="display">Loaded and initialized instance of CCD Display driver instance</param> public ClearOneDSPDevice(string key, string name, ClearOneDSPConfig config, IBasicCommunication comm) : base(key, name) { Debug.Console(0, this, "Constructing new {0} instance", name); _config = config; _commandQueue = new CrestronQueue(100); _responseQueue = new CrestronQueue <string>(); _responseParseThread = new Thread(parseResponse, null, Thread.eThreadStartOptions.Running); _commandInProgressTimer = new CTimer((o) => { _commandInProgress = null; }, Timeout.Infinite); _devices = new Dictionary <string, ClearOneDSPDeviceInfo>(); Communication = comm; _portGather = new CommunicationGather(Communication, "\x0D\x0A"); _portGather.LineReceived += this.lineReceived; if (config.CommunicationMonitorProperties != null) { CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, config.CommunicationMonitorProperties); } else { //#warning Need to deal with this poll string CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 30000, 60000, new Action(() => { if (_devices.Count == 0) { _commandQueue.Enqueue("** VER"); } //sendLine("** VER"); foreach (var controlPoint in LevelControlPoints.Values) { controlPoint.Poll(); } })); } LevelControlPoints = new Dictionary <string, ClearOneDSPVolumeControl>(); foreach (KeyValuePair <string, ClearOneLevelControlBlockConfig> kvp in _config.LevelControlBlocks) { this.LevelControlPoints.Add(kvp.Key, new ClearOneDSPVolumeControl(kvp.Key, kvp.Value, this)); } CrestronConsole.AddNewConsoleCommand((s) => { StringBuilder sb = new StringBuilder(); sb.AppendLine("Devices:"); foreach (var kvp in _devices) { sb.AppendFormat("\tDevice: {0}\r\n", kvp.Key); sb.AppendFormat("\t\tModel: {0}\r\n", kvp.Value.DeviceType.ToString()); sb.AppendFormat("\t\tId: {0}\r\n", kvp.Value.DeviceId); sb.AppendFormat("\t\tFirmware: {0}\r\n", kvp.Value.Version); } CrestronConsole.ConsoleCommandResponse("{0}", sb.ToString()); }, Key + "INFO", "Print Driver Info", ConsoleAccessLevelEnum.AccessOperator); }
public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString, long pollTime, long warningTime, long errorTime) : base(key, name) { Client = new GenericTcpIpClient(key + "-tcp", hostname, port, 512); CommunicationMonitor = new GenericCommunicationMonitor(this, Client, pollTime, warningTime, errorTime, pollString); // ------------------------------------------------------DELETE THIS CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor status change: {0}", a.Status); }; }
public GenericCommunicationMonitoredDevice(string key, string name, IBasicCommunication comm, string pollString, long pollTime, long warningTime, long errorTime) : base(key, name) { Client = comm; CommunicationMonitor = new GenericCommunicationMonitor(this, Client, pollTime, warningTime, errorTime, pollString); // ------------------------------------------------------DELETE THIS CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor status change: {0}", a.Status); }; }
public LutronQuantumArea(string key, string name, IBasicCommunication comm, LutronQuantumPropertiesConfig props) : base(key, name) { Communication = comm; IntegrationId = props.IntegrationId; if (props.Control.Method != eControlMethod.Com) { Username = props.Control.TcpSshProperties.Username; Password = props.Control.TcpSshProperties.Password; } LightingScenes = props.Scenes; var socket = comm as ISocketStatus; if (socket != null) { // IP Control socket.ConnectionChange += new EventHandler <GenericSocketStatusChageEventArgs>(socket_ConnectionChange); } else { // RS-232 Control } Communication.TextReceived += new EventHandler <GenericCommMethodReceiveTextArgs>(Communication_TextReceived); PortGather = new CommunicationGather(Communication, Delimiter); PortGather.LineReceived += new EventHandler <GenericCommMethodReceiveTextArgs>(PortGather_LineReceived); if (props.CommunicationMonitorProperties != null) { CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties); } else { CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 120000, 120000, 300000, "?ETHERNET,0\x0d\x0a"); } }