Closed kvid closed 2 years ago
As you mentioned, the communication is rather tightly coupled with the packaging concept. The main use case for the library is exchanging fixed size packages holding Integers and Reals. Strings are supported, but string processing during simulation sometimes had issues in Modelica tools (might have improved, not used that feature in more recent times). Unfortunately, I don't have a good suggestion for your use case with what is available in MDD and since nobody else jumped in, I will close this issue.
I've tried
Modelica_DeviceDrivers.Blocks.Communication.TCPIP_Client_IO
in OMEdit to access an existing remote service that has a telnet-like protocol where both the request and the response are ASCII/ANSI encoded strings terminated with CR+LF. Capturing the whole response as a single string seems to work as long as the expected receiving packet size is larger than the actual response, but I've not yet found a way to send the request string without including one or more zero bytes at the end of the string. The current code seems to require one zero byte to terminate a string, and also fill the following bytes with zeros up to a packet size that seems to be fixed for the whole session.Can any of you suggest how I can use any of the existing library blocks or functions to send a string request without zero bytes to my remote service. In my use case, I don't really need the packaging concept, but is of course willing to use it if that makes things easier. I've tried writing my own blocks calling the same library functions as e.g. the
Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.AddString
, but these library functions seems to be very tightly coupled with the packaging concept and fixed size packets, so I've not yet found a way to enforce sending a pure string packet without the zero bytes.