Skip to main content

A python library to run commands on a device via serial port

Project description

Serial Device Handler

PyPi version Github Issues

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

serialdevicehandler-1.0.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

serialdevicehandler-1.0.1-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page