Skip to main content

A library to decode and encode data packet for Aceinna Devices

Usage

A simple example to decode and encode the data packet for INS502 device.

from acenav_api import create_parser

parser = create_parser('IN502')
decode_payload = parser.decode('S2', bytes([0x0,0x1,0x2])) # return a dict object
binary_bytes = parser.encode('S2', [1,2,3]) # return as bytes

It also supports to pass a configuration file to the parser, the configuration file contains payload definition and the parser will generate the parser based on the configuration file.

from acenav_api import create_parser

parser = create_parser('IN502-custom', 'path/to/config.json')
# support custom packet type
decode_payload = parser.decode('S2', bytes([0x0,0x1,0x2])) # return a dict object
binary_bytes = parser.encode('S2',[0,1,2]) # return as bytes

A examle to use the library to communicate with the device. It includes command builder, data parser.

# Generate Command Builder
command_builder = create_command_builder('INS502')
# Generate Command Request Bytes
command_bytes = command_builder.create('uB', [
    {'paramId':1, 'value':1},
    {'paramId':2, 'value':2},
])

# Prepare serial_port or ethernet_port as communicator, then send request bytes
communicator.write(command_bytes)
# Read Response Bytes
read_bytes = communicator.read()
packet_bytes = fetch_last_packet(read_bytes, 'uB')

# Generate Data Parser
parser = create_parser('INS502')
# Decode Response as a dict
update_result = parser.decode('uB', packet_bytes)

How it work

The libary predefined configurations for each device, the configuration file is a json file that contains the payload definition for each packet type. It will decode or encode the data based on the configuration file.

User also could pass a custom configuration file to the parser to generate the parser. It is allowed to update the payload definition in the configuration file. It could be useful if the output format is modified or the payload is changed.

Supported Data Types

Outputs

uint8, int8, uint16, int16, uint32, int32, uint64, int64, float, double, string

Command

  1. Includes data types in Outputs
  2. output_array,output_update_array, update_result_array,parameter_array,uint8_array

Extend Data Types

output_array

Packet Odr display array. It is used in lO command response.

Field Type Description
packet_type string Packet Type
interface_type int Interface Type

output_update_array

Packet Odr update array. It is used in sO command request.

Field Type Description
packet_type string Packet Type
interface_type int Interface Type
odr int Odr

parameter_array

Parameter display array. It used in gB and uB command request.

Field Type Description
param_id int Param Id
value int Value

update_result_array

Update result array. It used in uB command response.

Field Type Description
param_id int Param Id
result int Result

Metadata

Release files for acenav-api 1.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for acenav-api 1.0.16
File Size Uploaded Provenance Actions
acenav_api-1.0.16.tar.gz 25.5 kB Without provenance Details for acenav_api-1.0.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for acenav-api 1.0.16
File Interpreter ABI Platform Actions
acenav_api-1.0.16-py3-none-any.whl Python 3 none any Details for acenav_api-1.0.16-py3-none-any.whl

Total release size: 51.5 kB

Release files / acenav_api-1.0.16.tar.gz

Download URL acenav_api-1.0.16.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ee492a9c7b5ba82ced86deabaf445d6474fc8829897eb34b6d68e9d028d291b9
BLAKE2b-256 checksum
How to use checksums
2a824bf1acc099c3cdd9edab5f12af90dbc9d0227f8516ef33e6fb3c723e2030
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.9

Release files / acenav_api-1.0.16-py3-none-any.whl

Download URL acenav_api-1.0.16-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9684cc46e77be61345f9c2dcfe28cbfcc6e04044e0873cd7c5027d084a3168ca
BLAKE2b-256 checksum
How to use checksums
66f1ae3400ba24d78a0b77fe00e479cd09dc6fb345411f7660a86ee3059ea3d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.9

Security for acenav-api 1.0.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page