
Chapter 19: Wireless Wide-Area Networking
Closing WWAN
205
Psion Mobile Devices Developers Guide
19.6 Closing WWAN
When an application has finished using the WWAN interface, the WWAN interface must be closed. It is
essential that the interface is closed before the application exits.
wwanReadyStatePtr);
if (retVal == WwanRequestStatus.NotInitialized)
{
if (WirelessWAN.Initialize() != WwanRequestStatus.Success)
{
return false;
}
}
int count = 60;
while (count > 0)
{
Thread.Sleep(1000);
// Get the ready state again....
retVal = WirelessWAN.GetReadyState(wwanParameters, wwanReadyStatePtr);
if (
(retVal != WwanRequestStatus.Success) ||
(wwanParameters.resultCode != WwanResult.Success) ||
(wwanReadyStatePtr == null)
)
{
// Unable to get the ready state. See return value / result code for reason.
return false;
}
if ((wwanReadyStatePtr.State & WWAN_READY_STATE_FLAGS.INITIALIZED) != 0)
{
// Already in the ready state.
return true;
}
count--;
}
return false;
}
Warning: If a Shutdown call is not paired with each Initialize call, system resources are not
released or cleaned up properly, resulting in a memory leak.
// For the initialization process
// see Section 19.5.3 Initializing the WWAN Driver on page 202
if (InitializeWWANAndWait())
{
// Do WWAN work here...
// Shutdown the interface
WirelessWAN::Shutdown();
}
// For the initialization process see Section 19.5.3 Initializing the WWAN Driver on page 202
if (InitializeWWANAndWait())
{
// Do WWAN work here...
// Shutdown (clean up) the WWAN interface
WirelessWAN.Shutdown();
}
Comentarios a estos manuales