internal QSysControl(QSys device, string controlId, QSysControlType type, int changeGroupID) : this(device, controlId, type) { ChangeGroupID = changeGroupID; if (QSys.Connected && ChangeGroupID > 0) { Send(string.Format("cga {0} \"{1}\"", ChangeGroupID, Name)); } }
/// <summary> /// Register a named control object /// </summary> /// <param name="id">The named ID of the control</param> /// <param name="controlType">Set the type of control</param> /// <param name="changeGroupID">Set the control to a change group</param> /// <returns>The QSysControl object with the ID</returns> public QSysControl Register(string id, QSysControlType controlType, int changeGroupID) { if (!ChangeGroups.Any(i => i == changeGroupID)) { ChangeGroups.Add(changeGroupID); if (this.QSys.Connected) { this.QSys.Send(string.Format("cgc {0}", changeGroupID)); this.QSys.Send(string.Format("cgs {0} {1}", changeGroupID, 200)); } } this.Controls[id] = new QSysControl(this.QSys, id, controlType, changeGroupID); return(this[id]); }
internal QSysControl(QSys device, string controlId, QSysControlType type) { QSys = device; ControlID = controlId; ControlType = type; ChangeGroupID = 0; Initialized = false; QSys.DataReceived += new QSysReceivedDataEventHandler(QSys_DataReceived); if (QSys.Connected) { Poll(); } }
/// <summary> /// Register a named control object /// </summary> /// <param name="id">The named ID of the control</param> /// <param name="controlType">Set the type of control</param> /// <returns>The QSysControl object with the ID</returns> public QSysControl Register(string id, QSysControlType controlType) { this.Controls[id] = new QSysControl(this.QSys, id, controlType); return(this[id]); }