Partager via


IObexDevice::Connect

This method is used to connect to a device. It operates in blocking mode.

HRESULT Connect(
  LPCWSTR pszPassword,
  DWORD dwCapability,
  IHeaderCollection* pHeaders
);

Parameters

  • pszPassword
    [in] Password for the device.
  • dwCapability
    [in] OBEX service for the connection.
  • pHeaders
    [in] Pointer to the headers list.

Return Values

This method returns one of the following values.

Return value Description
S_OK The connection was established successfully.
E_FAIL The connection failed.
OBEX_E_CONNECTION_NOT_ACCEPTED The authentication failed. The password is most likely incorrect.

Remarks

If a password is not specified and the server requires a password, a callback is made to the interface registered on the main OBEX object. If no interface is registered for callbacks and a password is required, the method fails. If the password is not specified, the password specified in IObexDevice::SetPassword.

The device capability (dwCapability) parameter specifies the OBEX service for the connection. If a Type header does not exist in the header collection, the OBEX layer generates the appropriate Type header based on the mapping of device capabilities to headers in the registry. A list of headers (pHeaders) may be passed in to provide the server with additional information.

Note   This method does not make the connection but it sends a new CONNECT packet. The physical transport might already exist and be reused.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Obex.h, Obex.idl.
Link Library: Uuid.lib.

See Also

Client Support | IObexDevice::SetPassword | IObexDevice | OBEX Interfaces

 Last updated on Friday, April 09, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.