]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/UARTDebugSenderP.nc
get rid of +5 for rounding, change arg name in functions in CtpInfo to match the...
[tinyos-2.x.git] / tos / lib / net / UARTDebugSenderP.nc
index b339d87b80b5d0b2f80c7afa93368d7ac071e106..4c1185131b199fb4363ce9bbb1c535d6490de153 100644 (file)
@@ -79,7 +79,11 @@ implementation {
             return FAIL;
         } else {
             message_t* msg = call MessagePool.get();
-            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg);
+            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg, sizeof(CollectionDebugMsg));
+           if (dbg_msg == NULL) {
+             return FAIL;
+           }
+           
             memset(dbg_msg, 0, len);
 
             dbg_msg->type = type;
@@ -96,13 +100,16 @@ implementation {
         }
     }
     /* Used for FE_SENT_MSG, FE_RCV_MSG, FE_FWD_MSG, FE_DST_MSG */
-    command error_t CollectionDebug.logEventMsg(uint8_t type, uint16_t msg_id, am_addr_t origin, am_addr_t node) {
+    command error_t TRUSTEDBLOCK CollectionDebug.logEventMsg(uint8_t type, uint16_t msg_id, am_addr_t origin, am_addr_t node) {
         statLogReceived++;
         if (call MessagePool.empty()) {
             return FAIL;
         } else {
             message_t* msg = call MessagePool.get();
-            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg);
+            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg, sizeof(CollectionDebugMsg));
+           if (dbg_msg == NULL) {
+             return FAIL;
+           }
             memset(dbg_msg, 0, len);
 
             dbg_msg->type = type;
@@ -122,13 +129,16 @@ implementation {
         }
     }
     /* Used for TREE_NEW_PARENT, TREE_ROUTE_INFO */
-    command error_t CollectionDebug.logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t metric) {
+    command error_t TRUSTEDBLOCK CollectionDebug.logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t metric) {
         statLogReceived++;
         if (call MessagePool.empty()) {
             return FAIL;
         } else {
             message_t* msg = call MessagePool.get();
-            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg);
+            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg, sizeof(CollectionDebugMsg));
+           if (dbg_msg == NULL) {
+             return FAIL;
+           }
             memset(dbg_msg, 0, len);
 
             dbg_msg->type = type;
@@ -154,7 +164,10 @@ implementation {
             return FAIL;
         } else {
             message_t* msg = call MessagePool.get();
-            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg);
+            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg, sizeof(CollectionDebugMsg));
+           if (dbg_msg == NULL) {
+             return FAIL;
+           }
             memset(dbg_msg, 0, len);
 
             dbg_msg->type = type;
@@ -172,13 +185,16 @@ implementation {
         }
     }
     /* Used for DBG_2, DBG_3 */
-    command error_t CollectionDebug.logEventDbg(uint8_t type, uint16_t arg1, uint16_t arg2, uint16_t arg3) {
+    command TRUSTEDBLOCK error_t CollectionDebug.logEventDbg(uint8_t type, uint16_t arg1, uint16_t arg2, uint16_t arg3) {
         statLogReceived++;
         if (call MessagePool.empty()) {
             return FAIL;
         } else {
             message_t* msg = call MessagePool.get();
-            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg);
+            CollectionDebugMsg* dbg_msg = call UARTSend.getPayload(msg, sizeof(CollectionDebugMsg));
+           if (dbg_msg == NULL) {
+             return FAIL;
+           }
             memset(dbg_msg, 0, len);
 
             dbg_msg->type = type;