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 |
Windows: COM1 Linux: /dev/tty |
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 |
---|---|---|
is_open |
Indicates whether the serial port is open | bool |
eol_delimiter |
defines the end-of-line separator for line reading | int |
total_rx |
stores the total bytes received | int |
total_tx |
stores the total bytes transmitted | int |
SerialDeviceHandler.execute()
Use the execute()
function to run a command.
Syntax:
device.execute(command, pseudo, stdout)
argument | description | expected type | default value |
---|---|---|---|
command |
Defines the command to be executed | str |
n/a |
pseudo |
Execute as a pseudo command. No command is executed. Use it to capture bootups, etc. | bool |
False |
stdout |
Live output while the command is running | 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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80decaee1490b6d71e293e80a5d346e350fbc56fd2bff7aef12960de3f33a151 |
|
MD5 | 092f9ab6f4f3f0a90532e0a2b9470539 |
|
BLAKE2b-256 | cf0f81ac89807543bd4f47d1a319c9e93362b7551904f9b5c221bda10f907184 |
Close
Hashes for serialdevicehandler-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47f80b26555e56459b56e8cd10cd4ed37c7c1c7ed4fb1e3b08ea50ab22bf25ef |
|
MD5 | 37e78dba242faa68dda947e8dce404a4 |
|
BLAKE2b-256 | e0f95c307ecd1e8883baf33f4dcf021d2d14c3316adbbf2878a6ced0949f03f1 |