update to GoodFETMCPCANCommunication.py to allow for id sweeps
authorchrishoder <chrishoder@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 25 Jan 2013 21:37:17 +0000 (21:37 +0000)
committerchrishoder <chrishoder@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 25 Jan 2013 21:37:17 +0000 (21:37 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1418 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFETMCPCANCommunication.py

index 7d8c205..e269a7b 100644 (file)
@@ -17,7 +17,7 @@ import array;
 import csv, time, argparse;
 import datetime
 import os
-
+from random import randrange
 from GoodFETMCPCAN import GoodFETMCPCAN;
 from intelhex import IntelHex;
 
@@ -234,6 +234,29 @@ class GoodFETMCPCANCommunication:
                         msgIDs.append(j)
         return msgIDs
     
+    def sweepRandom(self, freq, time = 5, number):
+        msgIDs = []
+        ids = []
+        for i in range(0,number,6):
+            idsTemp = []
+            comment = "sweepFilter"
+            for j in range(0,6,1):
+                id = randrange(2047)
+                comment += "_%d" % id
+                idsTemp.append(id)
+                ids.append(id)
+            print comment
+            description = "Running a sweep filer for all the possible standard IDs. This runs the following : " + comment
+            count = self.sniff(freq=freq, duration=time, description=description, comment = comment, filename, standardid = idsTemp)
+            if( count != 0):
+                for element in idsTemp:
+                    comment = "sweepFilter: %d" % (element)
+                    description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d " % element
+                    count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [element, element, element])
+                    if( count != 0):
+                        msgIDs.append(j)
+        return msgIDs, ids
+    
     def sniffTest(self, freq):
         
         rate = freq;