DBR701::Open
10/16/2008
This method resets the connection state, opens the serial port that has the specified name, and starts the internal HeartBeatThread, if it is not already running.
The MSN Direct application should call this method exactly once to start communications with the MSN Direct receiver over the MSN Direct protocol.
Syntax
int Open(
TCHAR *comName,
HANDLE hConnectionStateChangeEvent_ = INVALID_HANDLE_VALUE
);
Parameters
- comName
[in] Specifies the name of the serial port through which the host device conducts serial communications with the MSN Direct receiver.
hConnectionStateChangeEvent_
[in] Handle to the connection-state change event. This parameter is supplied by calling applications that want to be signaled of connection state-change events instead of polling the connection state of MSN Direct.This parameter is used by Windows Embedded CE only. Other types of host devices call Open and use only the comName parameter.
Return Value
Returns 1 if successful.
Returns 0 if the serial port is not successfully initialized.
Remarks
When you call Open, the DBR701 class creates a thread whose only purpose is to maintain the connection with the MSN Direct receiver and monitor its health. The HeartBeatThread sends a Tuning Data message to the receiver every 10 seconds. If no answer is received from the receiver for longer than 15 seconds, then the internal ConnectionAlive flag is set to false, to signal that the connection with the receiver is no longer active.
Requirements
Header | DBR701.h |
Library | DBRLib.lib |
Windows Embedded CE | Windows CE 5.0, Windows Embedded NavReady 2009 |
See Also
Reference
DBR701::IsConnectionAlive
DBR701 Class
MSN Direct Services Classes