protected async void OnDeviceCommand(DeviceCommandEventArgs e)
		{
			try
			{
				if (e.DeviceCommand == DeviceCommand.UpdateTemperature)
				{
					// ***
					// *** Send out a sensor reading to all devices
					// ***
					await this.SendSensorReading(true);
				}
				else if (e.DeviceCommand == DeviceCommand.ResetAlert)
				{
					// ***
					// *** Log this event
					// ***
					this.EventAggregator.GetEvent<Events.DebugEvent>().Publish(new DebugEventArgs(
							DebugEventType.Information,
							nameof(Mcp9808TemperatureRepository),
							"A Reset Alert command was received."));

					// ***
					// *** Check if we have a device
					// ***
					if (this.Device != null)
					{
						// ***
						// *** Reset the interrupt
						// ***
						this.Device.ClearInterrupt();
					}
				}
			}
			catch (Exception ex)
			{
				this.EventAggregator.GetEvent<Events.DebugEvent>().Publish(new DebugEventArgs(ex));
			}
		}
Beispiel #2
0
		/// <summary>
		/// Sends a device command to all connected clients.
		/// </summary>
		/// <param name="e">The device command event arguments.</param>
		public void SendDeviceCommandEvent(DeviceCommandEventArgs e)
		{
			this.Clients.All.OnDeviceCommandEvent(e);
		}