1
- # this script can be used to generate log files for the CANedge e.g. for testing WiFi transfer
2
-
3
1
import os
4
2
import hashlib
5
3
6
- # specify details of log files (device ID should match your test device)
7
- device_id = "534F281B"
8
- file_type = "MF4"
9
- sessions = 120
10
- splits = 50
11
- size_bytes = 2 * 1024 * 1024
12
4
13
- # function for creating files
14
5
def sha256_file (path ):
15
6
digest = hashlib .sha256 ()
16
7
with open (path , "rb" ) as f :
@@ -21,10 +12,17 @@ def sha256_file(path):
21
12
digest .update (buf )
22
13
return digest .hexdigest ().upper ()
23
14
24
- # run loop to create log files in folders
15
+
16
+ device_id = "3851A144" #"1973B1D6"
17
+ file_type = "MF4"
18
+ sessions = 30
19
+ splits = 50
20
+ session_offset = 20000
21
+ size_bytes = 2 * 1024 * 1024
22
+
25
23
dir_path = os .path .dirname (os .path .abspath (__file__ ))
26
24
27
- for session_no in range (1 , sessions + 1 ):
25
+ for session_no in range (session_offset , sessions + session_offset ):
28
26
for split_no in range (1 , splits + 1 ):
29
27
tmp_file_name = "{}.mf4" .format (split_no )
30
28
tmp_file_path = os .path .join (dir_path , tmp_file_name )
@@ -36,9 +34,7 @@ def sha256_file(path):
36
34
# Calculate digest of file
37
35
digest = sha256_file (tmp_file_path )
38
36
39
- # create folder name
40
37
folder = f'{ session_no } ' .zfill (8 )
41
-
42
38
# Check whether the specified path exists or not
43
39
isExist = os .path .exists (folder )
44
40
0 commit comments