Sections
Sub-Sections
Last Change
Annotate
Revision Log
Download
Plain Text
Original Format
Metanav
Preferences
About Trac
Links
Slowchop Studios
Gerald Kaszuba
Advertisement

root/wirelessheatmap/trunk/dump2pickle.py

Revision 53, 0.8 kB (checked in by gak, 21 months ago)
  • Property svn:executable set to *
  • Property svn:keywords set to Id Revision
Line 
1#!/usr/bin/env python   
2
3import cPickle as pickle
4import sys
5import time
6
7import betterprint as pprint
8
9from ap import AccessPoint
10
11class DumpPickler(object):
12
13    def __init__(self):
14        self.dump_file = sys.argv[1]
15        self.dest_file = 'all.dump'
16
17    def read_dump(self):
18        if not self.dump_file:
19            return
20        d = open(self.dump_file).read()
21        f = open(self.dest_file, 'a')
22        lines = d.split('\n')
23
24        t = time.time()
25
26        for line in lines:
27
28            bits = line.split(',')
29
30            if len(bits) != 15:
31                continue
32            if bits[0] == 'BSSID':
33                continue
34
35            f.write('%f,%s\n' % (t, line))
36
37    def loop(self):
38        while 1:
39            self.read_dump()
40            time.sleep(1)
41       
42DumpPickler().loop()
Note: See TracBrowser for help on using the browser.