A python library to run commands on a device via serial port
Project description
Serial Device Handler
Execute commands on a device via serial port.
Installing
Install using pip
pip install serialdevicehandler
or install it from PyPi
Example
from serialdevicehandler import *
device = serialdevicehandler(port="COM10", baudrate="115200")
output = device.execute("help")
print(output)
SerialDeviceHandler()
SerialDeviceHandler()
is the core class within the library.
Syntax:
device = SerialDeviceHandler(port, baudrate, timeout)
argument | description | expected type | default value |
---|---|---|---|
port |
Specifies the device port | str |
COM1 |
baudrate |
Specifies the device baudrate | str |
9600 |
timeout |
Specifies the command timeout | int |
0.2s |
There are some attributes for statistical and other purposes.
attribute | description | expected type | default value |
---|---|---|---|
is_open |
Indicates whether the serial port is open | bool |
False |
eol_delimiter |
defines the end-of-line separator for line reading | str |
\n |
total_rx |
stores the total bytes received | int |
0 |
total_tx |
stores the total bytes transmitted | int |
0 |
SerialDeviceHandler.execute()
Use the execute()
function to run a command.
Syntax:
device.execute(command, <optional arguments>)
argument | description | expected type | default value |
---|---|---|---|
command |
Defines the command to be executed | str |
n/a |
stdout |
Live output while the command is running | bool |
False |
read_only |
read only execution | bool | False |
write_only |
write only execution | bool | False |
Summary
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
Close
Hashes for serialdevicehandler-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1970f10fdfd31c54199cb4398448c0ac30f5e7ba5086fb07d7f4287f477c82f |
|
MD5 | 8b57a127046d3a005894c75c73cf1300 |
|
BLAKE2b-256 | 25b97405180fd590b9a7112c1799ffbb042b753b06ae1a34db67a2a4e01c6a04 |
Close
Hashes for serialdevicehandler-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c614a26f639b9a9499aa7f1541bee965a9f7691caeb0c3368115a344e910b2eb |
|
MD5 | 90d69350513370a8d8430aa3ac56cd66 |
|
BLAKE2b-256 | 921b96544c6cd5738b17570233d295101c51474a8885c56a3f9a0deabb659c83 |