Airvantage data pushing failure

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)

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.

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

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

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

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?

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 Fix CMake non-existent dependencies · CoRfr/legato-af@4b8f795 · GitHub fixes your error?

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

What command are you using? make localhost?

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

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.

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?

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

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

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

Best regards

Hi,

The module was not able to make Airvantage connection due to failure of LWM2M_DM_PSK_IDENTITY(LWM2M credentials is missing for your module ).

This credentials needs to be provided SierraWireless .And this Credential Need to be generated based on your module FSN

A sample Key will be look like
AT+WAMS=1,9,268,1,0
308201080282010100B225CCFB87A49A4DDFF4D8F86B06FBACA6707493F77E0F32A98DB223F357403083738F8B74F577A0394F7056962D323C13C39F6C1B2073F9B4CDA7ECF4AAB6CEF0709CEA7F2202320B2FF2DE35553F17D286DE95C8C6DC33A27072583A4139AE6B78DD4A1C6AC4DEADB7F8DCAECC203D202104045125BFF519E3980703B9002B54FBEC915DB36D177912E0F25055213F04E4AFB2755AFD3C2CB09FBC460C57C9E025D96CD3F63B312C3965A014442C6E38A937ED84CC9EF8D0D39715B2B3E2C2FAF2EBB89A15BA6993C11CEE9B81A56B17AE8E2D3642C67919BB05DD2B9240953CE5F241AD454B1AE5021055D84BB7AAB60BEA7DEA58FEF99E8DECAAA8714749020103
AT+WAMS=1,10,268,1,0
3082010802820101009F5CB2AD3764BBDBABC31CDD605815E4C095ECB4AA5B6C7E11419E6D57B0F3F95A897E2760CA515EECD745A115BA5F14AA97190AD6B9C116ABA0DEA6BE6A9F9C06FB8C8ED6F94AD4DFC21B1B873BB876B4D4839EBE290D65B4F4224EBD8939FAC2CECA1B37C667F04AA53C7DA32868B7AC7619238455C4E3BE5F9A48BC9DB85CB057941C102039447719499C32FF090CEC62A395D1412456651CF51BE88F02AD432A83538F8033FA4DBEA8013DC3B080CBF57A5A2D53A449062C7BD526667C364EAD5D48256A8E721C004801C3F5A0D548B045939EFD7D816AA6E8A858742D8A3BA292814D03FF87B140287E73A796126ED5E90FE548C103BA6E4780A6875233020103
AT+WAMS=1,11,30
636F6170733A2F2F62732E61697276616E746167652E6E65743A35363834
AT+WAMS=1,12,32
4238463131393842313346393343323841423545444637413137343338433530
AT+WAMS=1,13,16
30D3942EB0AD06FF87D2587D03A2ECE1

Once we got credentials ,we have to enter the credentials
microcom -E /dev/ttyAT
AT!UNLOCK=“A710”

Also
AT+WAMS=1,11,30 (Enter)
636F6170733A2F2F62732E61697276616E746167652E6E65743A35363834(CTRL-Z)
+WAMS: 0 - Success in storing
OK

AT+WAMS=1,11,30 (Enter)
636F6170733A2F2F62732E61697276616E746167652E6E65743A35363834(CTRL-Z)
+WAMS: 1 - Failure in Storing .
OK

Regards
Dharma