Hi Petteri,
maybe PB_ENCODE_ARRAYS_UNPACKED is taken into account correctly, but there's an issue in my implementation. The structure t_ResponseMeasurement, which I've introduced earlier, is part of a oneof message:
typedef struct _t_Response {
pb_size_t which_response;
union {
t_ResponseIdentification identification;
t_ResponseState state;
t_ResponseConfiguration configuration;
t_ResponseMeasurement measurement;
t_ResponseStart start;
t_ResponseStop stop;
t_ResponseHold hold;
t_ResponseProceed proceed;
t_ResponseError error;
t_ResponseService service;
t_ResponseVoltage voltage;
} response;
} t_Response;
The generated _size defines look as follows:
#define t_ResponseConfiguration_size 0
#define t_ResponseError_size 66
#define t_ResponseHold_size 0
#define t_ResponseIdentification_size 36
#define t_ResponseMeasurement_size 3593
#define t_ResponseProceed_size 0
#define t_ResponseService_size 2
#define t_ResponseStart_size 0
#define t_ResponseState_size 0
#define t_ResponseStop_size 0
#define t_ResponseVoltage_size 6
#define t_Response_size 3596
3593 compared to 3596 is exactly the difference which I'm looking for, possibly I encoded t_Response, but expected to see the size of t_ResponseMeasurement.
However, a hint in the documentation makes me doubt whether my assumption is correct: "Notice that neither which_payload field nor the unused fields in payload will consume any space in the resulting encoded message."
Thanks.
Best regards,
Dietmar