├── README.md ├── egts ├── __init__.py ├── crc.py ├── egts_message │ ├── __init__.py │ ├── message.py │ ├── service │ │ ├── __init__.py │ │ ├── auth │ │ │ ├── __init__.py │ │ │ ├── auth_info.py │ │ │ ├── auth_params.py │ │ │ ├── module_data.py │ │ │ ├── result_code.py │ │ │ ├── service_info.py │ │ │ ├── term_identity.py │ │ │ └── vehicle_data.py │ │ ├── commands │ │ │ ├── __init__.py │ │ │ └── command_data.py │ │ ├── data_record.py │ │ ├── data_subrecord.py │ │ ├── ecall │ │ │ ├── __init__.py │ │ │ ├── accel_data.py │ │ │ ├── raw_msd_data.py │ │ │ └── track_data.py │ │ ├── firmware │ │ │ ├── __init__.py │ │ │ ├── object_data_header.py │ │ │ ├── service_full_data.py │ │ │ └── service_part_data.py │ │ ├── record_response │ │ │ ├── __init__.py │ │ │ └── record_response.py │ │ ├── service.py │ │ └── teledata │ │ │ ├── __init__.py │ │ │ ├── abs_an_sens_data.py │ │ │ ├── abs_cntr_data.py │ │ │ ├── abs_dig_sens_data.py │ │ │ ├── abs_loopin_data.py │ │ │ ├── accel_data.py │ │ │ ├── ad_sensors_data.py │ │ │ ├── counters_data.py │ │ │ ├── ext_pos_data.py │ │ │ ├── liquid_level_sensor.py │ │ │ ├── loopin_data.py │ │ │ ├── passengers_counters.py │ │ │ ├── pos_data.py │ │ │ ├── presence_flags.py │ │ │ └── state_data.py │ └── transport.py ├── egts_types │ ├── __init__.py │ ├── date_time_field.py │ └── types.py ├── interface │ ├── __init__.py │ ├── classes.py │ ├── codes.py │ └── egts.py └── setup.py ├── pylintrc ├── setup_egts.py └── tests ├── __init__.py ├── json ├── EGTS_validator_x64.exe ├── data │ ├── abs_an_sens_data_simple.json │ ├── abs_cntr_data_simple.json │ ├── abs_dig_sens_data_simple.json │ ├── abs_loopin_data_simple.json │ ├── accel_data_max_size.json │ ├── accel_data_simple.json │ ├── ad_sensors_data_simple.json │ ├── auth_info_simple.json │ ├── auth_params_max_size.json │ ├── auth_params_no_optional.json │ ├── auth_params_simple.json │ ├── command_data_max_size_com.json │ ├── command_data_max_size_conf.json │ ├── command_data_simple_com.json │ ├── command_data_simple_conf.json │ ├── counters_data_simple.json │ ├── ext_pos_data_simple.json │ ├── liquid_level_sensor_simple.json │ ├── loopin_data_simple.json │ ├── module_data_simple.json │ ├── passengers_counters_simple.json │ ├── pos_data_simple.json │ ├── raw_msd_data_max_length.json │ ├── raw_msd_data_simple.json │ ├── record_response_simple.json │ ├── result_code_simple.json │ ├── service_full_data_max_size.json │ ├── service_full_data_simple.json │ ├── service_info_simple.json │ ├── service_part_data_max_size.json │ ├── service_part_data_simple.json │ ├── state_data_simple.json │ ├── term_identity_all_optional.json │ ├── term_identity_max_size.json │ ├── term_identity_no_optional.json │ ├── term_identity_simple.json │ ├── track_data_and_accel_data.json │ ├── track_data_empty.json │ ├── track_data_max_size.json │ ├── track_data_simple.json │ ├── transport.json │ ├── vehicle_data_and_term_identity.json │ └── vehicle_data_simple.json ├── expected │ ├── abs_an_sens_data_simple.txt │ ├── abs_cntr_data_simple.txt │ ├── abs_dig_sens_data_simple.txt │ ├── abs_loopin_data_simple.txt │ ├── accel_data_max_size.txt │ ├── accel_data_simple.txt │ ├── ad_sensors_data_simple.txt │ ├── auth_info_simple.txt │ ├── auth_params_max_size.txt │ ├── auth_params_no_optional.txt │ ├── command_data_simple_com.txt │ ├── command_data_simple_conf.txt │ ├── counters_data_simple.txt │ ├── ext_pos_data_simple.txt │ ├── liquid_level_sensor_simple.txt │ ├── loopin_data_simple.txt │ ├── module_data_simple.txt │ ├── passengers_counters_simple.txt │ ├── pos_data_simple.txt │ ├── raw_msd_data_max_length.txt │ ├── raw_msd_data_simple.txt │ ├── record_response_simple.txt │ ├── result.txt │ ├── result_code_simple.txt │ ├── service_full_data_max_size.txt │ ├── service_full_data_simple.txt │ ├── service_info_simple.txt │ ├── service_part_data_max_size.txt │ ├── service_part_data_simple.txt │ ├── state_data_simple.txt │ ├── term_identity_all_optional.txt │ ├── term_identity_max_size.txt │ ├── term_identity_no_optional.txt │ ├── term_identity_simple.txt │ ├── track_data_and_accel_data.txt │ ├── track_data_empty.txt │ ├── track_data_max_size.txt │ ├── track_data_simple.txt │ ├── transport.txt │ ├── vehicle_data_and_term_identity.txt │ └── vehicle_data_simple.txt ├── generated │ ├── clear.py │ ├── pos_data_simple.txt │ ├── tmp_msg.bin │ └── track_data_simple.txt └── tmp_a.bin ├── test_json.py └── test_types.py /README.md: -------------------------------------------------------------------------------- 1 | # EGTS Packet Encoder 2 | **Python library for encoding vehicle data to EGTS packets** 3 | 4 | ## Required packages: 5 | * enum 6 | 7 | ## Installation 8 | 1. Rename "_setup_egts.py_" to "_setup.py_" 9 | 2. Run "_python setup.py_" 10 | 3. After setup is done run "_pip install ._" 11 | 12 | ## Usage 13 | * To create a EGTS message use **EGTS** class from _interface_ package: `from egts.interface.egts import EGTS` 14 | * For manual data assignment: 15 | * Use the _codes_ module to get EGTS protocol codes: `from egts.interface import codes` 16 | * You **must** specify Packet Types and Subrecord Types:
17 | * In constructor:
18 | ```python 19 | msg = EGTS(PacketType.EGTS_PT_APPDATA, (SubrecordType.EGTS_SR_ACCEL_DATA,), (SubrecordType.EGTS_SR_TRACK_DATA, SubrecordType.EGTS_SR_TRACK_DATA)) 20 | ``` 21 | This command creates a EGTS_PT_APPDATA packet with two records: 22 | record #1 has one EGTS_SR_ACCEL_DATA subrecord; 23 | record #2 has two EGTS_SR_TRACK_DATA subrecords
24 | **OR** 25 | * Via _set_packet_type_, _add_record_ and _add_subrecord_ methods:
26 | ```python 27 | msg = EGTS() 28 | msg.set_packet_type(PacketType.EGTS_PT_APPDATA) 29 | record1 = msg.add_record((SubrecordType.EGTS_SR_ACCEL_DATA,)) 30 | record2 = msg.add_record() 31 | subrecord1 = record2.add_subrecord(SubrecordType.EGTS_SR_TRACK_DATA) 32 | subrecord2 = record2.add_subrecord(SubrecordType.EGTS_SR_TRACK_DATA) 33 | ``` 34 | * To work with a specific record within a packet, retrieve it using the number of the record: 35 | ```python 36 | record1 = msg[0] 37 | ``` 38 | * To work with a specific subrecord within a record, retrieve it using the number of the record: 39 | ```python 40 | subrecord1 = record1[0] 41 | ``` 42 | * Use `__setitem__` to set field values, there is a deep search so you don't have to retrieve compound fields every time: 43 | ```python 44 | subrecord1['cid'] = 1 45 | subrecord1['cct'] = 0 # does the same that subrecord1['type_flags']['cct'] = 0 46 | ``` 47 | * You can use `__getitem__` to get fields if neccessary: 48 | ```python 49 | flags = subrecord1['type_flags'] 50 | flags['cct'] = 0 51 | ``` 52 | * For JSON assignment: 53 | * Use `load_json` method: 54 | ```python 55 | msg = EGTS() 56 | msg.load_json('/home/sanchez486/data.json') 57 | ``` 58 | You can find json examples in `/tests/json/data` folder 59 | * Use `__str__` to get a EGTS packet byte string: 60 | ```python 61 | egts_string = str(msg) 62 | pring egts_string # 0100000B0012000100018807000100040000D90F0202180400010203047EB2 63 | ``` 64 | * Use `bytes` property to get packet representation in bytes: 65 | ```python 66 | egts_bytes = msg.bytes 67 | ``` 68 | * Use `write` method to write the packet bytes in a file: 69 | ```python 70 | msg.write('/home/sanchez486/data.hex') 71 | ``` 72 | 73 | ## Contacts 74 | I apologize for confusing import names and weird installation instructions. I didn't have a chance to create some order in the packages. 75 | The library was not properly tested with a real gear so it may show some unexpected behavior. If you have any questions, suggestions or fix requests please free to contact me in github or via these credentials: 76 | * E-mail: fergusonalexandr@mail.ru 77 | * Skype: live:ailiush 78 | * Vk: https://vk.com/sanchez486 79 | 80 | -------------------------------------------------------------------------------- /egts/__init__.py: -------------------------------------------------------------------------------- 1 | from .interface import egts, codes 2 | -------------------------------------------------------------------------------- /egts/crc.py: -------------------------------------------------------------------------------- 1 | """Calculating header checksum (CRC8)""" 2 | # CRC 8 Calculating table 3 | CRC8_TABLE = ( 4 | 0x00, 0x31, 0x62, 0x53, 0xC4, 0xF5, 0xA6, 0x97, 5 | 0xB9, 0x88, 0xDB, 0xEA, 0x7D, 0x4C, 0x1F, 0x2E, 6 | 0x43, 0x72, 0x21, 0x10, 0x87, 0xB6, 0xE5, 0xD4, 7 | 0xFA, 0xCB, 0x98, 0xA9, 0x3E, 0x0F, 0x5C, 0x6D, 8 | 0x86, 0xB7, 0xE4, 0xD5, 0x42, 0x73, 0x20, 0x11, 9 | 0x3F, 0x0E, 0x5D, 0x6C, 0xFB, 0xCA, 0x99, 0xA8, 10 | 0xC5, 0xF4, 0xA7, 0x96, 0x01, 0x30, 0x63, 0x52, 11 | 0x7C, 0x4D, 0x1E, 0x2F, 0xB8, 0x89, 0xDA, 0xEB, 12 | 0x3D, 0x0C, 0x5F, 0x6E, 0xF9, 0xC8, 0x9B, 0xAA, 13 | 0x84, 0xB5, 0xE6, 0xD7, 0x40, 0x71, 0x22, 0x13, 14 | 0x7E, 0x4F, 0x1C, 0x2D, 0xBA, 0x8B, 0xD8, 0xE9, 15 | 0xC7, 0xF6, 0xA5, 0x94, 0x03, 0x32, 0x61, 0x50, 16 | 0xBB, 0x8A, 0xD9, 0xE8, 0x7F, 0x4E, 0x1D, 0x2C, 17 | 0x02, 0x33, 0x60, 0x51, 0xC6, 0xF7, 0xA4, 0x95, 18 | 0xF8, 0xC9, 0x9A, 0xAB, 0x3C, 0x0D, 0x5E, 0x6F, 19 | 0x41, 0x70, 0x23, 0x12, 0x85, 0xB4, 0xE7, 0xD6, 20 | 0x7A, 0x4B, 0x18, 0x29, 0xBE, 0x8F, 0xDC, 0xED, 21 | 0xC3, 0xF2, 0xA1, 0x90, 0x07, 0x36, 0x65, 0x54, 22 | 0x39, 0x08, 0x5B, 0x6A, 0xFD, 0xCC, 0x9F, 0xAE, 23 | 0x80, 0xB1, 0xE2, 0xD3, 0x44, 0x75, 0x26, 0x17, 24 | 0xFC, 0xCD, 0x9E, 0xAF, 0x38, 0x09, 0x5A, 0x6B, 25 | 0x45, 0x74, 0x27, 0x16, 0x81, 0xB0, 0xE3, 0xD2, 26 | 0xBF, 0x8E, 0xDD, 0xEC, 0x7B, 0x4A, 0x19, 0x28, 27 | 0x06, 0x37, 0x64, 0x55, 0xC2, 0xF3, 0xA0, 0x91, 28 | 0x47, 0x76, 0x25, 0x14, 0x83, 0xB2, 0xE1, 0xD0, 29 | 0xFE, 0xCF, 0x9C, 0xAD, 0x3A, 0x0B, 0x58, 0x69, 30 | 0x04, 0x35, 0x66, 0x57, 0xC0, 0xF1, 0xA2, 0x93, 31 | 0xBD, 0x8C, 0xDF, 0xEE, 0x79, 0x48, 0x1B, 0x2A, 32 | 0xC1, 0xF0, 0xA3, 0x92, 0x05, 0x34, 0x67, 0x56, 33 | 0x78, 0x49, 0x1A, 0x2B, 0xBC, 0x8D, 0xDE, 0xEF, 34 | 0x82, 0xB3, 0xE0, 0xD1, 0x46, 0x77, 0x24, 0x15, 35 | 0x3B, 0x0A, 0x59, 0x68, 0xFF, 0xCE, 0x9D, 0xAC 36 | ) 37 | 38 | CRC16_TABLE = ( 39 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 40 | 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 41 | 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 42 | 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 43 | 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 44 | 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 45 | 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 46 | 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 47 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 48 | 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 49 | 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 50 | 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 51 | 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 52 | 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 53 | 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 54 | 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 55 | 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 56 | 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 57 | 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 58 | 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 59 | 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 60 | 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 61 | 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 62 | 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 63 | 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 64 | 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 65 | 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 66 | 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 67 | 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 68 | 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 69 | 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 70 | 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 71 | 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 72 | 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 73 | 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 74 | 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 75 | 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 76 | 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 77 | 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 78 | 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 79 | 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 80 | 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 81 | 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 82 | ) 83 | 84 | 85 | def header_crc(header): 86 | """ 87 | Calculate header checksum 88 | :param header: header bytes (tuple) 89 | :return: 8-bit checksum (int) 90 | """ 91 | crc = 0xFF 92 | i = 0 93 | while i < len(header): 94 | crc = CRC8_TABLE[crc ^ ord(header[i])] 95 | i += 1 96 | return crc 97 | 98 | 99 | def data_crc(data): 100 | """ 101 | Calculate data checksum 102 | :param data: data bytes (tuple) 103 | :return: 16-bit checksum (int) 104 | """ 105 | crc = 0xFFFF 106 | i = 0 107 | while i < len(data): 108 | crc = ((crc << 8) % 0x10000) ^ CRC16_TABLE[(crc >> 8) ^ ord(data[i])] 109 | i += 1 110 | return crc 111 | -------------------------------------------------------------------------------- /egts/egts_message/__init__.py: -------------------------------------------------------------------------------- 1 | """Whole EGTS Message class""" 2 | from .message import EGTSMessage 3 | -------------------------------------------------------------------------------- /egts/egts_message/message.py: -------------------------------------------------------------------------------- 1 | """Whole EGTS Message""" 2 | from . import transport 3 | from ..egts_types import * 4 | from .. import crc 5 | 6 | 7 | class EGTSMessage(EGTSRecord): 8 | """ 9 | EGTS message class 10 | """ 11 | def __init__(self, *args, **kwargs): 12 | """ 13 | Overriding constructor with fields 14 | :param args: additional args 15 | :param kwargs: parent class kwargs 16 | """ 17 | super(EGTSMessage, self).__init__( 18 | ('transport', transport.Transport()), 19 | ('hcs', Byte()), 20 | ('service', None), 21 | ('sfrcs', UShort(optional=True)), 22 | *args, **kwargs 23 | ) 24 | 25 | def set_fields(self): 26 | """ 27 | Calculate necessary fields 28 | """ 29 | if 'service' in self.value: 30 | self['sfrcs'] = crc.data_crc(self['service'].bytes) 31 | self['transport']['fdl'] = len(self['service']) 32 | self['hcs'] = crc.header_crc(self['transport'].bytes) 33 | -------------------------------------------------------------------------------- /egts/egts_message/service/__init__.py: -------------------------------------------------------------------------------- 1 | """EGTS Service Layer Classes""" 2 | from .auth import * 3 | from .commands import * 4 | from .ecall import * 5 | from .firmware import * 6 | from .record_response import * 7 | from .teledata import * 8 | from .data_subrecord import ServiceDataSubRecord 9 | from .data_record import ServiceDataRecord 10 | from .service import EGTSResponse, EGTSAppdata, EGTSSignedAppdata 11 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/__init__.py: -------------------------------------------------------------------------------- 1 | """EGTS_AUTH_SERVICE Classes""" 2 | from .auth_info import AuthInfo 3 | from .auth_params import AuthParams 4 | from .module_data import ModuleData 5 | from .result_code import ResultCode 6 | from .service_info import ServiceInfo 7 | from .term_identity import TermIdentity 8 | from .vehicle_data import VehicleData 9 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/auth_info.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_AUTH_INFO""" 2 | from ....egts_types import * 3 | 4 | 5 | class AuthInfo(EGTSRecord): 6 | """EGTS_SR_AUTH_INFO Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(AuthInfo, self).__init__( 14 | # Username and password. Set outside. 15 | ('unm', String(maxlen=32)), 16 | ('d1', Byte(value=0)), 17 | ('upsw', String(maxlen=32)), 18 | ('d2', Byte(value=0)), 19 | ('ss', String(maxlen=255, optional=True)), 20 | ('d3', Byte(optional=True)), 21 | *args, **kwargs 22 | ) 23 | 24 | def set_fields(self): 25 | """ 26 | Calculate necessary fields 27 | """ 28 | if self['ss'].specified: 29 | self['d3'] = 0 30 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/auth_params.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_AUTH_PARAMS""" 2 | from ....egts_types import * 3 | 4 | 5 | class AuthParams(EGTSRecord): 6 | """EGTS_SR_AUTH_PARAMS Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(AuthParams, self).__init__( 14 | ('flags', Flags()), 15 | # All fields are optional by default 16 | ('pkl', UShort(optional=True)), 17 | ('pbk', ArrayOfType(of_type=Byte, maxlen=512, optional=True)), 18 | ('isl', UShort(optional=True)), 19 | ('msz', UShort(optional=True)), 20 | ('ss', String(maxlen=255, optional=True)), 21 | ('d1', Byte(optional=True)), 22 | ('exp', String(maxlen=255, optional=True)), 23 | ('d2', Byte(optional=True)), 24 | *args, **kwargs 25 | ) 26 | 27 | def set_fields(self): 28 | """ 29 | Calculate necessary fields 30 | """ 31 | flags = self['flags'] 32 | flags['isle'] = int(self['isl'].specified) 33 | flags['exe'] = int(self['exp'].specified) 34 | flags['sse'] = int(self['ss'].specified) 35 | flags['pke'] = int(self['pbk'].specified) 36 | flags['mse'] = int(self['msz'].specified) 37 | 38 | if self['ss'].specified: 39 | self['d1'] = 0 40 | if self['exp'].specified: 41 | self['d2'] = 0 42 | if self['pbk'].specified: 43 | self['pkl'] = len(self['pbk']) 44 | 45 | 46 | class Flags(BitField): 47 | """EGTS_SR_AUTH_PARAMS Flags""" 48 | def __init__(self, *args, **kwargs): 49 | """ 50 | Overriding constructor with fields 51 | :param args: additional args 52 | :param kwargs: parent class kwargs 53 | """ 54 | super(Flags, self).__init__( 55 | ('empty', Bits(maxlen=1, value=0)), 56 | # Flags calculated based on fields existence 57 | ('exe', Bits(maxlen=1)), 58 | ('sse', Bits(maxlen=1)), 59 | ('mse', Bits(maxlen=1)), 60 | ('isle', Bits(maxlen=1)), 61 | ('pke', Bits(maxlen=1)), 62 | # No encryption by default 63 | ('ena', Bits(maxlen=2, value=0b01)), 64 | *args, **kwargs 65 | ) 66 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/module_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_MODULE_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class ModuleData(EGTSRecord): 6 | """EGTS_SR_MODULE_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(ModuleData, self).__init__( 14 | # Module Type; Main Module by default 15 | ('mt', Short(value=1)), 16 | # Vendor ID. Set outside 17 | ('vid', UInt()), 18 | # Firmware Version. Set Outside 19 | ('fwv', UShort()), 20 | # Software version. Set Outside 21 | ('swv', UShort()), 22 | # Modification Code. Set Outside 23 | ('md', Byte()), 24 | # State is ON by default 25 | ('st', Byte(value=1)), 26 | # String fields are unspecified by default 27 | ('srn', String(maxlen=32, optional=True)), 28 | ('d1', Byte(value=0)), 29 | ('dscr', String(maxlen=32, optional=True)), 30 | ('d2', Byte(value=0)), 31 | *args, **kwargs 32 | ) 33 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/result_code.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_RESULT_CODE""" 2 | from ....egts_types import * 3 | 4 | 5 | class ResultCode(EGTSRecord): 6 | """EGTS_SR_RESULT_CODE Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(ResultCode, self).__init__( 14 | # Result code. Set Outside. 15 | ('rcd', Byte()), 16 | *args, **kwargs 17 | ) 18 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/service_info.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_SERVICE_INFO""" 2 | from ....egts_types import * 3 | 4 | 5 | class ServiceInfo(EGTSRecord): 6 | """EGTS_SR_SERVICE_INFO Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(ServiceInfo, self).__init__( 14 | ('st', Byte()), 15 | # Default statement is IN_SERVICE 16 | ('sst', Byte(value=0)), 17 | ('srvp', ServiceParameters()), 18 | *args, **kwargs 19 | ) 20 | 21 | 22 | class ServiceParameters(BitField): 23 | """EGTS_SR_SERVICE_INFO Flags""" 24 | def __init__(self, *args, **kwargs): 25 | """ 26 | Overriding constructor with fields 27 | :param args: additional args 28 | :param kwargs: parent class kwargs 29 | """ 30 | super(ServiceParameters, self).__init__( 31 | # Service Attribute. Set Outside. 32 | ('srva', Bits(maxlen=1)), 33 | ('empty', Bits(maxlen=5, value=0)), 34 | # Priority is highest by default 35 | ('srvrp', Bits(maxlen=2, value=0b00)), 36 | *args, **kwargs 37 | ) 38 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/term_identity.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_TERM_IDENTITY""" 2 | from ....egts_types import * 3 | 4 | 5 | class TermIdentity(EGTSRecord): 6 | """EGTS_SR_TERM_IDENTITY Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(TermIdentity, self).__init__( 14 | # terminal identifier - set outside 15 | ('tid', UInt()), 16 | # Flags calculated based on fields existence 17 | ('flags', Flags()), 18 | # All fields unspecified by default 19 | ('hdid', UShort(optional=True)), 20 | ('imei', String(maxlen=15, minlen=15, optional=True)), 21 | ('imsi', String(maxlen=16, minlen=16, optional=True)), 22 | ('lngc', String(maxlen=3, minlen=3, optional=True)), 23 | ('nid', NetworkIdentifier(optional=True)), 24 | ('bs', UShort(optional=True)), 25 | ('msisdn', String(maxlen=15, minlen=15, optional=True)), 26 | *args, **kwargs 27 | ) 28 | 29 | def set_fields(self): 30 | """ 31 | Calculate necessary fields 32 | """ 33 | flags = self['flags'] 34 | flags['mne'] = int(self['msisdn'].specified) 35 | flags['bse'] = int(self['bs'].specified) 36 | flags['nide'] = int(self['nid'].specified) 37 | flags['lngce'] = int(self['lngc'].specified) 38 | flags['imsie'] = int(self['imsi'].specified) 39 | flags['imeie'] = int(self['imei'].specified) 40 | flags['hdide'] = int(self['hdid'].specified) 41 | 42 | 43 | class NetworkIdentifier(BitField): 44 | """EGTS_SR_TERM_IDENTITY Network Identifier Field""" 45 | def __init__(self, *args, **kwargs): 46 | """ 47 | Overriding constructor with fields 48 | :param args: additional args 49 | :param kwargs: parent class kwargs 50 | """ 51 | super(NetworkIdentifier, self).__init__( 52 | ('empty', Bits(maxlen=4, value=0)), 53 | # Mobile Codes; set outside 54 | ('mcc', Bits(maxlen=10)), 55 | ('mnc', Bits(maxlen=10)), 56 | *args, **kwargs 57 | ) 58 | 59 | 60 | class Flags(BitField): 61 | """EGTS_SR_TERM_IDENTITY Flags""" 62 | def __init__(self, *args, **kwargs): 63 | """ 64 | Overriding constructor with fields 65 | :param args: additional args 66 | :param kwargs: parent class kwargs 67 | """ 68 | super(Flags, self).__init__( 69 | # Flags calculated based on fields existence 70 | ('mne', Bits(maxlen=1)), 71 | ('bse', Bits(maxlen=1)), 72 | ('nide', Bits(maxlen=1)), 73 | # Simple algorithm by default 74 | ('ssra', Bits(maxlen=1, value=1)), 75 | ('lngce', Bits(maxlen=1)), 76 | ('imsie', Bits(maxlen=1)), 77 | ('imeie', Bits(maxlen=1)), 78 | ('hdide', Bits(maxlen=1)), 79 | *args, **kwargs 80 | ) 81 | -------------------------------------------------------------------------------- /egts/egts_message/service/auth/vehicle_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_VEHICLE_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class VehicleData(EGTSRecord): 6 | """EGTS_SR_VEHICLE_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(VehicleData, self).__init__( 14 | # VIN. Set Outside. 15 | ('vin', String(maxlen=17, minlen=17)), 16 | # Vehicle Type. Set Outside. 17 | ('vht', UInt()), 18 | # Propulsion Storage Type. Set Outside. 19 | ('vpst', UInt()), 20 | *args, **kwargs 21 | ) 22 | -------------------------------------------------------------------------------- /egts/egts_message/service/commands/__init__.py: -------------------------------------------------------------------------------- 1 | """EGTS_COMMANDS_SERVICE Classes""" 2 | from .command_data import CommandData 3 | -------------------------------------------------------------------------------- /egts/egts_message/service/commands/command_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_COMMAND_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class CommandData(EGTSRecord): 6 | """EGTS_SR_COMMAND_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(CommandData, self).__init__( 14 | # Types are set outside 15 | ('type_flags', TypeFlags()), 16 | # Command ID. Set Outside 17 | ('cid', UInt()), 18 | # Source ID. Set Outside 19 | ('sid', UInt()), 20 | # Flags calculated based on fields existence 21 | ('flags', Flags()), 22 | # All the following fields are unspecified by default 23 | ('chs', Byte(optional=True)), 24 | ('acl', Byte(optional=True)), 25 | ('ac', ArrayOfType(of_type=Byte, maxlen=255, optional=True)), 26 | ('cd', CommandDataField()), 27 | *args, **kwargs 28 | ) 29 | 30 | def set_fields(self): 31 | """ 32 | Calculate necessary fields 33 | """ 34 | flags = self['flags'] 35 | flags['acfe'] = int(self['ac'].specified) 36 | flags['chsfe'] = int(self['chs'].specified) 37 | 38 | if self['ac'].specified: 39 | self['acl'] = len(self['ac']) 40 | 41 | cmd = self['type_flags']['ct'].value 42 | mismatch = ((cmd == 0b0001 or cmd == 0b0010 or cmd == 0b1000) 43 | == self['cd']['flags'].specified) 44 | if mismatch: 45 | raise TypeError('COM/COMCONF mismatch!') 46 | 47 | 48 | class TypeFlags(BitField): 49 | """EGTS_SR_COMMAND_DATA Command Type Flags""" 50 | def __init__(self, *args, **kwargs): 51 | """ 52 | Overriding constructor with fields 53 | :param args: additional args 54 | :param kwargs: parent class kwargs 55 | """ 56 | super(TypeFlags, self).__init__( 57 | # Types are set outside 58 | ('ct', Bits(maxlen=4)), 59 | ('cct', Bits(maxlen=4)), 60 | *args, **kwargs 61 | ) 62 | 63 | 64 | class Flags(BitField): 65 | """EGTS_SR_COMMAND_DATA Flags""" 66 | def __init__(self, *args, **kwargs): 67 | """ 68 | Overriding constructor with fields 69 | :param args: additional args 70 | :param kwargs: parent class kwargs 71 | """ 72 | super(Flags, self).__init__( 73 | # Flags calculated based on fields existence 74 | ('empty', Bits(value=0, maxlen=6)), 75 | ('acfe', Bits(maxlen=1)), 76 | ('chsfe', Bits(maxlen=1)), 77 | *args, **kwargs 78 | ) 79 | 80 | 81 | class CommandDataField(EGTSRecord): 82 | """EGTS_SR_COMMAND_DATA Data Field""" 83 | def __init__(self, *args, **kwargs): 84 | """ 85 | Overriding constructor with fields 86 | :param args: additional args 87 | :param kwargs: parent class kwargs 88 | """ 89 | super(CommandDataField, self).__init__( 90 | # Command Data info is set outside 91 | ('adr', UShort()), 92 | ('flags', FieldFlags(optional=True)), 93 | ('ccd', UShort()), 94 | ('dt', ArrayOfType(of_type=Byte, maxlen=65200)), 95 | *args, **kwargs 96 | ) 97 | 98 | 99 | class FieldFlags(BitField): 100 | """EGTS Command Flags""" 101 | def __init__(self, *args, **kwargs): 102 | """ 103 | Overriding constructor with fields 104 | :param args: additional args 105 | :param kwargs: parent class kwargs 106 | """ 107 | super(FieldFlags, self).__init__( 108 | # Command Data Flags are set outside 109 | ('sz', Bits(maxlen=4)), 110 | ('act', Bits(maxlen=4)), 111 | *args, **kwargs 112 | ) 113 | -------------------------------------------------------------------------------- /egts/egts_message/service/data_record.py: -------------------------------------------------------------------------------- 1 | """Service Data Record""" 2 | from ...egts_types import * 3 | from ...egts_types.date_time_field import DateTime 4 | from .data_subrecord import ServiceDataSubRecord 5 | 6 | 7 | class ServiceDataRecord(EGTSRecord): 8 | """Service Layer Data Record""" 9 | def __init__(self, *args, **kwargs): 10 | """ 11 | Overriding constructor with fields 12 | :param args: additional args 13 | :param kwargs: parent class kwargs 14 | """ 15 | super(ServiceDataRecord, self).__init__( 16 | # record length is unknown yet 17 | ('rl', UShort()), 18 | # Record number is 1 by default 19 | ('rn', UShort(value=0x01)), 20 | ('rfl', Flags()), 21 | # Those three fields are unspecified by default 22 | ('oid', UInt(optional=True)), 23 | ('evid', UInt(optional=True)), 24 | ('tm', DateTime(optional=True)), 25 | # Service ID's. Set outside? 26 | ('sst', Byte()), 27 | ('rst', Byte()), 28 | ('rd', ArrayOfType(maxlen=7279, of_type=ServiceDataSubRecord)), 29 | *args, **kwargs 30 | ) 31 | 32 | def set_fields(self): 33 | """ 34 | Calculate necessary fields 35 | """ 36 | self['tmfe'] = int(self['tm'].specified) 37 | self['evfe'] = int(self['evid'].specified) 38 | self['obfe'] = int(self['oid'].specified) 39 | 40 | self['rl'] = len(self['rd']) 41 | 42 | 43 | class Flags(BitField): 44 | """Service Data Record Flags""" 45 | def __init__(self, *args, **kwargs): 46 | """ 47 | Overriding constructor with fields 48 | :param args: additional args 49 | :param kwargs: parent class kwargs 50 | """ 51 | super(Flags, self).__init__( 52 | # SSOD and RSOD unknown by default 53 | ('ssod', Bits(maxlen=1)), 54 | ('rsod', Bits(maxlen=1)), 55 | # Priority is highest by default 56 | ('rpp', Bits(maxlen=3, value=0)), 57 | # Presence flags 58 | ('tmfe', Bits(maxlen=1)), 59 | ('evfe', Bits(maxlen=1)), 60 | ('obfe', Bits(maxlen=1)), 61 | *args, **kwargs 62 | ) 63 | -------------------------------------------------------------------------------- /egts/egts_message/service/data_subrecord.py: -------------------------------------------------------------------------------- 1 | """Service Data Subrecord""" 2 | from ...egts_types import * 3 | 4 | 5 | class ServiceDataSubRecord(EGTSRecord): 6 | """Subrecord of Service Data Record""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(ServiceDataSubRecord, self).__init__( 14 | ('srt', Byte()), 15 | ('srl', UShort()), 16 | # Unspecified by default. Set outside 17 | ('srd', None), 18 | *args, **kwargs 19 | ) 20 | 21 | def set_fields(self): 22 | """ 23 | Calculate necessary fields 24 | """ 25 | self['srl'] = len(self['srd']) 26 | -------------------------------------------------------------------------------- /egts/egts_message/service/ecall/__init__.py: -------------------------------------------------------------------------------- 1 | """EGTS_ECALL_SERVICE Classes""" 2 | from .accel_data import AccelData 3 | from .raw_msd_data import RawMsdData 4 | from .track_data import TrackData 5 | -------------------------------------------------------------------------------- /egts/egts_message/service/ecall/accel_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_ACCEL_DATA""" 2 | from ....egts_types import * 3 | from ....egts_types.date_time_field import DateTime 4 | 5 | 6 | class AccelData(EGTSRecord): 7 | """EGTS_SR_ACCEL_DATA Class""" 8 | def __init__(self, *args, **kwargs): 9 | """ 10 | Overriding constructor with fields 11 | :param args: additional args 12 | :param kwargs: parent class kwargs 13 | """ 14 | super(AccelData, self).__init__( 15 | # Structures amount is calculated based on length of ads 16 | ('sa', Byte()), 17 | # Time is set outside 18 | ('atm', DateTime()), 19 | ('ads', ArrayOfType(of_type=AccelerometerDataService, maxlen=255)), 20 | *args, **kwargs 21 | ) 22 | 23 | def set_fields(self): 24 | """ 25 | Calculate necessary fields 26 | """ 27 | self['sa'] = self['ads'].quantity 28 | 29 | 30 | class AccelerometerDataService(EGTSRecord): 31 | """EGTS_SR_ACCEL_DATA Data Field""" 32 | def __init__(self, *args, **kwargs): 33 | """ 34 | Overriding constructor with fields 35 | :param args: additional args 36 | :param kwargs: parent class kwargs 37 | """ 38 | super(AccelerometerDataService, self).__init__( 39 | # Time is set outside 40 | ('rtm', UShort()), 41 | # Acceleration Values are set outside 42 | ('xaav', Short()), 43 | ('yaav', Short()), 44 | ('zaav', Short()), 45 | *args, **kwargs 46 | ) 47 | -------------------------------------------------------------------------------- /egts/egts_message/service/ecall/raw_msd_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_RAW_MSD_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class RawMsdData(EGTSRecord): 6 | """EGTS_SR_RAW_MSD_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | super(RawMsdData, self).__init__( 9 | # Format is GOST by default 10 | ('fm', Byte(value=1)), 11 | # Data is set outside 12 | ('msd', ArrayOfType(of_type=Byte, maxlen=116)), 13 | *args, **kwargs 14 | ) 15 | -------------------------------------------------------------------------------- /egts/egts_message/service/ecall/track_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_TRACK_DATA""" 2 | from ....egts_types import * 3 | from ....egts_types.date_time_field import DateTime 4 | 5 | 6 | class TrackData(EGTSRecord): 7 | """EGTS_SR_TRACK_DATA Class""" 8 | def __init__(self, *args, **kwargs): 9 | super(TrackData, self).__init__( 10 | # Structures amount is calculated based on length of tds 11 | ('sa', Byte()), 12 | # Time is set outside 13 | ('atm', DateTime()), 14 | ('tds', ArrayOfType(maxlen=255, of_type=TrackDataStructure)), 15 | *args, **kwargs 16 | ) 17 | 18 | def set_fields(self): 19 | """ 20 | Calculate necessary fields 21 | """ 22 | if self['tds'].quantity == 0: 23 | self['tds'].append({'flags': {'rtm': 0, 'lohs': 0, 'lahs': 0}}) 24 | self['sa'] = self['tds'].quantity 25 | 26 | 27 | class TrackDataStructure(EGTSRecord): 28 | """EGTS_SR_TRACK_DATA Track Data Structure Field""" 29 | def __init__(self, *args, **kwargs): 30 | super(TrackDataStructure, self).__init__( 31 | # All track data is set outside 32 | ('flags', Flags()), 33 | ('lat', UInt(optional=True)), 34 | ('long', UInt(optional=True)), 35 | ('spdl', Byte(optional=True)), 36 | ('dirh_spdh', DirhSpdh(optional=True)), 37 | ('dirl', Byte(optional=True)), 38 | *args, ** kwargs 39 | ) 40 | 41 | @property 42 | def special_inputs(self): 43 | return { 44 | 'dir': self._set_dir, 45 | 'spd': self._set_spd, 46 | 'lat': self._set_lat, 47 | 'long': self._set_long 48 | } 49 | 50 | @staticmethod 51 | def is_dig(val): 52 | try: 53 | float(str(val)) 54 | return True 55 | except ValueError: 56 | return False 57 | 58 | def _set_lat(self, value): 59 | if self.is_dig(value): 60 | val = float(value) 61 | self['lahs'] = val < 0 62 | self.value['lat'].value = int(abs(val) / 90 * 0xFFFFFFFF) 63 | else: 64 | self.value['lat'].value = value 65 | 66 | def _set_long(self, value): 67 | if self.is_dig(value): 68 | val = float(value) 69 | self['lohs'] = val < 0 70 | self.value['long'].value = int(abs(val) / 180 * 0xFFFFFFFF) 71 | else: 72 | self.value['long'].value = value 73 | 74 | def _set_dir(self, value): 75 | self['dirh_spdh']['dirh'] = value // 2**8 76 | self['dirl'] = value % 2**8 77 | 78 | def _set_spd(self, value): 79 | 80 | self['dirh_spdh']['spdh'] = int(value) // 2 ** 8 81 | self['spdl'] = int(value) % 2 ** 8 82 | 83 | def set_fields(self): 84 | """ 85 | Calculate necessary fields 86 | """ 87 | flags = self['flags'] 88 | if (self['lat'].specified and self['long'].specified and 89 | self['spdl'].specified and self['dirh_spdh'].specified and 90 | self['dirl'].specified): 91 | flags['tnde'] = 1 92 | elif (self['lat'].specified or self['long'].specified or 93 | self['spdl'].specified or self['dirh_spdh'].specified or 94 | self['dirl'].specified): 95 | raise NotImplementedError('Track Data is incomplete!') 96 | else: 97 | flags['tnde'] = 0 98 | flags['lahs'] = 0 99 | flags['lohs'] = 0 100 | 101 | 102 | class Flags(BitField): 103 | """EGTS_SR_TRACK_DATA Track Data Structure Field Flags""" 104 | def __init__(self, *args, **kwargs): 105 | super(Flags, self).__init__( 106 | # Existence field is calculated based on all fields presence 107 | ('tnde', Bits(maxlen=1)), 108 | # Hemispheres and time are set outside 109 | ('lohs', Bits(maxlen=1)), 110 | ('lahs', Bits(maxlen=1)), 111 | ('rtm', Bits(maxlen=5)), 112 | *args, ** kwargs 113 | ) 114 | 115 | 116 | class DirhSpdh(BitField): 117 | """EGTS_SR_TRACK_DATA Track Data Structure Field Dir and Spd High Bits""" 118 | def __init__(self, *args, **kwargs): 119 | super(DirhSpdh, self).__init__( 120 | # Dir and Speed bits are set outside 121 | ('dirh', Bits(maxlen=1)), 122 | ('spdh', Bits(maxlen=7)), 123 | *args, ** kwargs 124 | ) 125 | -------------------------------------------------------------------------------- /egts/egts_message/service/firmware/__init__.py: -------------------------------------------------------------------------------- 1 | """EGTS_FIRMWARE_SERVICE Classes""" 2 | from .object_data_header import ObjectDataHeader 3 | from .service_full_data import ServiceFullData 4 | from .service_part_data import ServicePartData 5 | -------------------------------------------------------------------------------- /egts/egts_message/service/firmware/object_data_header.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_OBJECT_DATA_HEADER""" 2 | from ....egts_types import * 3 | 4 | 5 | class ObjectDataHeader(EGTSRecord): 6 | """EGTS_SR_OBJECT_DATA_HEADER Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(ObjectDataHeader, self).__init__( 14 | # Types are set outside 15 | ('oa', ObjectAttribute()), 16 | # ID is set outside 17 | ('cmi', Byte()), 18 | # Version is set outside 19 | ('ver', UShort()), 20 | # Checksum (CRC16-CCITT) 21 | ('wos', UShort()), 22 | # Filename is unspecified by default 23 | ('fn', String(maxlen=64, optional=True)), 24 | ('d', Byte(value=0)), 25 | *args, **kwargs 26 | ) 27 | 28 | 29 | class ObjectAttribute(BitField): 30 | """EGTS_SR_OBJECT_DATA_HEADER Flags""" 31 | def __init__(self, *args, **kwargs): 32 | """ 33 | Overriding constructor with fields 34 | :param args: additional args 35 | :param kwargs: parent class kwargs 36 | """ 37 | super(ObjectAttribute, self).__init__( 38 | # Types are set outside 39 | ('empty', Bits(maxlen=4, value=0)), 40 | ('ot', Bits(maxlen=2)), 41 | ('mt', Bits(maxlen=2)), 42 | *args, **kwargs 43 | ) 44 | -------------------------------------------------------------------------------- /egts/egts_message/service/firmware/service_full_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_SERVICE_FULL_DATA""" 2 | from ....egts_types import * 3 | from .... import crc 4 | from . import object_data_header 5 | 6 | 7 | class ServiceFullData(EGTSRecord): 8 | """EGTS_SR_SERVICE_FULL_DATA_CLASS""" 9 | def __init__(self, *args, **kwargs): 10 | """ 11 | Overriding constructor with fields 12 | :param args: additional args 13 | :param kwargs: parent class kwargs 14 | """ 15 | super(ServiceFullData, self).__init__( 16 | # Header is unspecified by default 17 | ('odh', object_data_header.ObjectDataHeader()), 18 | # Data always exists and at least 1 Byte 19 | ('od', ArrayOfType(of_type=Byte, maxlen=65400)), 20 | *args, **kwargs 21 | ) 22 | 23 | def set_fields(self): 24 | """ 25 | Calculate necessary fields 26 | """ 27 | self['odh']['wos'] = crc.data_crc(self['od'].bytes) 28 | -------------------------------------------------------------------------------- /egts/egts_message/service/firmware/service_part_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_SERVICE_PART_DATA""" 2 | from ....egts_types import * 3 | from .... import crc 4 | from . import object_data_header 5 | 6 | 7 | class ServicePartData(EGTSRecord): 8 | """EGTS_SR_SERVICE_PART_DATA Class""" 9 | def __init__(self, *args, **kwargs): 10 | """ 11 | Overriding constructor with fields 12 | :param args: additional args 13 | :param kwargs: parent class kwargs 14 | """ 15 | super(ServicePartData, self).__init__( 16 | # ID is set and incremented outside. 17 | ('id', UShort()), 18 | # Part number is set and incremented outside 19 | ('pn', UShort()), 20 | # Quantity is calculated set outside 21 | ('epq', UShort()), 22 | # Header is unspecified by default 23 | ('odh', object_data_header.ObjectDataHeader(optional=True)), 24 | # Data always exists and at least 1 Byte 25 | ('od', ArrayOfType(of_type=Byte, maxlen=65400)), 26 | *args, **kwargs 27 | ) 28 | 29 | def set_fields(self): 30 | """ 31 | Calculate necessary fields 32 | """ 33 | self['odh']['wos'] = crc.data_crc(self['od'].bytes) 34 | -------------------------------------------------------------------------------- /egts/egts_message/service/record_response/__init__.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_RECORD_RESPONSE Class. Common for all Subrecord Types""" 2 | from .record_response import RecordResponse 3 | -------------------------------------------------------------------------------- /egts/egts_message/service/record_response/record_response.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_RECORD_RESPONSE. Common for every service type""" 2 | from ....egts_types import * 3 | 4 | 5 | class RecordResponse(EGTSRecord): 6 | """EGTS_SR_RECORD_RESPONSE Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(RecordResponse, self).__init__( 14 | ('crn', UShort()), 15 | ('rst', Byte()), 16 | *args, **kwargs 17 | ) 18 | -------------------------------------------------------------------------------- /egts/egts_message/service/service.py: -------------------------------------------------------------------------------- 1 | """EGTS Service Layer Message Types""" 2 | import abc 3 | from ...egts_types import * 4 | from .data_record import ServiceDataRecord 5 | 6 | 7 | class EGTSService(EGTSRecord): 8 | """EGTS Service base class""" 9 | __metaclass__ = abc.ABCMeta 10 | 11 | def set_fields(self): 12 | """ 13 | Calculate necessary fields 14 | """ 15 | i = 1 16 | for record in self['sdr']: 17 | record['rn'] = i 18 | i += 1 19 | 20 | 21 | class EGTSResponse(EGTSService): 22 | """EGTS_PT_RESPONSE""" 23 | def __init__(self, *args, **kwargs): 24 | """ 25 | Overriding constructor with fields 26 | :param args: additional args 27 | :param kwargs: parent class kwargs 28 | """ 29 | super(EGTSResponse, self).__init__( 30 | ('rpid', UShort()), 31 | ('pr', Byte()), 32 | ('sdr', ArrayOfType(of_type=ServiceDataRecord, maxlen=7279)), 33 | *args, **kwargs 34 | ) 35 | 36 | 37 | class EGTSAppdata(EGTSService): 38 | """EGTS_PT_APPDATA""" 39 | def __init__(self, *args, **kwargs): 40 | """ 41 | Overriding constructor with fields 42 | :param args: additional args 43 | :param kwargs: parent class kwargs 44 | """ 45 | super(EGTSAppdata, self).__init__( 46 | ('sdr', ArrayOfType(of_type=ServiceDataRecord, maxlen=7279)), 47 | *args, **kwargs 48 | ) 49 | 50 | 51 | class EGTSSignedAppdata(EGTSService): 52 | """EGTS_PT_SIGNED_APPDATA""" 53 | def __init__(self, *args, **kwargs): 54 | """ 55 | Overriding constructor with fields 56 | :param args: additional args 57 | :param kwargs: parent class kwargs 58 | """ 59 | super(EGTSSignedAppdata, self).__init__( 60 | ('sigl', UShort()), 61 | ('sigd', ArrayOfType(of_type=Byte, maxlen=512)), 62 | ('sdr', ArrayOfType(of_type=ServiceDataRecord, maxlen=7279)), 63 | *args, **kwargs 64 | ) 65 | 66 | def set_fields(self): 67 | """ 68 | Calculate necessary fields 69 | """ 70 | super(EGTSSignedAppdata, self).set_fields() 71 | self['sigl'] = len(self['sigd']) 72 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/__init__.py: -------------------------------------------------------------------------------- 1 | """EGTS_TELEDATA_SERVICE Classes""" 2 | from .pos_data import PosData 3 | from .ext_pos_data import ExtPosData 4 | from .ad_sensors_data import AdSensorsData 5 | from .counters_data import CountersData 6 | from .state_data import StateData 7 | from .loopin_data import LoopinData 8 | from .abs_dig_sens_data import AbsDigSensData 9 | from .abs_an_sens_data import AbsAnSensData 10 | from .abs_cntr_data import AbsCntrData 11 | from .abs_loopin_data import AbsLoopinData 12 | from .liquid_level_sensor import LiquidLevelSensor 13 | from .passengers_counters import PassengersCounters 14 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/abs_an_sens_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_ABS_AN_SENS_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class AbsAnSensData(EGTSRecord): 6 | """EGTS_SR_ABS_AN_SENS_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(AbsAnSensData, self).__init__( 14 | # Analog Sensor state and number are set outside 15 | ('asn', Byte()), 16 | ('asv', ArrayOfType(of_type=Byte, maxlen=3, minlen=3)), 17 | *args, **kwargs 18 | ) 19 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/abs_cntr_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_CNTR_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class AbsCntrData(EGTSRecord): 6 | """EGTS_SR_CNTR_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(AbsCntrData, self).__init__( 14 | # Counter number and value are set outside 15 | ('cn', Byte()), 16 | ('cnv', ArrayOfType(of_type=Byte, maxlen=3, minlen=3)), 17 | *args, **kwargs 18 | ) 19 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/abs_dig_sens_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_DIG_SENS_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class AbsDigSensData(EGTSRecord): 6 | """EGTS_SR_DIG_SENS_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(AbsDigSensData, self).__init__( 14 | # Digital sensor state set outside 15 | ('dsnl_dsst', DsnlDsst()), 16 | ('dsnh', Byte()), 17 | *args, **kwargs 18 | ) 19 | 20 | @property 21 | def special_inputs(self): 22 | return { 23 | 'dsn': self._set_dsn 24 | } 25 | 26 | def _set_dsn(self, value): 27 | self['dsnl_dsst']['dsnl'] = value % 2**4 28 | self['dsnh'] = value // 2**4 29 | 30 | 31 | class DsnlDsst(BitField): 32 | """EGTS_SR_DIG_SENS_DATA Sensor State Bits and Number Low Bits Field""" 33 | def __init__(self, *args, **kwargs): 34 | """ 35 | Overriding constructor with fields 36 | :param args: additional args 37 | :param kwargs: parent class kwargs 38 | """ 39 | super(DsnlDsst, self).__init__( 40 | ('dsnl', Bits(maxlen=4)), 41 | ('dsst', Bits(maxlen=4)), 42 | *args, **kwargs 43 | ) 44 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/abs_loopin_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_ABS_LOOPIN_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class AbsLoopinData(EGTSRecord): 6 | """EGTS_SR_ABS_LOOPIN_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(AbsLoopinData, self).__init__( 14 | # All set outside 15 | ('linl_lis', LinlLis()), 16 | ('linh', Byte()), 17 | *args, **kwargs 18 | ) 19 | 20 | @property 21 | def special_inputs(self): 22 | return { 23 | 'lin': self._set_dsn 24 | } 25 | 26 | def _set_dsn(self, value): 27 | self['linl_lis']['linl'] = value % 2**4 28 | self['linh'] = value // 2**4 29 | 30 | 31 | class LinlLis(BitField): 32 | """EGTS_SR_ABS_LOOPIN_DATA Sensor State Bits and Number Low Bits Field""" 33 | def __init__(self, *args, **kwargs): 34 | """ 35 | Overriding constructor with fields 36 | :param args: additional args 37 | :param kwargs: parent class kwargs 38 | """ 39 | super(LinlLis, self).__init__( 40 | ('linl', Bits(maxlen=4)), 41 | ('lis', Bits(maxlen=4)), 42 | *args, **kwargs 43 | ) 44 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/accel_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_ACCEL_DATA""" 2 | from ..ecall import AccelData 3 | 4 | # this class is the same as EGTS_SR_ACCEL_DATA in eCall 5 | AccelData = AccelData 6 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/ad_sensors_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_AD_SENSORS_DATA""" 2 | from ....egts_types import * 3 | from . import presence_flags 4 | 5 | 6 | class AdSensorsData(EGTSRecord): 7 | """EGTS_SR_AD_SENSORS_DATA Class""" 8 | def __init__(self, *args, **kwargs): 9 | """ 10 | Overriding constructor with fields 11 | :param args: additional args 12 | :param kwargs: parent class kwargs 13 | """ 14 | super(AdSensorsData, self).__init__( 15 | # Flags calculated based on fields existance 16 | ('dioe_flags', presence_flags.PresenceFlags(field_name='dioe')), 17 | # DOUT - set outside? 18 | ('dout', Byte()), 19 | # ASFE Flags set outside 20 | ('asfe_flags', presence_flags.PresenceFlags(field_name='asfe')), 21 | # digital inputs fields set outside 22 | ('adio', ArrayOfType(of_type=Byte, maxlen=8, optional=True)), 23 | # analog sensor fields set outside 24 | ('ans', ArrayOfType(of_type=Ans, maxlen=8, optional=True)), 25 | *args, **kwargs 26 | ) 27 | 28 | @property 29 | def special_inputs(self): 30 | def generate_adio_setter(number): 31 | flags = self['dioe_flags'] 32 | predecessors = 0 33 | for i in xrange(1, number): 34 | predecessors += flags['dioe{}'.format(i)].value 35 | 36 | def setter(value): 37 | if flags['dioe{}'.format(number)] == 0b1: 38 | self['adio'][predecessors] = value 39 | else: 40 | self['adio'].insert(predecessors, value) 41 | flags['dioe{}'.format(number)] = 0b1 42 | 43 | return setter 44 | 45 | def generate_ans_setter(number): 46 | flags = self['asfe_flags'] 47 | predecessors = 0 48 | for i in xrange(1, number): 49 | predecessors += flags['asfe{}'.format(i)].value 50 | 51 | def setter(value): 52 | if flags['asfe{}'.format(number)] == 0b1: 53 | self['ans'][predecessors] = value 54 | else: 55 | self['ans'].insert(predecessors, value) 56 | flags['asfe{}'.format(number)] = 0b1 57 | return setter 58 | 59 | setters = {'adio{}'.format(num): generate_adio_setter(num) for num in range(1, 9)} 60 | setters.update({'ans{}'.format(num): generate_ans_setter(num) for num in range(1, 9)}) 61 | return setters 62 | 63 | 64 | class Ans(ArrayOfType): 65 | """EGTS_SR_AD_SENSORS_DATA Additional Digital Input Class""" 66 | def __init__(self, *args, **kwargs): 67 | """ 68 | Field of 3 bytes constructor 69 | """ 70 | super(Ans, self).__init__(of_type=Byte, maxlen=3, minlen=3, *args, **kwargs) 71 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/counters_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_COUNTERS_DATA""" 2 | from ....egts_types import * 3 | from . import presence_flags 4 | 5 | 6 | class CountersData(EGTSRecord): 7 | """EGTS_SR_COUNTERS_DATA Class""" 8 | def __init__(self, *args, **kwargs): 9 | """ 10 | Overriding constructor with fields 11 | :param args: additional args 12 | :param kwargs: parent class kwargs 13 | """ 14 | super(CountersData, self).__init__( 15 | # Flags calculated based on fields existance 16 | ('cfe_flags', presence_flags.PresenceFlags(field_name='cfe')), 17 | # counter fields set outside 18 | ('cn', ArrayOfType(of_type=Cn, maxlen=8, optional=True)), 19 | *args, **kwargs 20 | ) 21 | 22 | @property 23 | def special_inputs(self): 24 | def generate_setter(number): 25 | flags = self['cfe_flags'] 26 | predecessors = 0 27 | for i in xrange(1, number): 28 | predecessors += flags['cfe{}'.format(i)].value 29 | 30 | def setter(value): 31 | if flags['cfe{}'.format(number)] == 0b1: 32 | self['cn'][predecessors] = value 33 | else: 34 | self['cn'].insert(predecessors, value) 35 | flags['cfe{}'.format(number)] = 0b1 36 | 37 | return setter 38 | 39 | return {'cn{}'.format(num): generate_setter(num) for num in range(1, 9)} 40 | 41 | 42 | class Cn(ArrayOfType): 43 | """EGTS_SR_COUNTERS_DATA Counter Class""" 44 | def __init__(self, *args, **kwargs): 45 | """ 46 | Field of 3 bytes constructor 47 | """ 48 | super(Cn, self).__init__(of_type=Byte, maxlen=3, minlen=3, *args, **kwargs) 49 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/ext_pos_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_EXT_POS_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class ExtPosData(EGTSRecord): 6 | """EGTS_SR_EXT_POS_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(ExtPosData, self).__init__( 14 | # Flags calculated based on fields existence 15 | ('flags', Flags()), 16 | # All fields are unspecified by default 17 | ('vdop', UShort(optional=True)), 18 | ('hdop', UShort(optional=True)), 19 | ('pdop', UShort(optional=True)), 20 | ('sat', Byte(optional=True)), 21 | ('ns', UShort(optional=True)), 22 | *args, **kwargs 23 | ) 24 | 25 | def set_fields(self): 26 | """ 27 | Calculate necessary fields 28 | """ 29 | flags = self['flags'] 30 | flags['nsfe'] = int(self['ns'].specified) 31 | flags['sfe'] = int(self['ns'].specified and self['sat'].specified) 32 | flags['pfe'] = int(self['pdop'].specified) 33 | flags['hfe'] = int(self['hdop'].specified) 34 | flags['vfe'] = int(self['vdop'].specified) 35 | 36 | 37 | class Flags(BitField): 38 | """EGTS_SR_EXT_POS_DATA Flags""" 39 | def __init__(self, *args, **kwargs): 40 | """ 41 | Overriding constructor with fields 42 | :param args: additional args 43 | :param kwargs: parent class kwargs 44 | """ 45 | super(Flags, self).__init__( 46 | # Flags calculated based on fields existence 47 | ('empty', Bits(maxlen=3, value=0)), 48 | ('nsfe', Bits(maxlen=1)), 49 | ('sfe', Bits(maxlen=1)), 50 | ('pfe', Bits(maxlen=1)), 51 | ('hfe', Bits(maxlen=1)), 52 | ('vfe', Bits(maxlen=1)), 53 | *args, **kwargs 54 | ) 55 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/liquid_level_sensor.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_LIQUID_SENSOR""" 2 | from ....egts_types import * 3 | 4 | 5 | class LiquidLevelSensor(EGTSRecord): 6 | """EGTS_SR_LIQUID_SENSOR Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(LiquidLevelSensor, self).__init__( 14 | ('flags', Flags()), 15 | # All set outside 16 | ('maddr', UShort()), 17 | ('llsd', ArrayOfType(of_type=Byte, maxlen=512, minlen=4)), 18 | *args, **kwargs 19 | ) 20 | 21 | 22 | class Flags(BitField): 23 | """EGTS_SR_LIQUID_SENSOR Flags""" 24 | def __init__(self, *args, **kwargs): 25 | """ 26 | Overriding constructor with fields 27 | :param args: additional args 28 | :param kwargs: parent class kwargs 29 | """ 30 | super(Flags, self).__init__( 31 | ('empty', Bits(maxlen=1, value=0b0)), 32 | # No error by default 33 | ('llsef', Bits(maxlen=1, value=0b0)), 34 | # Value unit is set outside 35 | ('llsvu', Bits(maxlen=2)), 36 | # UInt by default 37 | ('rdf', Bits(maxlen=1, value=0b0)), 38 | # Number is set outside 39 | ('llsn', Bits(maxlen=3)), 40 | *args, **kwargs 41 | ) 42 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/loopin_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_LOOPIN_DATA""" 2 | from ....egts_types import * 3 | from . import presence_flags 4 | 5 | 6 | class LoopinData(EGTSRecord): 7 | """EGTS_SR_LOOPIN_DATA Class""" 8 | def __init__(self, *args, **kwargs): 9 | """ 10 | Overriding constructor with fields 11 | :param args: additional args 12 | :param kwargs: parent class kwargs 13 | """ 14 | super(LoopinData, self).__init__( 15 | # Flags calculated based on fields existance 16 | ('life_flags', presence_flags.PresenceFlags(field_name='life')), 17 | # Flags are calculated based on fields existence 18 | ('lis', ArrayOfType(of_type=Lis, maxlen=4, optional=True)), 19 | *args, **kwargs 20 | ) 21 | 22 | @property 23 | def special_inputs(self): 24 | def generate_setter(number): 25 | flags = self['life_flags'] 26 | predecessors = 0 27 | for i in xrange(1, number, 2): 28 | if flags['life{}'.format(i)].value or flags['life{}'.format(i+1)].value: 29 | predecessors += 1 30 | 31 | def setter(value): 32 | if number % 2: 33 | position = 'lis_odd' 34 | else: 35 | position = 'lis_even' 36 | if flags['life{}'.format(number)] == 0b1: 37 | self['lis'][predecessors][position] = value 38 | else: 39 | new_field = Lis() 40 | new_field[position] = value 41 | self['lis'].insert(predecessors, new_field) 42 | flags['life{}'.format(number)] = 0b1 43 | 44 | return setter 45 | 46 | return {'lis{}'.format(num): generate_setter(num) for num in range(1, 9)} 47 | 48 | 49 | class Lis(BitField): 50 | """EGTS_SR_LOOPIN_DATA Loop In State (4 bits each)""" 51 | def __init__(self, *args, **kwargs): 52 | """ 53 | Overriding constructor with fields 54 | :param args: additional args 55 | :param kwargs: parent class kwargs 56 | """ 57 | super(Lis, self).__init__( 58 | # Flags calculated based on fields existance 59 | ('lis_odd', Bits(maxlen=4, value=0)), 60 | ('lis_even', Bits(maxlen=4, value=0)), 61 | *args, **kwargs 62 | ) 63 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/passengers_counters.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_PASSENGERS_COUNTERS""" 2 | from ....egts_types import * 3 | from . import presence_flags 4 | 5 | 6 | class PassengersCounters(EGTSRecord): 7 | """EGTS_SR_PASSENGERS_COUNTERS Class""" 8 | def __init__(self, *args, **kwargs): 9 | """ 10 | Overriding constructor with fields 11 | :param args: additional args 12 | :param kwargs: parent class kwargs 13 | """ 14 | super(PassengersCounters, self).__init__( 15 | ('flags', Flags()), 16 | # All set outside 17 | ('dpr', presence_flags.PresenceFlags(field_name='dpr')), 18 | ('drl', Byte()), 19 | ('maddr', UShort()), 20 | ('pcd', ArrayOfType(of_type=Pcd, maxlen=8)), 21 | *args, **kwargs 22 | ) 23 | 24 | @property 25 | def special_inputs(self): 26 | flags = self['dpr'] 27 | 28 | def get_pcd(number): 29 | predecessors = 0 30 | for i in xrange(1, number): 31 | predecessors += flags['dpr{}'.format(i)].value 32 | 33 | if not flags['dpr{}'.format(number)].value: 34 | flags['dpr{}'.format(number)] = 0b1 35 | self['pcd'].insert(predecessors, [None, None]) 36 | return self['pcd'][predecessors] 37 | 38 | def pcd_setter(value): 39 | for field in value.keys(): 40 | self[field] = value[field] 41 | 42 | def generate_ipq_setter(number): 43 | def setter(value): 44 | pcd = get_pcd(number) 45 | pcd.value = (value, None) 46 | 47 | return setter 48 | 49 | def generate_opq_setter(number): 50 | def setter(value): 51 | pcd = get_pcd(number) 52 | pcd.value = (None, value) 53 | 54 | return setter 55 | 56 | setters = {'pcd': pcd_setter} 57 | setters.update({'ipq{}'.format(num): generate_ipq_setter(num) for num in range(1, 9)}) 58 | setters.update({'opq{}'.format(num): generate_opq_setter(num) for num in range(1, 9)}) 59 | return setters 60 | 61 | 62 | class Flags(BitField): 63 | """EGTS_SR_PASSENGERS_COUNTERS Flags""" 64 | def __init__(self, *args, **kwargs): 65 | """ 66 | Overriding constructor with fields 67 | :param args: additional args 68 | :param kwargs: parent class kwargs 69 | """ 70 | super(Flags, self).__init__( 71 | ('empty', Bits(maxlen=7, value=0)), 72 | # Raw data flag zero by default 73 | ('rdf', Bits(maxlen=1, value=0)), 74 | *args, **kwargs 75 | ) 76 | 77 | 78 | class Pcd(ArrayOfType): 79 | """EGTS_SR_PASSENGERS_COUNTERS Passenger Counters Data""" 80 | def __init__(self, *args, **kwargs): 81 | super(Pcd, self).__init__(of_type=Byte, maxlen=2, minlen=2, *args, **kwargs) 82 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/pos_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_POS_DATA""" 2 | from ....egts_types import * 3 | from ....egts_types.date_time_field import DateTime 4 | 5 | 6 | class PosData(EGTSRecord): 7 | """EGTS_SR_POS_DATA Class""" 8 | def __init__(self, *args, **kwargs): 9 | """ 10 | Overriding constructor with fields 11 | :param args: additional args 12 | :param kwargs: parent class kwargs 13 | """ 14 | super(PosData, self).__init__( 15 | # All set outside 16 | ('ntm', DateTime()), 17 | ('lat', UInt()), 18 | ('long', UInt()), 19 | ('flags', Flags()), 20 | ('spdl', Byte()), 21 | ('dirh_alts_spdh', DirhAltsSpdh()), 22 | ('dirl', Byte()), 23 | ('odm', ArrayOfType(of_type=Byte, maxlen=3, minlen=3)), 24 | ('din', Byte()), 25 | ('src', Byte()), 26 | ('alt', ArrayOfType(of_type=Byte, maxlen=3, minlen=3, 27 | optional=True)), 28 | ('srcd', Short(optional=True)), 29 | *args, **kwargs 30 | ) 31 | 32 | @property 33 | def special_inputs(self): 34 | return { 35 | 'dir': self._set_dir, 36 | 'spd': self._set_spd, 37 | 'lat': self._set_lat, 38 | 'long': self._set_long, 39 | 'alt': self._set_alt 40 | } 41 | 42 | def _set_dir(self, value): 43 | self['dirh_alts_spdh']['dirh'] = value // 2**8 44 | self['dirl'] = value % 2**8 45 | 46 | def _set_spd(self, value): 47 | self['dirh_alts_spdh']['spdh'] = int(value) // 2 ** 8 48 | self['spdl'] = int(value) % 2 ** 8 49 | 50 | @staticmethod 51 | def is_dig(val): 52 | try: 53 | float(str(val)) 54 | return True 55 | except ValueError: 56 | return False 57 | 58 | def _set_lat(self, value): 59 | if self.is_dig(value): 60 | val = float(value) 61 | self['lahs'] = val < 0 62 | self.value['lat'].value = int(abs(val) / 90 * 0xFFFFFFFF) 63 | else: 64 | self.value['lat'].value = value 65 | 66 | def _set_long(self, value): 67 | if self.is_dig(value): 68 | val = float(value) 69 | self['lohs'] = val < 0 70 | self.value['long'].value = int(abs(val) / 180 * 0xFFFFFFFF) 71 | else: 72 | self.value['long'].value = value 73 | 74 | def _set_alt(self, value): 75 | if self.is_dig(value): 76 | raise NotImplementedError("Unable to set as a number, specification undefined") 77 | else: 78 | self.value['alt'].value = value 79 | 80 | def set_fields(self): 81 | """ 82 | Calculate necessary fields 83 | """ 84 | flags = self['flags'] 85 | if self['alt'].quantity > 0: 86 | flags['alte'] = 0b1 87 | else: 88 | flags['alte'] = 0b0 89 | self['dirh_alts_spdh']['alts'] = 0b0 90 | 91 | 92 | class DirhAltsSpdh(BitField): 93 | """EGTS_SR_POS_DATA Dir and Speed High bits + Altitude Sign""" 94 | def __init__(self, *args, **kwargs): 95 | """ 96 | Overriding constructor with fields 97 | :param args: additional args 98 | :param kwargs: parent class kwargs 99 | """ 100 | super(DirhAltsSpdh, self).__init__( 101 | ('dirh', Bits(maxlen=1)), 102 | ('alts', Bits(maxlen=1, value=0)), 103 | ('spdh', Bits(maxlen=6)), 104 | *args, **kwargs 105 | ) 106 | 107 | 108 | class Flags(BitField): 109 | """EGTS_SR_POS_DATA Flags""" 110 | def __init__(self, *args, **kwargs): 111 | """ 112 | Overriding constructor with fields 113 | :param args: additional args 114 | :param kwargs: parent class kwargs 115 | """ 116 | super(Flags, self).__init__( 117 | ('alte', Bits(maxlen=1)), 118 | ('lohs', Bits(maxlen=1)), 119 | ('lahs', Bits(maxlen=1)), 120 | ('mv', Bits(maxlen=1)), 121 | ('bb', Bits(maxlen=1)), 122 | ('cs', Bits(maxlen=1)), 123 | ('fix', Bits(maxlen=1)), 124 | ('vld', Bits(maxlen=1)), 125 | *args, **kwargs 126 | ) 127 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/presence_flags.py: -------------------------------------------------------------------------------- 1 | """Unique Teledata Structure - Array of 8 flags for 8 objects""" 2 | from ....egts_types import BitField, Bits 3 | 4 | 5 | class PresenceFlags(BitField): 6 | """Presence Flags class""" 7 | def __init__(self, field_name, *args, **kwargs): 8 | """ 9 | Adds fields name in regular BitField Object 10 | :param field_name: 11 | :param args: (name, type) tuples 12 | :param kwargs: parent class kwargs 13 | """ 14 | items = list() 15 | for i in xrange(8, 0, -1): 16 | items.append((field_name + str(i), Bits(maxlen=1, value=0))) 17 | super(PresenceFlags, self).__init__(*(items+list(args)), **kwargs) 18 | -------------------------------------------------------------------------------- /egts/egts_message/service/teledata/state_data.py: -------------------------------------------------------------------------------- 1 | """EGTS_SR_STATE_DATA""" 2 | from ....egts_types import * 3 | 4 | 5 | class StateData(EGTSRecord): 6 | """EGTS_SR_STATE_DATA Class""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(StateData, self).__init__( 14 | # State is set outside 15 | ('st', Byte()), 16 | # Voltages are set outside 17 | ('mpsv', Byte()), 18 | ('bbv', Byte()), 19 | ('ibv', Byte()), 20 | ('flags', Flags()), 21 | *args, **kwargs 22 | ) 23 | 24 | 25 | class Flags(BitField): 26 | """EGTS_SR_STATE_DATA Flags""" 27 | def __init__(self, *args, **kwargs): 28 | """ 29 | Overriding constructor with fields 30 | :param args: additional args 31 | :param kwargs: parent class kwargs 32 | """ 33 | super(Flags, self).__init__( 34 | # All the state flags are set outside 35 | ('empty', Bits(maxlen=5, value=0)), 36 | ('nms', Bits(maxlen=1)), 37 | ('ibu', Bits(maxlen=1)), 38 | ('bbu', Bits(maxlen=1)), 39 | *args, **kwargs 40 | ) 41 | -------------------------------------------------------------------------------- /egts/egts_message/transport.py: -------------------------------------------------------------------------------- 1 | """Transport Layer encoder""" 2 | from ..egts_types import * 3 | 4 | 5 | class Transport(EGTSRecord): 6 | """Transport Layer Message""" 7 | def __init__(self, *args, **kwargs): 8 | """ 9 | Overriding constructor with fields 10 | :param args: additional args 11 | :param kwargs: parent class kwargs 12 | """ 13 | super(Transport, self).__init__( 14 | ('prv', Byte(value=0x01)), 15 | # no security key by default 16 | ('skid', Byte(value=0x00)), 17 | ('flags', Flags()), 18 | # length is unknown yet 19 | ('hl', Byte()), 20 | # header encoding is 0 by default 21 | ('he', Byte(value=0)), 22 | # No frame data yet 23 | ('fdl', UShort(value=0x0000)), 24 | # packet id = 1 by default 25 | ('pid', UShort(value=1)), 26 | ('pt', Byte()), 27 | ('pra', UShort(optional=True)), 28 | ('rca', UShort(optional=True)), 29 | ('ttl', Byte(optional=True)), 30 | *args, **kwargs 31 | ) 32 | 33 | def set_fields(self): 34 | """ 35 | Calculate necessary fields 36 | """ 37 | if (self['pra'].specified and 38 | self['rca'].specified and 39 | self['ttl'].specified): 40 | self['rte'] = 0b1 41 | elif (not self['pra'].specified and 42 | not self['rca'].specified and 43 | not self['ttl'].specified): 44 | self['rte'] = 0b0 45 | else: 46 | raise TypeError('Please set all address fields!') 47 | 48 | # Counting length; hl = length of transport layer msg + 1 byte checksum 49 | self['hl'] = self.__len__() + 1 50 | 51 | 52 | class Flags(BitField): 53 | """Transport Layer Flags""" 54 | 55 | def __init__(self, *args, **kwargs): 56 | """ 57 | Overriding constructor with fields 58 | :param args: additional args 59 | :param kwargs: parent class kwargs 60 | """ 61 | super(Flags, self).__init__( 62 | ('prf', Bits(maxlen=2, value=0b00)), 63 | # address flag 64 | ('rte', Bits(maxlen=1)), 65 | # no encryption by default 66 | ('ena', Bits(maxlen=2, value=0b00)), 67 | # no compression by default 68 | ('cmp', Bits(maxlen=1, value=0b0)), 69 | # highest priority by default (?) 70 | ('pr', Bits(maxlen=2, value=0b00)), 71 | *args, ** kwargs 72 | ) 73 | -------------------------------------------------------------------------------- /egts/egts_types/__init__.py: -------------------------------------------------------------------------------- 1 | """Basic EGTS Types""" 2 | from .types import ( 3 | Byte, UShort, UInt, ULong, Short, Int, Float, Double, String, ArrayOfType, 4 | EGTSRecord, BitField, Bits, Boolean 5 | ) 6 | -------------------------------------------------------------------------------- /egts/egts_types/date_time_field.py: -------------------------------------------------------------------------------- 1 | from egts.egts_types import types 2 | from datetime import datetime 3 | import re 4 | 5 | 6 | class DateTime(types.UInt): 7 | """ 8 | Date-Time field which accepts datetime input and string time inputs 9 | """ 10 | @property 11 | def _input_casts(self): 12 | """ 13 | Add datetime cast in input casts 14 | :return: (input format: cast function) dict 15 | """ 16 | casts = super(DateTime, self)._input_casts 17 | casts[datetime] = self._datetime_cast 18 | return casts 19 | 20 | def _datetime_cast(self, value): 21 | """ 22 | Cast datetime value 23 | :param value: datetime value 24 | """ 25 | initial_date = datetime(year=2010, month=1, day=1, hour=0, minute=0, second=0) 26 | seconds = int((value - initial_date).total_seconds()) 27 | self._value = int(seconds) 28 | 29 | def _string_cast(self, value): 30 | """ 31 | Cast string value. 32 | :param value: string value 33 | """ 34 | try: 35 | mat = re.match('(\d{4})\-(\d{2})\-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})$', value) 36 | if mat is not None: 37 | self._datetime_cast(datetime(*(map(int, mat.groups())))) 38 | return 39 | except ValueError: 40 | pass 41 | super(DateTime, self)._string_cast(value) 42 | -------------------------------------------------------------------------------- /egts/interface/__init__.py: -------------------------------------------------------------------------------- 1 | from .egts import EGTS 2 | from .codes import * 3 | -------------------------------------------------------------------------------- /egts/interface/classes.py: -------------------------------------------------------------------------------- 1 | """Classes and accoridng codes""" 2 | from ..egts_message.service import * 3 | 4 | 5 | packet_types = { 6 | 0: EGTSResponse, 7 | 1: EGTSAppdata, 8 | 2: EGTSSignedAppdata 9 | } 10 | 11 | subrecord_types = { 12 | 0: RecordResponse, 13 | # Auth 14 | 1: TermIdentity, 15 | 2: ModuleData, 16 | 3: VehicleData, 17 | 6: AuthParams, 18 | 7: AuthInfo, 19 | 8: ServiceInfo, 20 | 9: ResultCode, 21 | # Commands 22 | 51: CommandData, 23 | # Firmware 24 | 33: ServicePartData, 25 | 34: ServiceFullData, 26 | # ECall 27 | 20: AccelData, 28 | 40: RawMsdData, 29 | 62: TrackData, 30 | # Teledata 31 | 16: PosData, 32 | 17: ExtPosData, 33 | 18: AdSensorsData, 34 | 19: CountersData, 35 | 21: StateData, 36 | 22: LoopinData, 37 | 23: AbsDigSensData, 38 | 24: AbsAnSensData, 39 | 25: AbsCntrData, 40 | 26: AbsLoopinData, 41 | 27: LiquidLevelSensor, 42 | 28: PassengersCounters 43 | } 44 | -------------------------------------------------------------------------------- /egts/interface/egts.py: -------------------------------------------------------------------------------- 1 | """MAIN EGTS INTERFACE""" 2 | import json 3 | import enum 4 | from ..egts_message import EGTSMessage 5 | from . import classes 6 | 7 | 8 | class EGTS(object): 9 | """EGTS Message interface""" 10 | def __init__(self, packet_type=None, *records): 11 | """Constructor""" 12 | self._message = EGTSMessage() 13 | if packet_type: 14 | self.set_packet_type(packet_type) 15 | for subrecords in records: 16 | self.add_record(*subrecords) 17 | 18 | def __str__(self): 19 | """ 20 | Get message's octet string 21 | :return: octet string 22 | """ 23 | return str(self._message) 24 | 25 | @property 26 | def bytes(self): 27 | """ 28 | Get message's bytes representation 29 | :return: byte string 30 | """ 31 | return self._message.bytes 32 | 33 | def __getitem__(self, item): 34 | return self._message[item] 35 | 36 | def __setitem__(self, key, value): 37 | self._message[key] = value 38 | 39 | def load_json(self, json_path): 40 | """ 41 | Read EGTS message from json 42 | :param json_path: file to read 43 | """ 44 | json_file = open(json_path) 45 | egts = json.load(json_file) 46 | if 'service' in egts: 47 | self.set_packet_type(egts['transport']['pt']) 48 | for record in egts['service']['sdr']: 49 | types = list() 50 | for subrecord in record['rd']: 51 | types.append(subrecord['srt']) 52 | self.add_record(*types) 53 | else: 54 | self._message._value.pop('service') 55 | self._message._value.pop('sfrcs') 56 | self._message.value = egts 57 | if not self._message.is_ready(): 58 | raise ValueError('Incomplete JSON! Some required fields are unspecified!') 59 | 60 | def write(self, output_folder): 61 | """ 62 | Write the message to raw byte file 63 | :param output_folder: path to write 64 | """ 65 | output_file = open(output_folder, 'wb') 66 | output_file.write(self.bytes) 67 | 68 | def set_packet_type(self, packet_type): 69 | """ 70 | Specify message's packet type 71 | :param packet_type: type of packet (int/enum) 72 | """ 73 | if isinstance(packet_type, enum.Enum): 74 | pt = packet_type.value 75 | else: 76 | pt = packet_type 77 | try: 78 | self._message['service'] = classes.packet_types[pt]() 79 | self._message['transport']['pt'] = pt 80 | except KeyError: 81 | raise TypeError('Unknown packet type: {}'.format(pt)) 82 | 83 | def add_record(self, *subrecord_types): 84 | """ 85 | Add new record to the message 86 | :param subrecord_types: 87 | :return: 88 | """ 89 | sdr = self._message['sdr'] 90 | sdr.append() 91 | record_number = sdr.quantity - 1 92 | for subrecord_type in subrecord_types: 93 | self.add_subrecord(record_number, subrecord_type) 94 | return sdr[record_number] 95 | 96 | def add_subrecord(self, record_number, subrecord_type): 97 | """ 98 | Add subrecord to the record 99 | :param record_number: number of record to add to 100 | :param subrecord_type: subrecord type to add 101 | """ 102 | record = self._message['sdr'][record_number] 103 | srd = record['rd'] 104 | srd.append() 105 | subrecord_number = srd.quantity - 1 106 | 107 | if isinstance(subrecord_type, enum.Enum): 108 | srt = subrecord_type.value 109 | else: 110 | srt = subrecord_type 111 | srd[subrecord_number]['srd'] = classes.subrecord_types[srt]() 112 | srd[subrecord_number]['srt'] = srt 113 | return srd[subrecord_number] 114 | -------------------------------------------------------------------------------- /egts/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Note: To use the 'upload' functionality of this file, you must: 5 | # $ pipenv install twine --dev 6 | 7 | import io 8 | import os 9 | import sys 10 | from shutil import rmtree 11 | 12 | from setuptools import find_packages, setup, Command 13 | 14 | # Package meta-data. 15 | NAME = 'egts' 16 | DESCRIPTION = 'Enocder interface for creating EGTS messages' 17 | URL = 'https://github.com/Sanchez486/egts-python/' 18 | EMAIL = 'fergusonalexandr@mail.ru' 19 | AUTHOR = 'Sanchez486' 20 | REQUIRES_PYTHON = '>=2.7.0' 21 | VERSION = '0.1.0' 22 | 23 | # What packages are required for this module to be executed? 24 | REQUIRED = [ 25 | 'enum', 26 | ] 27 | 28 | # What packages are optional? 29 | EXTRAS = { 30 | # 'fancy feature': ['django'], 31 | } 32 | 33 | # The rest you shouldn't have to touch too much :) 34 | # ------------------------------------------------ 35 | # Except, perhaps the License and Trove Classifiers! 36 | # If you do change the License, remember to change the Trove Classifier for that! 37 | 38 | here = os.path.abspath(os.path.dirname(__file__)) 39 | 40 | # Load the package's __version__.py module as a dictionary. 41 | about = {} 42 | about['__version__'] = VERSION 43 | 44 | 45 | class UploadCommand(Command): 46 | """Support setup.py upload.""" 47 | 48 | description = 'Build and publish the package.' 49 | user_options = [] 50 | 51 | @staticmethod 52 | def status(s): 53 | """Prints things in bold.""" 54 | print('\033[1m{0}\033[0m'.format(s)) 55 | 56 | def initialize_options(self): 57 | pass 58 | 59 | def finalize_options(self): 60 | pass 61 | 62 | def run(self): 63 | try: 64 | self.status('Removing previous builds…') 65 | rmtree(os.path.join(here, 'dist')) 66 | except OSError: 67 | pass 68 | 69 | self.status('Building Source and Wheel (universal) distribution…') 70 | os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) 71 | 72 | self.status('Uploading the package to PyPI via Twine…') 73 | os.system('twine upload dist/*') 74 | 75 | self.status('Pushing git tags…') 76 | os.system('git tag v{0}'.format(about['__version__'])) 77 | os.system('git push --tags') 78 | 79 | sys.exit() 80 | 81 | 82 | # Where the magic happens: 83 | setup( 84 | name=NAME, 85 | version=about['__version__'], 86 | description=DESCRIPTION, 87 | author=AUTHOR, 88 | author_email=EMAIL, 89 | python_requires=REQUIRES_PYTHON, 90 | url=URL, 91 | packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]), 92 | install_requires=REQUIRED, 93 | extras_require=EXTRAS, 94 | include_package_data=True, 95 | license='MIT', 96 | classifiers=[ 97 | # Trove classifiers 98 | # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers 99 | 'License :: OSI Approved :: MIT License', 100 | 'Programming Language :: Python', 101 | 'Programming Language :: Python :: 2', 102 | 'Programming Language :: Python :: 2.7', 103 | ], 104 | # $ setup.py publish support. 105 | cmdclass={ 106 | 'upload': UploadCommand, 107 | }, 108 | ) 109 | -------------------------------------------------------------------------------- /pylintrc: -------------------------------------------------------------------------------- 1 | # pylint: skip-file 2 | [MESSAGES CONTROL] 3 | disable=too-many-ancestors, 4 | too-many-arguments, 5 | no-member, 6 | abstract-method, 7 | not-callable, 8 | too-few-public-methods, 9 | duplicate-code, 10 | not-an-iterable, 11 | invalid-name, 12 | wildcard-import, 13 | unused-wildcard-import 14 | 15 | [SPELLING] 16 | spelling-ignore-words=egts 17 | -------------------------------------------------------------------------------- /setup_egts.py: -------------------------------------------------------------------------------- 1 | NAME = 'egts' 2 | DESCRIPTION = 'Enocder interface for creating EGTS messages' 3 | URL = 'https://github.com/Sanchez486/egts-python/' 4 | EMAIL = 'fergusonalexandr@mail.ru' 5 | AUTHOR = 'Sanchez486' 6 | REQUIRES_PYTHON = '>=2.7.0' 7 | VERSION = '0.1.0' 8 | 9 | from setuptools import setup 10 | 11 | setup(name=NAME, 12 | version='0.1.0', 13 | description=DESCRIPTION, 14 | url=URL, 15 | author=AUTHOR, 16 | author_email=EMAIL, 17 | license='MIT', 18 | packages=['egts'], 19 | zip_safe=False) 20 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanchez486/egts-python/d553dfb2e58a17366c13e57c4c1b16a387111df7/tests/__init__.py -------------------------------------------------------------------------------- /tests/json/EGTS_validator_x64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanchez486/egts-python/d553dfb2e58a17366c13e57c4c1b16a387111df7/tests/json/EGTS_validator_x64.exe -------------------------------------------------------------------------------- /tests/json/data/abs_an_sens_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 24, 18 | "srd": { 19 | "asn": 1, 20 | "asv": "0x020304" 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/json/data/abs_cntr_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 25, 18 | "srd": { 19 | "cn": 1, 20 | "cnv": "0x020304" 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/json/data/abs_dig_sens_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 23, 18 | "srd": { 19 | "dsn": 300, 20 | "dsst": 1 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/json/data/abs_loopin_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 26, 18 | "srd": { 19 | "lin": 300, 20 | "lis": 1 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/json/data/accel_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 10, 14 | "rst": 10, 15 | "rd": [ 16 | { 17 | "srt": 20, 18 | "srd": { 19 | "atm": "0x02ADC4F6", 20 | "ads": [ 21 | { 22 | "rtm": 0, 23 | "xaav": 0, 24 | "yaav": 0, 25 | "zaav": 0 26 | }, 27 | { 28 | "rtm": 1, 29 | "xaav": 1, 30 | "yaav": 1, 31 | "zaav": 1 32 | } 33 | ] 34 | } 35 | } 36 | ] 37 | } 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/json/data/ad_sensors_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 18, 18 | "srd": { 19 | "dout": 0, 20 | "adio1": 1, 21 | "ans1": [ 22 | 0, 23 | 0, 24 | 1 25 | ], 26 | "adio8": 8, 27 | "ans8": [ 28 | 0, 29 | 0, 30 | 8 31 | ], 32 | "adio3": 3, 33 | "ans3": [ 34 | 0, 35 | 0, 36 | 3 37 | ] 38 | } 39 | } 40 | ] 41 | } 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/json/data/auth_info_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 7, 18 | "srd": { 19 | "unm": "username1", 20 | "upsw": "pswd0123", 21 | "ss": "45678" 22 | } 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/json/data/auth_params_max_size.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 6, 18 | "srd": { 19 | "pbk": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 20 | "isl": 32, 21 | "msz": 16, 22 | "ss": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 23 | "exp": "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" 24 | } 25 | } 26 | ] 27 | } 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/json/data/auth_params_no_optional.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 6, 18 | "srd": { 19 | } 20 | } 21 | ] 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/json/data/auth_params_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 6, 18 | "srd": { 19 | "pbk": "0x11223344556677889900aabbccddeeff1234567890abcdeffedcba0987654321", 20 | "isl": 32, 21 | "msz": 16, 22 | "ss": "0123456789", 23 | "exp": "9876543210" 24 | } 25 | } 26 | ] 27 | } 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/json/data/command_data_simple_com.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 4, 14 | "rst": 4, 15 | "rd": [ 16 | { 17 | "srt": 51, 18 | "srd": { 19 | "type_flags": { 20 | "ct": 5, 21 | "cct": 0 22 | }, 23 | "cid": 1, 24 | "sid": 1, 25 | "ac": "0x0102030405060708", 26 | "cd": { 27 | "adr": 12345, 28 | "flags" : { 29 | "sz": 1, 30 | "act": 0 31 | }, 32 | "ccd": 12345, 33 | "dt": "0x30313233343536373839" 34 | } 35 | } 36 | } 37 | ] 38 | } 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/json/data/command_data_simple_conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 4, 14 | "rst": 4, 15 | "rd": [ 16 | { 17 | "srt": 51, 18 | "srd": { 19 | "type_flags": { 20 | "ct": 1, 21 | "cct": 0 22 | }, 23 | "cid": 1, 24 | "sid": 1, 25 | "ac": "0x0102030405060708", 26 | "cd": { 27 | "adr": 12345, 28 | "ccd": 12345, 29 | "dt": "0x30313233343536373839" 30 | } 31 | } 32 | } 33 | ] 34 | } 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/json/data/counters_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 19, 18 | "srd": { 19 | "cn1": [ 20 | 0, 21 | 0, 22 | 1 23 | ], 24 | "cn8": [ 25 | 0, 26 | 0, 27 | 8 28 | ], 29 | "cn3": [ 30 | 0, 31 | 0, 32 | 3 33 | ] 34 | } 35 | } 36 | ] 37 | } 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/json/data/ext_pos_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 17, 18 | "srd": { 19 | "vdop": 65000, 20 | "hdop": 30000, 21 | "pdop": 45000, 22 | "sat": 1, 23 | "ns": 20000 24 | } 25 | } 26 | ] 27 | } 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/json/data/liquid_level_sensor_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 27, 18 | "srd": { 19 | "llsvu": "0b10", 20 | "llsn": 1, 21 | "maddr": 65000, 22 | "llsd": "0x03040506" 23 | } 24 | } 25 | ] 26 | } 27 | ] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/json/data/loopin_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 22, 18 | "srd": { 19 | "lis1": 1, 20 | "lis8": 8, 21 | "lis3": 15 22 | } 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/json/data/module_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 2, 18 | "srd": { 19 | "vid": 12345, 20 | "fwv": "0x0101", 21 | "swv": "0x0101", 22 | "md": 10, 23 | "st": 1, 24 | "srn": "01234", 25 | "dscr": "56789" 26 | } 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/json/data/passengers_counters_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 28, 18 | "srd": { 19 | "drl": 0, 20 | "maddr": 300, 21 | "pcd": { 22 | "ipq1": 1, 23 | "opq1": 1, 24 | "ipq8": 8, 25 | "opq8": 8, 26 | "ipq3": 3, 27 | "opq3": 3 28 | }, 29 | "ipq2": 2, 30 | "opq2": 2 31 | } 32 | } 33 | ] 34 | } 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/json/data/pos_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "2018-06-05T10:00:00", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 16, 18 | "srd": { 19 | "ntm": "2018-06-05T10:00:01", 20 | "lat": -25.5246, 21 | "long": 153.65379, 22 | "lohs": 0, 23 | "lahs": 0, 24 | "mv": 1, 25 | "bb": 0, 26 | "cs": 0, 27 | "vld": 1, 28 | "fix": 0, 29 | "spd": 600, 30 | "alt": "0x010203", 31 | "alts": 0, 32 | "src": 13, 33 | "srcd": -100, 34 | "dir": 300, 35 | "odm": "0x050607", 36 | "din": "0b00000101" 37 | } 38 | }, 39 | { 40 | "srt": 16, 41 | "srd": { 42 | "ntm": "2018-06-05T10:00:01", 43 | "lat": -25.5246, 44 | "long": 153.65379, 45 | "lohs": 0, 46 | "lahs": 0, 47 | "mv": 1, 48 | "bb": 0, 49 | "cs": 0, 50 | "vld": 1, 51 | "fix": 0, 52 | "spd": 601, 53 | "alt": "0x010203", 54 | "alts": 0, 55 | "src": 13, 56 | "srcd": -100, 57 | "dir": 300, 58 | "odm": "0x050607", 59 | "din": "0b00000101" 60 | } 61 | } 62 | ] 63 | } 64 | ] 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tests/json/data/raw_msd_data_max_length.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 10, 14 | "rst": 10, 15 | "rd": [ 16 | { 17 | "srt": 40, 18 | "srd": { 19 | "fm": 0, 20 | "msd": "0x5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F454E4421" 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/json/data/raw_msd_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 10, 14 | "rst": 10, 15 | "rd": [ 16 | { 17 | "srt": 40, 18 | "srd": { 19 | "fm": 0, 20 | "msd": "0x5241575F44415441" 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/json/data/record_response_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 0, 18 | "srd": { 19 | "crn": 65000, 20 | "rst": 0 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/json/data/result_code_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 9, 18 | "srd": { 19 | "rcd": 1 20 | } 21 | } 22 | ] 23 | } 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/json/data/service_full_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 9, 14 | "rst": 9, 15 | "rd": [ 16 | { 17 | "srt": 34, 18 | "srd": { 19 | "odh": { 20 | "oa": { 21 | "ot": 0, 22 | "mt": 0 23 | }, 24 | "cmi": 123, 25 | "ver": 1, 26 | "wos": 12346, 27 | "fn": "abcdeabcde" 28 | }, 29 | "od": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" 30 | } 31 | } 32 | ] 33 | } 34 | ] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/json/data/service_info_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 8, 18 | "srd": { 19 | "st": 1, 20 | "sst": 0, 21 | "srvp": { 22 | "srva": 1, 23 | "srvrp": 2 24 | } 25 | } 26 | } 27 | ] 28 | } 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/json/data/service_part_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 9, 14 | "rst": 9, 15 | "rd": [ 16 | { 17 | "srt": 33, 18 | "srd": { 19 | "id": 12345, 20 | "pn": 2, 21 | "epq": 2, 22 | "odh": { 23 | "oa": { 24 | "ot": 0, 25 | "mt": 0 26 | }, 27 | "cmi": 123, 28 | "ver": 1, 29 | "wos": 12346, 30 | "fn": "abcdeabcde" 31 | }, 32 | "od": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" 33 | } 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/json/data/state_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 2, 14 | "rst": 2, 15 | "rd": [ 16 | { 17 | "srt": 21, 18 | "srd": { 19 | "st": 2, 20 | "mpsv": 150, 21 | "bbv": 200, 22 | "ibv": 250, 23 | "nms": 1, 24 | "ibu": 0, 25 | "bbu": 1 26 | } 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/json/data/term_identity_all_optional.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 1, 18 | "srd": { 19 | "tid": 1234, 20 | "hdid": 65000, 21 | "flags": { 22 | "ssra": 0 23 | }, 24 | "imei": "a2345678901234b", 25 | "imsi": "c23456789012345d", 26 | "lngc": "rus", 27 | "nid": { 28 | "mcc": 64, 29 | "mnc": 515 30 | }, 31 | "bs": 4096, 32 | "msisdn": "e2345678901234f" 33 | } 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/json/data/term_identity_max_size.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 1, 18 | "srd": { 19 | "tid": 1234, 20 | "hdid": 65000, 21 | "flags": { 22 | "ssra": 0 23 | }, 24 | "imei": "a2345678901234b", 25 | "imsi": "c23456789012345d", 26 | "lngc": "rus", 27 | "nid": { 28 | "mcc": 64, 29 | "mnc": 515 30 | }, 31 | "bs": 4096, 32 | "msisdn": "e2345678901234f" 33 | } 34 | } 35 | ] 36 | } 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/json/data/term_identity_no_optional.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 1, 18 | "srd": { 19 | "tid": 1234, 20 | "flags": { 21 | "ssra": 0 22 | } 23 | } 24 | } 25 | ] 26 | } 27 | ] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/json/data/term_identity_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 1, 18 | "srd": { 19 | "tid": 1234, 20 | "flags": { 21 | "ssra": 0 22 | }, 23 | "imei": "АБВГД678901234b", 24 | "imsi": "c23456789012345f", 25 | "bs": 4096, 26 | "msisdn": "e2345678901234f" 27 | } 28 | } 29 | ] 30 | } 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/json/data/track_data_and_accel_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 10, 14 | "rst": 10, 15 | "rd": [ 16 | { 17 | "srt": 62, 18 | "srd": { 19 | "atm": 300000, 20 | "tds": [ 21 | { 22 | "flags": { 23 | "rtm": 10 24 | }, 25 | "lat": 0, 26 | "long": 0, 27 | "spd": 0, 28 | "dir": 100 29 | }, 30 | { 31 | "flags": { 32 | "rtm": 11 33 | }, 34 | "lat": 56.0003, 35 | "long": 44.0025, 36 | "spd": 1000, 37 | "dir": 120 38 | } 39 | ] 40 | } 41 | }, 42 | { 43 | "srt": 20, 44 | "srd": { 45 | "atm": "0x02ADC4F6", 46 | "ads": [ 47 | { 48 | "rtm": 0, 49 | "xaav": 0, 50 | "yaav": 0, 51 | "zaav": 0 52 | }, 53 | { 54 | "rtm": 1, 55 | "xaav": 1, 56 | "yaav": 1, 57 | "zaav": 1 58 | } 59 | ] 60 | } 61 | } 62 | ] 63 | } 64 | ] 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tests/json/data/track_data_empty.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 10, 14 | "rst": 10, 15 | "rd": [ 16 | { 17 | "srt": 62, 18 | "srd": { 19 | "atm": 300000 20 | } 21 | } 22 | ] 23 | } 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/json/data/track_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "2018-06-05T10:00:00", 13 | "sst": 10, 14 | "rst": 10, 15 | "rd": [ 16 | { 17 | "srt": 62, 18 | "srd": { 19 | "atm": "2018-06-05T10:00:01", 20 | "tds": [ 21 | { 22 | "flags": { 23 | "lohs": 1, 24 | "lahs": 1, 25 | "rtm": 10 26 | }, 27 | "lat": 0, 28 | "long": 0, 29 | "spd": 0, 30 | "dir": 100 31 | }, 32 | { 33 | "flags": { 34 | "rtm": 11 35 | }, 36 | "lat": -25.5246, 37 | "long": 153.65379, 38 | "spd": 1000, 39 | "dir": 120 40 | } 41 | ] 42 | } 43 | } 44 | ] 45 | } 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/json/data/transport.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 0 4 | } 5 | } -------------------------------------------------------------------------------- /tests/json/data/vehicle_data_and_term_identity.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 3, 18 | "srd": { 19 | "vin": "a234567890123456b", 20 | "vht": 12345, 21 | "vpst": 23456 22 | } 23 | }, 24 | { 25 | "srt": 1, 26 | "srd": { 27 | "tid": 1234, 28 | "flags": { 29 | "ssra": 0 30 | }, 31 | "imei": "a2345678901234b", 32 | "imsi": "c23456789012345d", 33 | "bs": 4096, 34 | "msisdn": "e2345678901234f" 35 | } 36 | } 37 | ] 38 | } 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/json/data/vehicle_data_simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "transport": { 3 | "pt": 1 4 | }, 5 | "service": { 6 | "sdr": [ 7 | { 8 | "rfl": { 9 | "ssod": 0, 10 | "rsod": 0 11 | }, 12 | "tm": "0x0fd90000", 13 | "sst": 1, 14 | "rst": 1, 15 | "rd": [ 16 | { 17 | "srt": 3, 18 | "srd": { 19 | "vin": "a234567890123456b", 20 | "vht": 12345, 21 | "vpst": 23456 22 | } 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/json/expected/abs_an_sens_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0012000100018807000100040000D90F0202180400010203047EB2 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 18 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x88 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xB27E 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 7 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 24 (unspecified) 57 | Subrecord Length - 4 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/abs_cntr_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0012000100018807000100040000D90F0202190400010203041F0A 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 18 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x88 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x0A1F 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 7 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 25 (unspecified) 57 | Subrecord Length - 4 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/abs_dig_sens_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0010000100011F05000100040000D90F0202170200C11291EE 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 16 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x1F 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xEE91 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 5 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 23 (unspecified) 57 | Subrecord Length - 2 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/abs_loopin_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0010000100011F05000100040000D90F02021A0200C112EBCF 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 16 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x1F 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xCFEB 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 5 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 26 (unspecified) 57 | Subrecord Length - 2 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/accel_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002300010001DF18000100040000D90F0A0A14150002F6C4AD0200000000000000000100010001000100AD25 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 35 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xDF 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x25AD 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 24 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 10 (EGTS_ECALL_SERVICE) 50 | Recipient Service Type - 10 (EGTS_ECALL_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 20 (EGTS_SR_ACCEL_DATA) 57 | Subrecord Length - 21 58 | Structures Amount - 2 59 | Absolute Time - 0x02ADC4F6 (05.06.2011 04:03:02.000 GMT) 60 | Accelerometr Data Structures: 61 | ----------------------------- 62 | 1 63 | Relative Time - [000 ms] (05.06.2011 04:03:02.000 GMT) 64 | XAAV - 0x0000 0.0m/c2 65 | YAAV - 0x0000 0.0m/c2 66 | ZAAV - 0x0000 0.0m/c2 67 | 68 | ------------------ 69 | 2 70 | Relative Time - [001 ms] (05.06.2011 04:03:02.001 GMT) 71 | XAAV - 0x0001 0.1m/c2 72 | YAAV - 0x0001 0.1m/c2 73 | ZAAV - 0x0001 0.1m/c2 74 | 75 | ------------------ 76 | 77 | 78 | ------------------------------------------------------------- 79 | Press any key to exit... 80 | -------------------------------------------------------------------------------- /tests/json/expected/ad_sensors_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001D00010001ED12000100040000D90F0202120F00850085010308000001000003000008AFE6 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 29 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xED 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xE6AF 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 18 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 18 (unspecified) 57 | Subrecord Length - 15 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/auth_info_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002700010001C01C000100040000D90F0101071900757365726E616D6531007073776430313233003435363738006BBC 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 39 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xC0 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xBC6B 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 28 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 7 (EGTS_SR_AUTH_INFO) 57 | Subrecord Length - 25 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/auth_params_max_size.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001504010001DD0A040100040000D90F01010607047D0002FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF200010003030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030300031313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313100AD6D 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 1045 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xDD 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x6DAD 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 1034 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 6 (EGTS_SR_AUTH_PARAMS) 57 | Subrecord Length - 1031 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/auth_params_no_optional.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001100010001CC06000100040000D90F010106030005000062C6 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 17 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xCC 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xC662 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 6 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 6 (EGTS_SR_AUTH_PARAMS) 57 | Subrecord Length - 3 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/command_data_simple_com.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B003000010001E725000100040000D90F0404332200500100000001000000020801020304050607083930103930303132333435363738391C7B 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 48 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xE7 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x7B1C 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 37 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 4 (EGTS_COMMANDS_SERVICE) 50 | Recipient Service Type - 4 (EGTS_COMMANDS_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 51 (EGTS_SR_COMMAND_DATA) 57 | Subrecord Length - 34 58 | Command Type - 0101b (EGTS_CT_COM) 59 | Confirmation Type - 0000b (EGTS_CC_OK) 60 | Command Identifier - 1 61 | Source Identifier - 1 62 | Flags - 00000010b (0x02) 63 | ACFE - 1 64 | CHSFE - 0 65 | Auth Code Length - 8 66 | AuthCode - 0102030405060708 67 | Command Data - 393010393030313233343536373839 68 | Address - 12345 69 | SZ - 0001b 70 | ACT - 0000b 71 | Command Code - 0x3039 (unspecified) 72 | Command Type - 0101b (EGTS_CT_COM) 73 | Confirmation Type - 0000b (EGTS_CC_OK) 74 | Command Identifier - 1 75 | Source Identifier - 1 76 | Flags - 00000010b (0x02) 77 | ACFE - 1 78 | CHSFE - 0 79 | Auth Code Length - 8 80 | AuthCode - 0102030405060708 81 | Command Data - 393010393030313233343536373839 82 | 83 | 84 | ------------------------------------------------------------- 85 | Press any key to exit... 86 | -------------------------------------------------------------------------------- /tests/json/expected/command_data_simple_conf.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002F00010001FE24000100040000D90F04043321001001000000010000000208010203040506070839303930303132333435363738397AF2 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 47 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xFE 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xF27A 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 36 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 4 (EGTS_COMMANDS_SERVICE) 50 | Recipient Service Type - 4 (EGTS_COMMANDS_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 51 (EGTS_SR_COMMAND_DATA) 57 | Subrecord Length - 33 58 | Command Type - 0001b (EGTS_CT_COMCONF) 59 | Confirmation Type - 0000b (EGTS_CC_OK) 60 | Command Identifier - 1 61 | Source Identifier - 1 62 | Flags - 00000010b (0x02) 63 | ACFE - 1 64 | CHSFE - 0 65 | Auth Code Length - 8 66 | AuthCode - 0102030405060708 67 | Command Data - 3930393030313233343536373839 68 | Address - 12345 69 | Command Code - 0x3039 (unspecified) 70 | Command Type - 0001b (EGTS_CT_COMCONF) 71 | Confirmation Type - 0000b (EGTS_CC_OK) 72 | Command Identifier - 1 73 | Source Identifier - 1 74 | Flags - 00000010b (0x02) 75 | ACFE - 1 76 | CHSFE - 0 77 | Auth Code Length - 8 78 | AuthCode - 0102030405060708 79 | Command Data - 3930393030313233343536373839 80 | 81 | 82 | ------------------------------------------------------------- 83 | Press any key to exit... 84 | -------------------------------------------------------------------------------- /tests/json/expected/counters_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001800010001210D000100040000D90F0202130A0085000001000003000008F494 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 24 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x21 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x94F4 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 13 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 19 (unspecified) 57 | Subrecord Length - 10 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/ext_pos_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001800010001210D000100040000D90F0202110A001FE8FD3075C8AF01204EA4E5 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 24 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x21 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xE5A4 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 13 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 17 (unspecified) 57 | Subrecord Length - 10 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/liquid_level_sensor_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001500010001D30A000100040000D90F02021B070021E8FD0304050695DB 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 21 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xD3 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xDB95 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 10 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 27 (unspecified) 57 | Subrecord Length - 7 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/loopin_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0012000100018807000100040000D90F02021604008510F008223D 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 18 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x88 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x3D22 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 7 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 22 (unspecified) 57 | Subrecord Length - 4 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/module_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002600010001131B000100040000D90F0101021800010039300000010101010A013031323334003536373839006135 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 38 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x13 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x3561 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 27 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 2 (EGTS_SR_MODULE_DATA) 57 | Subrecord Length - 24 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/passengers_counters_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001B000100016510000100040000D90F02021C0D000087002C010101020203030808727D 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 27 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x65 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x7D72 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 16 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 28 (unspecified) 57 | Subrecord Length - 13 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/pos_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts-python\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002800010001A51D000100042024D90F0202101A002124D90F4D729A483DA387DAD158822C050607050D0102039CFF9EBB 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 40 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xA5 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xBB9E 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 29 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD92420 (05.06.2018 10:00:00 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 16 (unspecified) 57 | Subrecord Length - 26 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/raw_msd_data_max_length.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0083000100019478000100040000D90F0A0A287500005F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F454E44213D9D 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 131 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x94 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x9D3D 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 120 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 10 (EGTS_ECALL_SERVICE) 50 | Recipient Service Type - 10 (EGTS_ECALL_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 40 (EGTS_SR_RAW_MSD_DATA) 57 | Subrecord Length - 117 58 | Format - 0 59 | Raw MSD data - 116 bytes [5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F5F564552595F4C4F4E475F444154415F454E4421] 60 | 61 | 62 | ------------------------------------------------------------- 63 | Press any key to exit... 64 | -------------------------------------------------------------------------------- /tests/json/expected/raw_msd_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001700010001440C000100040000D90F0A0A280900005241575F444154416CE8 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 23 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x44 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xE86C 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 12 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 10 (EGTS_ECALL_SERVICE) 50 | Recipient Service Type - 10 (EGTS_ECALL_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 40 (EGTS_SR_RAW_MSD_DATA) 57 | Subrecord Length - 9 58 | Format - 0 59 | Raw MSD data - 8 bytes [5241575F44415441] 60 | 61 | 62 | ------------------------------------------------------------- 63 | Press any key to exit... 64 | -------------------------------------------------------------------------------- /tests/json/expected/record_response_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001100010001CC06000100040000D90F0101000300E8FD007ECC 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 17 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xCC 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xCC7E 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 6 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 0 (EGTS_SR_RESPONSE) 57 | Subrecord Length - 3 58 | Confirmed Record Number- 65000 59 | Record Status - 0 (OK) 60 | 61 | 62 | ------------------------------------------------------------- 63 | Press any key to exit... 64 | -------------------------------------------------------------------------------- /tests/json/expected/result_code_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B000F000100010604000100040000D90F010109010001C71F 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 15 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x06 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x1FC7 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 4 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 9 (EGTS_SR_RESULT_CODE) 57 | Subrecord Length - 1 58 | Result Code - 1 (In progress) 59 | 60 | 61 | ------------------------------------------------------------- 62 | Press any key to exit... 63 | -------------------------------------------------------------------------------- /tests/json/expected/service_full_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B005F00010001BB54000100040000D90F0909225100007B010054F16162636465616263646500FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0773 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 95 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xBB 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x7307 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 84 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 9 (EGTS_FIRMWARE_SERVICE) 50 | Recipient Service Type - 9 (EGTS_FIRMWARE_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 34 (EGTS_SR_SERVICE_FULL_DATA) 57 | Subrecord Length - 81 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/service_info_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B001100010001CC06000100040000D90F0101080300010082CB2B 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 17 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xCC 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x2BCB 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 6 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 8 (EGTS_SR_SRV_INFO) 57 | Subrecord Length - 3 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/service_part_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B006500010001965A000100040000D90F0909215700393002000200007B010054F16162636465616263646500FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF766F 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 101 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x96 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x6F76 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 90 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 9 (EGTS_FIRMWARE_SERVICE) 50 | Recipient Service Type - 9 (EGTS_FIRMWARE_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 33 (EGTS_SR_SERVICE_PART_DATA) 57 | Subrecord Length - 87 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/state_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0013000100015B08000100040000D90F02021505000296C8FA056CE9 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 19 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x5B 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xE96C 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 8 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 21 (unspecified) 57 | Subrecord Length - 5 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/term_identity_all_optional.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B004B00010001D840000100040000D90F0101013D00D2040000EFE8FD613233343536373839303132333462633233343536373839303132333435647275730102030010653233343536373839303132333466DBA9 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 75 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xD8 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xA9DB 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 64 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 1 (EGTS_SR_TERM_IDENTITY) 57 | Subrecord Length - 61 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/term_identity_max_size.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B004B00010001D840000100040000D90F0101013D00D2040000EFE8FD613233343536373839303132333462633233343536373839303132333435647275730102030010653233343536373839303132333466DBA9 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 75 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xD8 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xA9DB 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 64 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 1 (EGTS_SR_TERM_IDENTITY) 57 | Subrecord Length - 61 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/term_identity_no_optional.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0013000100015B08000100040000D90F0101010500D204000000D278 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 19 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x5B 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x78D2 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 8 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 1 (EGTS_SR_TERM_IDENTITY) 57 | Subrecord Length - 5 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/term_identity_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B004300010001E638000100040000D90F0101013500D2040000C6C0C1C2C3C43637383930313233346263323334353637383930313233343566001065323334353637383930313233346666CC 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 67 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xE6 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xCC66 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 56 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 1 (EGTS_SR_TERM_IDENTITY) 57 | Subrecord Length - 53 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/track_data_and_accel_data.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B004300010001E638000100040000D90F0A0A3E1D0002E0930400EA0000000000000000000064EB8B2C4A9F42D2943EE8037814150002F6C4AD02000000000000000001000100010001000411 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 67 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xE6 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x1104 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 56 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 10 (EGTS_ECALL_SERVICE) 50 | Recipient Service Type - 10 (EGTS_ECALL_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 62 (EGTS_SR_ECALL_TRACK_DATA) 57 | Subrecord Length - 29 58 | Structures Amount - 2 59 | Absolute Time - 0x000493E0 (04.01.2010 11:20:00.000 GMT) 60 | Track Points Data Structures: 61 | ----------------------------- 62 | 1 63 | Relative Time - [1000 ms] (04.01.2010 11:20:01.000 GMT) 64 | Point Data Exist - 1 65 | Long. Hemisphere - 1 66 | Lat. Hemisphere - 1 67 | LAT - 0x00000000 (N0.00000000) 68 | LON - 0x00000000 (W0.00000000) 69 | SPEED - 0 (0.00 kmph) 70 | DIR - 100 71 | ------------------ 72 | 2 73 | Relative Time - [1100 ms] (04.01.2010 11:20:02.100 GMT) 74 | Point Data Exist - 1 75 | Long. Hemisphere - 1 76 | Lat. Hemisphere - 1 77 | LAT - 0x9F4A2C8B (N56.00030000) 78 | LON - 0x3E94D242 (W44.00249997) 79 | SPEED - 1000 (10.00 kmph) 80 | DIR - 120 81 | ------------------ 82 | 83 | Subrecord Data: 84 | ------------------ 85 | Validating Result - 0 (OK) 86 | 87 | Subrecord Type - 20 (EGTS_SR_ACCEL_DATA) 88 | Subrecord Length - 21 89 | Structures Amount - 2 90 | Absolute Time - 0x02ADC4F6 (05.06.2011 04:03:02.000 GMT) 91 | Accelerometr Data Structures: 92 | ----------------------------- 93 | 1 94 | Relative Time - [000 ms] (05.06.2011 04:03:02.000 GMT) 95 | XAAV - 0x0000 0.0m/c2 96 | YAAV - 0x0000 0.0m/c2 97 | ZAAV - 0x0000 0.0m/c2 98 | 99 | ------------------ 100 | 2 101 | Relative Time - [001 ms] (05.06.2011 04:03:02.001 GMT) 102 | XAAV - 0x0001 0.1m/c2 103 | YAAV - 0x0001 0.1m/c2 104 | ZAAV - 0x0001 0.1m/c2 105 | 106 | ------------------ 107 | 108 | 109 | ------------------------------------------------------------- 110 | Press any key to exit... 111 | -------------------------------------------------------------------------------- /tests/json/expected/track_data_empty.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0014000100010009000100040000D90F0A0A3E060001E09304000022C4 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 20 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x00 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xC422 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 9 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 10 (EGTS_ECALL_SERVICE) 50 | Recipient Service Type - 10 (EGTS_ECALL_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 62 (EGTS_SR_ECALL_TRACK_DATA) 57 | Subrecord Length - 6 58 | Structures Amount - 1 59 | Absolute Time - 0x000493E0 (04.01.2010 11:20:00.000 GMT) 60 | Track Points Data Structures: 61 | ----------------------------- 62 | 63 | 64 | ------------------------------------------------------------- 65 | Press any key to exit... 66 | -------------------------------------------------------------------------------- /tests/json/expected/track_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002B00010001E120000100042024D90F0A0A3E1D00022124D90FEA0000000000000000000064CB4D729A483DA387DAE80378C7C3 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 43 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xE1 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xC3C7 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 32 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD92420 (05.06.2018 10:00:00 GMT) 49 | Source Service Type - 10 (EGTS_ECALL_SERVICE) 50 | Recipient Service Type - 10 (EGTS_ECALL_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 62 (EGTS_SR_ECALL_TRACK_DATA) 57 | Subrecord Length - 29 58 | Structures Amount - 2 59 | Absolute Time - 0x0FD92421 (05.06.2018 10:00:01.000 GMT) 60 | Track Points Data Structures: 61 | ----------------------------- 62 | 1 63 | Relative Time - [1000 ms] (05.06.2018 10:00:02.000 GMT) 64 | Point Data Exist - 1 65 | Long. Hemisphere - 1 66 | Lat. Hemisphere - 1 67 | LAT - 0x00000000 (N0.00000000) 68 | LON - 0x00000000 (W0.00000000) 69 | SPEED - 0 (0.00 kmph) 70 | DIR - 100 71 | ------------------ 72 | 2 73 | Relative Time - [1100 ms] (05.06.2018 10:00:03.100 GMT) 74 | Point Data Exist - 1 75 | Long. Hemisphere - 1 76 | Lat. Hemisphere - 0 77 | LAT - 0x489A724D (S25.52459998) 78 | LON - 0xDA87A33D (W153.65378997) 79 | SPEED - 1000 (10.00 kmph) 80 | DIR - 120 81 | ------------------ 82 | 83 | 84 | ------------------------------------------------------------- 85 | Press any key to exit... 86 | -------------------------------------------------------------------------------- /tests/json/expected/transport.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B00000001000052 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 0 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x52 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - unspecified 32 | Service Layer CS - 0x0000 33 | 34 | 35 | ------------------------------------------------------------- 36 | Press any key to exit... 37 | -------------------------------------------------------------------------------- /tests/json/expected/vehicle_data_and_term_identity.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B005F00010001BB54000100040000D90F0101031900613233343536373839303132333435366239300000A05B0000013500D2040000C66132333435363738393031323334626332333435363738393031323334356400106532333435363738393031323334669826 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 95 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xBB 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x2698 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 84 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 3 (EGTS_SR_VEHICLE_DATA) 57 | Subrecord Length - 25 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/expected/vehicle_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts_protocol\tests\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002700010001C01C000100040000D90F0101031900613233343536373839303132333435366239300000A05B0000F00B 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 39 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xC0 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0x0BF0 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 28 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD90000 (05.06.2018 07:25:52 GMT) 49 | Source Service Type - 1 (EGTS_AUTH_SERVICE) 50 | Recipient Service Type - 1 (EGTS_AUTH_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 165 (Unknown service subrecord type) 55 | 56 | Subrecord Type - 3 (EGTS_SR_VEHICLE_DATA) 57 | Subrecord Length - 25 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/generated/clear.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | CWD = os.getcwd() 5 | 6 | 7 | def clear(): 8 | for the_file in os.listdir(CWD): 9 | file_path = os.path.join(CWD, the_file) 10 | if (os.path.isfile(file_path) and 11 | not the_file == 'clear.py' and 12 | (the_file[-4:] == '.txt' or the_file == 'tmp_msg.bin')): 13 | os.unlink(file_path) 14 | 15 | 16 | if __name__ == '__main__': 17 | clear() 18 | print 'directory cleared successfully!' 19 | 20 | -------------------------------------------------------------------------------- /tests/json/generated/pos_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts-python\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B0045000100016E3A000100042024D90F0202101A002124D90F4D729A483DA387DAD158822C050607050D0102039CFF101A002124D90F4D729A483DA387DAD159822C050607050D0102039CFFABD7 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 69 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0x6E 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xD7AB 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 58 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD92420 (05.06.2018 10:00:00 GMT) 49 | Source Service Type - 2 (EGTS_TELEDATA_SERVICE) 50 | Recipient Service Type - 2 (EGTS_TELEDATA_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 150 (Unknown service) 55 | 56 | Subrecord Type - 16 (unspecified) 57 | Subrecord Length - 26 58 | 59 | 60 | ------------------------------------------------------------- 61 | Press any key to exit... 62 | -------------------------------------------------------------------------------- /tests/json/generated/tmp_msg.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanchez486/egts-python/d553dfb2e58a17366c13e57c4c1b16a387111df7/tests/json/generated/tmp_msg.bin -------------------------------------------------------------------------------- /tests/json/generated/track_data_simple.txt: -------------------------------------------------------------------------------- 1 | EGTS protocol validator v.1.0 Copyright JSC "Navigation-information systems", 2011 2 | ------------------------------------------------------------------------------------ 3 | File: 'D:\PycharmProjects\egts-python\tests\json\generated\tmp_msg.bin' 4 | Packet data: 5 | 0100000B002B00010001E120000100042024D90F0A0A3E1D00022124D90FEA0000000000000000000064CB4D729A483DA387DAE80378C7C3 6 | 7 | 8 | EGTS Transport Layer: 9 | --------------------- 10 | Validating result - 0 (OK) 11 | 12 | Protocol Version - 1 13 | Security Key ID - 0 14 | Flags - 00000000b (0x00) 15 | Prefix - 00 16 | Route - 0 17 | Encryption Alg - 00 18 | Compression - 0 19 | Priority - 00 (the highest) 20 | Header Length - 11 21 | Header Encoding - 0 22 | Frame Data Length - 43 23 | Packet ID - 1 24 | No route info - 25 | Header Check Sum - 0xE1 26 | 27 | EGTS Service Layer: 28 | --------------------- 29 | Validating result - 0 (OK) 30 | 31 | Packet Type - EGTS_PT_APPDATA 32 | Service Layer CS - 0xC3C7 33 | 34 | Service Layer Record: 35 | --------------------- 36 | Validating Result - 0 (OK) 37 | 38 | Record Length - 32 39 | Record Number - 1 40 | Record flags - 00000100b (0x04) 41 | Sourse Service On Device - 0 42 | Recipient Service On Device - 0 43 | Group Flag - 0 44 | Record Processing Priority - 00 (the highest) 45 | Time Field Exists - 1 46 | Event ID Field Exists - 0 47 | Object ID Field Exists - 0 48 | Time - 0x0FD92420 (05.06.2018 10:00:00 GMT) 49 | Source Service Type - 10 (EGTS_ECALL_SERVICE) 50 | Recipient Service Type - 10 (EGTS_ECALL_SERVICE) 51 | 52 | Subrecord Data: 53 | ------------------ 54 | Validating Result - 0 (OK) 55 | 56 | Subrecord Type - 62 (EGTS_SR_ECALL_TRACK_DATA) 57 | Subrecord Length - 29 58 | Structures Amount - 2 59 | Absolute Time - 0x0FD92421 (05.06.2018 10:00:01.000 GMT) 60 | Track Points Data Structures: 61 | ----------------------------- 62 | 1 63 | Relative Time - [1000 ms] (05.06.2018 10:00:02.000 GMT) 64 | Point Data Exist - 1 65 | Long. Hemisphere - 1 66 | Lat. Hemisphere - 1 67 | LAT - 0x00000000 (N0.00000000) 68 | LON - 0x00000000 (W0.00000000) 69 | SPEED - 0 (0.00 kmph) 70 | DIR - 100 71 | ------------------ 72 | 2 73 | Relative Time - [1100 ms] (05.06.2018 10:00:03.100 GMT) 74 | Point Data Exist - 1 75 | Long. Hemisphere - 1 76 | Lat. Hemisphere - 0 77 | LAT - 0x489A724D (S25.52459998) 78 | LON - 0xDA87A33D (W153.65378997) 79 | SPEED - 1000 (10.00 kmph) 80 | DIR - 120 81 | ------------------ 82 | 83 | 84 | ------------------------------------------------------------- 85 | Press any key to exit... 86 | -------------------------------------------------------------------------------- /tests/json/tmp_a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sanchez486/egts-python/d553dfb2e58a17366c13e57c4c1b16a387111df7/tests/json/tmp_a.bin -------------------------------------------------------------------------------- /tests/test_json.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | import win32com.client 4 | import pytest 5 | from egts.interface import egts 6 | 7 | 8 | CWD = os.getcwd() + '\\' 9 | VALIDATOR_FILENAME = 'EGTS_validator_x64.exe' 10 | VALIDATOR_PATH = '{}json\\{}'.format(CWD, VALIDATOR_FILENAME) 11 | 12 | 13 | TEST_NAMES = [ 14 | 'pos_data_simple', 15 | 'track_data_simple', 16 | """" 'track_data_simple', 17 | 'ad_sensors_data_simple', 18 | 'passengers_counters_simple', 19 | 'loopin_data_simple', 20 | 'abs_an_sens_data_simple', 21 | 'abs_cntr_data_simple', 22 | 'abs_dig_sens_data_simple', 23 | 'abs_loopin_data_simple', 24 | 'ext_pos_data_simple', 25 | 'pos_data_simple', 26 | 'liquid_level_sensor_simple', 27 | 'record_response_simple', 28 | 'state_data_simple', 29 | 'accel_data_simple', 30 | 'accel_data_max_size', 31 | 'auth_info_simple', 32 | 'auth_params_max_size', 33 | 'auth_params_no_optional', 34 | # VALIDATOR CRASH: 'command_data_max_size_com', 35 | # VALIDATOR CRASH: 'command_data_max_size_conf', 36 | 'command_data_simple_com', 37 | 'command_data_simple_conf', 38 | 'counters_data_simple', 39 | 'module_data_simple', 40 | 'raw_msd_data_max_length', 41 | 'raw_msd_data_simple', 42 | 'result_code_simple', 43 | 'service_full_data_max_size', 44 | 'service_full_data_simple', 45 | 'service_info_simple', 46 | 'service_part_data_max_size', 47 | 'service_part_data_simple', 48 | 'term_identity_all_optional', 49 | 'term_identity_max_size', 50 | 'term_identity_no_optional', 51 | 'term_identity_simple', 52 | 'track_data_and_accel_data', 53 | 'track_data_empty', 54 | 'track_data_max_size', 55 | 'transport', 56 | 'vehicle_data_and_term_identity', 57 | 'vehicle_data_simple', """ 58 | ] 59 | 60 | 61 | @pytest.mark.parametrize("test_name", TEST_NAMES) 62 | def test_json(test_name): 63 | def wait(tm): 64 | time.sleep(tm/10.) 65 | 66 | # Write Test Message File 67 | msg = egts.EGTS() 68 | json_path = '{}json\\data\\{}.json'.format(CWD, test_name) 69 | msg.load_json(json_path) 70 | msg_path = '{}json\\generated\\tmp_msg.bin'.format(CWD) 71 | msg.write(msg_path) 72 | 73 | 74 | # Generate Validator Output 75 | result_path = '{}json\\generated\\{}.txt'.format(CWD, test_name) 76 | shell = win32com.client.Dispatch('WScript.Shell') 77 | shell.Run('cmd /C ' + VALIDATOR_PATH + ' -f:' + msg_path + ' > ' + result_path) 78 | wait(1) 79 | shell.SendKeys("{Enter}", 0) 80 | wait(1) 81 | 82 | # Compare output with expected 83 | expected_path = '{}json\\expected\\{}.txt'.format(CWD, test_name) 84 | if os.path.isfile(expected_path): 85 | result = open(result_path, 'r') 86 | 87 | expected = open(expected_path, 'r') 88 | assert result.readlines()[3:] == expected.readlines()[3:] 89 | else: 90 | raise NotImplementedError('{} do not have any expected output!'.format(test_name)) 91 | --------------------------------------------------------------------------------