Reset telemetry while rebooting

This commit is contained in:
Xiangzhi Sheng 2017-02-10 18:40:38 +08:00
Родитель 8e35824573
Коммит c9e7d20499
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -4,6 +4,7 @@ using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Configurations;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Extensions;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.Cooler.CommandProcessors;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.Cooler.Telemetry;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.SimulatorCore.CommandProcessors;
@ -14,9 +15,8 @@ using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.Sim
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.SimulatorCore.Telemetry.Factory;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.SimulatorCore.Transport.Factory;
using Microsoft.Azure.Devices.Client;
using Newtonsoft.Json;
using Microsoft.Azure.Devices.Shared;
using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Extensions;
using Newtonsoft.Json;
namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.Cooler.Devices
{
@ -189,6 +189,15 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob
private async Task RebootAsync()
{
// before reboot, we reset telemetry for demo purpose
var telemetry = _telemetryController as ITelemetryWithTemperatureMeanValue;
if (telemetry != null)
{
telemetry.TemperatureMeanValue = 34.5;
}
await UpdateReportedTemperatureMeanValue();
await SetReportedPropertyAsync("Method.Reboot", null);
var watch = Stopwatch.StartNew();