Airvantage data pushing failure


#1

Hi all,

I’ve been trying to upload my position to AirVantage with AirVantage Data API. When executing the authentication with the server always fails due to error from swiQmi and secStore(I’m not 100% sure, the log will also be attached with this post). I’ve been trying to locate the error but I don’t have enough understanding with these two apps.

The Legato framework version is 17.07.1.

The positioning part was proved to be fine. The procedure of using AV Data API is as follows:

Asset variable paths:

#define LONGITUDE_VAR “/position/longitude”
#define LATITUDE_VAR “/position/latitude”
#define ACCURACY_VAR “/position/accuracy”

Initialize AV session:

void initAV()
{
sessionHandlerRef = le_avdata_AddSessionStateHandler(sessionHandler, NULL);
requestSessionRef = le_avdata_RequestSession();
if (NULL == requestSessionRef)
{
LE_ERROR(“AirVantage Connection Controller does not start.”);
}else{
LE_INFO(“AirVantage Connection Controller started.”);
}
le_result_t res = le_avdata_CreateResource(LONGITUDE_VAR, LE_AVDATA_ACCESS_VARIABLE );
LE_ASSERT(res==LE_OK||res==LE_DUPLICATE);
res = le_avdata_CreateResource(LATITUDE_VAR, LE_AVDATA_ACCESS_VARIABLE );
LE_ASSERT(res==LE_OK||res==LE_DUPLICATE);
res = le_avdata_CreateResource(ACCURACY_VAR, LE_AVDATA_ACCESS_VARIABLE );
LE_ASSERT(res==LE_OK||res==LE_DUPLICATE);

}

Session state handler:

void sessionHandler(le_avdata_SessionState_t sessionState,void *contextPtr)
{
switch (sessionState)
{
case(LE_AVDATA_SESSION_STARTED):
LE_INFO(“AV data session started”);
break;
case(LE_AVDATA_SESSION_STOPPED):
LE_INFO(“AV data session stopped”);
break;
}
}

Set resource value and push:

void pushPositionToAV(float cLatitude, float cLongitude, float chAccuracy)
{
le_result_t res;
// Set values
res = le_avdata_SetFloat(LONGITUDE_VAR, cLongitude);
LE_ERROR_IF(res!=LE_OK, “Setting longitude error”);
res = le_avdata_SetFloat(LATITUDE_VAR, cLatitude);
LE_ERROR_IF(res!=LE_OK, “Setting latitude error”);
res = le_avdata_SetFloat(ACCURACY_VAR, chAccuracy);
LE_ERROR_IF(res!=LE_OK, “Setting accuracy error”);
// Push values
res = le_avdata_Push(LONGITUDE_VAR, pushHandler, NULL);
LE_ERROR_IF(res!=LE_OK||res!=LE_BUSY, “Pushing longitude error”);
res = le_avdata_Push(LATITUDE_VAR, pushHandler, NULL);
LE_ERROR_IF(res!=LE_OK||res!=LE_BUSY, “Pushing latitude error”);
res = le_avdata_Push(ACCURACY_VAR, pushHandler, NULL);
LE_ERROR_IF(res!=LE_OK||res!=LE_BUSY, “Pushing accuracy error”);
}

Push state handler:

void pushHandler(le_avdata_PushStatus_t status, void *contextPtr)
{
switch (status)
{
case LE_AVDATA_PUSH_SUCCESS:
LE_INFO(“Push successfully”);
break;
case LE_AVDATA_PUSH_FAILED:
LE_ERROR(“Push failed”);
break;
}
}

The Legato Log is enclosed in the attachment. Could someone help me to debug this issue? A lot of thx!

Best regards,

Lichen Yao

Legato log.docx (6.6 KB)


#2

Hi,

From the log, the authentication to Airvantage server is not successful:


