Skip to content

Commit aaa94aa

Browse files
Add in value lookups
1 parent 158e9f9 commit aaa94aa

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

SensorHost/SensorHost.Shared/Result.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,9 @@ public SensorModes Mode
104104
/// </summary>
105105
public bool? Float { get; set; }
106106

107+
/// <summary>
108+
/// Defines the custom lookup to use to change the value to text.
109+
/// </summary>
110+
public string ValueLookup { get; set; }
107111
}
108112
}

SensorHost/SensorHost/Serializer/JsonSerializer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ private string ConvertToJson(Result result)
112112
}
113113

114114
json.AddJsonValue("value", result.Value);
115+
json.AddXmlValue("valueLookup", result.ValueLookup);
115116

116117
json.Append("}");
117118
return json.ToString();

SensorHost/SensorHost/Serializer/XmlSerializer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,13 @@ private string ConvertToXml(Result result)
114114
if (result.Float.HasValue)
115115
{
116116
xml.AddXmlValue("float", result.Float.Value);
117-
}
117+
}
118118

119119
xml.AddXmlValue("value", result.Value);
120+
if (!string.IsNullOrWhiteSpace(result.ValueLookup))
121+
{
122+
xml.AddXmlValue("valueLookup", result.ValueLookup);
123+
}
120124

121125
xml.Append("</result>");
122126
return xml.ToString();

0 commit comments

Comments
 (0)