How to Make a Data Connection by Using Connection Manager

Windows CE 5.0 Not SupportedWindows Embedded NavReady 2009 Supported

10/16/2008

Applies to Windows Embedded NavReady

This topic describes how an application establishes a data connection by using Connection Manager. This data connection can be established by using one of the following methods:

  • Over the Dial-up Networking (DUN) profile by using the CSPRas connection service provider (CSP).
  • Over ActiveSync Desktop Pass-through (DTPT) by using the CSPNet connection service provider.

If you use Connection Manager to establish connections for your applications, Connection Manager will establish and manage all connections made through Bluetooth profiles or through DTPT over USB, serial, infrared, or Bluetooth. For more information about Connection Manager, see Connection Manager Overview for Portable Navigation Devices.

Hardware and Software Assumptions

  • You have installed Platform Builder for Windows CE 5.0.
  • You have already created the source code for your application functionality. You want to create a basic framework for the application code so that you can add connectivity to it by using Connection Manager, and then run it on a Windows Embedded NavReady powered device. For more information, see Creating a New Project.
  • You have already added the application to the run-time image. For more information, see Adding a Project to an OS Design and Updating the Project.bib File.
  • The target device that will support your application is a portable navigation device (PND), and it includes support for the Connection Manager Catalog item (SYSGEN_CONNMGR). You must also include additional Catalog items, as follows:
    • If you are using Bluetooth DUN, the run-time image on the target device also includes support for the Bluetooth DUN Profile Catalog item (SYSGEN_BTH_PAIRSVC).
    • If you are using ActiveSync Desktop Pass-through (DTPT), the run-time image on the target device also includes support for the ActiveSync Catalog items (SYSGEN_AS_BASE and SYSGEN_AS_FILE).
  • The target device is already configured for Connection Manager.

Steps

Step More information

1. In Platform Builder, open the subproject for the connected application.

  • On the File menu, choose Open, and set Files of type to "Projects (.pbpxml)".
  • Browse to the project file, select it, and choose Open.

No further information

2. Choose the GUID for the connection that you want to create and use.

For example, to let Connection Manager determine which connection to use, choose the GUID constant IID_DestNetInternet.

Or, to choose a specific connection, acquire the connection GUID by calling ConnMgrMapConRef, which returns the GUID in pGUID

No further information

3. Create an application framework that includes a windows class and a message loop to handle status notifications from connection manager.

Note that when you create the window class by calling CreateWindow, the return value is a handle to the application main window. You can use this handle later to post a message to the main window.

Also be sure to add an #include statement for conmgr.h; for example:

#include <connmgr.h>

Creating a Window

Creating a Sample Application

4. In the application source code, add code to establish a connection before the application executes the connected functionality, such as pairing to a Bluetooth-enabled device or connecting to the Internet.

Establishing a Connection to a Bluetooth Network

5. In the callback function for the main window WndProc, add cases for the Connection Manager Status Constants that you want the application to handle.

Handling Connection Status Notifications

6. Rebuild the application.

  • On the Build Project menu, choose Build Current Project.

No further information

7. (Optional) For a target device that supports DTPT, create a menu in the PND user interface (UI) that enables users to connect to a desktop computer through ActiveSync. Then, create user documentation that describes how to connect to a desktop computer. For more information about device synchronization, see this Microsoft Web site.

  • Users should set the DTPT connection type on the desktop computer to either Work Network or The Internet.

Creating End User Documentation for an OS Design

8. (Optional) For a target device that supports Bluetooth DUN, create a menu in the PND UI that enables users to create a pairing relationship to a Bluetooth-enabled device. Then, create user documentation that describes how to pair to a Bluetooth-enabled device.

Creating End User Documentation for an OS Design

How to Create and Manage Bluetooth Pairing Relationships

See Also

Tasks

Making a Bluetooth DUN Connection Without Using HFP or the Pairing Service

Concepts

ActiveSync Desktop Pass-through (DTPT) for Portable Navigation Devices
Overview of Dial-up Networking (DUN) Profile (Data Terminal Role)

Other Resources

Connection Manager Application Development for Portable Navigation Devices
Bluetooth Pairing Service