-
Notifications
You must be signed in to change notification settings - Fork 1
/
bcm.py
41 lines (31 loc) · 1.02 KB
/
bcm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
import tqdm
from argparse import ArgumentParser
from src.devices.bcm import BCM
import argparse
from src.protocols.kwp2000 import NegativeResponseError
from src.protocols.logger import Logger
if __name__ == "__main__":
# debug = False
logger = Logger()
bcm = BCM(logger)
bcm.connect()
#bcm.writeMemory()
#raise Exception("test")
memory_address = 2000
memory_size = 200
CHUNK_SIZE = 100
filename = "non-kessy.txt"
with open(filename, "w") as f:
for i in range(0, memory_size, CHUNK_SIZE ):
currentMemoryAddress = memory_address + i
try:
databyte = bcm.readMemory(currentMemoryAddress,CHUNK_SIZE)
databyte = databyte.hex()
except NegativeResponseError:
databyte = "ERR"
pass
string = str(currentMemoryAddress) + ":" + databyte + "\n"
print(string)
f.write(string)
f.flush()