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 or newer
- 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.
Troubleshooting
I get an error message saying 'no module named serial' or similar
This is a known issue and is usually caused by one of two things.
Ensure you haven't installed serial
or jserial
Embody-serial uses the pyserial
library. Run pip list
to see if either the serial
or jserial
library is installed. If they are, remove them with pip uninstall serial
.
Problems with pyserial
Sometimes, for whatever reason, it is necessary to re-install pyserial. Perform a pip uninstall pyserial
and then pip install pyserial
to see if this helps.
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
File details
Details for the file embody_serial-1.0.32.tar.gz
.
File metadata
- Download URL: embody_serial-1.0.32.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56c707494eb4b7d218e3106391a31f83c960b96d6751a561ed30a83d3aa21221 |
|
MD5 | cf05cf16d15a1b8aca2bb8eeefb16b11 |
|
BLAKE2b-256 | 102a82550537d520790e6bfd9498f1f4e32d7cfd46a7e9a2ee7bd14f0322f8bf |
File details
Details for the file embody_serial-1.0.32-py3-none-any.whl
.
File metadata
- Download URL: embody_serial-1.0.32-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b1aae8d6c4529883380980c38fc77652cd2e91c8c4d1214935fef78e0f14671 |
|
MD5 | 5ac5d2e39307d6a459c7461466d03687 |
|
BLAKE2b-256 | 18440604f793f4c75d58b52584384239f4f0e58d18e781f5792da3313bc34bfd |