]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Improve Deluge to report the UID of the running application. tos-deluge script from...
authorrazvanm <razvanm>
Thu, 20 Dec 2007 21:23:51 +0000 (21:23 +0000)
committerrazvanm <razvanm>
Thu, 20 Dec 2007 21:23:51 +0000 (21:23 +0000)
tools/tinyos/misc/tos-deluge
tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManager.h
tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc

index f3fa97652afeebf8cc7ba80e0bd3d8c7b810c8f3..5c593b977cf27a1e54fbc226d35dd8c735ce8bfc 100755 (executable)
@@ -54,6 +54,7 @@ MSG_REPROG    = 5
 MSG_DISS      = 6
 MSG_REPROG_BS = 7
 MSG_SYNC      = 8
+MSG_IDENT     = 9
 
 ERROR_SUCCESS = 0   # T2-compatible
 ERROR_FAIL    = 1   # T2-compatible
@@ -186,6 +187,15 @@ def op_read(s, img_num, offset, length):
         sreqpkt['len'] = (offset + length) - sreqpkt['offset']
         
     return r
+
+def op_ident(s):
+    sreqpkt = SerialReqPacket((MSG_IDENT, 0, 0, 0, []))
+    if s.write_packet(SERIAL_AMGROUP, SERIAL_AMID, sreqpkt.payload()):
+        packet = s.read_packet(SERIAL_AMGROUP, SERIAL_AMID)
+        sreplypkt = SerialReplyPacket(packet[1])
+        if sreplypkt.error == ERROR_SUCCESS:
+            return toInt(sreplypkt.data)
+    return 0
     
 # Checks for valid CRC and image timestamp
 def verifyMetaData(r):
@@ -215,12 +225,15 @@ def getMetaData(s, img_num):
 
 # Prints status of the image in the external flash
 def op_ping(s, img_num):
+    uid = op_ident(s)
     metadata = getMetaData(s, img_num)
     if not metadata == None:
         if verifyMetaData(metadata) == True:
             print "Connected to Deluge node."
             # Prints out image status
             print "--------------------------------------------------"
+            print "Currently Executing:"
+            print "  UID:         %d" % (uid)
             print "Stored image %d" % img_num
             print toStatusStr(2, metadata)
             print "--------------------------------------------------"
index 35c1a188830a6a8ffbfa4a4428942a422437c7bf..9af71b102df737b8b633e3db48543366f2c270b6 100644 (file)
@@ -36,6 +36,7 @@
 #define SERIALMSG_DISS      6
 #define SERIALMSG_REPROG_BS 7
 #define SERIALMSG_SYNC      8
+#define SERIALMSG_IDENT     9
 
 typedef nx_struct SerialReqPacket {
   nx_uint8_t msg_type;
index bf29d2b3bc273eaede1bf54402c11d6dbb922526..c728b11faf15da81030cff2baa12a35b02f2aabe 100644 (file)
@@ -223,6 +223,12 @@ implementation
           signal ReprogNotify.notify(img_num);
           sendReply(SUCCESS, sizeof(SerialReplyPacket));
           break;
+        case SERIALMSG_IDENT:
+         // This is not send using nx_uint32 in order to maintain
+         // consistency with data from the Deluge image.
+          *(uint32_t*)(&serialMsg_payload->data) = IDENT_UID_HASH;
+         sendReply(SUCCESS, sizeof(SerialReplyPacket) + 4);
+         break;
   #endif
       }
     } else {