This is probably a basic question, but not sure the steps involved.
I am trying to use the existing gnss calls with python, which works fine, but instead of getting text status
‘Success!’ or ‘The GNSS device is already started’ which is returned to my python subprocess function call,
I would like to just receive an integer so I don’t have to try to pattern match every single thing the system might return.
So how do I take the code found here:
here is an example…
static int Enable
(
void
)
{
le_result_t result = LE_FAULT;
result = le_gnss_Enable();
switch (result)
{
case LE_OK:
printf("Success!\n");
break;
case LE_DUPLICATE:
printf("The GNSS device is already enabled\n");
break;
case LE_NOT_PERMITTED:
printf("The GNSS device is not initialized\n");
break;
case LE_FAULT:
printf("Failed to enable GNSS device\n");
break;
default:
printf("Invalid status\n");
break;
}
return (LE_OK == result) ? EXIT_SUCCESS : EXIT_FAILURE;
}
Would be revised to:
static int Enable
(
void
)
{
le_result_t result = LE_FAULT;
result = le_gnss_Enable();
switch (result)
{
case LE_OK:
#printf("Success!\n");
***Return 1; ***
break;
case LE_DUPLICATE:
#printf("The GNSS device is already enabled\n");
***Return 1; ***
break;
case LE_NOT_PERMITTED:
#printf("The GNSS device is not initialized\n");
***Return 0; ***
break;
case LE_FAULT:
#printf("Failed to enable GNSS device\n");
***Return 2; ***
break;
default:
printf("Invalid status\n");
***Return 3; ***
break;
}
return (LE_OK == result) ? EXIT_SUCCESS : EXIT_FAILURE;
}
So an integer (0-3) returned instead of status text.
(I realize that my revised code is probably NOT correct c, just trying to show what I need to accomplish)
Once I make the change, how do I re-compile and reload this on the FX30?
Do I have to use Leaf or can I somehow compile it and upload it with SCP or perhaps load raw c and compile it on the device?
Leaf is not working to well for me, as I keep getting errors when trying to load sample code.
I have a tried using leaf with a Debian 11 on Virtualbox, but the sample apps never seem to compile correctly on the FX30 and I haven’t had much luck figuring out all the errors.
Thanks.