Share via


Retrieving AVDTP Connection State (Windows Embedded CE 6.0)

1/6/2010

Windows Embedded CE defines a property and an event class that enables an application to retrieve the current status of the Audio/Video Distribution Transport Protocol (AVDTP) layer and to receive event notifications.

Retrieving the Current Status of AVDTP

To retrieve the connections status, call the waveOutGetProperty function and pass the following GUID in the pPropSetId parameter.

// {399B03C3-D326-4317-B675-ACD546BD3BDF}
static const GUID GUID_STATE = 
{ 0x399b03c3, 0xd326, 0x4317, { 0xb6, 0x75, 0xac, 0xd5, 0x46, 0xbd, 0x3b, 0xdf } };

This GUID type is declared in bt_ddi.h.

On return, waveOutGetProperty retrieves the current state of the A2DP connection in the pvPropData out parameter. The following table shows the possible values.

Value Description

BT_AVDTP_STATE_DISCONNECTED (0)

The AVDTP layer is not currently connected with the peer A2DP device.

BT_AVDTP_STATE_SUSPENDED (1)

The AVDTP layer is currently connected with the peer A2DP device but the connection is not active.

BT_AVDTP_STATE_STREAMING (2)

The AVDTP layer is currently connected with the peer A2DP device and is streaming audio.

Receiving Notification for AVDTP State Changes

The Bluetooth stack can generate events that signal an application when the state of the A2DTP layer changes. In order to receive notifications about the changes in the AVDTP layer, the application must register the A2DTP event class by using the RequestBluetoothNotifications function. The event class BTE_CLASS_AVDTP (16) and its associated event type BTE_AVDTP_STATE (500) are defined in the bt_api.h header. When changes in the AVDTP layer occur, the stack populates the BTEVENT structure with event information and places it in a message queue. The caller must read this queue to retrieve event information. To store information specific to AVDTP, the application can use the BT_AVDTP_STATE_CHANGE structure.

For more information about accessing these events, see Handling Events from the Bluetooth Stack.

See Also

Concepts

Audio/Video Distribution Transport Protocol (AVDTP)
Bluetooth Advanced Audio