From: chrishoder Date: Sun, 20 Jan 2013 03:32:34 +0000 (+0000) Subject: updated file management for the data gathering and upload to database X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=b889bfabe5b0ed8d248ae1533c1a260d103ae1a0 updated file management for the data gathering and upload to database git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1391 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/GoodFETMCPCANCommunication.py b/client/GoodFETMCPCANCommunication.py index f979f62..f555e47 100644 --- a/client/GoodFETMCPCANCommunication.py +++ b/client/GoodFETMCPCANCommunication.py @@ -15,17 +15,25 @@ import sys; import binascii; import array; import csv, time, argparse; +import datetime from GoodFETMCPCAN import GoodFETMCPCAN; from intelhex import IntelHex; class GoodFETMCPCANCommunication: - def __init__(self): + def __init__(self, filename=None): self.client=GoodFETMCPCAN(); self.client.serInit() self.client.MCPsetup(); + if( filname == None): + # create a filename with today's date + now = datetime.datetime.now() + self.filename = "../../contrib/ThayerData/" + self.filename += now.strftime("%Y%m%d") + else: + self.filename=filename ########################## # INFO @@ -57,9 +65,9 @@ class GoodFETMCPCANCommunication: def reset(self): self.client.MCPsetup(); - def sniff(self,freq,duration,filename,description, verbose=True, comment=None): + def sniff(self,freq,duration,description, verbose=True, comment=None): self.client.MCPsetrate(freq); - outfile = open(filename,'a'); + outfile = open(self.filename,'a'); dataWriter = csv.writer(outfile,delimiter=','); dataWriter.writerow(['# Time Error Bytes 1-13']); dataWriter.writerow(['#' + description])