protobin 0.0.7__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {protobin-0.0.7 → protobin-0.0.9}/PKG-INFO +2 -1
- {protobin-0.0.7 → protobin-0.0.9}/protobin/fields.py +21 -17
- protobin-0.0.9/protobin/interfaces.py +0 -0
- {protobin-0.0.7 → protobin-0.0.9}/protobin/protocol.py +24 -15
- {protobin-0.0.7 → protobin-0.0.9}/pyproject.toml +4 -1
- {protobin-0.0.7 → protobin-0.0.9}/tests/demo.json +20 -7
- protobin-0.0.9/tests/demo.yaml +87 -0
- {protobin-0.0.7 → protobin-0.0.9}/tests/tests.py +188 -68
- protobin-0.0.7/tests/demo.yaml +0 -624
- {protobin-0.0.7 → protobin-0.0.9}/.gitignore +0 -0
- {protobin-0.0.7 → protobin-0.0.9}/LICENSE.txt +0 -0
- {protobin-0.0.7 → protobin-0.0.9}/README.md +0 -0
- {protobin-0.0.7 → protobin-0.0.9}/protobin/__init__.py +0 -0
- {protobin-0.0.7 → protobin-0.0.9}/protobin/errors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: protobin
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: Python library for encode and decode data in protobin format
|
|
5
5
|
Project-URL: Homepage, https://github.com/drmelectronic/protobin-python
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/drmelectronic/protobin-python/issues
|
|
@@ -33,6 +33,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
33
33
|
Classifier: Operating System :: OS Independent
|
|
34
34
|
Classifier: Programming Language :: Python :: 3
|
|
35
35
|
Requires-Python: >=3.9
|
|
36
|
+
Requires-Dist: pyyaml~=6.0
|
|
36
37
|
Description-Content-Type: text/markdown
|
|
37
38
|
|
|
38
39
|
# protobin
|
|
@@ -13,6 +13,7 @@ class FieldEnum(enum.StrEnum):
|
|
|
13
13
|
CHAR = 'char'
|
|
14
14
|
DATE = 'date'
|
|
15
15
|
DATETIME = 'datetime'
|
|
16
|
+
ID = 'id'
|
|
16
17
|
FLAGS = 'flags'
|
|
17
18
|
FLOAT = 'float'
|
|
18
19
|
SIGNED = 'signed'
|
|
@@ -77,12 +78,6 @@ class FieldBase:
|
|
|
77
78
|
return binary[:self.bytes], binary[self.bytes:]
|
|
78
79
|
return binary[1:binary[0] + 1], binary[binary[0] + 1:]
|
|
79
80
|
|
|
80
|
-
def to_dict(self):
|
|
81
|
-
return {
|
|
82
|
-
'key': self.key,
|
|
83
|
-
'bytes': self.bytes,
|
|
84
|
-
'type': self.type
|
|
85
|
-
}
|
|
86
81
|
|
|
87
82
|
|
|
88
83
|
class FieldArray(FieldBase):
|
|
@@ -98,11 +93,6 @@ class FieldArray(FieldBase):
|
|
|
98
93
|
val, binary = self.from_binary(binary)
|
|
99
94
|
return val, binary
|
|
100
95
|
|
|
101
|
-
def to_dict(self):
|
|
102
|
-
d = super().to_dict()
|
|
103
|
-
d['array'] = self.array
|
|
104
|
-
return d
|
|
105
|
-
|
|
106
96
|
def to_binary(self, val):
|
|
107
97
|
binary = b''
|
|
108
98
|
length = len(val)
|
|
@@ -304,10 +294,23 @@ class FieldFloat(FieldBase):
|
|
|
304
294
|
def to_binary(self, val):
|
|
305
295
|
return int(round(val * (10 ** self.decimals))).to_bytes(self.bytes, 'big', signed=True)
|
|
306
296
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
297
|
+
|
|
298
|
+
class FieldId(FieldBase):
|
|
299
|
+
|
|
300
|
+
def to_binary(self, val):
|
|
301
|
+
if val is None:
|
|
302
|
+
val = 0
|
|
303
|
+
max_value = 256 ** self.bytes - 1
|
|
304
|
+
val = min(val, max_value)
|
|
305
|
+
if val < 0:
|
|
306
|
+
raise ValueError('Negative values not allowed')
|
|
307
|
+
return int(val).to_bytes(self.bytes, 'big', signed=False)
|
|
308
|
+
|
|
309
|
+
def from_binary(self, binary):
|
|
310
|
+
val = int.from_bytes(binary[:self.bytes], 'big', signed=False)
|
|
311
|
+
if val == 0:
|
|
312
|
+
val = None
|
|
313
|
+
return val
|
|
311
314
|
|
|
312
315
|
|
|
313
316
|
class FieldSigned(FieldBase):
|
|
@@ -380,11 +383,11 @@ class FieldUnsigned(FieldBase):
|
|
|
380
383
|
|
|
381
384
|
def to_binary(self, val):
|
|
382
385
|
if val is None:
|
|
383
|
-
|
|
386
|
+
raise ValueError(f'Error en el campo "{self.key}" no se permite None')
|
|
384
387
|
max_value = 256 ** self.bytes - 1
|
|
385
388
|
val = min(val, max_value)
|
|
386
389
|
if val < 0:
|
|
387
|
-
raise ValueError('
|
|
390
|
+
raise ValueError(f'Error en el campo "{self.key}" se espera enteros positivos y se recibió {val}')
|
|
388
391
|
return int(val).to_bytes(self.bytes, 'big', signed=False)
|
|
389
392
|
|
|
390
393
|
def from_binary(self, binary):
|
|
@@ -400,6 +403,7 @@ FIELD_MAP = {
|
|
|
400
403
|
'datetime': FieldDateTime,
|
|
401
404
|
'flags': FieldFlags,
|
|
402
405
|
'float': FieldFloat,
|
|
406
|
+
'id': FieldId,
|
|
403
407
|
'signed': FieldSigned,
|
|
404
408
|
'string': FieldString,
|
|
405
409
|
'time': FieldTime,
|
|
File without changes
|
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
import json
|
|
2
|
-
|
|
3
2
|
import yaml
|
|
4
|
-
|
|
5
3
|
from protobin.fields import FieldBase, FIELD_MAP
|
|
6
4
|
|
|
7
5
|
|
|
8
6
|
class Format:
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
input_fields: [FieldBase]
|
|
9
|
+
output_fields: [FieldBase]
|
|
11
10
|
|
|
12
|
-
def __init__(self, format:
|
|
13
|
-
self.
|
|
11
|
+
def __init__(self, name: str, format, server: bool):
|
|
12
|
+
self.name = name
|
|
13
|
+
self.input_fields = []
|
|
14
|
+
self.output_fields = []
|
|
14
15
|
self.header = format['header']
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
if server is None:
|
|
17
|
+
input_mode = 'fields'
|
|
18
|
+
output_mode = 'fields'
|
|
19
|
+
else:
|
|
20
|
+
input_mode = 'device' if server else 'server'
|
|
21
|
+
output_mode = 'server' if server else 'device'
|
|
22
|
+
for k, f in format[input_mode].items():
|
|
23
|
+
self.input_fields.append(FIELD_MAP[f['type']](k, f))
|
|
24
|
+
for k, f in format[output_mode].items():
|
|
25
|
+
self.output_fields.append(FIELD_MAP[f['type']](k, f))
|
|
17
26
|
|
|
18
27
|
def encode(self, data):
|
|
19
28
|
binary = self.header.encode('utf') + b'='
|
|
20
|
-
for f in self.
|
|
29
|
+
for f in self.output_fields:
|
|
21
30
|
binary += f.encode(data)
|
|
22
31
|
return binary
|
|
23
32
|
|
|
24
33
|
def decode(self, binary):
|
|
25
34
|
data = {}
|
|
26
|
-
for f in self.
|
|
35
|
+
for f in self.input_fields:
|
|
27
36
|
val, binary = f.decode(binary)
|
|
28
37
|
if isinstance(f.key, list):
|
|
29
38
|
for k in f.key:
|
|
@@ -32,13 +41,11 @@ class Format:
|
|
|
32
41
|
data[f.key] = val
|
|
33
42
|
return data
|
|
34
43
|
|
|
35
|
-
def to_dict(self):
|
|
36
|
-
return [f.to_dict() for f in self.fields]
|
|
37
|
-
|
|
38
44
|
|
|
39
45
|
class Protocol:
|
|
40
46
|
|
|
41
|
-
def __init__(self, file=None, js=None):
|
|
47
|
+
def __init__(self, server: bool = None, file=None, js=None):
|
|
48
|
+
self.server = server
|
|
42
49
|
self.headers = {}
|
|
43
50
|
if file:
|
|
44
51
|
with open(file, 'r') as f:
|
|
@@ -54,7 +61,9 @@ class Protocol:
|
|
|
54
61
|
def load_format(self, js):
|
|
55
62
|
self.formats = {}
|
|
56
63
|
for k in js.keys():
|
|
57
|
-
|
|
64
|
+
if js[k]['header'] in self.headers:
|
|
65
|
+
raise KeyError(f'El header "{js[k]['header']}" ya está en uso en "{self.headers[js[k]["header"]]}"')
|
|
66
|
+
self.formats[k] = Format(name=k, format=js[k], server=self.server)
|
|
58
67
|
self.headers[js[k]['header']] = k
|
|
59
68
|
|
|
60
69
|
def get_format(self, h):
|
|
@@ -66,4 +75,4 @@ class Protocol:
|
|
|
66
75
|
def decode(self, binary):
|
|
67
76
|
h, binary = binary.split(b'=')
|
|
68
77
|
format = self.get_format(h)
|
|
69
|
-
return
|
|
78
|
+
return format.name, format.decode(binary)
|
|
@@ -4,10 +4,13 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "protobin"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.9"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Daniel Robles", email="drm.electronic@gmail.com" },
|
|
10
10
|
]
|
|
11
|
+
dependencies = [
|
|
12
|
+
'PyYAML ~= 6.0'
|
|
13
|
+
]
|
|
11
14
|
description = "Python library for encode and decode data in protobin format"
|
|
12
15
|
readme = "README.md"
|
|
13
16
|
license = { file="LICENSE.txt" }
|
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"login": {
|
|
3
3
|
"header": "T",
|
|
4
|
-
"
|
|
5
|
-
"serial": {"
|
|
6
|
-
}
|
|
4
|
+
"device": {
|
|
5
|
+
"serial": {"type": "string"}
|
|
6
|
+
},
|
|
7
|
+
"server": {
|
|
8
|
+
"id": {"bytes": 2, "type": "id"},
|
|
9
|
+
"bus_number": {"bytes": 2, "type": "id"},
|
|
10
|
+
"route": {"bytes": 1, "type": "id"},
|
|
11
|
+
"direction": {"bytes": 1, "type": "bool"},
|
|
12
|
+
"geofence": {"bytes": 2, "type": "id"},
|
|
13
|
+
"state": {"bytes": 1, "type": "char"},
|
|
14
|
+
"trip": {"bytes": 4, "type": "id"},
|
|
15
|
+
"driver": {"bytes": 4, "type": "id"}
|
|
16
|
+
}
|
|
7
17
|
},
|
|
8
18
|
"report": {
|
|
9
19
|
"header": "P",
|
|
10
|
-
"
|
|
20
|
+
"device": {
|
|
11
21
|
"positions": {"bytes": 19, "type": "array", "array": {
|
|
12
22
|
"time": {"bytes": 6, "type": "datetime"},
|
|
13
23
|
"lng": {"bytes": 4, "type": "float", "decimals": 6},
|
|
14
24
|
"lat": {"bytes": 4, "type": "float", "decimals": 6},
|
|
15
25
|
"speed": {"bytes": 1, "type": "unsigned"},
|
|
16
|
-
"mark": {"bytes": 2, "type": "
|
|
17
|
-
"busstop": {"bytes": 2, "type": "
|
|
26
|
+
"mark": {"bytes": 2, "type": "id"},
|
|
27
|
+
"busstop": {"bytes": 2, "type": "id"}}
|
|
18
28
|
},
|
|
19
29
|
"trip": {"bytes": 4, "type": "unsigned"},
|
|
20
30
|
"route": {"bytes": 1, "type": "unsigned"},
|
|
21
31
|
"direction": {"bytes": 1, "type": "bool"},
|
|
22
32
|
"state": {"bytes": 1, "type": "char"},
|
|
23
33
|
"sales": {"bytes": 3, "type": "unsigned"},
|
|
24
|
-
"events": {"
|
|
34
|
+
"events": {"type": "array", "array": {
|
|
25
35
|
"id": {"bytes": 2, "type": "unsigned"},
|
|
26
36
|
"value": {"bytes": 1, "type": "unsigned"}}
|
|
27
37
|
}
|
|
38
|
+
},
|
|
39
|
+
"server": {
|
|
40
|
+
"positions": {"bytes": 1, "type": "unsigned"}
|
|
28
41
|
}
|
|
29
42
|
}
|
|
30
43
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
login:
|
|
3
|
+
header: T
|
|
4
|
+
device:
|
|
5
|
+
serial:
|
|
6
|
+
type: string
|
|
7
|
+
server:
|
|
8
|
+
id:
|
|
9
|
+
bytes: 2
|
|
10
|
+
type: id
|
|
11
|
+
bus_number:
|
|
12
|
+
bytes: 2
|
|
13
|
+
type: id
|
|
14
|
+
route:
|
|
15
|
+
bytes: 1
|
|
16
|
+
type: id
|
|
17
|
+
direction:
|
|
18
|
+
bytes: 1
|
|
19
|
+
type: bool
|
|
20
|
+
geofence:
|
|
21
|
+
bytes: 2
|
|
22
|
+
type: id
|
|
23
|
+
state:
|
|
24
|
+
bytes: 1
|
|
25
|
+
type: char
|
|
26
|
+
trip:
|
|
27
|
+
bytes: 4
|
|
28
|
+
type: id
|
|
29
|
+
driver:
|
|
30
|
+
bytes: 4
|
|
31
|
+
type: id
|
|
32
|
+
report:
|
|
33
|
+
header: P
|
|
34
|
+
device:
|
|
35
|
+
positions:
|
|
36
|
+
array:
|
|
37
|
+
busstop:
|
|
38
|
+
bytes: 2
|
|
39
|
+
type: id
|
|
40
|
+
lat:
|
|
41
|
+
bytes: 4
|
|
42
|
+
decimals: 6
|
|
43
|
+
type: float
|
|
44
|
+
lng:
|
|
45
|
+
bytes: 4
|
|
46
|
+
decimals: 6
|
|
47
|
+
type: float
|
|
48
|
+
mark:
|
|
49
|
+
bytes: 2
|
|
50
|
+
type: id
|
|
51
|
+
speed:
|
|
52
|
+
bytes: 1
|
|
53
|
+
type: unsigned
|
|
54
|
+
time:
|
|
55
|
+
bytes: 6
|
|
56
|
+
type: datetime
|
|
57
|
+
bytes: 19
|
|
58
|
+
type: array
|
|
59
|
+
trip:
|
|
60
|
+
bytes: 4
|
|
61
|
+
type: unsigned
|
|
62
|
+
route:
|
|
63
|
+
bytes: 1
|
|
64
|
+
type: unsigned
|
|
65
|
+
direction:
|
|
66
|
+
bytes: 1
|
|
67
|
+
type: bool
|
|
68
|
+
state:
|
|
69
|
+
bytes: 1
|
|
70
|
+
type: char
|
|
71
|
+
sales:
|
|
72
|
+
bytes: 3
|
|
73
|
+
type: unsigned
|
|
74
|
+
events:
|
|
75
|
+
array:
|
|
76
|
+
id:
|
|
77
|
+
bytes: 2
|
|
78
|
+
type: unsigned
|
|
79
|
+
value:
|
|
80
|
+
bytes: 1
|
|
81
|
+
type: unsigned
|
|
82
|
+
bytes: 3
|
|
83
|
+
type: array
|
|
84
|
+
server:
|
|
85
|
+
positions:
|
|
86
|
+
bytes: 1
|
|
87
|
+
type: unsigned
|
|
@@ -12,7 +12,7 @@ DATA = {
|
|
|
12
12
|
'lng': -11.485014,
|
|
13
13
|
'lat': -77.621845,
|
|
14
14
|
'speed': 20,
|
|
15
|
-
'mark':
|
|
15
|
+
'mark': None,
|
|
16
16
|
'busstop': 16
|
|
17
17
|
},
|
|
18
18
|
{
|
|
@@ -20,7 +20,7 @@ DATA = {
|
|
|
20
20
|
'lng': -11.485414,
|
|
21
21
|
'lat': -77.622245,
|
|
22
22
|
'speed': 25,
|
|
23
|
-
'mark':
|
|
23
|
+
'mark': None,
|
|
24
24
|
'busstop': 16
|
|
25
25
|
},
|
|
26
26
|
{
|
|
@@ -28,7 +28,7 @@ DATA = {
|
|
|
28
28
|
'lng': -11.485514,
|
|
29
29
|
'lat': -77.621945,
|
|
30
30
|
'speed': 18,
|
|
31
|
-
'mark':
|
|
31
|
+
'mark': None,
|
|
32
32
|
'busstop': 16
|
|
33
33
|
},
|
|
34
34
|
{
|
|
@@ -228,6 +228,7 @@ class BasicTest(unittest.TestCase):
|
|
|
228
228
|
def test_float(self):
|
|
229
229
|
data = {'test': -11.659812}
|
|
230
230
|
binary = self.protocol.encode(data, 'float')
|
|
231
|
+
print(binary)
|
|
231
232
|
h, recv = self.protocol.decode(binary)
|
|
232
233
|
self.assertEqual(data, recv)
|
|
233
234
|
|
|
@@ -263,17 +264,12 @@ class BasicTest(unittest.TestCase):
|
|
|
263
264
|
class AdvancedTest(unittest.TestCase):
|
|
264
265
|
|
|
265
266
|
def test_file_json(self):
|
|
266
|
-
|
|
267
|
-
binary =
|
|
268
|
-
|
|
267
|
+
device = Protocol(file='demo.json', server=False)
|
|
268
|
+
binary = device.encode(DATA, 'report')
|
|
269
|
+
server = Protocol(file='demo.json', server=True)
|
|
270
|
+
name, recv = server.decode(binary)
|
|
269
271
|
self.assertEqual(DATA, recv)
|
|
270
|
-
self.assertEqual(
|
|
271
|
-
|
|
272
|
-
# def test_file_yaml(self):
|
|
273
|
-
# protocol = Protocol(file='demo.yaml')
|
|
274
|
-
# binary = protocol.encode(DATA, 'report')
|
|
275
|
-
# h, recv = protocol.decode(binary)
|
|
276
|
-
# self.assertEqual(h, 'P')
|
|
272
|
+
self.assertEqual(name, 'report')
|
|
277
273
|
|
|
278
274
|
def test_json(self):
|
|
279
275
|
protocol = Protocol(js={'medida':
|
|
@@ -293,66 +289,190 @@ class AdvancedTest(unittest.TestCase):
|
|
|
293
289
|
self.assertEqual(data, recv)
|
|
294
290
|
|
|
295
291
|
def test_new_yaml(self):
|
|
296
|
-
ym = yaml.full_load("""
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
292
|
+
ym = yaml.full_load("""
|
|
293
|
+
login:
|
|
294
|
+
device:
|
|
295
|
+
serial:
|
|
296
|
+
type: string
|
|
297
|
+
header: T
|
|
298
|
+
server:
|
|
299
|
+
bus_number:
|
|
300
|
+
bytes: 2
|
|
301
|
+
type: id
|
|
302
|
+
direction:
|
|
303
|
+
bytes: 1
|
|
304
|
+
type: bool
|
|
305
|
+
driver:
|
|
306
|
+
bytes: 4
|
|
307
|
+
type: id
|
|
308
|
+
geofence:
|
|
309
|
+
bytes: 2
|
|
310
|
+
type: id
|
|
311
|
+
id:
|
|
312
|
+
bytes: 2
|
|
313
|
+
type: id
|
|
314
|
+
route:
|
|
315
|
+
bytes: 1
|
|
316
|
+
type: id
|
|
317
|
+
state:
|
|
318
|
+
bytes: 1
|
|
319
|
+
type: char
|
|
320
|
+
trip:
|
|
321
|
+
bytes: 4
|
|
322
|
+
type: id
|
|
323
|
+
report:
|
|
324
|
+
device:
|
|
325
|
+
direction:
|
|
326
|
+
bytes: 1
|
|
327
|
+
type: bool
|
|
328
|
+
events:
|
|
329
|
+
array:
|
|
330
|
+
id:
|
|
331
|
+
bytes: 2
|
|
332
|
+
type: unsigned
|
|
333
|
+
value:
|
|
334
|
+
bytes: 1
|
|
335
|
+
type: unsigned
|
|
336
|
+
bytes: 3
|
|
337
|
+
type: array
|
|
338
|
+
positions:
|
|
339
|
+
array:
|
|
340
|
+
busstop:
|
|
341
|
+
bytes: 2
|
|
342
|
+
type: id
|
|
343
|
+
lat:
|
|
344
|
+
bytes: 4
|
|
345
|
+
decimals: 6
|
|
346
|
+
type: float
|
|
347
|
+
lng:
|
|
348
|
+
bytes: 4
|
|
349
|
+
decimals: 6
|
|
350
|
+
type: float
|
|
351
|
+
mark:
|
|
352
|
+
bytes: 2
|
|
353
|
+
type: id
|
|
354
|
+
speed:
|
|
355
|
+
bytes: 1
|
|
356
|
+
type: unsigned
|
|
357
|
+
time:
|
|
358
|
+
bytes: 6
|
|
359
|
+
type: datetime
|
|
360
|
+
bytes: 19
|
|
361
|
+
type: array
|
|
362
|
+
route:
|
|
363
|
+
bytes: 1
|
|
364
|
+
type: unsigned
|
|
365
|
+
sales:
|
|
366
|
+
bytes: 3
|
|
367
|
+
type: unsigned
|
|
368
|
+
state:
|
|
369
|
+
bytes: 1
|
|
370
|
+
type: char
|
|
371
|
+
trip:
|
|
372
|
+
bytes: 4
|
|
373
|
+
type: unsigned
|
|
374
|
+
header: P
|
|
375
|
+
server:
|
|
376
|
+
positions:
|
|
377
|
+
bytes: 1
|
|
378
|
+
type: unsigned
|
|
346
379
|
""")
|
|
347
380
|
js = json.dumps(ym, indent=2)
|
|
348
381
|
|
|
349
382
|
def test_convert_json_to_yaml(self):
|
|
350
|
-
|
|
383
|
+
with open('demo.json', 'r') as f:
|
|
384
|
+
js = json.loads(f.read())
|
|
385
|
+
ym = yaml.dump(js)
|
|
386
|
+
print(ym)
|
|
351
387
|
|
|
352
388
|
def test_login(self):
|
|
353
|
-
|
|
389
|
+
device = Protocol(file='demo.json', server=False)
|
|
390
|
+
server = Protocol(file='demo.json', server=True)
|
|
391
|
+
|
|
392
|
+
data = {'serial': '15984316545'}
|
|
393
|
+
binary = device.encode(data, 'login')
|
|
394
|
+
print('client', binary)
|
|
395
|
+
header, recv = server.decode(binary)
|
|
396
|
+
self.assertEqual(header, 'login')
|
|
397
|
+
self.assertEqual(data, recv)
|
|
398
|
+
data = {
|
|
399
|
+
'id': 43,
|
|
400
|
+
'bus_number': 18,
|
|
401
|
+
'route': 2,
|
|
402
|
+
'direction': True,
|
|
403
|
+
'geofence': None,
|
|
404
|
+
'state': 'R',
|
|
405
|
+
'trip': 5681121,
|
|
406
|
+
'driver': 1432
|
|
407
|
+
}
|
|
408
|
+
binary = server.encode(data, 'login')
|
|
409
|
+
print('server', binary)
|
|
410
|
+
header, recv = device.decode(binary)
|
|
411
|
+
self.assertEqual(header, 'login')
|
|
412
|
+
self.assertEqual(data, recv)
|
|
413
|
+
|
|
414
|
+
def test_file_yaml(self):
|
|
415
|
+
device = Protocol(file='demo.yaml', server=False)
|
|
416
|
+
server = Protocol(file='demo.yaml', server=True)
|
|
354
417
|
data = {'serial': '15984316545'}
|
|
355
|
-
binary =
|
|
356
|
-
header, recv =
|
|
418
|
+
binary = device.encode(data, 'login')
|
|
419
|
+
header, recv = server.decode(binary)
|
|
420
|
+
self.assertEqual(header, 'login')
|
|
357
421
|
self.assertEqual(data, recv)
|
|
358
|
-
|
|
422
|
+
data = {
|
|
423
|
+
'id': 43,
|
|
424
|
+
'bus_number': 18,
|
|
425
|
+
'route': 2,
|
|
426
|
+
'direction': True,
|
|
427
|
+
'geofence': None,
|
|
428
|
+
'state': 'R',
|
|
429
|
+
'trip': 5681121,
|
|
430
|
+
'driver': 1432
|
|
431
|
+
}
|
|
432
|
+
binary = server.encode(data, 'login')
|
|
433
|
+
header, recv = device.decode(binary)
|
|
434
|
+
self.assertEqual(header, 'login')
|
|
435
|
+
self.assertEqual(data, recv)
|
|
436
|
+
|
|
437
|
+
def test_file_json_yaml(self):
|
|
438
|
+
device = Protocol(file='demo.json', server=False)
|
|
439
|
+
server = Protocol(file='demo.yaml', server=True)
|
|
440
|
+
data = {'serial': '15984316545'}
|
|
441
|
+
binary = device.encode(data, 'login')
|
|
442
|
+
header, recv = server.decode(binary)
|
|
443
|
+
self.assertEqual(header, 'login')
|
|
444
|
+
self.assertEqual(data, recv)
|
|
445
|
+
data = {
|
|
446
|
+
'id': 43,
|
|
447
|
+
'bus_number': 18,
|
|
448
|
+
'route': 2,
|
|
449
|
+
'direction': True,
|
|
450
|
+
'geofence': None,
|
|
451
|
+
'state': 'R',
|
|
452
|
+
'trip': 5681121,
|
|
453
|
+
'driver': 1432
|
|
454
|
+
}
|
|
455
|
+
binary = server.encode(data, 'login')
|
|
456
|
+
header, recv = device.decode(binary)
|
|
457
|
+
self.assertEqual(header, 'login')
|
|
458
|
+
self.assertEqual(data, recv)
|
|
459
|
+
|
|
460
|
+
def test_error_header(self):
|
|
461
|
+
with self.assertRaises(KeyError) as er:
|
|
462
|
+
Protocol(js={
|
|
463
|
+
'array': {
|
|
464
|
+
"header": "A",
|
|
465
|
+
"fields": {
|
|
466
|
+
'test': {'bytes': 0, 'type': 'array', 'array': {
|
|
467
|
+
'test': {'bytes': 0, 'type': 'string'}
|
|
468
|
+
}}}
|
|
469
|
+
},
|
|
470
|
+
'bits': {
|
|
471
|
+
"header": "B",
|
|
472
|
+
"fields": {'test': {'type': 'bits'}}
|
|
473
|
+
},
|
|
474
|
+
'bits_fixed': {
|
|
475
|
+
"header": "B",
|
|
476
|
+
"fields": {'test': {'type': 'bits', 'length': 7}}
|
|
477
|
+
}
|
|
478
|
+
})
|
protobin-0.0.7/tests/demo.yaml
DELETED
|
@@ -1,624 +0,0 @@
|
|
|
1
|
-
report:
|
|
2
|
-
header: P
|
|
3
|
-
format:
|
|
4
|
-
positions:
|
|
5
|
-
bytes: 19
|
|
6
|
-
type: array
|
|
7
|
-
array:
|
|
8
|
-
time:
|
|
9
|
-
bytes: 6
|
|
10
|
-
type: datetime
|
|
11
|
-
lng:
|
|
12
|
-
bytes: 4
|
|
13
|
-
decimals: 6
|
|
14
|
-
type: float
|
|
15
|
-
lat:
|
|
16
|
-
bytes: 4
|
|
17
|
-
decimals: 6
|
|
18
|
-
type: float
|
|
19
|
-
speed:
|
|
20
|
-
bytes: 1
|
|
21
|
-
type: unsigned
|
|
22
|
-
mark:
|
|
23
|
-
bytes: 2
|
|
24
|
-
type: unsigned
|
|
25
|
-
busstop:
|
|
26
|
-
bytes: 2
|
|
27
|
-
type: unsigned
|
|
28
|
-
trip:
|
|
29
|
-
bytes: 4
|
|
30
|
-
type: unsigned
|
|
31
|
-
route:
|
|
32
|
-
bytes: 1
|
|
33
|
-
type: unsigned
|
|
34
|
-
direction:
|
|
35
|
-
bytes: 1
|
|
36
|
-
type: bool
|
|
37
|
-
state:
|
|
38
|
-
bytes: 1
|
|
39
|
-
type: char
|
|
40
|
-
sales:
|
|
41
|
-
bytes: 3
|
|
42
|
-
type: unsigned
|
|
43
|
-
events:
|
|
44
|
-
bytes: 3
|
|
45
|
-
type: array
|
|
46
|
-
array:
|
|
47
|
-
id:
|
|
48
|
-
bytes: 2
|
|
49
|
-
type: unsigned
|
|
50
|
-
value:
|
|
51
|
-
bytes: 1
|
|
52
|
-
type: unsigned
|
|
53
|
-
|
|
54
|
-
ask_schedule:
|
|
55
|
-
id:
|
|
56
|
-
bytes: 4
|
|
57
|
-
type: unsigned
|
|
58
|
-
inicio:
|
|
59
|
-
bytes: 6
|
|
60
|
-
type: datetime
|
|
61
|
-
controles:
|
|
62
|
-
type: array
|
|
63
|
-
array:
|
|
64
|
-
geocerca:
|
|
65
|
-
bytes: 2
|
|
66
|
-
type: unsigned
|
|
67
|
-
tiempo:
|
|
68
|
-
bytes: 1
|
|
69
|
-
type: signed
|
|
70
|
-
volada:
|
|
71
|
-
bytes: 1
|
|
72
|
-
type: signed
|
|
73
|
-
|
|
74
|
-
ask_trip:
|
|
75
|
-
- bytes: 4
|
|
76
|
-
key: salida
|
|
77
|
-
type: unsigned
|
|
78
|
-
backward_datero:
|
|
79
|
-
- bytes: 2
|
|
80
|
-
key: geocerca
|
|
81
|
-
type: unsigned
|
|
82
|
-
- bytes: 1
|
|
83
|
-
key: i
|
|
84
|
-
type: unsigned
|
|
85
|
-
- bytes: 1
|
|
86
|
-
key: delta
|
|
87
|
-
type: unsigned
|
|
88
|
-
- bytes: 2
|
|
89
|
-
key: padron
|
|
90
|
-
type: unsigned
|
|
91
|
-
- bytes: 0
|
|
92
|
-
key: id
|
|
93
|
-
type: string
|
|
94
|
-
busstop:
|
|
95
|
-
- bytes: 2
|
|
96
|
-
key: id
|
|
97
|
-
type: unsigned
|
|
98
|
-
- bytes: 1
|
|
99
|
-
key: orden
|
|
100
|
-
type: unsigned
|
|
101
|
-
- bytes: 4
|
|
102
|
-
decimals: 6
|
|
103
|
-
key: longitud
|
|
104
|
-
type: float
|
|
105
|
-
- bytes: 4
|
|
106
|
-
decimals: 6
|
|
107
|
-
key: latitud
|
|
108
|
-
type: float
|
|
109
|
-
- bytes: 2
|
|
110
|
-
key: radio
|
|
111
|
-
type: unsigned
|
|
112
|
-
- bytes: 1
|
|
113
|
-
key: ruta
|
|
114
|
-
type: unsigned
|
|
115
|
-
- bytes: 1
|
|
116
|
-
keys:
|
|
117
|
-
- liquidar
|
|
118
|
-
- lado
|
|
119
|
-
- terminal
|
|
120
|
-
- activo
|
|
121
|
-
type: flags
|
|
122
|
-
- bytes: 14
|
|
123
|
-
key: nombre
|
|
124
|
-
type: string
|
|
125
|
-
- bytes: 1
|
|
126
|
-
key: velocidad
|
|
127
|
-
type: unsigned
|
|
128
|
-
- array:
|
|
129
|
-
- bytes: 2
|
|
130
|
-
key: boleto
|
|
131
|
-
type: unsigned
|
|
132
|
-
- bytes: 2
|
|
133
|
-
key: fin
|
|
134
|
-
type: unsigned
|
|
135
|
-
bytes: 0
|
|
136
|
-
key: tarifas
|
|
137
|
-
type: array
|
|
138
|
-
- bytes: 6
|
|
139
|
-
key: timestamp
|
|
140
|
-
type: datetime
|
|
141
|
-
command:
|
|
142
|
-
- bytes: 1
|
|
143
|
-
key: comando
|
|
144
|
-
type: char
|
|
145
|
-
- bytes: 0
|
|
146
|
-
key: id
|
|
147
|
-
type: string
|
|
148
|
-
- bytes: 0
|
|
149
|
-
key: value
|
|
150
|
-
type: string
|
|
151
|
-
error:
|
|
152
|
-
- bytes: 0
|
|
153
|
-
key: error
|
|
154
|
-
type: string
|
|
155
|
-
fare:
|
|
156
|
-
- bytes: 2
|
|
157
|
-
key: id
|
|
158
|
-
type: unsigned
|
|
159
|
-
- bytes: 7
|
|
160
|
-
key: color
|
|
161
|
-
type: string
|
|
162
|
-
- bytes: 1
|
|
163
|
-
key: orden
|
|
164
|
-
type: unsigned
|
|
165
|
-
- bytes: 13
|
|
166
|
-
key: nombre
|
|
167
|
-
type: string
|
|
168
|
-
- bytes: 1
|
|
169
|
-
keys:
|
|
170
|
-
- activo
|
|
171
|
-
- reintegro
|
|
172
|
-
type: flags
|
|
173
|
-
- bytes: 1
|
|
174
|
-
keys:
|
|
175
|
-
- lunes
|
|
176
|
-
- martes
|
|
177
|
-
- miercoles
|
|
178
|
-
- jueves
|
|
179
|
-
- viernes
|
|
180
|
-
- sabado
|
|
181
|
-
- domingo
|
|
182
|
-
- feriado
|
|
183
|
-
type: flags
|
|
184
|
-
- bytes: 2
|
|
185
|
-
key: ruta
|
|
186
|
-
type: unsigned
|
|
187
|
-
- bytes: 2
|
|
188
|
-
decimals: 2
|
|
189
|
-
key: tarifa
|
|
190
|
-
type: float
|
|
191
|
-
- bytes: 6
|
|
192
|
-
key: timestamp
|
|
193
|
-
type: datetime
|
|
194
|
-
finalize_sales:
|
|
195
|
-
- bytes: 4
|
|
196
|
-
key: sesion
|
|
197
|
-
type: unsigned
|
|
198
|
-
- bytes: 2
|
|
199
|
-
key: unidad
|
|
200
|
-
type: unsigned
|
|
201
|
-
- bytes: 6
|
|
202
|
-
key: fin
|
|
203
|
-
type: datetime
|
|
204
|
-
- bytes: 4
|
|
205
|
-
key: produccion
|
|
206
|
-
type: unsigned
|
|
207
|
-
- bytes: 4
|
|
208
|
-
key: primero
|
|
209
|
-
type: unsigned
|
|
210
|
-
- bytes: 4
|
|
211
|
-
key: ultimo
|
|
212
|
-
type: unsigned
|
|
213
|
-
finalize_sales_response:
|
|
214
|
-
- bytes: 1
|
|
215
|
-
key: error
|
|
216
|
-
type: bool
|
|
217
|
-
- bytes: 0
|
|
218
|
-
key: title
|
|
219
|
-
type: string
|
|
220
|
-
- bytes: 0
|
|
221
|
-
key: mensaje
|
|
222
|
-
type: string
|
|
223
|
-
- bytes: 4
|
|
224
|
-
key: id
|
|
225
|
-
type: unsigned
|
|
226
|
-
forward_datero:
|
|
227
|
-
- bytes: 2
|
|
228
|
-
key: geocerca
|
|
229
|
-
type: unsigned
|
|
230
|
-
- bytes: 4
|
|
231
|
-
key: salida
|
|
232
|
-
type: unsigned
|
|
233
|
-
- bytes: 6
|
|
234
|
-
key: hora
|
|
235
|
-
type: datetime
|
|
236
|
-
- array:
|
|
237
|
-
- bytes: 2
|
|
238
|
-
key: padron
|
|
239
|
-
type: unsigned
|
|
240
|
-
- bytes: 1
|
|
241
|
-
key: delta
|
|
242
|
-
type: unsigned
|
|
243
|
-
bytes: 0
|
|
244
|
-
key: dateros
|
|
245
|
-
type: array
|
|
246
|
-
geocerca:
|
|
247
|
-
- bytes: 2
|
|
248
|
-
key: id
|
|
249
|
-
type: unsigned
|
|
250
|
-
- bytes: 1
|
|
251
|
-
key: orden
|
|
252
|
-
type: unsigned
|
|
253
|
-
- bytes: 4
|
|
254
|
-
decimals: 6
|
|
255
|
-
key: longitud
|
|
256
|
-
type: float
|
|
257
|
-
- bytes: 4
|
|
258
|
-
decimals: 6
|
|
259
|
-
key: latitud
|
|
260
|
-
type: float
|
|
261
|
-
- bytes: 2
|
|
262
|
-
key: radio
|
|
263
|
-
type: unsigned
|
|
264
|
-
- bytes: 1
|
|
265
|
-
key: ruta
|
|
266
|
-
type: unsigned
|
|
267
|
-
- bytes: 1
|
|
268
|
-
keys:
|
|
269
|
-
- lado
|
|
270
|
-
- control
|
|
271
|
-
- datear
|
|
272
|
-
- activo
|
|
273
|
-
type: flags
|
|
274
|
-
- bytes: 15
|
|
275
|
-
key: nombre
|
|
276
|
-
type: string
|
|
277
|
-
- bytes: 6
|
|
278
|
-
key: timestamp
|
|
279
|
-
type: datetime
|
|
280
|
-
login:
|
|
281
|
-
- bytes: 0
|
|
282
|
-
key: serial
|
|
283
|
-
type: string
|
|
284
|
-
login_device:
|
|
285
|
-
- bytes: 2
|
|
286
|
-
key: id
|
|
287
|
-
type: unsigned
|
|
288
|
-
- bytes: 2
|
|
289
|
-
key: padron
|
|
290
|
-
type: unsigned
|
|
291
|
-
- bytes: 1
|
|
292
|
-
key: ruta
|
|
293
|
-
type: unsigned
|
|
294
|
-
- bytes: 1
|
|
295
|
-
key: lado
|
|
296
|
-
type: bool
|
|
297
|
-
- bytes: 2
|
|
298
|
-
key: geocerca
|
|
299
|
-
type: unsigned
|
|
300
|
-
- bytes: 1
|
|
301
|
-
key: estado
|
|
302
|
-
type: char
|
|
303
|
-
- bytes: 4
|
|
304
|
-
key: salida
|
|
305
|
-
type: unsigned
|
|
306
|
-
- bytes: 4
|
|
307
|
-
key: conductor
|
|
308
|
-
type: unsigned
|
|
309
|
-
- bytes: 1
|
|
310
|
-
key: orden
|
|
311
|
-
type: unsigned
|
|
312
|
-
- bytes: 1
|
|
313
|
-
key: logueado
|
|
314
|
-
type: bool
|
|
315
|
-
- bytes: 6
|
|
316
|
-
key: data
|
|
317
|
-
type: datetime
|
|
318
|
-
- bytes: 2
|
|
319
|
-
key: programada
|
|
320
|
-
type: time
|
|
321
|
-
message:
|
|
322
|
-
- bytes: 4
|
|
323
|
-
key: id
|
|
324
|
-
type: unsigned
|
|
325
|
-
- bytes: 0
|
|
326
|
-
key: texto
|
|
327
|
-
type: string
|
|
328
|
-
message_response:
|
|
329
|
-
- bytes: 4
|
|
330
|
-
key: id
|
|
331
|
-
type: unsigned
|
|
332
|
-
- bytes: 1
|
|
333
|
-
key: read
|
|
334
|
-
type: bool
|
|
335
|
-
new_ip:
|
|
336
|
-
- bytes: 0
|
|
337
|
-
key: ip
|
|
338
|
-
type: string
|
|
339
|
-
operation:
|
|
340
|
-
- bytes: 0
|
|
341
|
-
key: id
|
|
342
|
-
type: string
|
|
343
|
-
- bytes: 0
|
|
344
|
-
key: section
|
|
345
|
-
type: string
|
|
346
|
-
- bytes: 0
|
|
347
|
-
key: key
|
|
348
|
-
type: string
|
|
349
|
-
- bytes: 0
|
|
350
|
-
key: value
|
|
351
|
-
type: string
|
|
352
|
-
operation_response:
|
|
353
|
-
- bytes: 0
|
|
354
|
-
key: id
|
|
355
|
-
type: string
|
|
356
|
-
parameter:
|
|
357
|
-
- bytes: 0
|
|
358
|
-
key: id
|
|
359
|
-
type: string
|
|
360
|
-
- bytes: 0
|
|
361
|
-
key: nombre
|
|
362
|
-
type: string
|
|
363
|
-
- bytes: 0
|
|
364
|
-
key: valor
|
|
365
|
-
type: string
|
|
366
|
-
position_response:
|
|
367
|
-
- bytes: 1
|
|
368
|
-
key: reportes
|
|
369
|
-
type: unsigned
|
|
370
|
-
- array:
|
|
371
|
-
- bytes: 2
|
|
372
|
-
key: id
|
|
373
|
-
type: unsigned
|
|
374
|
-
bytes: 0
|
|
375
|
-
key: ids
|
|
376
|
-
type: array
|
|
377
|
-
remaining_data:
|
|
378
|
-
- bytes: 4
|
|
379
|
-
key: faltantes
|
|
380
|
-
type: unsigned
|
|
381
|
-
- bytes: 1
|
|
382
|
-
key: tabla
|
|
383
|
-
type: char
|
|
384
|
-
route:
|
|
385
|
-
- bytes: 2
|
|
386
|
-
key: id
|
|
387
|
-
type: unsigned
|
|
388
|
-
- bytes: 0
|
|
389
|
-
key: codigo
|
|
390
|
-
type: string
|
|
391
|
-
- bytes: 6
|
|
392
|
-
key: timestamp
|
|
393
|
-
type: datetime
|
|
394
|
-
route_settings:
|
|
395
|
-
- bytes: 2
|
|
396
|
-
key: id
|
|
397
|
-
type: unsigned
|
|
398
|
-
- bytes: 0
|
|
399
|
-
key: nombre
|
|
400
|
-
type: string
|
|
401
|
-
- bytes: 1
|
|
402
|
-
key: ruta
|
|
403
|
-
type: unsigned
|
|
404
|
-
- bytes: 0
|
|
405
|
-
key: tipo
|
|
406
|
-
type: string
|
|
407
|
-
- bytes: 0
|
|
408
|
-
key: data
|
|
409
|
-
type: string
|
|
410
|
-
- bytes: 6
|
|
411
|
-
key: timestamp
|
|
412
|
-
type: datetime
|
|
413
|
-
schedule:
|
|
414
|
-
- bytes: 4
|
|
415
|
-
key: salida
|
|
416
|
-
type: unsigned
|
|
417
|
-
- array:
|
|
418
|
-
- bytes: 2
|
|
419
|
-
key: geocerca
|
|
420
|
-
type: unsigned
|
|
421
|
-
bytes: 0
|
|
422
|
-
key: controles
|
|
423
|
-
type: array
|
|
424
|
-
settings:
|
|
425
|
-
- bytes: 2
|
|
426
|
-
key: id
|
|
427
|
-
type: unsigned
|
|
428
|
-
- bytes: 0
|
|
429
|
-
key: nombre
|
|
430
|
-
type: string
|
|
431
|
-
- bytes: 0
|
|
432
|
-
key: tipo
|
|
433
|
-
type: string
|
|
434
|
-
- bytes: 0
|
|
435
|
-
key: data
|
|
436
|
-
type: string
|
|
437
|
-
- bytes: 6
|
|
438
|
-
key: timestamp
|
|
439
|
-
type: datetime
|
|
440
|
-
start_sales:
|
|
441
|
-
- bytes: 0
|
|
442
|
-
key: clave
|
|
443
|
-
type: string
|
|
444
|
-
- bytes: 0
|
|
445
|
-
key: dni
|
|
446
|
-
type: string
|
|
447
|
-
- bytes: 1
|
|
448
|
-
key: lado
|
|
449
|
-
type: bool
|
|
450
|
-
- bytes: 1
|
|
451
|
-
key: ruta
|
|
452
|
-
type: unsigned
|
|
453
|
-
- bytes: 2
|
|
454
|
-
key: unidad
|
|
455
|
-
type: unsigned
|
|
456
|
-
start_sales_response:
|
|
457
|
-
- bytes: 1
|
|
458
|
-
key: error
|
|
459
|
-
type: bool
|
|
460
|
-
- bytes: 0
|
|
461
|
-
key: title
|
|
462
|
-
type: string
|
|
463
|
-
- bytes: 0
|
|
464
|
-
key: mensaje
|
|
465
|
-
type: string
|
|
466
|
-
- array:
|
|
467
|
-
- bytes: 4
|
|
468
|
-
key: id
|
|
469
|
-
type: unsigned
|
|
470
|
-
- bytes: 2
|
|
471
|
-
key: conductor_id
|
|
472
|
-
type: unsigned
|
|
473
|
-
- bytes: 0
|
|
474
|
-
key: conductor_codigo
|
|
475
|
-
type: string
|
|
476
|
-
- bytes: 1
|
|
477
|
-
keys:
|
|
478
|
-
- activo
|
|
479
|
-
- castigado
|
|
480
|
-
- conductor
|
|
481
|
-
- vencido
|
|
482
|
-
type: flags
|
|
483
|
-
- bytes: 1
|
|
484
|
-
key: ruta
|
|
485
|
-
type: unsigned
|
|
486
|
-
- bytes: 1
|
|
487
|
-
key: lado
|
|
488
|
-
type: bool
|
|
489
|
-
- bytes: 6
|
|
490
|
-
key: inicio
|
|
491
|
-
type: datetime
|
|
492
|
-
bytes: 0
|
|
493
|
-
key: sesiones
|
|
494
|
-
type: array
|
|
495
|
-
tickets:
|
|
496
|
-
- array:
|
|
497
|
-
- bytes: 2
|
|
498
|
-
key: boleto
|
|
499
|
-
type: unsigned
|
|
500
|
-
- bytes: 2
|
|
501
|
-
key: conductor
|
|
502
|
-
type: unsigned
|
|
503
|
-
- bytes: 4
|
|
504
|
-
key: correlativo
|
|
505
|
-
type: unsigned
|
|
506
|
-
- bytes: 3
|
|
507
|
-
key: dia
|
|
508
|
-
type: date
|
|
509
|
-
- bytes: 2
|
|
510
|
-
key: fin
|
|
511
|
-
type: unsigned
|
|
512
|
-
- bytes: 6
|
|
513
|
-
key: hora
|
|
514
|
-
type: datetime
|
|
515
|
-
- bytes: 4
|
|
516
|
-
key: inicio
|
|
517
|
-
type: unsigned
|
|
518
|
-
- bytes: 2
|
|
519
|
-
key: inspector
|
|
520
|
-
type: unsigned
|
|
521
|
-
- bytes: 1
|
|
522
|
-
key: medio_pago
|
|
523
|
-
type: unsigned
|
|
524
|
-
- bytes: 4
|
|
525
|
-
key: numero
|
|
526
|
-
type: unsigned
|
|
527
|
-
- bytes: 2
|
|
528
|
-
key: precio
|
|
529
|
-
type: unsigned
|
|
530
|
-
- bytes: 1
|
|
531
|
-
key: ruta
|
|
532
|
-
type: unsigned
|
|
533
|
-
- bytes: 4
|
|
534
|
-
key: sesion
|
|
535
|
-
type: unsigned
|
|
536
|
-
- bytes: 2
|
|
537
|
-
key: unidad
|
|
538
|
-
type: unsigned
|
|
539
|
-
- bytes: 0
|
|
540
|
-
key: tarjeta
|
|
541
|
-
type: string
|
|
542
|
-
bytes: 0
|
|
543
|
-
key: tickets
|
|
544
|
-
type: array
|
|
545
|
-
tickets_response:
|
|
546
|
-
- array:
|
|
547
|
-
- bytes: 4
|
|
548
|
-
key: correlativo
|
|
549
|
-
type: unsigned
|
|
550
|
-
- bytes: 0
|
|
551
|
-
key: id
|
|
552
|
-
type: string
|
|
553
|
-
bytes: 0
|
|
554
|
-
key: tickets
|
|
555
|
-
type: array
|
|
556
|
-
timestamp:
|
|
557
|
-
- bytes: 6
|
|
558
|
-
key: timestamp
|
|
559
|
-
type: timestamp
|
|
560
|
-
timestamp_us:
|
|
561
|
-
- bytes: 8
|
|
562
|
-
key: timestamp
|
|
563
|
-
type: timestamp
|
|
564
|
-
trip:
|
|
565
|
-
- bytes: 4
|
|
566
|
-
key: id
|
|
567
|
-
type: unsigned
|
|
568
|
-
- bytes: 1
|
|
569
|
-
key: ruta
|
|
570
|
-
type: unsigned
|
|
571
|
-
- bytes: 1
|
|
572
|
-
key: lado
|
|
573
|
-
type: bool
|
|
574
|
-
- bytes: 6
|
|
575
|
-
key: inicio
|
|
576
|
-
type: datetime
|
|
577
|
-
- bytes: 1
|
|
578
|
-
key: estado
|
|
579
|
-
type: char
|
|
580
|
-
- bytes: 1
|
|
581
|
-
key: frecuencia
|
|
582
|
-
type: unsigned
|
|
583
|
-
- bytes: 4
|
|
584
|
-
key: conductor
|
|
585
|
-
type: unsigned
|
|
586
|
-
- bytes: 2
|
|
587
|
-
key: geocerca
|
|
588
|
-
type: unsigned
|
|
589
|
-
- array:
|
|
590
|
-
- bytes: 2
|
|
591
|
-
key: geocerca
|
|
592
|
-
type: unsigned
|
|
593
|
-
- bytes: 1
|
|
594
|
-
key: tiempo
|
|
595
|
-
type: signed
|
|
596
|
-
- bytes: 1
|
|
597
|
-
key: volada
|
|
598
|
-
type: signed
|
|
599
|
-
bytes: 0
|
|
600
|
-
key: controles
|
|
601
|
-
type: array
|
|
602
|
-
- bytes: 0
|
|
603
|
-
key: marcados
|
|
604
|
-
type: bits
|
|
605
|
-
user_route:
|
|
606
|
-
- bytes: 2
|
|
607
|
-
key: id
|
|
608
|
-
type: unsigned
|
|
609
|
-
- bytes: 9
|
|
610
|
-
key: celular
|
|
611
|
-
type: string
|
|
612
|
-
- bytes: 14
|
|
613
|
-
key: nombre
|
|
614
|
-
type: string
|
|
615
|
-
- array:
|
|
616
|
-
- bytes: 1
|
|
617
|
-
key: ruta
|
|
618
|
-
type: unsigned
|
|
619
|
-
bytes: 1
|
|
620
|
-
key: rutas
|
|
621
|
-
type: array
|
|
622
|
-
- bytes: 6
|
|
623
|
-
key: timestamp
|
|
624
|
-
type: datetime
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|