Beispiel #1
0
    def __init__(self, logfile, msg):
        if not logfile:
            logfile = gs.user_file_path(msg.name + ".csv")
        self._f = open(logfile, 'w')

        #print the CSV header
        header = ["time", "acid"] + [f.name for f in msg.fields]
        self._f.write(", ".join(header)+"\n")
Beispiel #2
0
    def __init__(self, logfile):
        if not logfile:
            logfile = gs.user_file_path("flight.sqlite")

        self._con = sqlite3.connect(logfile, detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
        # by setting the text_factory as str, sqlite will not get in the way
        # when storing 8-bit bytestrings (i.e. the raw payload data)
        self._con.text_factory = str
        self._cur = self._con.cursor()
        self._cur.execute("CREATE TABLE data(time timestamp, acid INTEGER, msgid INTEGER, payload BLOB)")