I’m having trouble returning a user defined STRUCT through a function in my .api file.
/home/f/legatoapps/_build_app/wp76xx/api/732e28177b4a96521bsb9d6c80fecb29/server/ctrlSerial_server.c:349:61: error: incompatible type for argument 2 of ‘ctrlPower_PackTestStruc’
LE_ASSERT(ctrlPower_PackTestStruct( &_msgBufPtr, _result ));
^
/home/d/Desktop/myLeafWorkspace/leaf-data/wp76xxdev_R16.3_L19.11.6/wp76-legato/framework/include/le_log.h:915:13: note: in definition of macro ‘LE_FATAL_IF’
if (condition) { LE_FATAL(formatString, ##__VA_ARGS__) }
^~~~~~~~~
/home/f/legatoapps/_build_app/wp76xx/api/732e28177b4a96521bsb9d6c80fecb29/server/ctrlSerial_server.c:349:5: note: in expansion of macro ‘LE_ASSERT’
LE_ASSERT(ctrlPower_PackTestStruct( &_msgBufPtr, _result ));
^~~~~~~~~
In file included from /home/f/legatoapps/_build_app/wp76xx/api/732e28177b4a96521bsb9d6c80fecb29/server/ctrlSerial_server.c:13:0:
/home/f/legatoapps/_build_app/wp76xx/api/732e28177b4a96521bsb9d6c80fecb29/ctrlSerial_messages.h:430:20: note: expected ‘const ctrlPower_TestStruc_t * {aka const struct <anonymous> *}’ but argument is of type ‘ctrlPower_TestStruc_t {aka struct <anonymous>}’
static inline bool ctrlPower_PackTestStruct
^~~~~~~~~~~~~~~~~~~~~~~~
These are my compilations errors, do you know how to fix this?
My function in the .api is declared like:
FUNCTION TestStruct SendAndReceiveStruct
(
string cmd[20] IN,
string arg[20] IN
);
My struct in the .api is declared like:
STRUCT TestStruct
(
le_result_t res;
int8 output;
);
My defined function in my main .c file is
ctrlPower_TestStruct_t SendAndReceiveStruct
(
string cmd[20] IN,
string arg[20] IN
);
My struct in the .api is declared like:
ctrlPower_TestStruct SendAndReceiveStruct(
const char *cmd, // IN
const char *arg // IN
)
{
// process here
return (ctrlPower_TestStruct){.res = LE_OK, output = 1}; // just testing values
}
Thanks for your help