The CrossLab SOA parameter Service.
Project description
This is the Parameter service to use as a Crosslab SOA service. It allows to transmit variouse numeric parameters / values between different devices.
Parameter Producer
service = ParameterService__Producer(
"position",
[
{"name": "x", "unit": "m", "minimum": -1.2, "maximum": 1.2},
{"name": "y", "unit": "m", "minimum": -1.2, "maximum": 1.2},
{"name": "z", "unit": "m", "minimum": 0, "maximum": 0.5},
],
)
deviceHandler.add_service(service)
When any parameter changes (or is initialized) the service inform the service via:
await service.updateParameter("x", 0.5)
Parameter Consumer
service = ParameterService__Consumer(
"position",
[
{"name": "x", "unit": "m"},
{"name": "y", "unit": "m"},
{"name": "z", "unit": "m", "minimum": 0, "maximum": 1},
{"name": "ANY", "unit": "ANY"},
],
)
deviceHandler.add_service(service)
The special name / unit “ANY” allows to receive any parameter. When a new parameter gets connected / disconnect the service will emit the following callback:
def parameterListChanged(event: ParameterListChangedEvent):
print(event)
# event.parameters is a list of all parameters
service.on("parameterListChanged", parameterListChanged)
When a parameter changes the service will emit the following callback:
def parameterChanged(event: ParameterChangedEvent):
print(event)
# event.parameter is the changed parameter
service.on("parameterChanged", parameterChanged)
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
File details
Details for the file crosslab_soa_service_parameter-0.2.8.tar.gz
.
File metadata
- Download URL: crosslab_soa_service_parameter-0.2.8.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b1941518d17818935ec4214d02c79ae2bd61c184ec445b698b5597aec53f668 |
|
MD5 | 081b53874e24e2fbc4e422eb5c8594c3 |
|
BLAKE2b-256 | 57954dd52054d2ba257398a3c28c1420ab7ee37ad2845a747bfbc2b153bc1b7e |