/// <summary> /// Plugin device constructor /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="config"></param> public EssentialsPluginTemplateLogicDevice(string key, string name, EssentialsPluginConfigObjectTemplate config) : base(key, name) { Debug.Console(0, this, "Constructing new {0} instance", name); // TODO [ ] Update the constructor as needed for the plugin device being developed _config = config; }
/// <summary> /// Plugin device constructor for Crestron devices /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="config"></param> /// <param name="hardware"></param> public EssentialsPluginTemplateCrestronDevice(string key, string name, EssentialsPluginConfigObjectTemplate config, GenericBase hardware) : base(key, name, hardware) { Debug.Console(0, this, "Constructing new {0} instance", name); // The base class takes care of registering the hardware device for you // TODO [ ] Update the constructor as needed for the plugin device being developed _config = config; }
/// <summary> /// Plugin device constructor for devices that need IBasicCommunication /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="config"></param> /// <param name="comms"></param> public EssentialsPluginTemplateDevice(string key, string name, EssentialsPluginConfigObjectTemplate config, IBasicCommunication comms) : base(key, name) { Debug.Console(0, this, "Constructing new {0} instance", name); // TODO [ ] Update the constructor as needed for the plugin device being developed _config = config; ConnectFeedback = new BoolFeedback(() => Connect); OnlineFeedback = new BoolFeedback(() => _commsMonitor.IsOnline); StatusFeedback = new IntFeedback(() => (int)_commsMonitor.Status); _comms = comms; _commsMonitor = new GenericCommunicationMonitor(this, _comms, _config.PollTimeMs, _config.WarningTimeoutMs, _config.ErrorTimeoutMs, Poll); var socket = _comms as ISocketStatus; if (socket != null) { // device comms is IP **ELSE** device comms is RS232 socket.ConnectionChange += socket_ConnectionChange; Connect = true; } #region Communication data event handlers. Comment out any that don't apply to the API type // Only one of the below handlers should be necessary. // _comms gather for any API that has a defined delimiter // TODO [ ] If not using an ASCII based API, remove the line below _commsGather = new CommunicationGather(_comms, CommsDelimiter); _commsGather.LineReceived += Handle_LineRecieved; // _comms byte buffer for HEX/byte based API's with no delimiter // TODO [ ] If not using an HEX/byte based API, remove the line below _comms.BytesReceived += Handle_BytesReceived; // _comms byte buffer for HEX/byte based API's with no delimiter // TODO [ ] If not using an HEX/byte based API, remove the line below _comms.TextReceived += Handle_TextReceived; #endregion }