-
Notifications
You must be signed in to change notification settings - Fork 0
/
MessageBody.cs
96 lines (83 loc) · 2.48 KB
/
MessageBody.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Newtonsoft.Json;
namespace TemperatureDataFactory
{
public class MessageBody
{
[JsonProperty("InstanceId")]
public int InstanceId { get; set; }
[JsonProperty("machine")]
public Machine Machine { get; set; }
[JsonProperty("ambient")]
public Ambient Ambient { get; set; }
[JsonProperty("timeCreated")]
public string TimeCreated { get; set; }
[JsonProperty("machineCode")]
public string MachineCode {get; set; }
}
[JsonObject("machine")]
public class Machine
{
[JsonProperty("temperature")]
public double Temperature { get; set; }
[JsonProperty("pressure")]
public double Pressure { get; set; }
}
[JsonObject("ambient")]
public class Ambient
{
[JsonProperty("temperature")]
public double Temperature { get; set; }
[JsonProperty("humidity")]
public int Humidity { get; set; }
}
}// Copyright (c) Microsoft. All rights reserved.
namespace SimulatedTemperatureSensor
{
using System;
using Newtonsoft.Json;
// NOTE: IF CHANGING ANYTHING IN THIS FILE, UPDATE MESSAGEBODY.CS IN TEMPERATURE FILTER
// TODO Put message body in a common lib
/// <summary>
///Body:
///{
/// “machine”:{
/// “temperature”:,
/// “pressure”:
/// },
/// “ambient”:{
/// “temperature”: ,
/// “humidity”:
/// }
/// “timeCreated”:”UTC iso format”
///}
///Units and types:
///Temperature: double, C
///Humidity: int, %
///Pressure: double, psi
/// </summary>
class MessageBody
{
[JsonProperty(PropertyName = "machine")]
public Machine Machine { get; set; }
[JsonProperty(PropertyName = "ambient")]
public Ambient Ambient { get; set; }
[JsonProperty(PropertyName = "timeCreated")]
public DateTime TimeCreated { get; set; }
}
class Machine
{
[JsonProperty(PropertyName = "temperature")]
public double Temperature { get; set; }
[JsonProperty(PropertyName = "pressure")]
public double Pressure { get; set; }
}
class Ambient
{
[JsonProperty(PropertyName = "temperature")]
public double Temperature { get; set; }
[JsonProperty(PropertyName = "humidity")]
public int Humidity { get; set; }
}
}