/// <summary> /// Private event handler method, to handle device state updates. /// This event indicates changes of teh device state, from on-line to off-line /// or vise versa. /// </summary> /// <param name="sender">Pointer, to the sender of the event.</param> /// <param name="e">Event Argument, contains the device (=zone) quality.</param> private void _protocolDriver_onDeviceStatusUpdate(object sender, ProtocolDeviceUpdatedEventArgs e) { _log.Trace(m => m("OSCC.onDeviceStatusUpdate: Device (with id {0}) state change received: {1}", e.DeviceId.ToString(), e.DeviceQuality.ToString())); if (_oscDriver != null) { _oscDriver.SendMessage(new OscEvent(eOscEvent.SetValue, "/NuvoControl/NuvoStatus", (e.DeviceQuality == ZoneQuality.Online ? 1.0 : 0.25))); // update the device quality. Which in this case means, update the zone quality _deviceQualityList[e.DeviceId] = e.DeviceQuality; // Init "static" text (configuration data) updateConfigurationDataOnOscClient(); } }
/// <summary> /// Private event handler method, to handle device state updates. /// This event indicates changes of teh device state, from on-line to off-line /// or vise versa. /// </summary> /// <param name="sender">Pointer, to the sender of the event.</param> /// <param name="e">Event Argument, contains the device (=zone) quality.</param> private void _protocolDriver_onDeviceStatusUpdate(object sender, ProtocolDeviceUpdatedEventArgs e) { _log.Trace(m => m("Zone {0}: Device (with id {1}) state change received: {2}", _zoneId.ToString(), e.DeviceId, e.DeviceQuality.ToString())); bool notifyClient = false; lock (this) { if (e.DeviceId == _zoneId.DeviceId) { _log.Trace(m => m(String.Format("ZC.onDeviceStatusUpdate: Address={0}, Command={1}", _zoneId.ToString(), _zoneState.ToString()))); // update the device quality. Which in this case means, update the zone quality _zoneState.ZoneQuality = e.DeviceQuality; notifyClient = true; } } if (notifyClient) { NotifySubscribedClients(); } }
/// <summary> /// Event method used in SendCommandTest2 /// </summary> /// <param name="sender">This pointer to the sender of the event.</param> /// <param name="e">Event arguments, returned by the sender.</param> void _protDriver_onDeviceStatusUpdate(object sender, ProtocolDeviceUpdatedEventArgs e) { _protDeviceUpdatedEventArgs.Add(e); }
/// <summary> /// Device Status Update method /// </summary> /// <param name="sender">This pointer to the sender of the event.</param> /// <param name="e">Event arguments, returned by the sender.</param> static void _driver_onDeviceStatusUpdate(object sender, ProtocolDeviceUpdatedEventArgs e) { LogHelper.Log(LogLevel.Info, String.Format(">>> [{0}] Device {1} Status Update: {2}", DateTime.Now.ToShortTimeString(), e.DeviceId.ToString(), e.DeviceQuality.ToString())); }