Library for classes and functions that are used for the development of drivers integrated into Device Hub.
Project description
Usage
Create a device driver by inheriting from the Device class and using decorators:
from lab_device_sdk.device import Device
from lab_device_sdk.decorators import command, settings, float_in, int_in, string_in, string_out
class MyDevice(Device):
device_type_id = "my-device-001"
manufacturer = "My Company"
model = "Model X"
def __init__(self, device_id: str, configuration: str | None = None):
super().__init__(device_id, configuration)
@settings()
@string_in("Host", "localhost", "Device host address")
@string_in("Port", "8080", "Device port")
@int_in("Timeout (sec)", 30, "Connection timeout")
async def connect(self, host: str, port: str):
# Connection logic here
pass
@command("Get Status", "Get device status")
@string_out("Status")
async def get_status(self) -> str:
return "OK"
@command("Set Temperature", "Set device temperature")
@float_in("Temperature (C)", 25.0, "Device temperature")
async def set_temperature(self, temperature: float):
pass
@command("Reset", "Reset the device")
async def reset(self):
pass
@command("Set Mode", "Set device mode")
@string_in("Mode", "Normal", "Device mode", options=["Normal", "Safe", "Test"], constrain_to_options=True)
async def set_mode(self, mode: str):
pass
Development
This project has a dev container. If you already have VS Code and Docker installed, you can click the badge above or here to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
To publish a new version of the repository, you can run the Publish workflow manually and publish to the staging registry from any branch, and you can check the 'Publish to Primary' option when on main to publish to the primary registry and create a git tag.
Updating from the template
This repository uses a copier template. To pull in the latest updates from the template, use the command:
copier update --trust --conflict rej --defaults
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lab_device_sdk-0.1.5.tar.gz.
File metadata
- Download URL: lab_device_sdk-0.1.5.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7b19a1bf1f7addf43d67866f1fb9a887d7af71715b21b6426c75ca2b3996167
|
|
| MD5 |
3225eb88138f458ed7f3d8fddb498df8
|
|
| BLAKE2b-256 |
5d5efd6ef2bb1382a71f10d5e472afb9e16e2da5faf32550c6fa8e4719f50de3
|
File details
Details for the file lab_device_sdk-0.1.5-py3-none-any.whl.
File metadata
- Download URL: lab_device_sdk-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f4d77c9f7fc1913f12de28d3328636941e235ccc365f22a194350d6cd51e7a6
|
|
| MD5 |
54c349e71e684849daba42793cb8f6dc
|
|
| BLAKE2b-256 |
3d4a949467de459b65c446555e89c2dc5a27083ed63fdc5e2282e496ab5ead3b
|