Oct 3 08:18:18 | =ERR= | avcDaemon[806] | Oct 03 08:18:18
Oct 3 08:18:18 | =ERR= | avcDaemon[806] | ALRT
Oct 3 08:18:18 | =ERR= | avcDaemon[806] | 40 invalidate peer
Oct 3 08:18:18 | avcDaemon[806]/avcDaemon T=main | avcClient.c EventHandler() 449 | Authentication to DM failed
Oct 3 08:18:18 | avcDaemon[806]/avcDaemon T=main | avcServer.c avcServer_UpdateHandler() 756 | Update state: Authentication failed
Oct 3 08:18:18 | INFO | avcDaemon[806] | Oct 03 08:18:18 WARN received alert, peer has been invalidated


Here I have tried on my MangoH_Red board:


Sep 29 09:38:01 | avcDaemon[3637]/avcDaemon T=main | avcServer.c avcServer_UpdateHandler() 756 | Update state: Authentication started
Sep 29 09:38:02 | secStore[3560]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 808 | Sending QMI_SWI_SFS_OPEN_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=48.[0x30]
Sep 29 09:38:02 | secStore[3560]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 808 | Sending QMI_SWI_SFS_OPEN_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=48.[0x30]
Sep 29 09:38:03 | avcDaemon[3637]/avcDaemon T=main | avcFs.c ReadFs() 41 | failed to open /avc/packageDownloader/packageUri: LE_NOT_FOUND
Sep 29 09:38:03 | avcDaemon[3637]/avcDaemon T=main | packageDownloader.c packageDownloader_GetResumeInfo() 336 | Failed to read /avc/packageDownloader/packageUri: LE_NOT_FOUND
Sep 29 09:38:03 | avcDaemon[3637]/avcDaemon T=main | avcServer.c avcServer_UpdateHandler() 756 | Update state: Session started


So I wonder if you have register your module to the AVMS server.


#3

Hi jyijyi,

Thank you for your reply. I have already registered my device on the server.

Previously I already managed to send data and command back and forth with sketches installed on the Arduino embedded on mangOH Green through the WP module. But that was using MQTT protocol rather than LWM2M. I will definitely check my registration is correct or not. But I doubt it because I can receive registration notification on AV when I issue AT command on my module to establish AV session.

Thanks a lot,

Lichen Yao


#4

Update:

Connecting to AV server failed with AT command “at+wdss=1,1” too. Log output:

