update to threading of sniff on mainDisplay as well as added option to sniff in commu...
[goodfet] / client / GoodFETMCPCANCommunication.py
index 169e02a..107b6ea 100644 (file)
@@ -72,7 +72,7 @@ class GoodFETMCPCANCommunication:
     #   SNIFF
     ##########################
          
-    def sniff(self,freq,duration,description, verbose=True, comment=None, filename=None, standardid=None, debug=False, faster=False, parsed=True):
+    def sniff(self,freq,duration,description, verbose=True, comment=None, filename=None, standardid=None, debug=False, faster=False, parsed=True, data = None):
         
         #reset eveything on the chip
         self.client.serInit() 
@@ -152,6 +152,10 @@ class GoodFETMCPCANCommunication:
                 packet=self.client.fastrxpacket();
             else:
                 packet=self.client.rxpacket();
+                
+            #add the data to list if the pointer was included
+            if(data != None):
+                data.append(packet)
             
             if(debug == True):
                 #check packet status
@@ -476,9 +480,11 @@ class GoodFETMCPCANCommunication:
             self.client.txpacket(packet)
             ## listen for 2 packets. one should be the rtr we requested the other should be
             ## a new packet response
-            starttime = time.tim()
+            starttime = time.time()
             while ((time.time() - starttime) < duration):
                 packet = self.client.rxpacket()
+                if( packet == None):
+                    continue
                 row = []
                 row.append("%f"%time.time()) #timestamp
                 row.append(0) #error flag (not checkign)