Motorola SYMBOL MINISCAN MSXX04 Guía de usuario Pagina 216

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 278
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 215
Chapter 19: Wireless Wide-Area Networking
Initializing the WWAN Driver
Psion Mobile Devices Developers Guide
204
This example shows how to initialize WWAN without setting the indications listener.
// Wait for it to become ready:
// Create and register the listener object to receive events
WWANReadyStateListener* myReadyStateListener = new WWANReadyStateListener();
WirelessWAN::SetIndicationsListener(myReadyStateListener);
WirelessWAN::SetIndicationsState(true);
// To prevent a race condition, check to see if the event occured between the
// time last check for the WWAN ready state and registration for the event.
retVal = WirelessWAN::GetReadyState(params, &wwanReadyStatePtr); // Try again.
if( retVal != WwanRequestSuccess ||
params.resultCode != WwanResultSuccess ||
wwanReadyStatePtr == 0)
{
// Unable to get the ready state. See return value/result code for reason.
// Remove indication registration and cleanup objects.
WirelessWAN::SetIndicationsListener(NULL);
WirelessWAN::SetIndicationsState(false);
delete myReadyStateListener;
return false;
}
// Check the ready state flag
readyState = wwanReadyStatePtr->State;
free(wwanReadyStatePtr); // Memory was allocated by "GetReadyState(...)"
if ((readyState & WWAN_READY_STATE_INITIALIZED) != 0 )
{
// Already in the ready state.
// Remove indication registration and cleanup objects
WirelessWAN::SetIndicationsListener(NULL);
WirelessWAN::SetIndicationsState(false);
delete myReadyStateListener;
return true;
}
// 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;
}
private bool InitWWANandWait()
{
WWanRequestParameters wwanParameters = new WWanRequestParameters();
WWAN_READY_STATE wwanReadyStatePtr = new WWAN_READY_STATE();
WwanRequestStatus retVal = WirelessWAN.GetReadyState(wwanParameters,
Vista de pagina 215
1 2 ... 211 212 213 214 215 216 217 218 219 220 221 ... 277 278

Comentarios a estos manuales

Sin comentarios