Closed Little-Cat closed 1 year ago
Hi @Little-Cat... I'd need a bit more details... I guess you are having a DB with a custom data type and you want to read the values of arrays inside that one using the Web-API?
Thanks. Yes. You are right. I need read and write data from array with custom data type. { String name; Byte id; String value } as examle. I can get Browse variables over WebApi but i don`t know how I can read it. Sorry for my English.
All right and this part of the readme does not help you with that?
https://github.com/siemens/simatic-s7-webserver-api#plcprogram-browse-read-and-write
If you can browse the variable you should be able to read the sub-values just the same way let's say there's a custom datatype "cumstomudt" called "myudt" inside a DB called "mydb" it contains a bool called "bool" and an array[0..1] of byte called "arr" Now you should be able to read the sub-values like the following: await requestHandler.PlcProgramRead
All right? You could also try using the plcprogramhandler but the readstructvychildvalues might not be working for the array ...
Yes. It is true. I can read separate variables from each array. But i need read all 50 array variableas at one time. As i can read it in the modbus, for example "read(array, 50)" where array = Array.of(my UDT data type). For reading each variables separate i must create syntax for each variable. Too long.
I think I got you now. To be honest, right now what you want to do is afaik not fully supported by the Web-API, but you can try using the PlcProgramHandler, I tried making a first draft to read all the sub-values of an array via 1 bulk request and set the values accordingly. Of course you can also just build that bulk request and do the assignment accordingly (you'll have to save the request id to know which array element the response belongs to). Maybe you could try sending a request to read with raw for the array "head" but as I said - I'm not sure that's supported... if you absolutely want to have the data in one "big" encoded stream you might want to check wether you want to use OPC UA for that...
Thanks a lot
Sorry. How i can get array values from plc with my custom data type. I can`t create json request.