
Chapter 19: Wireless Wide-Area Networking
Windows Embedded CE 5.0, Windows Embedded CE 6.0, Windows Mobile 2003 SE, and Windows CE .NET 4.2
207
Psion Mobile Devices Developers Guide
See also Section 19.7.3 The DbGprs.csv File on page 209 for information that may need to be provided to
complete the connection.
The following example uses RasGetEntryDialParams and RasDial to start a connection.
Note: You must initialize WWAN before making the connection. See Section 19.5 Initializing WWAN on
page 200 for details.
Note: It is recommended that the application wait for a Packet Service Status (see
Section 19.7.4 Checking Packet Data Status on page 209) of Wwan AttachStateAttached before
attempting a connection through RAS.
#include <wwan.hpp>
#include <ras.h>
using namespace PsionTeklogix::WWAN;
//
// WWANRas_Connect()
//
// This function is called in order to establish a RAS connection through the WWAN
// driver.
//
// Parameters:
// entryName Name of the RAS phone book entry. For WWAN, this should always be
// "Wirless WAN"
// password Password corresponding (if none was stored earlier)
// hWnd Handle of window that will receive connection state messages. You
// receive this via the WM_RASDIALEVENT windows message.
//
// Notes:
// REMEMBER: Initialize WWAN interface first!
//
// Returns:
// TRUE for success, FALSE otherwise
//
//
BOOL WWANRas_Connect(WCHAR const * entryName,
WCHAR const * username,
WCHAR const * password,
HWND hWnd)
{
HRASCONN hRasConn;
RASDIALPARAMS rasDialParams;
BOOL passwordSet;
// Initialize the RASDIALPARAMS structure.
// NOTE: When connecting to WWAN, entryName will be "Wireless WAN".
memset (&rasDialParams, 0, sizeof (RASDIALPARAMS));
rasDialParams.dwSize = sizeof (RASDIALPARAMS);
wcsncpy (rasDialParams.szEntryName, entryName, RAS_MaxEntryName);
if (RasGetEntryDialParams(NULL,
&rasDialParams,
&passwordSet) != 0)
{
return FALSE;
}
// If the password was not automatically determined, then provide it here.
if (!passwordSet)
{
wcscpy (rasDialParams.szUserName, username);
wcscpy (rasDialParams.szPassword, password);
}
// Connect
if (RasDial(NULL, NULL, &rasDialParams, 0xffffffff, hWnd, &hRasConn) != 0)
{
Comentarios a estos manuales