... | ... | @@ -25,20 +25,20 @@ The discussed file can be found [here](TODO) |
|
|
#define REGISTRY_RED 4
|
|
|
#define REGISTRY_GREEN 23
|
|
|
```
|
|
|
These Definitions link the GPIO ports of the ESP32 to readable names, according to their purpose. See [wiring up the demo](TODO) for more information.
|
|
|
These Definitions link the GPIO ports of the ESP32 to readable names, according to their purpose. See [wiring up the demo](setup/Wiring-of-the-demo) for more information.
|
|
|
|
|
|
```
|
|
|
#define RED_LED 4
|
|
|
#define GREEN_LED 2
|
|
|
```
|
|
|
Here, the GPIO pins used for the red and green LEDs attached to the ESP32 Dev Board are defined. If you were to diverge from the [default wiring of the demo](TODO), you'll need to adjust the GPIO numbers here.
|
|
|
Here, the GPIO pins used for the red and green LEDs attached to the ESP32 Dev Board are defined. If you were to diverge from the [default wiring of the demo](setup/Wiring-of-the-demo), you'll need to adjust the GPIO numbers here.
|
|
|
|
|
|
```
|
|
|
#include <ESPmDNS.h>
|
|
|
#include <HTTPClient.h>
|
|
|
```
|
|
|
Here we include the headers for both the HTTPClient library and the ESPmDNS, which both come as part of espressif's standard library for the ESP32.
|
|
|
ESPmDNS is used to resolve the local address of the [AAS Server](TODO) `aas-server.local` and the [registry](TODO) `registry.local`. HTTPClient is used to make requests to the REST API endpoints exposed by BaSyx.
|
|
|
ESPmDNS is used to resolve the local address of the [AAS Server](What-am-I-looking-at-here#aas-server) `aas-server.local` and the [registry](What-am-I-looking-at-here#registry) `registry.local`. HTTPClient is used to make requests to the REST API endpoints exposed by BaSyx.
|
|
|
The separate resolution is neccessary, as `HTTPClient` doesn't resolve them itself.
|
|
|
|
|
|
```c++
|
... | ... | @@ -187,7 +187,7 @@ ret = (http.GET() == 200); |
|
|
```
|
|
|
The beginning should look familiar by now, this time the endpoint of our request is
|
|
|
`http://aas-server.local:4000/aasServer/shells/urn:de.olipar.basyx:LightControllerAAS/aas/submodels/lightControllerSM/submodel/submodelElements/isActive/value`
|
|
|
It pays to play around with the endpoints in a browser a bit. If you use Firefox, the json will be nicely formatted out of the box and you'll soon find your way round them. If you get stuck, there's always the [official API specification](TODO) available.
|
|
|
It pays to play around with the endpoints in a browser a bit. If you use Firefox, the json will be nicely formatted out of the box and you'll soon find your way round them. If you get stuck, there's always the [official API specification](https://app.swaggerhub.com/apis/BaSyx/basyx_submodel_http_rest_api/v1) available.
|
|
|
Let's walk through this URL backwards:
|
|
|
We want to get the `value` of the Property `isActive`, which is an element of the sumbodel `lightControllerSM` of the AAS, which is known as `urn:de.olipar.basyx:LightControllerAAS`.
|
|
|
|
... | ... | |