demo project

Dependencies:   AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL

Revision:
20:891b5270845a
Parent:
19:2f0ec9ac1238
--- a/Utils/Alert.cpp	Sat Jan 23 00:20:27 2016 +0000
+++ b/Utils/Alert.cpp	Tue Jan 26 17:34:51 2016 +0000
@@ -10,9 +10,10 @@
 
 SafeCircBuf<Alert, AlertBufSize, uint32_t> AlertBuf;
 
-void Alert::SetAlert(time_t created, char* msg, char* atype)
+void Alert::SetAlert(time_t created, int createdMs, char* msg, char* atype)
 {
     Created = created;
+    CreatedMs = createdMs;
     
     if (strlen(atype) >= AlertTypeMaxLen)
     {
@@ -35,12 +36,13 @@
 }
 
 
-void Alert::SetPositionAlert(time_t created, int partIx, float diff)
+void Alert::SetPositionAlert(time_t created, int createdMs, int partIx, float diff)
 {
     char* msg = "Arm joint failed to move to desired position. Joint %d is off by %f";
     int slen = sprintf_s(Msg, AlertMsgMaxLen, msg, partIx, diff);
 
     Created = created;
+    CreatedMs = createdMs;
     strcpy(MeasureName, "rot");
     Index = partIx;
     Value = diff;
@@ -48,12 +50,13 @@
     strcpy(AlertType, "Position");
 }
 
-void Alert::SetLoadAlert(time_t created, int partIx, float val)
+void Alert::SetLoadAlert(time_t created, int createdMs, int partIx, float val)
 {
     char* msg = "Arm joint reported a high load. Joint %d, load %f";
     int slen = sprintf_s(Msg, AlertMsgMaxLen, msg, partIx, val);
 
     Created = created;
+    CreatedMs = createdMs;
     strcpy(MeasureName, "load");
     Index = partIx;
     Value = val;
@@ -61,12 +64,13 @@
     strcpy(AlertType, "Load");
 }
 
-void Alert::SetHardwareAlert(time_t created, int partIx, int code)
+void Alert::SetHardwareAlert(time_t created, int createdMs, int partIx, int code)
 {
     char* msg = "Arm joint reported an error. Joint %d error code %d";
     int slen = sprintf_s(Msg, AlertMsgMaxLen, msg, partIx, code);
 
     Created = created;
+    CreatedMs = createdMs;
     strcpy(MeasureName, "error");
     Index = partIx;
     Value = (float)code;
@@ -74,12 +78,13 @@
     strcpy(AlertType, "Hardware");
 }
 
-void Alert::SetTemperatureAlert(time_t created, int partIx, float temp)
+void Alert::SetTemperatureAlert(time_t created, int createdMs, int partIx, float temp)
 {
     char* msg = "Arm joint reported a high temperature. Joint %d temperature %f";
     int slen = sprintf_s(Msg, AlertMsgMaxLen, msg, partIx, temp);
 
     Created = created;
+    CreatedMs = createdMs;
     strcpy(MeasureName, "temp");
     Index = partIx;
     Value = temp;
@@ -87,12 +92,13 @@
     strcpy(AlertType, "Temperature");
 }
 
-void Alert::SetVoltageAlert(time_t created, int partIx, float val)
+void Alert::SetVoltageAlert(time_t created, int createdMs, int partIx, float val)
 {
     char* msg = "Arm joint reported an unexpected voltge. Joint %d volt %f";
     int slen = sprintf_s(Msg, AlertMsgMaxLen, msg, partIx, val);
 
     Created = created;
+    CreatedMs = createdMs;
     strcpy(MeasureName, "volt");
     Index = partIx;
     Value = val;