diff --git a/src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml b/src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml
index 60a73c8..757992b 100644
--- a/src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml
+++ b/src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml
@@ -22,7 +22,7 @@
-
+
-
+
-
-
+
+
+
+
+
@@ -103,7 +108,19 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/EyesAndEars.UWP/EyesAndEars.UWP/Services/DataServices.cs b/src/EyesAndEars.UWP/EyesAndEars.UWP/Services/DataServices.cs
index a469d1e..b93de54 100644
--- a/src/EyesAndEars.UWP/EyesAndEars.UWP/Services/DataServices.cs
+++ b/src/EyesAndEars.UWP/EyesAndEars.UWP/Services/DataServices.cs
@@ -19,7 +19,7 @@ namespace EyesAndEars.UWP.Services {
var statusJSON = await WebServices.GetJSON(statusAPI);
var r = MapToLightReading(readingJSON);
var s = MapToDeviceStatus(statusJSON);
- var c = UpdateStatusColour(s.status);
+ var c = UpdateStatusColour(s.status, r.reading);
return new Device(deviceId, r, s, c);
}
catch (Exception e) {
@@ -28,12 +28,37 @@ namespace EyesAndEars.UWP.Services {
}
}
- static SolidColorBrush UpdateStatusColour(string status) {
+ static SolidColorBrush UpdateStatusColour(string status, int reading) {
try {
- return status.Equals("on", StringComparison.OrdinalIgnoreCase) ?
- new SolidColorBrush(Colors.SeaGreen) :
- new SolidColorBrush(Colors.DarkRed);
- }
+ if (status.Equals("on", StringComparison.OrdinalIgnoreCase)) {
+ /* Note: Reading values breakdown.
+ * =======================================
+ * 1. When testing the light meters, the base line for normal
+ * light is 48 or below. Anything above this is when one of
+ * the guys in the factory was welding. Becuase of this,
+ * I have set 0 to 48 as the 'default' status on the
+ * dashboard.
+ *
+ * 2. During testing we noticed the light meters would
+ * return 'negative light' values. There is a reason for
+ * this but that is out of the scope of this project. This
+ * project just needs to process the data. The negative
+ * light values are when the lights in the factory are off.
+ * The light meter is still running but there is no light
+ * to measure. So, everything is fine but it looks broken.
+ * The 'LightSkyBlue' colour is used to help relay this
+ * bit of information.
+ */
+ if (reading > 0 && reading < 48) // On but no weld detected.
+ return new SolidColorBrush(Colors.LightSeaGreen);
+ if (reading > 48) // On and weld detected.
+ return new SolidColorBrush(Colors.DarkSeaGreen);
+ else {
+ // On but factory lights are off.
+ return new SolidColorBrush(Colors.LightSkyBlue);
+ }
+ }
+ else return new SolidColorBrush(Colors.DarkRed); }
catch (Exception e) {
Debug.WriteLine(e.Message);
return new SolidColorBrush(Colors.DarkOrange);