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

Update file README.md

parent 8b33c737
No related branches found
No related tags found
No related merge requests found
Pipeline #314278 passed
### General
The latest version of the demo consists mainly of three communication partners: demo2_dzwald.py, demo2_forestmanager.py (which represents the Dienstleister) and demo2_forestmanager_waldbesitzer.py (which as the name implies represents the forest owner).
demo2_dzwald.py uses the S3IBServer Component from broker_api.py to expose an underlying AAS through the AAS-Interface.
......@@ -95,6 +97,46 @@ event: model.BasicEventElement = await client.getValue(dzwald_id, dzwald_endpoin
/submodel/submodelElements/Auftragsstatus_Updated")
auftragsstatus_updated = await client.awaitEvent(event.message_topic)
```
### Operations
Operation Submodelelements can be thought of operation descriptions. The actual callable/invokable is added to the S3IBServer (alongside the operation path for authorization purposes):
```
getHolzpreisbereich_op = model.Operation(
id_short="getHolzpreisbereich",
input_variable=[model.OperationVariable(model.Property(
id_short="HolzlisteId",
value_type=model.datatypes.String
))]
)
holzliste.add_referable(getHolzpreisbereich_op)
...
def getHolzpreisbereich(provider: api.ModelProvider, HolzlisteId: str):
...
return reply
...
callable = lambda **kwargs : getHolzpreisbereich(provider, **kwargs)
operation_path = f"/aas/submodels/{helpers.encode_id(HolzlisteId)}/submodel/submodelElements/getHolzpreisbereich"
server.add_callable(operation_path, callable)
```
Invoke the Operation using S3IBAsyncClient's invokeOperation method:
```
HolzlisteId = "https://www.company.com/holzliste/1"
reply4 = await client.invokeOperation(
dzwald_id,
dzwald_endpoint,
f"/aas/submodels/{helpers.encode_id(HolzlisteId)}/submodel/submodelElements/getHolzpreisbereich",
{"HolzlisteId": HolzlisteId}
)
print(f"result of operation 'getHolzpreisbereich': {reply4}")
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment