How to use own defined struct in .api file

Hello,
I have a requirement to use my own defined structure in the .api file. Somehow I am successfully doing this like below:

File: abc.api
REFERENCE Params;
FUNCTION Info(Params params OUT);

File: abcd.h
typedef struct {
//Common parameters
int32_t signal_strength;
int32_t temperature;
uint32_t level;
}abc_Params;

File: abcde.c
void abc_Info(abc_ParamsRef_t* params) {

//Here I can’t access the struct members
}

Could anyone please help

Hello sowviroy

*.api files do not support structures

Solution #1:
Use different functions to pass the difference structure fields

Solution #2:
abc_Params myStruc;
Use le_event_Report ( myEvtId, & myStruc, sizeof ( myStruc ) );

KR.

I do need to use a structure in an API call.
Legato documentation shows there is a provision for STRUCT. But it is not recognised by compiler.
Wasnt it supposed to work?

Hiya,

API doesn’t support a struct as a ‘datatype’.

The struct you see mentioned in the docs are just how the IPC library deals with references - they’re actually an opaque data type that you treat as a void pointer.

This has caused me grief for a couple of years…

ciao, Dave