Description
Description
The construction of an instance of OdinWiFiInterface manipulates the system event queue in such a way that previous configuration is lost. In particular, when used with MbedCloudClient, the OdinWiFiInterface can cancel timers that were set up by the cloud client.
- Type: Bug
- Related issue: none known
- Priority: Major
Bug
Code behaves differently depending on when an OdinWiFiInterface is instantiated.
For instance
{
OdinWiFiInterface wifi;
...
MbedCloudClient _cloud_client;
_cloud_client.setup(&wifi);
...
}
runs as expected,
But
{
OdinWiFiInterface *wifi;
MbedCloudClient _cloud_client;
...
wifi = new OdinWiFiInterface();
...
_cloud_client.setup(wifi);
...
}
results in a cloud client whose timers do not fire (for example it won't send keep-alive messages to the cloud)
Files using mbed-cloud-client-example-restricted to demonstrate this behavior are attached.
original.log
original.log - the trace debug log of mbed-cloud-client-example-restricted (unmodified).
easy-connect-patch.txt
easy-connect-patch.txt - patch for easy-connect.h
modified.log
modified.log - the trace debug log of mbed-cloud-client-example-restricted (with easy-connect.patch applied)
mbed-cloud-client-example-restricted uses the easy-connect library which instantiates a global OdinWiFiInterface at initialization. The patch modifies easy-connect, so that the OdinWiFiInterface is instantiated dynamically just before it is needed.
original.log shows the mbed cloud-client sending a keep-alive message as the result of a timer expiration
...
[DBG ][mClt]: M2MNsdlInterface::timer_expired - M2MTimerObserver::Registration - Send update registration
[DBG ][mClt]: M2MNsdlInterface::send_update_registration( lifetime 0)
...
These log messages are missing from modified.log.
Target
UBLOX_EVK_ODIN_W2
Toolchain:
GCC_ARM
Toolchain version:
mbed-cli version:
1.1.0
mbed-os sha:
fc18365 Merge pull request #4463 from ARMmbed/release-candidate
DAPLink version:
Expected behavior
Mbed cloud client should behave consistently regardless of when an OdinWiFiInterface is instantiated.
Actual behavior
Timers do not expire and thus Mbed cloud client does not send keep-alive messages in the case where an OdinWiFiInterface is instantiated after the cloud client.
Steps to reproduce
Apply easy-connect-patch.txt to the easy-connect library in mbed-cloud-client-example-restricted. Execute mbed-cloud-client-example-restricted