Skip to content
Snippets Groups Projects
Commit 8b33c737 authored by Ahmed Osman's avatar Ahmed Osman
Browse files

Update file README.md

parent c3d643cb
No related branches found
No related tags found
No related merge requests found
Pipeline #314275 passed
...@@ -63,6 +63,38 @@ Security-related data can be stored in the security submodel (refer to /model/se ...@@ -63,6 +63,38 @@ Security-related data can be stored in the security submodel (refer to /model/se
Since permission-granting decisions are made by the opa-server (if security enabled), this data must provided (in simpler format) to it and continiously updated (if changes occur). This is handled by the S3IBServer Component utilizing the security.py::get_dict_from_security_submodel method. Since permission-granting decisions are made by the opa-server (if security enabled), this data must provided (in simpler format) to it and continiously updated (if changes occur). This is handled by the S3IBServer Component utilizing the security.py::get_dict_from_security_submodel method.
### Events
Create server-side Events (S3IBServer expects events to be stored in a separate submodel with a fixed id).
In the following, any changes (received set-Requests) to Auftragsstatus cause an event message to be sent to topic123 (and all queues bound/subscribed to it):
```
events = model.Submodel(
id_="https://www.company.com/submodels/events",
id_short="Events"
)
event = model.BasicEventElement(
id_short="Auftragsstatus_Updated",
observed=model.ModelReference.from_referable(arbeitsauftrag.get_referable(configs.AUFTRAGSSTATUS)),
direction=model.Direction.OUTPUT,
state=model.StateOfEvent.ON,
message_topic="topic123"
)
events.add_referable(event)
```
On client-side events can be subscribed to and awaited using S3IBAsyncClient's awaitEvent method:
```
events_submodel_id = "https://www.company.com/submodels/events"
events_submodel_id_encoded = base64.urlsafe_b64encode(events_submodel_id.encode()).decode()
event: model.BasicEventElement = await client.getValue(dzwald_id, dzwald_endpoint,
f"/aas/submodels/{events_submodel_id_encoded} \
/submodel/submodelElements/Auftragsstatus_Updated")
auftragsstatus_updated = await client.awaitEvent(event.message_topic)
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment