1 from datetime import datetime, timezone
2 from sqlite3 import connect
5 from .gps303proto import parse_message, proto_by_name
7 db = connect(sys.argv[1])
10 proto = proto_by_name(sys.argv[2])
12 raise ValueError("No protocol with name " + sys.argv[2])
13 selector = " where proto = :proto"
19 "select tstamp, imei, peeraddr, proto, packet from events" +
20 selector, {"proto": proto}
23 for tstamp, imei, peeraddr, proto, packet in c:
24 msg = parse_message(packet)
26 datetime.fromtimestamp(tstamp)
27 .astimezone(tz=timezone.utc)