How to set StringLength and encoding for a string which is a field of a structure?

47 views
Skip to first unread message

dcre...@gmail.com

unread,
Jul 4, 2019, 4:02:54 PM7/4/19
to Franca
Hello,

I am just wondering how to set the Length and encoding for a string, which is a field of a strcture, lets say I am defining the types in a .fidl file:
struct MyStructure_t
{
UInt8 MyUint8
String MyString
}

And I am defining a broadcast event in another .fidl file which includes the last one:

broadcast Event 1
{
out
{
MyStructure_t MyStructure
}
}

Is there a proper way to set in .fdepl file the size and coding for the string? something like:

broadcast Event1 {
SomeIpEventID = 1
SomeIpEventGroups = { 0 }
out
{
MyStructure
{
MyUint8
MyString
{
SomeIpStringLengthWidth = 0
SomeIpStringEncoding = utf8
SomeIpStringLength = 128
}
}
}
}

Please help!!! Thank you in advance!

Best regards

Daniel C.

Klaus Birken

unread,
Aug 14, 2019, 5:57:56 PM8/14/19
to Franca
Hi,


This would allow you to define the deployment data (encoding/string length) for MyStructure_t.MyString. An example can be found here: https://github.com/franca/franca/blob/master/examples/org.franca.examples.deploy/models/org/example/deploy/SimpleDeploy.fdepl

(Note that the above examples only mention string encoding, but using it for specifying string length is straightforward).

You could also use overwrites in order to define the string properties for an instance of a struct type, for an example see line 56f in the SimpleDeploy.fdepl above. However, I would not recommend redefining deployment properties using overwrites, because this might lead to runtime issues. E.g., if you have different string encodings for several instances of the same struct type, they will not be interchangeable at runtime.

Hope this helps, regards,
Klaus
Reply all
Reply to author
Forward
0 new messages