Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set different max_count values for different sub-messages of the same type #1031

Open
philbinj opened this issue Nov 8, 2024 · 1 comment

Comments

@philbinj
Copy link

philbinj commented Nov 8, 2024

For example, for this proto:

message FloatArray {
  repeated float xs = 1;
}
message Msg {
  FloatArray a = 1;
  FloatArray b = 2;
}

How can I set different max_count values for a and b? The following options file doesn't seem to work:

Msg.a.xs max_count:50
Msg.b.xs max_count:100
@PetteriAimonen
Copy link
Member

They both use the same submessage type, so it is not possible by just using nanopb options. Because the same C struct is used for both, they cannot have different sizes.

If the arrays were directly in the main message (instead of wrapped in a submessage), this would be possible. Another way would be to have separate submessage types in .proto.

You can do this with callback_datatype and a custom callback function, but that quickly gets pretty complex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants