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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file serialdevicehandler-1.0.1.tar.gz.

File metadata

  • Download URL: serialdevicehandler-1.0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for serialdevicehandler-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b1970f10fdfd31c54199cb4398448c0ac30f5e7ba5086fb07d7f4287f477c82f
MD5 8b57a127046d3a005894c75c73cf1300
BLAKE2b-256 25b97405180fd590b9a7112c1799ffbb042b753b06ae1a34db67a2a4e01c6a04

See more details on using hashes here.

File details

Details for the file serialdevicehandler-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for serialdevicehandler-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c614a26f639b9a9499aa7f1541bee965a9f7691caeb0c3368115a344e910b2eb
MD5 90d69350513370a8d8430aa3ac56cd66
BLAKE2b-256 921b96544c6cd5738b17570233d295101c51474a8885c56a3f9a0deabb659c83

See more details on using hashes here.

Supported by

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