![background image](http://html1.mh-extra.com/html/ifm/al1302/al1302_operating-instructions-manual_3915929045.webp)
IO-Link Master with PROFINET Interface DataLine 8 Ports IP 65 / IP 66 / IP 67
45
>
Example: Clone the Data Storage of an IO-Link port
52344
Task:
Save the Data Storage of IO-Link port X02 of IO-Link master 1 and restore the data at IO-Link
master 2.
Solution:
The cloning process consists of 2 steps. In the first step, the Data Storage of the IO-Link
port of IO-Link master 1 is saved. In the second step, the saved data is restored at the Data Storage of
port IO-Link port of IO-Link master 2.
Save Data Storage:
1 Preparations
►
Read size of segments of Data Storage (h = number of bytes):
{"code":"request", "cid": -1,"adr":"/iolinkmaster/port[2]/datastorage/chunksize/getdata"}
Example: h = 256
►
Read total size of Data Storage area (g = number of bytes):
{"code": "request", "cid": -1, "adr": "/iolinkmaster/port[2]/datastorage/size/getdata"}
Example: g = 550
►
Calcuate the number of reading steps n: n = first integer value to which the following applies: g < n*h
Example: n= 3, because 550 < 3*256
2 Read Data Storage of IO-Link port
►
Read Data Storage segment by segment ("pos" is the byte offset, at which the reading process with length "length"
starts).
{"code": "request", "cid": -1, "adr": "/iolinkmaster/port[2]/datastorage/getblobdata", "data": {"pos": 0, "length": h}}
{"code": "request", "cid": -1, "adr": "/iolinkmaster/port[2]/datastorage/getblobdata", "data": {"pos": h, "length": h}}
{"code": "request", "cid": -1, "adr": "/iolinkmaster/port[2]/datastorage/getblobdata", "data": {"pos": 2*h, "length": h}}
...
{"code": "request", "cid": -1, "adr": "/iolinkmaster/port[2]/datastorage/getblobdata", "data": {"pos": n*h, "length": h}}
Example:
1st read request: pos = 0, length = 256
2nd read resquest: pos = 256, length =256
3rd read request: pos = 512, length = 256
>
Each segment value will be returned as BASE64 coded string.
►
Join segments.
Restore Data Storage:
1 Preparations
►
Determine the size of the saved Data Storage value (n = number of bytes).
Example: n = 550
►
Read size of segments (s = number of bytes):
{"code":"request", "cid": -1,"adr":"/iolinkmaster/port[1]/datastorage/chunksize/getdata"}
Example: s = 256
2 Transfer Data Storage strings
►
Start transfer of Data Storage string ("size" = size of Data Storage string):
{"code":"request", "cid": -1, "adr":"/iolinkmaster/port[1]/datastorage/start_stream_set", "data": {"size": n}}
Example: size = 550
►
Transfer Data Storage string segment by segment ("value" = string value of length s):
{"code": "request", "cid": -1, "adr": "/iolinkmaster/port[1]/datastorage/stream_set", "data": {"value":
"aWZtfgIAAABBTDF4NXhfY25faXRfdDIuMi43Nw..."}