Communicate with the embody device over a serial port
Project description
Embody Serial
Features
- Connects to an EmBody device over the serial port
- Uses the EmBody protocol to communicate with the device
- Integrates with the EmBody Protocol Codec project
- Asynchronous send without having to wait for response
- Synchronous send where response message is returned
- Send facade for protocol agnostic communication with device
- Provides callback interfaces for incoming messages, response messages and connect/disconnect
- All methods and callbacks are threadsafe
- Separate threads for send, receive and callback processing
- Type safe code using mypy for type checking
Requirements
- Python 3.9
- Access to private Aidee Health repositories on Github
Installation
You can install Embody Serial via pip:
$ pip install embody-serial
This adds embody-serial
as a library, but also provides the CLI application with the same name.
Usage
A very basic example where you send a message request and get a response:
from embodyserial.embodyserial import EmbodySerial
from embodyserial.helpers import EmbodySendHelper
embody_serial = EmbodySerial()
send_helper = EmbodySendHelper(sender=embody_serial)
print(f"Serial no: {send_helper.get_serial_no()}")
embody_serial.shutdown()
If you want to see more of what happens under the hood, activate debug logging before setting up EmbodySerial
:
import logging
logging.basicConfig(level=logging.DEBUG)
Using the application from the command line
The application also provides a CLI application that is automatically added to the path when installing via pip.
Once installed with pip, type:
embody-serial --help
To see which options are available.
Note The serial port is automatically detected, but can be overridden by using the
--device
option.
Example - List all attribute values
embody-serial --get-all
Example - Get serial no of device
embody-serial --get serialno
Example - List files over serial port
embody-serial --list-files
Example - Set time current time (UTC)
embody-serial --set-time
Example - Download files
embody-serial --download-files
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for embody_serial-1.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e62764d039a8b01ffe75fb80d22e7cb42b9bb9ac4183ec8b136f237f2875a93e |
|
MD5 | b8913faeed4c8639b651bfb4fc79b445 |
|
BLAKE2b-256 | 1f30af6a0ddd0b47eec594e1fcab91b09c55ab3fee07001470f2b6875e05ede1 |