IO-Link master with EtherCAT interface DataLine 4 ports IP 65 / IP 66 / IP 67
62
Example: Subscribing to notifications in CSV format
61162
Task
: Every 2 seconds, the current values of the following parameters are to be sent to a network
server with the IP address 192.168.0.4
•
cyclic IO-Link input data of the IO-Link device at port X02
•
Operating temperature of the IO-Link master.
The data should be transmitted in CSV format (comma separator).
Solution:
► Use the subscribe service to subscribe to the required data and set the output format to "csv0".
Data in CSV format can only be sent via TCP protocol.
•
Request:
{
"cid": 1,
"adr":"/timer[1]/counter/datachanged/subscribe",
"code":"request",
"callback":"tcp://192.168.50.59:1883/topic",
"codec":"csv0",
"data":{
"datatosend":[
"/iolinkmaster/port[2]/iolinkdevice/pdin",
"/processdatamaster/temperature"]}
}
► Set the interval of the timer to 2 seconds:
•
Request:
{
"code":"request",
"cid":4712,
"adr":"/timer[1]/interval/setdata",
"data":{"newvalue":2000}
}
The cyclically sent notification has the following structure:
/timer[1]/counter/datachanged,6317,200,1,200,39,200,03B0
>
Example: Unsubscribing from notifications
61163
Task:
The existing subscription (
Example: Subscribing to notifications
(
)) is to be deleted.
Solution:
Use the unsubscribe service to delete the subscription. For this purpose, the value of the
parameter "callback" in the request must be equal to the value of the existing subscription.
{
"code":"request",
"cid":4711,
"adr":"/timer[1]/counter/datachanged/unsubscribe",
"data":{
"callback":"http://192.168.0.4:80/temp"
}
>