Oct 3 11:14:50 swi-mdm9x15 user.debug Legato: DBUG | atQmiLinker[518]/atQmiLinker T=unknown | main.c QmiAtCmdCb() 278 | Received:`at+wdss=1,1^M '
Oct 3 11:14:50 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[813]/avcDaemon T=main | avcFs.c ReadFs() 41 | failed to open /avc/fw/updateState: LE_NOT_FOUND
Oct 3 11:14:50 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[813]/avcDaemon T=main | packageDownloader.c packageDownloader_GetFwUpdateState() 480 | FW update state not found
Oct 3 11:14:50 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[813]/avcDaemon T=main | avcFs.c ReadFs() 41 | failed to open /avc/fw/updateResult: LE_NOT_FOUND
Oct 3 11:14:50 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[813]/avcDaemon T=main | packageDownloader.c packageDownloader_GetFwUpdateResult() 525 | FW update result not found
Oct 3 11:14:50 swi-mdm9x15 user.info Legato: INFO | checkDataConnectivity[574]/component T=main | main.c stateHandler() 19 | Data connected
Oct 3 11:14:50 swi-mdm9x15 user.info Legato: INFO | avcDaemon[813]/avcDaemon T=main | avcClient.c avcClient_Connect() 632 | Starting retry timer of 15 min at index 0
Oct 3 11:14:50 swi-mdm9x15 user.debug Legato: DBUG | atQmiLinker[518]/atQmiLinker T=Reader | main.c SendResponse() 430 | ##^M OK^M ##
Oct 3 11:14:50 swi-mdm9x15 user.info Legato: INFO | avcDaemon[813]/avcDaemon T=main | avcClient.c BearerEventCb() 130 | connected 1
Oct 3 11:14:50 swi-mdm9x15 user.err Legato: =ERR= | secStore[561]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 808 | Sending QMI_SWI_SFS_OPEN_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=48.[0x30]
Oct 3 11:14:50 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[813]/avcDaemon T=main | osPortSecurity.c lwm2mcore_GetCredential() 100 | Unable to retrieve credentials for 7: -1 LE_NOT_FOUND
Oct 3 11:14:51 swi-mdm9x15 user.info Legato: INFO | avcDaemon[813]/avcDaemon T=main | osUdp.c lwm2mcore_UdpConnect() 439 | sockfd 35
Oct 3 11:14:58 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[813]/avcDaemon T=main | avcClient.c EventHandler() 376 | Session failure
Oct 3 11:14:58 swi-mdm9x15 user.err Legato: =ERR= | avcDaemon[813]/avcDaemon T=main | avcClient.c EventHandler() 382 | Session failure on bootstrap server
Oct 3 11:14:58 swi-mdm9x15 user.info Legato: INFO | avcDaemon[813]/avcDaemon T=main | avcServer.c avcServer_UpdateHandler() 756 | Update state: Session stopped
Oct 3 11:14:59 swi-mdm9x15 daemon.info dnsmasq[766]: reading /etc/resolv.conf
Oct 3 11:14:59 swi-mdm9x15 daemon.info dnsmasq[766]: using nameserver 194.151.228.2#53
Oct 3 11:14:59 swi-mdm9x15 daemon.info dnsmasq[766]: using nameserver 194.151.228.50#53
Oct 3 11:14:59 swi-mdm9x15 user.warn Legato: -WRN- | dcsDaemon[527]/dataConnectionService T=main | dcsServer.c SetDefaultGateway() 1180 | Default gateway or interface is empty
Oct 3 11:14:59 swi-mdm9x15 user.info Legato: INFO | avcDaemon[813]/framework T=main | LE_FILENAME TimerFdHandler() 448 | Stale timer expired
Oct 3 11:14:59 swi-mdm9x15 user.debug Legato: DBUG | atQmiLinker[518]/atQmiLinker T=Reader | main.c SendUnsolicitedResponse() 456 | **^M +WDSI: 8^M **
Oct 3 11:14:59 swi-mdm9x15 user.info Legato: INFO | checkDataConnectivity[574]/component T=main | main.c stateHandler() 21 | Data disconnected


#5

It looks like it’s having some issues getting the bootstrap credentials.
Could you retry with 17.08.1?


#6

Thank you CoRfr. I will try with 17.08.1. But when I make the framework for localhost there are some error message after the --Configuring done message:

CMake Warning (dev) at apps/test/fwupdate/fwupdateIntegrationTest/CMakeLists.txt:27 (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies. Run “cmake --help-policy CMP0046” for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

The dependency target “flashTest” of target “tests_c” does not exist.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/test/framework/log/CMakeLists.txt:35 (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies. Run “cmake --help-policy CMP0046” for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

The dependency target “log” of target “logTest” does not exist.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at apps/test/framework/log/CMakeLists.txt:34 (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies. Run “cmake --help-policy CMP0046” for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

The dependency target “logDaemon” of target “logTest” does not exist.
This warning is for project developers. Use -Wno-dev to suppress it.

– Generating done
CMake Warning:
Manually-specified variables were not used by the project:

DISABLE_SMACK
PLANTUML_JAR_FILE
PLATFORM_SIMULATION

– Build files have been written to: /home/lichen/legato/packages/legato/build/localhost
make -C build/localhost user_docs
make[2]: Entering directory '/home/lichen/legato/packages/legato/build/localhost’
make[2]: *** No rule to make target ‘user_docs’. Stop.
make[2]: Leaving directory '/home/lichen/legato/packages/legato/build/localhost’
Makefile:202: recipe for target ‘user_docs’ failed
make[1]: *** [user_docs] Error 2
make[1]: Leaving directory '/home/lichen/legato/packages/legato’
Makefile:49: recipe for target ‘default’ failed
make: *** [default] Error 2

No error displayed when making for wp85. Is that an issue that needs extra care?


#7

Oh weird but valid errors, what’s your OS?

You shouldn’t need to build localhost though, just make wp85 should be enough to produce content for your target.

EDIT: As for the localhost build error, can you check if https://github.com/CoRfr/legato-af/commit/4b8f795d1bcee4fe324f1c6ebdc73ed8c4ddd26b fixes your error?


#8

My OS is Ubuntu 16.04 LTS.

The solution you provided does not solve the problem. Here is the error log:

mv build/localhost/localhost.localhost.update
build/localhost/system.localhost.update
make -C build/localhost user_docs
make[2]: Entering directory '/home/lichen/legato/packages/legato-17.08.1/build/localhost’
make[2]: *** No rule to make target ‘user_docs’. Stop.
make[2]: Leaving directory '/home/lichen/legato/packages/legato-17.08.1/build/localhost’
Makefile:202: recipe for target ‘user_docs’ failed
make[1]: *** [user_docs] Error 2
make[1]: Leaving directory '/home/lichen/legato/packages/legato-17.08.1’
Makefile:49: recipe for target ‘default’ failed
make: *** [default] Error 2


#9

What command are you using? make localhost?

If it’s make default, this is not a supported target.


#10

I succeeded making with make localhost. But I cannot build my program on Developer Studio. Symbol resolving errors show up even for those “LE_OK”-like symbols. I just copied the codes that I could succeed building with 17.07.


#11

Hi CoRfr,

I tried on 17.08.1 but not succeeded. The same error occurs:

Oct 5 14:37:59 | UpdatePosToAv_08[19285]/component T=main | main.c initAV() 83 | AirVantage Connection Controller started.
Oct 5 14:37:59 | secStore[12256]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 808 | Sending QMI_SWI_SFS_OPEN_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=48.[0x30]
Oct 5 14:37:59 | avcDaemon[12349]/avcDaemon T=main | osPortSecurity.c lwm2mcore_GetCredential() 100 | Unable to retrieve credentials for 7: -1 LE_NOT_FOUND

It says the credential for 7 cannot be retrieved because it’s not there. I found in osPortSecurity.c the 7th credential is “LWM2M_DM_PSK_IDENTITY”.

static const char* CredentialLocations[LWM2MCORE_CREDENTIAL_MAX] = {
“LWM2M_FW_KEY”, ///< LWM2MCORE_CREDENTIAL_FW_KEY
"LWM2M_SW_KEY", ///< LWM2MCORE_CREDENTIAL_SW_KEY
"certificate", ///< LWM2MCORE_CREDENTIAL_CERTIFICATE
"LWM2M_BOOTSTRAP_SERVER_IDENTITY", ///< LWM2MCORE_CREDENTIAL_BS_PUBLIC_KEY
"bs_server_public_key", ///< LWM2MCORE_CREDENTIAL_BS_SERVER_PUBLIC_KEY
"LWM2M_BOOTSTRAP_SERVER_PSK", ///< LWM2MCORE_CREDENTIAL_BS_SECRET_KEY
"LWM2M_BOOTSTRAP_SERVER_ADDR", ///< LWM2MCORE_CREDENTIAL_BS_ADDRESS
"LWM2M_DM_PSK_IDENTITY", ///< LWM2MCORE_CREDENTIAL_DM_PUBLIC_KEY
"dm_server_public_key", ///< LWM2MCORE_CREDENTIAL_DM_SERVER_PUBLIC_KEY
"LWM2M_DM_PSK_SECRET", ///< LWM2MCORE_CREDENTIAL_DM_SECRET_KEY
"LWM2M_DM_SERVER_ADDR", ///< LWM2MCORE_CREDENTIAL_DM_ADDRESS
};

Do you have any idea why this credential may be lost?


#12

Just to be clear, make wp85 is what you need to run to build legato for wp85. Not make or make localhost.


#13

Yeah, it was my misunderstanding. But I still cannot establish connection with AirVantage.


#14

Hi Lichen,
What is your status on this topic ?
I am facing to the same problem.

Best regards