/// <summary> /// Stops the driver by unhooking any event handlers and releasing any used resources. /// </summary> public override void StopDriver() { if (_nestListener != null) { _nestListener.PropertyChanged -= NestUpdateHandler; _nestListener.Dispose(); _nestListener = null; } }
/// <summary> /// Starts the driver. This typcially sets any class variables and hooks /// any event handlers such as SerialPort ReceivedBytes, etc. /// </summary> /// <param name="configFileData"> /// Contains the contents of any configuration files specified in the /// ConfigurationFileNames property. /// </param> /// <returns>Initial driver ready status.</returns> public override bool StartDriver(Dictionary <string, byte[]> configFileData) { // Configure service settings for small request packet performance ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; // Instantiate and Start the thermostat service _nestListener = new NestListener(Logger, TestAuth); _nestListener.PropertyChanged += NestUpdateHandler; _nestListener.Connect(); _nestController = new NestController(TestAuth); // Driver isn't ready until we get nest data so return false return(false); }