Psion Teklogix 7527S User's Guide Page 214

  • Download
  • Add to my manuals
  • Print
  • Page
    / 262
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 213
Chapter 22: Wireless Wide-Area Networking
Initializing The WWAN Driver
202 Psion Teklogix Mobile Devices SDK Developers Guide
Sample Code For Initializing WWAN
This example provides a safe and reliable way to ensure that the WWAN interface is initialized
correctly. This example is written in C++; however, the same process can be followed for a
.NETapplication.
Example 22.1 Initializing WWAN in C++
// Use this class in the function, InitializeWWANAndWait
class WWANReadyStateListener : public PsionTeklogix::WWAN::IndicationsListener
{
public:
WWANReadyStateListener()
{
// Create an event to wait on, this object signals it when WWAN is ready.
WwanReadyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
}
~WWANReadyStateListener()
{
if (WwanReadyEvent != 0)
{
CloseHandle(WwanReadyEvent);
WwanReadyEvent = 0;
}
}
HANDLE GetWwanReadyEvent(){ return WwanReadyEvent; }
virtual void OnReadyState( const WWAN_READY_STATE &ReadyState )
{
if ((ReadyState.State & WWAN_READY_STATE_INITIALIZED) != 0 )
{
if (WwanReadyEvent != 0)
{
SetEvent(WwanReadyEvent);
}
}
}
private:
HANDLE WwanReadyEvent;
};
bool InitializeWWANAndWait()
{
WWanRequestParameters params = {0};
WWAN_READY_STATE* wwanReadyStatePtr = 0;
WwanRequestStatus retVal;
// See if the WWAN namespace has been initialized, and get the ready state.
retVal = WirelessWAN::GetReadyState(params, &wwanReadyStatePtr);
if(WwanRequestNotInitialized == retVal)
{
// The namespace is not initialized, attempt to do so:
if (WwanResultSuccess != WirelessWAN::Initialize())
{
// Error initializing the WWAN namespace.
return false;
}
Page view 213
1 2 ... 209 210 211 212 213 214 215 216 217 218 219 ... 261 262

Comments to this Manuals

No comments