WIP "Initializing a GPRS Bearer" example is WRONG!

Open AT® IP Connectivity Development Guide, WIPlib v5.20
WM_DEV_OAT_UGD_075, Rev 006, October 21, 2009:

This is WRONG: by far the most likely “success” result from wip_bearerStart is not OK, but WIP_BERR_OK_INPROGRESS (yes, it’s an unhelpful and misleading name - see below)

The use of “Magic Numbers” is also a bad example in any context!

The correct test would be:

/* Attempt to start the Bearer */
s32 bearerStart_result = wip_bearerStart( myBearer );

if( (OK == bearerStart_result ) ||
    (WIP_BERR_OK_INPROGRESS == bearerStart_result) )
     /* Success - The bearer either has started, or is starting */
     return TRUE;
     /* Fail - cannot start the bearer */
     wip_bearerClose( myBearer );
     return FALSE;

Note that naming WIP_BERR_OK_INPROGRESS as an “error” i [/i]is unhelpful and misleading - see: Documentation Unhelpful/Misleading: WIP_BERR_OK_INPROGRESS - #3 by medhat

The documentation is unclear as to whether the WIP_BEV_IP_CONNECTED event will still follow after an ‘OK’ return from wip_bearerStart…


I think you have very valid point here. :slight_smile: