# Serial Device Handler
[![PyPi version][shields-pypi_version]][url-pypi_version]
[![Github Issues][shields-issues]][url-issues]
Execute commands on a device via serial port.
<br>
## Installing
Install using <a href="https://pip.pypa.io/en/stable/">pip</a>
```bash
pip install serialdevicehandler
```
or install it from <a href="https://pypi.org/project/serialdevicehandler/#files">PyPi</a>
<br>
## Example
```python
from serialdevicehandler import *
device = serialdevicehandler(port="COM10", baudrate="115200")
output = device.execute("help")
print(output)
```
<br>
## SerialDeviceHandler()
`SerialDeviceHandler()` is the core class within the library.
Syntax:
```python
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 |
<br>
### SerialDeviceHandler.execute()
Use the `execute()` function to run a command.
Syntax:
```python
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
<br>
## Summary
- <a href="https://github.com/Salliii/conlay#serialdevicehandler">SerialDeviceHandler()</a>
- <a href="https://github.com/Salliii/conlay#serialdevicehandlerexecute">_execute()_</a>
<!-- shields -->
[shields-pypi_version]: https://img.shields.io/pypi/v/serialdevicehandler?label=PyPi%20Version&style=for-the-badge
[shields-issues]: https://img.shields.io/github/issues/Salliii/serialdevicehandler?style=for-the-badge
<!-- url -->
[url-pypi_version]: https://pypi.org/project/serialdevicehandler/
[url-issues]: https://github.com/Salliii/serialdevicehandler/issues
Raw data
{
"_id": null,
"home_page": "https://github.com/Salliii/serialdevicehandler",
"name": "serialdevicehandler",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,library,serial device,serial interface,commands,execute",
"author": "Salliii",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/25/b9/7405180fd590b9a7112c1799ffbb042b753b06ae1a34db67a2a4e01c6a04/serialdevicehandler-1.0.1.tar.gz",
"platform": null,
"description": "# Serial Device Handler\r\n[![PyPi version][shields-pypi_version]][url-pypi_version]\r\n[![Github Issues][shields-issues]][url-issues]\r\n\r\nExecute commands on a device via serial port.\r\n\r\n\r\n<br>\r\n\r\n\r\n## Installing\r\nInstall using <a href=\"https://pip.pypa.io/en/stable/\">pip</a>\r\n\r\n```bash\r\npip install serialdevicehandler\r\n```\r\n\r\nor install it from <a href=\"https://pypi.org/project/serialdevicehandler/#files\">PyPi</a>\r\n\r\n\r\n<br>\r\n\r\n\r\n## Example\r\n```python\r\nfrom serialdevicehandler import *\r\n\r\ndevice = serialdevicehandler(port=\"COM10\", baudrate=\"115200\")\r\n\r\noutput = device.execute(\"help\")\r\n\r\nprint(output)\r\n```\r\n\r\n\r\n<br>\r\n\r\n\r\n## SerialDeviceHandler()\r\n`SerialDeviceHandler()` is the core class within the library.\r\n\r\nSyntax:\r\n\r\n```python\r\ndevice = SerialDeviceHandler(port, baudrate, timeout)\r\n```\r\n\r\n| argument | description | expected type | default value |\r\n| :------- | :---------- | :------------ | :------------ |\r\n| `port` | Specifies the device port | `str` | COM1 |\r\n| `baudrate` | Specifies the device baudrate | `str` | 9600 |\r\n| `timeout` | Specifies the command timeout | `int` | 0.2s |\r\n\r\nThere are some attributes for statistical and other purposes.\r\n\r\n| attribute | description | expected type | default value |\r\n| :-------- | :---------- | :------------ | :------------ |\r\n| `is_open` | Indicates whether the serial port is open | `bool` | False |\r\n| `eol_delimiter` | defines the end-of-line separator for line reading | `str` | \\n |\r\n| `total_rx` | stores the total bytes received | `int` | 0 |\r\n| `total_tx` | stores the total bytes transmitted | `int` | 0 |\r\n\r\n\r\n<br>\r\n\r\n\r\n### SerialDeviceHandler.execute()\r\nUse the `execute()` function to run a command.\r\n\r\nSyntax:\r\n\r\n```python\r\ndevice.execute(command, <optional arguments>)\r\n```\r\n\r\n| argument | description | expected type | default value |\r\n| :------- | :---------- | :------------ | :------------ |\r\n| `command` | Defines the command to be executed | `str` | n/a |\r\n| `stdout` | Live output while the command is running | `bool` | False |\r\n| `read_only` | read only execution | bool | False\r\n| `write_only` | write only execution | bool | False\r\n\r\n\r\n<br>\r\n\r\n\r\n## Summary\r\n\r\n- <a href=\"https://github.com/Salliii/conlay#serialdevicehandler\">SerialDeviceHandler()</a>\r\n - <a href=\"https://github.com/Salliii/conlay#serialdevicehandlerexecute\">_execute()_</a>\r\n\r\n\r\n\r\n\r\n<!-- shields -->\r\n[shields-pypi_version]: https://img.shields.io/pypi/v/serialdevicehandler?label=PyPi%20Version&style=for-the-badge\r\n[shields-issues]: https://img.shields.io/github/issues/Salliii/serialdevicehandler?style=for-the-badge\r\n\r\n<!-- url -->\r\n[url-pypi_version]: https://pypi.org/project/serialdevicehandler/\r\n[url-issues]: https://github.com/Salliii/serialdevicehandler/issues\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A python library to run commands on a device via serial port",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/Salliii/serialdevicehandler"
},
"split_keywords": [
"python",
"library",
"serial device",
"serial interface",
"commands",
"execute"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "921b96544c6cd5738b17570233d295101c51474a8885c56a3f9a0deabb659c83",
"md5": "90d69350513370a8d8430aa3ac56cd66",
"sha256": "c614a26f639b9a9499aa7f1541bee965a9f7691caeb0c3368115a344e910b2eb"
},
"downloads": -1,
"filename": "serialdevicehandler-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "90d69350513370a8d8430aa3ac56cd66",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3715,
"upload_time": "2023-06-29T07:41:33",
"upload_time_iso_8601": "2023-06-29T07:41:33.075238Z",
"url": "https://files.pythonhosted.org/packages/92/1b/96544c6cd5738b17570233d295101c51474a8885c56a3f9a0deabb659c83/serialdevicehandler-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "25b97405180fd590b9a7112c1799ffbb042b753b06ae1a34db67a2a4e01c6a04",
"md5": "8b57a127046d3a005894c75c73cf1300",
"sha256": "b1970f10fdfd31c54199cb4398448c0ac30f5e7ba5086fb07d7f4287f477c82f"
},
"downloads": -1,
"filename": "serialdevicehandler-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "8b57a127046d3a005894c75c73cf1300",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3443,
"upload_time": "2023-06-29T07:41:34",
"upload_time_iso_8601": "2023-06-29T07:41:34.848631Z",
"url": "https://files.pythonhosted.org/packages/25/b9/7405180fd590b9a7112c1799ffbb042b753b06ae1a34db67a2a4e01c6a04/serialdevicehandler-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-29 07:41:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Salliii",
"github_project": "serialdevicehandler",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "serialdevicehandler"
}