Developer World
Spresense SDK Library v1.4.2-3df2e9d
bt_avrcp.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/bluetooth/bt_avrcp.h
3  *
4  * Copyright 2018 Sony Semiconductor Solutions Corporation
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17  * the names of its contributors may be used to endorse or promote
18  * products derived from this software without specific prior written
19  * permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ****************************************************************************/
35 
43 #ifndef __MODULES_INCLUDE_BLUETOOTH_BT_AVRCP_H
44 #define __MODULES_INCLUDE_BLUETOOTH_BT_AVRCP_H
45 
46 /****************************************************************************
47  * Included Files
48  ****************************************************************************/
49 
50 #include <stdint.h>
51 #include <bluetooth/bluetooth.h>
53 #include <bluetooth/bt_common.h>
54 
55 /****************************************************************************
56  * Pre-processor Definitions
57  ****************************************************************************/
58 
59 /****************************************************************************
60  * Public Types
61  ****************************************************************************/
62 
67 typedef enum
68 {
72 
77 typedef struct avrcTrackInfo {
79  uint8_t attrId;
80  uint16_t attrLen;
81  uint8_t attrValue[48];
83 
89 {
90  void (*playStatusChange)(BT_AVRC_TRACK_INFO *trackInfo);
91  void (*trackChange)(BT_AVRC_TRACK_INFO *trackInfo);
92  void (*trackReachedEnd)(uint8_t *pdata, int len);
93  void (*trackReachedStart)(uint8_t *pdata, int len);
94  void (*playPosChanged)(uint8_t *pdata, int len);
95  void (*batteryStatusChange)(uint8_t *pdata, int len);
96  void (*systemStatusChange)(uint8_t *pdata, int len);
97  void (*appSettingChange)(uint8_t *pdata, int len);
98  void (*nowPlayingChange)(uint8_t *pdata, int len);
99  void (*avalPlayerChange)(uint8_t *pdata, int len);
100  void (*addrPlayChange)(uint8_t *pdata, int len);
101  void (*uidsChange)(uint8_t *pdata, int len);
102  void (*volumeChange)(uint8_t *pdata, int len);
103 };
104 
110 {
111  void (*command_status)(BT_CMD_STATUS status);
112  void (*connect)(struct bt_acl_state_s *bt_acl_state, BT_AVRCP_ROLE role);
113  void (*disconnect)(struct bt_acl_state_s *bt_acl_state, BT_AVRCP_ROLE role);
114 };
115 
121 {
124  uint16_t bt_avrcc_handle;
125  uint16_t bt_avrct_handle;
130 };
131 
132 /****************************************************************************
133  * Public Function Prototypes
134  ****************************************************************************/
135 
142 bool bt_avrcp_is_supported(void);
143 
153 int bt_avrcp_connect(struct bt_acl_state_s *bt_acl_state);
154 
164 int bt_avrcp_disconnect(struct bt_acl_state_s *bt_acl_state);
165 
177 int bt_avrcp_send_command(struct bt_acl_state_s *bt_acl_state, BT_AVRCP_CMD_ID cmd_id, bool press);
178 
188 int bt_register_notification(struct bt_avrcp_notify_ops_s *bt_avrcp_notify_ops);
189 
199 int bt_avrcp_register_cb(struct bt_avrcp_ops_s *bt_avrcp_ops);
200 
201 #endif /* __MODULES_INCLUDE_BLUETOOTH_BT_AVRCP_H */
Bluetooth AVRCP application callbacks.
Definition: bt_avrcp.h:109
int bt_avrcp_disconnect(struct bt_acl_state_s *bt_acl_state)
Bluetooth AVRCP disconnect Disconnect to peer device with AVRCP.
BT avrc track info type.
struct bt_avrcp_ops_s * bt_avrcp_ops
Definition: bt_avrcp.h:128
struct bt_hal_avrcp_ops_s * bt_hal_avrcp_ops
Definition: bt_avrcp.h:127
int bt_avrcp_connect(struct bt_acl_state_s *bt_acl_state)
Bluetooth AVRCP connect Connect to peer device with AVRCP.
Definition: bt_avrcp.h:77
BT address types.
Definition: bluetooth.h:120
BT_AVRCP_ROLE
AVRCP role.
Definition: bt_avrcp.h:67
Definition: bt_avrcp.h:69
uint8_t attrValue[48]
Definition: bt_avrcp.h:81
Definition: bt_avrcp.h:70
Bluetooth generic API.
struct bt_acl_state_s * bt_acl_state
Definition: bt_avrcp.h:126
BT_ADDR addr
Definition: bt_avrcp.h:78
uint16_t attrLen
Definition: bt_avrcp.h:80
uint16_t bt_avrcc_handle
Definition: bt_avrcp.h:124
bool bt_avrcp_is_supported(void)
Get AVRCP support or not support.
Bluetooth AVRCP application callbacks.
Definition: bt_avrcp.h:88
int bt_register_notification(struct bt_avrcp_notify_ops_s *bt_avrcp_notify_ops)
Bluetooth AVRCP Register notification Set callback about AVRCP notification.
BT_AVRCP_CMD_ID
AVRCP command list.
Definition: bt_avrcp_cmds.h:63
uint8_t attrId
Definition: bt_avrcp.h:79
struct bt_avrcp_notify_ops_s * bt_avrcp_notify_ops
Definition: bt_avrcp.h:129
BT_CONNECT_STATUS bt_avrct_connection
Definition: bt_avrcp.h:123
Bluetooth AVRCP context.
Definition: bt_avrcp.h:120
uint16_t bt_avrct_handle
Definition: bt_avrcp.h:125
BT_CONNECT_STATUS bt_avrcc_connection
Definition: bt_avrcp.h:122
BT_CONNECT_STATUS
BT profile connection status.
Definition: bt_common.h:61
Bluetooth AVRCP HAL callbacks.
Definition: bt_if.h:102
Bluetooth ACL context.
Definition: bt_common.h:89
BT_CMD_STATUS
BT hci command status.
Definition: bluetooth.h:138
int bt_avrcp_send_command(struct bt_acl_state_s *bt_acl_state, BT_AVRCP_CMD_ID cmd_id, bool press)
Bluetooth send AVRCP command Send command to target device.
Bluetooth common header for SDK on Spresense.
AVRCP command I/F.
int bt_avrcp_register_cb(struct bt_avrcp_ops_s *bt_avrcp_ops)
Bluetooth AVRCP Register connection status callback Set callback about AVRCP connection.