Bug fixes and new features added to zigduino firmware and client.
[goodfet] / client / experiments.py
index 7de389f..450973a 100644 (file)
@@ -22,11 +22,11 @@ class experiments(GoodFETMCPCANCommunication):
     
     """
     
-    def __init__(self, data_location):
+    def __init__(self, data_location = "../../contrib/ThayerData/"):
         """ 
         Constructor
-        @type datalocation: string
-        @param datalocation: path to the folder where data will be stored
+        @type data_location: string
+        @param data_location: path to the folder where data will be stored
         """
         GoodFETMCPCANCommunication.__init__(self, data_location)
         #super(experiments,self).__init(self)
@@ -38,8 +38,8 @@ class experiments(GoodFETMCPCANCommunication):
         This method will sweep through the range of standard ids given from low to high.
         This will actively filter for 6 ids at a time and sniff for the given amount of
         time in seconds. If at least one message is read in then it will go individually
-        through the 6 ids and sniff only for that id for the given amount of time. All the
-        data gathered will be saved.  This does not save any sniffed packets.
+        through the 6 ids and sniff only for that id for the given amount of time.
+        This does not save any sniffed packets.
         
         @type  freq: number
         @param freq: The frequency at which the bus is communicating
@@ -326,6 +326,13 @@ class experiments(GoodFETMCPCANCommunication):
                 tT.sleep(period/1000)
             fuzzNumber += 1
         print "Fuzzing Complete"   
+        SIDhigh = (1056 >> 3) & 0xFF; # get SID bits 10:3, rotate them to bits 7:0
+        SIDlow = (1056 & 0x07) << 5;  # get SID bits 2:0, rotate them to bits 7:5
+        packet = [SIDhigh, SIDlow, 0, 0, 8, 65, 255, 32, 120, 0, 0, 1, 247]
+        self.client.txpacket(packet)
+        for i in range(0,100):
+            self.client.MCPrts(TXB0=True)
+            tT.sleep(.01)
         outfile.close()
             
     def generalFuzz(self,freq, Fuzzes, period, writesPerFuzz):
@@ -384,7 +391,7 @@ class experiments(GoodFETMCPCANCommunication):
                 
                 value = random.randint(0, 255) #generate pseudo-random integer value
                 packet[i+5] = value
-            print packet
+            #print packet
             #put a rough time stamp on the data and get all the data bytes    
             row = [time.time(), id_new,8] 
             """@todo: allow for varied packet lengths"""