INFO: Configuring Auto-Connect Notification for ActiveSync (317171)
The information in this article applies to:
- Microsoft Windows CE Operating System, Versions 3.0
- Microsoft Windows CE Platform Builder 3.0
- Microsoft Windows CE Platform Builder 4.0
- Microsoft Windows CE .NET Operating System
This article was previously published under Q317171 SUMMARY
A common implementation of Microsoft ActiveSync services on a device involves configuring a designated hardware port to automatically start ActiveSync when the port detects that the device has been connected to another device (or "cradled"). This article describes how the notification system is used to start ActiveSync components on a Windows CE-based device, and how to use the notification system in Platform Builder.
MORE INFORMATION
Currently, the mechanism that is used by Windows CE to start ActiveSync when a designated hardware port event occurs is to use the notification system. The notification system provides the NOTIFICATION_EVENT_RS232_DETECTED event as a link between the hardware event and starting ActiveSync. A device driver is responsible for detecting the appropriate hardware event and starting an event by using the CeEventHasOccurred function. This event causes the system to read a corresponding notification database record and to start the associated program. By default, this program is ActiveSync.
Typical platform implementations use a serial port for ActiveSync automatic connections. The notification is started when the carrier-detect signal is asserted (this is the bases for the notification event name). The hardware event can also take other forms such as detecting a connection on a USB port.
This event is designed to report a hardware connection on a physical port. The event does not indicate which program or server might be running at the other end of the connection. For example, with a serial port, ActiveSync is started if the device is connected to an RS-232 dumb terminal that asserts carrier detect by using a null modem cable. Triggering the Event
To start the event, call the following function (which is defined in the Platform Builder headers):
BOOL CeEventHasOccurred (LONG lWhichEvent, TCHAR *pwszEndOfCommandLine);
For auto-connect events, the first parameter is used to pass NOTIFICATION_EVENT_RS232_DETECTED. You can use the second parameter to pass additional parameters to the program that is started. Most implementations pass NULL. For example, you can use this parameter to pass the port name on which the event originates.
Configuring the Program That Is Started
The program that is started for a particular event is stored in the object store property database. The value is defined in Wceappsfe.db:
Record :
Field : 0001001f : "repllog.exe"
Field : 0002001f : "AppRunAtRs232Detect"
Field : 00030013 : 9
End
The first field contains the name of the program file to start. The second field contains the initial parameter that is passed to the program, which is used to identify the event that started the program. The third field identifies the record with NOTIFICATION_EVENT_RS232_DETECTED.
You can change this record at run time by using the CeRunAppAtEvent function.
Starting the Program
After the event is triggered, the notification system starts the configured program. The command line at the program entry point has one or more parameters. The first parameter is the event name that is specified in the database record (for example, "AppRunAtRs232Detect"). The remainder of the command line is supplied by the pwszEndOfCommandLine parameter when the driver calls CeEventHasOccurred.
Modification Type: | Minor | Last Reviewed: | 8/18/2005 |
---|
Keywords: | kbenv kbinfo KB317171 |
---|
|