dotstack API Reference
1.10.37
|
AVCTP is the transport mechanisms used to exchange messages for controlling Audio and/or Video devices. More...
Modules | |
Configuration | |
This module describes parameters used to configure AVCTP layer. | |
Data Structures | |
struct | bt_avctp_evt_channel_connected_t |
Parameter to AVCTP_EVT_CHANNEL_CONNECTED event. More... | |
struct | bt_avctp_evt_channel_disconnected_t |
Parameter to AVCTP_EVT_CHANNEL_DISCONNECTED event. More... | |
struct | bt_avctp_evt_connection_failed_t |
Parameter to AVCTP_EVT_CONNECTION_FAILED event. More... | |
struct | bt_avctp_evt_command_received_t |
Parameter to AVCTP_EVT_COMMAND_RECEIVED event. More... | |
struct | bt_avctp_evt_response_received_t |
Parameter to AVCTP_EVT_RESPONSE_RECEIVED event. More... | |
struct | bt_avctp_evt_command_sent_t |
Parameter to AVCTP_EVT_COMMAND_SENT event. More... | |
struct | bt_avctp_evt_command_cancelled_t |
Parameter to AVCTP_EVT_COMMAND_CANCELLED event. More... | |
struct | bt_avctp_evt_response_sent_t |
Parameter to AVCTP_EVT_RESPONSE_SENT event. More... | |
struct | bt_avctp_evt_response_cancelled_t |
Parameter to AVCTP_EVT_RESPONSE_CANCELLED event. More... | |
union | bt_avctp_event_t |
Parameter to an application callback. More... | |
struct | bt_avctp_message_t |
AVCTP message description. More... | |
struct | bt_avctp_transport_t |
AVCTP transport description. More... | |
struct | bt_avctp_channel_t |
AVCTP channel description. More... | |
struct | bt_avctp_mgr_t |
AVCTP manager. More... | |
Typedefs | |
typedef void(* | bt_avctp_mgr_callback_fp) (struct _bt_avctp_mgr_t *mgr, bt_byte evt, bt_avctp_event_t *evt_param, void *callback_param) |
AVCTP application callback. More... | |
Functions | |
bt_avctp_mgr_t * | bt_avctp_get_mgr (void) |
Return a pointer to an instance of the AVCTP manager. More... | |
void | bt_avctp_init (void) |
Initialize the AVCTP layer. More... | |
void | bt_avctp_set_callback (bt_avctp_mgr_t *mgr, bt_avctp_mgr_callback_fp callback, void *callback_param) |
Register a AVCTP application callback. More... | |
bt_avctp_channel_t * | bt_avctp_create_channel (bt_avctp_mgr_t *mgr, bt_uint profile_id, bt_int psm, bt_byte l2cap_mode) |
Allocate AVCTP channel. More... | |
bt_avctp_channel_t * | bt_avctp_create_outgoing_channel (bt_avctp_mgr_t *mgr, bt_uint profile_id, bt_int psm, bt_byte l2cap_mode) |
Allocate AVCTP channel. More... | |
bt_bool | bt_avctp_destroy_channel (bt_avctp_channel_t *channel) |
Destroy AVCTP channel. More... | |
bt_bool | bt_avctp_listen (bt_avctp_channel_t *channel) |
Listen for incoming connections. More... | |
void | bt_avctp_cancel_listen (bt_avctp_channel_t *channel) |
Cancel listening for incoming connections. More... | |
bt_byte | bt_avctp_get_channel_state (bt_avctp_channel_t *channel) |
Get channel state. More... | |
bt_bdaddr_t * | bt_avctp_get_channel_remote_address (bt_avctp_channel_t *channel) |
Get channel's remote BT address. More... | |
bt_bool | bt_avctp_connect (bt_avctp_channel_t *channel, bt_bdaddr_t *remote_address, bt_uint acl_config) |
Connect to a remote device. More... | |
bt_bool | bt_avctp_disconnect (bt_avctp_channel_t *channel) |
Disconnect from a remote device. More... | |
bt_bool | bt_avctp_send_command (bt_avctp_channel_t *channel, bt_byte *data, bt_uint data_len, bt_byte *tran_id) |
Send a command message to a remote device. More... | |
bt_bool | bt_avctp_send_response (bt_avctp_channel_t *channel, bt_byte tran_id, bt_byte *data, bt_uint data_len) |
Send a response message to a remote device. More... | |
void | bt_avctp_cancel_command (bt_avctp_channel_t *channel, bt_byte tran_id) |
Cancel a command message. More... | |
void | bt_avctp_cancel_response (bt_avctp_channel_t *channel, bt_byte tran_id) |
Cancel a response message. More... | |
bt_hci_conn_state_t * | bt_avctp_get_hci_connection (bt_avctp_channel_t *channel) |
Get HCI connection for a channel. More... | |
AVCTP is the transport mechanisms used to exchange messages for controlling Audio and/or Video devices.
The actual message contents are defined in the applicable A/V control profiles.
typedef void(* bt_avctp_mgr_callback_fp) (struct _bt_avctp_mgr_t *mgr, bt_byte evt, bt_avctp_event_t *evt_param, void *callback_param) |
AVCTP application callback.
In order to be notified of various events a consumer of the AVCTP layer has to register a callback function (done with bt_avctp_set_callback()). The stack will call that function whenever a new event has been generated.
mgr | AVCTP manager. |
evt | AVCTP event. The event can be one of the following values:
|
evt_param | Event parameter. Which member of the bt_avctp_event_t union is valid depends on the event:
|
callback_param | A pointer to an arbitrary data set by a call to bt_avctp_set_callback. |
void bt_avctp_cancel_command | ( | bt_avctp_channel_t * | channel, |
bt_byte | tran_id | ||
) |
Cancel a command message.
If a message has not yet been sent to the remote device, it can be canceled (i.e. removed from send queue) by calling this function.
channel | AVCTP channel. |
tran_id | Transaction Id. This value is obtained by calling bt_avctp_send_command. |
TRUE
if the function succeeds. FALSE
otherwise. No events will be generated. void bt_avctp_cancel_listen | ( | bt_avctp_channel_t * | channel | ) |
Cancel listening for incoming connections.
This function stops listening for incoming connections on the specified channel.
channel | AVCTP channel. |
TRUE
if the function succeeds. FALSE
otherwise. void bt_avctp_cancel_response | ( | bt_avctp_channel_t * | channel, |
bt_byte | tran_id | ||
) |
Cancel a response message.
If a message has not yet been sent to the remote device, it can be canceled (i.e. removed from send queue) by calling this function.
channel | AVCTP channel. |
tran_id | Transaction Id. This value is obtained by calling bt_avctp_send_command. |
TRUE
if the function succeeds. FALSE
otherwise. No events will be generated. bt_bool bt_avctp_connect | ( | bt_avctp_channel_t * | channel, |
bt_bdaddr_t * | remote_address, | ||
bt_uint | acl_config | ||
) |
Connect to a remote device.
This function establishes a connection to a remote device specified by the remote_address
. If connection cannot be initiated for some reason, for example, there is not enough resources, it returns FALSE and no events are generated. Otherwise the result of an attempt to connect to the remote device is reported via the AVCTP callback. The events generated will either be AVCTP_EVT_CHANNEL_CONNECTED or AVCTP_EVT_CONNECTION_FAILED.
channel | AVCTP channel. |
remote_address | The address of a remote device. |
acl_config | ACL link configuration. This can be a combination of the following values:
|
TRUE
if connection establishment has been started. FALSE
otherwise. bt_avctp_channel_t* bt_avctp_create_channel | ( | bt_avctp_mgr_t * | mgr, |
bt_uint | profile_id, | ||
bt_int | psm, | ||
bt_byte | l2cap_mode | ||
) |
Allocate AVCTP channel.
This function allocates a new incoming AVCTP channel. The channel is intended to be used to accept a connection from a remote device. There can be only one channel for each combination of profile_id
and psm
.
mgr | AVCTP manager. |
profile_id | Profile Id |
psm | The PSM on which the underlying L2CAP channel will listen and accept incoming connections. |
l2cap_mode | Underlying L2CAP channel mode. This currently can only be CMODE_BASIC. |
NULL
otherwise. bt_avctp_channel_t* bt_avctp_create_outgoing_channel | ( | bt_avctp_mgr_t * | mgr, |
bt_uint | profile_id, | ||
bt_int | psm, | ||
bt_byte | l2cap_mode | ||
) |
Allocate AVCTP channel.
This function allocates a new outgoing AVCTP channel. The channel is intended to be used to create a connection to a remote device. There can be multiple channels with the same profile_id
and psm
.
mgr | AVCTP manager. |
profile_id | Profile Id |
psm | The PSM on which the underlying L2CAP channel will listen and accept incoming connections. |
l2cap_mode | Underlying L2CAP channel mode. This currently can only be CMODE_BASIC. |
NULL
otherwise. bt_bool bt_avctp_destroy_channel | ( | bt_avctp_channel_t * | channel | ) |
Destroy AVCTP channel.
This function frees memory used by the channel. The channel has to exist and be in the "idle" state for this function to succeed. I.e. the channel has to be disconnected before this function can be called.
channel | AVCTP channel. |
TRUE
if the function succeeds. FALSE
otherwise. bt_bool bt_avctp_disconnect | ( | bt_avctp_channel_t * | channel | ) |
Disconnect from a remote device.
This function closes a connection to a remote device.
channel | AVCTP channel. |
TRUE
if disconnection has been started. FALSE
otherwise. No events will be generated. bt_bdaddr_t* bt_avctp_get_channel_remote_address | ( | bt_avctp_channel_t * | channel | ) |
Get channel's remote BT address.
This function returns the address of the remote device associated with the channel.
channel | AVCTP channel. |
bt_byte bt_avctp_get_channel_state | ( | bt_avctp_channel_t * | channel | ) |
Get channel state.
This function return current state of the specified channel
channel | AVCTP channel. |
bt_hci_conn_state_t* bt_avctp_get_hci_connection | ( | bt_avctp_channel_t * | channel | ) |
Get HCI connection for a channel.
This function returns a pointer to a structure that describes an HCI connection a channel is open on. The return value can be used to call various function from the HCI layer. For example, if an app wants to force disconnection from a remote device it can call bt_hci_disconnect.
channel | AVCTP channel. |
Pointer
to a structure that describes an HCI connection if the function succeeds. NULL
otherwise. The function fails only if a channel specified by the channel
parameter bt_avctp_mgr_t* bt_avctp_get_mgr | ( | void | ) |
Return a pointer to an instance of the AVCTP manager.
This function returns a pointer to an instance of the AVCTP manager. There is only one instance of the manager allocated by the stack.
void bt_avctp_init | ( | void | ) |
Initialize the AVCTP layer.
This function initializes the AVCTP layer of the stack. It must be called prior to any other AVCTP function can be called.
bt_bool bt_avctp_listen | ( | bt_avctp_channel_t * | channel | ) |
Listen for incoming connections.
This function enables incoming connections on the specified AVCTP channel.
channel | AVCTP channel. |
TRUE
if the function succeeds. FALSE
otherwise. bt_bool bt_avctp_send_command | ( | bt_avctp_channel_t * | channel, |
bt_byte * | data, | ||
bt_uint | data_len, | ||
bt_byte * | tran_id | ||
) |
Send a command message to a remote device.
This function sends a command message to a remote device.
channel | AVCTP channel. |
data | Message body. |
data_len | Message body length. |
tran_id | Pointer to a bt_byte where AVRCP will write transaction id assigned to the message. |
TRUE
if the function succeeds. FALSE
otherwise. No events will be generated. bt_bool bt_avctp_send_response | ( | bt_avctp_channel_t * | channel, |
bt_byte | tran_id, | ||
bt_byte * | data, | ||
bt_uint | data_len | ||
) |
Send a response message to a remote device.
This function sends a response message to a remote device.
channel | AVCTP channel. |
tran_id | Transaction Id. This value is obtained by calling bt_avctp_send_command. |
data | Message body. |
data_len | Message body length. |
TRUE
if the function succeeds. FALSE
otherwise. No events will be generated. void bt_avctp_set_callback | ( | bt_avctp_mgr_t * | mgr, |
bt_avctp_mgr_callback_fp | callback, | ||
void * | callback_param | ||
) |
Register a AVCTP application callback.
In order to be notified of various events a consumer of the AVCTP layer has to register a callback function. The stack will call this function whenever a new event has been generated passing the code of the event as the second parameter. The event can be one of the following values:
mgr | AVCTP manager. |
callback | The callback function that will be called when the AVCTP generates an event. |
callback_param | A pointer to arbitrary data to be passed to the callback callback. |