Hi
I’m slowly going mad with DataConnectionService.
Legato version 20.04 on Mangoh RED.
Basic application, register a connection handler (le_data_AddConnectionStateHandler) and request data interface (le_data_Request). App starts and gets correct message indicating data interface connected.
Then I find that if network registration is lost (remove antenna for example), I get the correct message to the connectionHandler (isConnected = 0), date interface disconnected.
If I then restore network registration (replace antenna) the connection handler never gets a message and the data channel does not seem to start.
I traced back to dcsCellular.c in function le_dcsCellular_RetryConn() to this message:
LE_DEBUG(“Cellular connection %s already up with no need to retry”, cellConnName);
return LE_DUPLICATE;
If I remove the return line (HACK - to allow code to run further), then all works as expected, I get connection lost and restored reliably. I’m pretty sure I’m doing something else wrong, or else there would be thousands of tickets for this. Loosing network registration is a common occurrence in any application. But then I see a lot of posts saying data connection breaks after several hours etc… maybe related.
Can anyone confirm this operation before I delve into the complex world of Legato source and start posting trace logs?
Here is the simple app
#include “legato.h”
#include “interfaces.h”
static bool wasConnected;
static le_data_RequestObjRef_t modemDataConnectionRef = NULL;static void ConnectionStateHandler
(
const char *intfName,
bool isConnected,
void *contextPtr
)
{
if (isConnected)
{
LE_INFO(“ConnectionStateHandler: Interface %s CONNECTED, wasConnected=%d”, intfName, wasConnected);
}
else
{
LE_INFO(“ConnectionStateHandler: Interface %s DISCONNECTED, wasConnected=%d”,intfName, wasConnected);
}
wasConnected = isConnected;}
COMPONENT_INIT
{
LE_INFO(“FMP DataConnectionServices Test\n”);le_data_AddConnectionStateHandler(ConnectionStateHandler, NULL); modemDataConnectionRef = le_data_Request();
}
Logs at point registration is restored:
Jun 27 22:02:27 swi-mdm9x15 user.info Legato: INFO | dcsDaemon[1078]/dcsCellular T=main | dcsCellular.c DcsCellularPacketSwitchHandler() 732 | Packet switch state: previous 5, new 0
Jun 27 22:02:27 swi-mdm9x15 user.info Legato: INFO | dcsDaemon[1078]/dcsCellular T=main | dcsCellular.c DcsCellularPacketSwitchHandler() 732 | Packet switch state: previous 0, new 1
Jun 27 22:02:27 swi-mdm9x15 user.info Legato: INFO | dcsDaemon[1078]/dcs T=main | dcs_db.c dcs_EventNotifierTechStateTransition() 311 | Notify all channels of technology 2 of system state transition to up
Jun 27 22:02:27 swi-mdm9x15 user.debug Legato: DBUG | dcsDaemon[1078]/dcsCellular T=main | dcsCellular.c le_dcsCellular_RetryConn() 1328 | Cellular connection 1 already up with no need to retry