After issuing the wip_bearerStop() command and getting the WIP_BERR_OK_INPROGRESS response, I get a mysterious event on the bearer handler with a value of 8… it arrives immediately before the WIP_BEV_STOPPED event.
The bearer is disconnecting fine, but I can’t find any SW reference to the bearer handler event with value 8
The only events I see in the documentation are:
which are valued as 1-6
If you look in the wip_bearer.h header file, you’ll see that there are actually 8 defines:
/* Bearer related events */
#define WIP_BEV_CONN_FAILED 1 // connection failed
#define WIP_BEV_IP_CONNECTED 2 // IP connected
#define WIP_BEV_IP_DISCONNECTED 3 // IP disconnected
#define WIP_BEV_STOPPED 4 // Stopped
#define WIP_BEV_LINK_STATUS 5 // Link status
#define WIP_BEV_DRIVER 6 // Driver
#define WIP_BEV_ME_UNREG 7 // ME unregister
#define WIP_BEV_CTX_DEACT 8 // Context deactivate
However, without the full bearer state diagram from SiWi, we have no idea when the last two (undocumented) events are emitted.
Often, the doco from SiWi runs somewhat behind the codebase (sigh!). But at least you can look into the header files for yourself and see what is hidden away.
It is only in newer versions of wip_bearer.h that 8 is defined as CTX_DEACT.
In particular I’ve seen that happen when the module itself believes the voltage is too low, which can happen if antenna is placed above the module itself with no other shielding than that of the module itself.
It can also happen if you shut down GPRS prematurely.
There may be other cases when that event code happens too.