from random import randrange
from GoodFETMCPCAN import GoodFETMCPCAN;
from intelhex import IntelHex;
+import Queue
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()
packet=self.client.fastrxpacket();
else:
packet=self.client.rxpacket();
-
+
+ #add the data to list if the pointer was included
+ if(data != None):
+ #data.append(self.client.packet2parsedstr(packet))
+ data.put(self.client.packet2parsedstr(packet))
if(debug == True):
#check packet status
MCPstatusReg = self.client.MCPrxstatus();
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)