... | ... | @@ -32,7 +32,7 @@ While the Basyx part is written in Java, python scripts are used to access the R |
|
|
|
|
|
### IRfidReader
|
|
|
|
|
|
The file can be found here. The interface includes these methods:
|
|
|
The file can be found [here](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/src/main/java/de/olipar/basyx/lichterkette/IRfidReader.java). The interface includes these methods:
|
|
|
|
|
|
| Method | Purpose |
|
|
|
|-----|-----------|
|
... | ... | @@ -43,7 +43,7 @@ The file can be found here. The interface includes these methods: |
|
|
|
|
|
### RfidReader
|
|
|
|
|
|
The file can be found here. The class implements the interface `IRfidReader`.
|
|
|
The file can be found [here](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/src/main/java/de/olipar/basyx/lichterkette/RfidReader.java). The class implements the interface `IRfidReader`.
|
|
|
|
|
|
MQTT is used to start scripts accessing the RFID reader. The topic determins the python script that will be run.
|
|
|
|
... | ... | @@ -169,7 +169,7 @@ A MQTT client is initialized and the connection options set. [`RfidMqttCallback` |
|
|
|
|
|
### RfidController
|
|
|
|
|
|
The file can be found here.
|
|
|
The file can be found [here](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/src/main/java/de/olipar/basyx/lichterkette/RfidController.java).
|
|
|
|
|
|
```java
|
|
|
public static void main(String[] args) {
|
... | ... | @@ -191,7 +191,7 @@ The amount of RFID readers is retrieved from the environment variable. The amoun |
|
|
|
|
|
### RfidSubmodelProvider
|
|
|
|
|
|
The file can be found here.
|
|
|
The file can be found [here](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/src/main/java/de/olipar/basyx/lichterkette/RfidSubmodelProvider.java).
|
|
|
|
|
|
Like in the other submodel providers in the project a method for creating a submodel is defined and the operations are added. For reading a tag once or starting the loop simply the function calling the methods of the rfid reader and the operation need to be set.
|
|
|
|
... | ... | @@ -228,7 +228,7 @@ Because the `hostUploadAndRegister()` method is almost the same for all submodel |
|
|
|
|
|
### MqttRfidCallback
|
|
|
|
|
|
The file can be found here. The class implements `org.eclipse.paho.client.mqttv3.MqttCallback`. Especially overriding the method `messageArrived` is usefull to react to received MQTT messages.
|
|
|
The file can be found [here](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/src/main/java/de/olipar/basyx/lichterkette/RfidMqttCallback.java). The class implements `org.eclipse.paho.client.mqttv3.MqttCallback`. Especially overriding the method `messageArrived` is usefull to react to received MQTT messages.
|
|
|
|
|
|
```java
|
|
|
try{
|
... | ... | @@ -276,7 +276,7 @@ Using the `ConnectedAssetAdministrationShellManager`, the AAS of the display can |
|
|
|
|
|
### mqtt_handler_rfid.py
|
|
|
|
|
|
In this script, a paho MQTT client is implemented. Depending on the received message a corresponding python script for reading or writing a tag is run.
|
|
|
In [this script](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/resources/sensors/mqtt_handler_rfid.py), a paho MQTT client is implemented. Depending on the received message a corresponding python script for reading or writing a tag is run.
|
|
|
|
|
|
```python
|
|
|
brokerAddress = environ.get('MQTTBROKERHOST')
|
... | ... | @@ -354,7 +354,7 @@ A MQTT client is initialized and the previous functions are assigned as on_conne |
|
|
|
|
|
### read_rfid.py
|
|
|
|
|
|
The script can be found here. For using the RFID reader, `mfrc522` is used.
|
|
|
The script can be found [here](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/resources/sensors/read_rfid.py). For using the RFID reader, `mfrc522` is used.
|
|
|
|
|
|
```python
|
|
|
brokerAddress = environ.get('MQTTBROKERHOST')
|
... | ... | @@ -398,12 +398,12 @@ A dictionary containing the data is created and converted into a string. This st |
|
|
|
|
|
### read_rfid_loop.py
|
|
|
|
|
|
The script works like `read_rfid.py`. But instead of terminating after one tag was read, it runs in an infinit loop. Every time a chip is detected, the MQTT message is published. A 3 second delay is set to avoid instantly reading the same chip again.
|
|
|
[The script](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/resources/sensors/read_rfid_loop.py) works like `read_rfid.py`. But instead of terminating after one tag was read, it runs in an infinit loop. Every time a chip is detected, the MQTT message is published. A 3 second delay is set to avoid instantly reading the same chip again.
|
|
|
|
|
|
|
|
|
### write_rfid.py
|
|
|
|
|
|
The script can be found here. It works like `read_rfid.py` as well.
|
|
|
The script can be found [here](https://gitlab.hrz.tu-chemnitz.de/vws-demo/vws-spielwiese/-/blob/rfidReader/basyx.lichterkette/resources/sensors/write_rfid.py). It works like `read_rfid.py` as well.
|
|
|
|
|
|
```python
|
|
|
try:
|
... | ... | |