1 /** @file 2 * @brief Advance Audio Distribution Profile header. 3 */ 4 5 /* 6 * Copyright (c) 2015-2016 Intel Corporation 7 * 8 * SPDX-License-Identifier: Apache-2.0 9 */ 10 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_A2DP_H_ 11 #define ZEPHYR_INCLUDE_BLUETOOTH_A2DP_H_ 12 13 #include <bluetooth/avdtp.h> 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /** @brief Stream Structure */ 20 struct bt_a2dp_stream { 21 /* TODO */ 22 }; 23 24 /** @brief Codec ID */ 25 enum bt_a2dp_codec_id { 26 /** Codec SBC */ 27 BT_A2DP_SBC = 0x00, 28 /** Codec MPEG-1 */ 29 BT_A2DP_MPEG1 = 0x01, 30 /** Codec MPEG-2 */ 31 BT_A2DP_MPEG2 = 0x02, 32 /** Codec ATRAC */ 33 BT_A2DP_ATRAC = 0x04, 34 /** Codec Non-A2DP */ 35 BT_A2DP_VENDOR = 0xff 36 }; 37 38 /** @brief Preset for the endpoint */ 39 struct bt_a2dp_preset { 40 /** Length of preset */ 41 u8_t len; 42 /** Preset */ 43 u8_t preset[0]; 44 }; 45 46 /** @brief Stream End Point */ 47 struct bt_a2dp_endpoint { 48 /** Code ID */ 49 u8_t codec_id; 50 /** Stream End Point Information */ 51 struct bt_avdtp_seid_lsep info; 52 /** Pointer to preset codec chosen */ 53 struct bt_a2dp_preset *preset; 54 /** Capabilities */ 55 struct bt_a2dp_preset *caps; 56 }; 57 58 /** @brief Stream End Point Media Type */ 59 enum MEDIA_TYPE { 60 /** Audio Media Type */ 61 BT_A2DP_AUDIO = 0x00, 62 /** Video Media Type */ 63 BT_A2DP_VIDEO = 0x01, 64 /** Multimedia Media Type */ 65 BT_A2DP_MULTIMEDIA = 0x02 66 }; 67 68 /** @brief Stream End Point Role */ 69 enum ROLE_TYPE { 70 /** Source Role */ 71 BT_A2DP_SOURCE = 0, 72 /** Sink Role */ 73 BT_A2DP_SINK = 1 74 }; 75 76 /** @brief A2DP structure */ 77 struct bt_a2dp; 78 79 /** @brief A2DP Connect. 80 * 81 * This function is to be called after the conn parameter is obtained by 82 * performing a GAP procedure. The API is to be used to establish A2DP 83 * connection between devices. 84 * 85 * @param conn Pointer to bt_conn structure. 86 * 87 * @return pointer to struct bt_a2dp in case of success or NULL in case 88 * of error. 89 */ 90 struct bt_a2dp *bt_a2dp_connect(struct bt_conn *conn); 91 92 /** @brief Endpoint Registration. 93 * 94 * This function is used for registering the stream end points. The user has 95 * to take care of allocating the memory, the preset pointer and then pass the 96 * required arguments. Also, only one sep can be registered at a time. 97 * 98 * @param endpoint Pointer to bt_a2dp_endpoint structure. 99 * @param media_type Media type that the Endpoint is. 100 * @param role Role of Endpoint. 101 * 102 * @return 0 in case of success and error code in case of error. 103 */ 104 int bt_a2dp_register_endpoint(struct bt_a2dp_endpoint *endpoint, 105 u8_t media_type, u8_t role); 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_A2DP_H_ */ 112