Developers guide

Chapter 22: Wireless Wide-Area Networking
Initializing The WWAN Driver
204 Psion Teklogix Mobile Devices SDK Developers Guide
This example shows how to initialize WWAN without setting the indications listener.
}
// Wait up to 30 seconds for the listener object to signal ready.
const int thirtySeconds = 30000;
DWORD eventWait =
WaitForSingleObject(myReadyStateListener->GetWwanReadyEvent(),
thirtySeconds);
// Remove indication registration and cleanup objects
WirelessWAN::SetIndicationsListener(NULL);
WirelessWAN::SetIndicationsState(false);
delete myReadyStateListener;
if (eventWait == WAIT_TIMEOUT)
{
// Ready event not received within 30 seconds;
return false;
}
// The ready event was received.
return true;
}
Example 22.2 Initializing WWAN in C#
private bool InitWWANandWait()
{
WWanRequestParameters wwanParameters = new WWanRequestParameters();
WWAN_READY_STATE wwanReadyStatePtr = new WWAN_READY_STATE();
WwanRequestStatus retVal = WirelessWAN.GetReadyState(wwanParameters,
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 re
ason.
return false;
}
Example 22.1 Initializing WWAN in C++ (Continued)