mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: format the new source files
This commit is contained in:
parent
a849ce9942
commit
e132e95476
112
components/bt/bluedroid/bta/ar/bta_ar.c
Executable file → Normal file
112
components/bt/bluedroid/bta/ar/bta_ar.c
Executable file → Normal file
@ -46,12 +46,9 @@ tBTA_AR_CB bta_ar_cb;
|
||||
static UINT8 bta_ar_id(tBTA_SYS_ID sys_id)
|
||||
{
|
||||
UINT8 mask = 0;
|
||||
if (sys_id == BTA_ID_AV)
|
||||
{
|
||||
if (sys_id == BTA_ID_AV) {
|
||||
mask = BTA_AR_AV_MASK;
|
||||
}
|
||||
else if (sys_id == BTA_ID_AVK)
|
||||
{
|
||||
} else if (sys_id == BTA_ID_AVK) {
|
||||
mask = BTA_AR_AVK_MASK;
|
||||
}
|
||||
|
||||
@ -85,10 +82,12 @@ void bta_ar_init(void)
|
||||
static void bta_ar_avdt_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p_data)
|
||||
{
|
||||
/* route the AVDT registration callback to av or avk */
|
||||
if (bta_ar_cb.p_av_conn_cback)
|
||||
if (bta_ar_cb.p_av_conn_cback) {
|
||||
(*bta_ar_cb.p_av_conn_cback)(handle, bd_addr, event, p_data);
|
||||
if (bta_ar_cb.p_avk_conn_cback)
|
||||
}
|
||||
if (bta_ar_cb.p_avk_conn_cback) {
|
||||
(*bta_ar_cb.p_avk_conn_cback)(handle, bd_addr, event, p_data);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -104,27 +103,21 @@ void bta_ar_reg_avdt(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback, tBTA_SYS_ID sy
|
||||
{
|
||||
UINT8 mask = 0;
|
||||
|
||||
if (sys_id == BTA_ID_AV)
|
||||
{
|
||||
if (sys_id == BTA_ID_AV) {
|
||||
bta_ar_cb.p_av_conn_cback = p_cback;
|
||||
mask = BTA_AR_AV_MASK;
|
||||
}
|
||||
else if (sys_id == BTA_ID_AVK)
|
||||
{
|
||||
} else if (sys_id == BTA_ID_AVK) {
|
||||
bta_ar_cb.p_avk_conn_cback = p_cback;
|
||||
mask = BTA_AR_AVK_MASK;
|
||||
}
|
||||
#if (BTA_AR_DEBUG == TRUE)
|
||||
else
|
||||
{
|
||||
else {
|
||||
APPL_TRACE_ERROR("bta_ar_reg_avdt: the registration is from wrong sys_id:%d", sys_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mask)
|
||||
{
|
||||
if (bta_ar_cb.avdt_registered == 0)
|
||||
{
|
||||
if (mask) {
|
||||
if (bta_ar_cb.avdt_registered == 0) {
|
||||
AVDT_Register(p_reg, bta_ar_avdt_cback);
|
||||
}
|
||||
bta_ar_cb.avdt_registered |= mask;
|
||||
@ -144,20 +137,18 @@ void bta_ar_dereg_avdt(tBTA_SYS_ID sys_id)
|
||||
{
|
||||
UINT8 mask = 0;
|
||||
|
||||
if (sys_id == BTA_ID_AV)
|
||||
{
|
||||
if (sys_id == BTA_ID_AV) {
|
||||
bta_ar_cb.p_av_conn_cback = NULL;
|
||||
mask = BTA_AR_AV_MASK;
|
||||
}
|
||||
else if (sys_id == BTA_ID_AVK)
|
||||
{
|
||||
} else if (sys_id == BTA_ID_AVK) {
|
||||
bta_ar_cb.p_avk_conn_cback = NULL;
|
||||
mask = BTA_AR_AVK_MASK;
|
||||
}
|
||||
bta_ar_cb.avdt_registered &= ~mask;
|
||||
|
||||
if (bta_ar_cb.avdt_registered == 0)
|
||||
if (bta_ar_cb.avdt_registered == 0) {
|
||||
AVDT_Deregister();
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -177,17 +168,12 @@ void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, BD_ADDR bd_addr)
|
||||
UINT8 event = BTA_AR_AVDT_CONN_EVT;
|
||||
tAVDT_CTRL data;
|
||||
|
||||
if (sys_id == BTA_ID_AV)
|
||||
{
|
||||
if (bta_ar_cb.p_avk_conn_cback)
|
||||
{
|
||||
if (sys_id == BTA_ID_AV) {
|
||||
if (bta_ar_cb.p_avk_conn_cback) {
|
||||
(*bta_ar_cb.p_avk_conn_cback)(0, bd_addr, event, &data);
|
||||
}
|
||||
}
|
||||
else if (sys_id == BTA_ID_AVK)
|
||||
{
|
||||
if (bta_ar_cb.p_av_conn_cback)
|
||||
{
|
||||
} else if (sys_id == BTA_ID_AVK) {
|
||||
if (bta_ar_cb.p_av_conn_cback) {
|
||||
(*bta_ar_cb.p_av_conn_cback)(0, bd_addr, event, &data);
|
||||
}
|
||||
}
|
||||
@ -206,10 +192,8 @@ void bta_ar_reg_avct(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask, tBTA_SYS_ID sys_
|
||||
{
|
||||
UINT8 mask = bta_ar_id (sys_id);
|
||||
|
||||
if (mask)
|
||||
{
|
||||
if (bta_ar_cb.avct_registered == 0)
|
||||
{
|
||||
if (mask) {
|
||||
if (bta_ar_cb.avct_registered == 0) {
|
||||
AVCT_Register(mtu, mtu_br, sec_mask);
|
||||
}
|
||||
bta_ar_cb.avct_registered |= mask;
|
||||
@ -231,8 +215,9 @@ void bta_ar_dereg_avct(tBTA_SYS_ID sys_id)
|
||||
|
||||
bta_ar_cb.avct_registered &= ~mask;
|
||||
|
||||
if (bta_ar_cb.avct_registered == 0)
|
||||
if (bta_ar_cb.avct_registered == 0) {
|
||||
AVCT_Deregister();
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@ -250,13 +235,12 @@ void bta_ar_reg_avrc(UINT16 service_uuid, char *service_name, char *provider_nam
|
||||
UINT8 mask = bta_ar_id (sys_id);
|
||||
UINT8 temp[8], *p;
|
||||
|
||||
if (!mask || !categories)
|
||||
if (!mask || !categories) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET)
|
||||
{
|
||||
if (bta_ar_cb.sdp_tg_handle == 0)
|
||||
{
|
||||
if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET) {
|
||||
if (bta_ar_cb.sdp_tg_handle == 0) {
|
||||
bta_ar_cb.tg_registered = mask;
|
||||
bta_ar_cb.sdp_tg_handle = SDP_CreateRecord();
|
||||
AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_tg_handle);
|
||||
@ -264,25 +248,20 @@ void bta_ar_reg_avrc(UINT16 service_uuid, char *service_name, char *provider_nam
|
||||
}
|
||||
/* only one TG is allowed (first-come, first-served).
|
||||
* If sdp_tg_handle is non-0, ignore this request */
|
||||
}
|
||||
else if ((service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL) || (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_CONTROL))
|
||||
{
|
||||
} else if ((service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL) || (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_CONTROL)) {
|
||||
bta_ar_cb.ct_categories [mask - 1] = categories;
|
||||
categories = bta_ar_cb.ct_categories[0]|bta_ar_cb.ct_categories[1];
|
||||
if (bta_ar_cb.sdp_ct_handle == 0)
|
||||
{
|
||||
categories = bta_ar_cb.ct_categories[0] | bta_ar_cb.ct_categories[1];
|
||||
if (bta_ar_cb.sdp_ct_handle == 0) {
|
||||
bta_ar_cb.sdp_ct_handle = SDP_CreateRecord();
|
||||
AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_ct_handle);
|
||||
bta_sys_add_uuid(service_uuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* multiple CTs are allowed.
|
||||
* Change supported categories on the second one */
|
||||
p = temp;
|
||||
UINT16_TO_BE_STREAM(p, categories);
|
||||
SDP_AddAttribute(bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
|
||||
(UINT32)2, (UINT8*)temp);
|
||||
(UINT32)2, (UINT8 *)temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,39 +281,32 @@ void bta_ar_dereg_avrc(UINT16 service_uuid, tBTA_SYS_ID sys_id)
|
||||
UINT16 categories = 0;
|
||||
UINT8 temp[8], *p;
|
||||
|
||||
if (!mask)
|
||||
if (!mask) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET)
|
||||
{
|
||||
if (bta_ar_cb.sdp_tg_handle && mask == bta_ar_cb.tg_registered)
|
||||
{
|
||||
if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET) {
|
||||
if (bta_ar_cb.sdp_tg_handle && mask == bta_ar_cb.tg_registered) {
|
||||
bta_ar_cb.tg_registered = 0;
|
||||
SDP_DeleteRecord(bta_ar_cb.sdp_tg_handle);
|
||||
bta_ar_cb.sdp_tg_handle = 0;
|
||||
bta_sys_remove_uuid(service_uuid);
|
||||
}
|
||||
}
|
||||
else if (service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL)
|
||||
{
|
||||
if (bta_ar_cb.sdp_ct_handle)
|
||||
{
|
||||
} else if (service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL) {
|
||||
if (bta_ar_cb.sdp_ct_handle) {
|
||||
bta_ar_cb.ct_categories [mask - 1] = 0;
|
||||
categories = bta_ar_cb.ct_categories[0]|bta_ar_cb.ct_categories[1];
|
||||
if (!categories)
|
||||
{
|
||||
categories = bta_ar_cb.ct_categories[0] | bta_ar_cb.ct_categories[1];
|
||||
if (!categories) {
|
||||
/* no CT is still registered - cleaup */
|
||||
SDP_DeleteRecord(bta_ar_cb.sdp_ct_handle);
|
||||
bta_ar_cb.sdp_ct_handle = 0;
|
||||
bta_sys_remove_uuid(service_uuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* change supported categories to the remaning one */
|
||||
p = temp;
|
||||
UINT16_TO_BE_STREAM(p, categories);
|
||||
SDP_AddAttribute(bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
|
||||
(UINT32)2, (UINT8*)temp);
|
||||
(UINT32)2, (UINT8 *)temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
components/bt/bluedroid/bta/ar/bta_ar_int.h
Executable file → Normal file
3
components/bt/bluedroid/bta/ar/bta_ar_int.h
Executable file → Normal file
@ -36,8 +36,7 @@
|
||||
#define BTA_AR_AVK_MASK 0x02
|
||||
|
||||
/* data associated with BTA_AR */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVDT_CTRL_CBACK *p_av_conn_cback; /* av connection callback function */
|
||||
tAVDT_CTRL_CBACK *p_avk_conn_cback; /* avk connection callback function */
|
||||
UINT8 avdt_registered;
|
||||
|
857
components/bt/bluedroid/bta/av/bta_av_aact.c
Executable file → Normal file
857
components/bt/bluedroid/bta/av/bta_av_aact.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
716
components/bt/bluedroid/bta/av/bta_av_act.c
Executable file → Normal file
716
components/bt/bluedroid/bta/av/bta_av_act.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
105
components/bt/bluedroid/bta/av/bta_av_api.c
Executable file → Normal file
105
components/bt/bluedroid/bta/av/bta_av_api.c
Executable file → Normal file
@ -38,8 +38,7 @@
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
static const tBTA_SYS_REG bta_av_reg =
|
||||
{
|
||||
static const tBTA_SYS_REG bta_av_reg = {
|
||||
bta_av_hdl_event,
|
||||
BTA_AvDisable
|
||||
};
|
||||
@ -64,8 +63,7 @@ void BTA_AvEnable(tBTA_SEC sec_mask, tBTA_AV_FEAT features, tBTA_AV_CBACK *p_cba
|
||||
/* register with BTA system manager */
|
||||
bta_sys_register(BTA_ID_AV, &bta_av_reg);
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_ENABLE *) GKI_getbuf(sizeof(tBTA_AV_API_ENABLE))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_ENABLE *) GKI_getbuf(sizeof(tBTA_AV_API_ENABLE))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_ENABLE_EVT;
|
||||
p_buf->p_cback = p_cback;
|
||||
p_buf->features = features;
|
||||
@ -88,8 +86,7 @@ void BTA_AvDisable(void)
|
||||
BT_HDR *p_buf;
|
||||
|
||||
bta_sys_deregister(BTA_ID_AV);
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
|
||||
p_buf->event = BTA_AV_API_DISABLE_EVT;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
@ -113,17 +110,13 @@ void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name, UINT8 app_id,
|
||||
tBTA_AV_API_REG *p_buf;
|
||||
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_REG *) GKI_getbuf(sizeof(tBTA_AV_API_REG))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_REG *) GKI_getbuf(sizeof(tBTA_AV_API_REG))) != NULL) {
|
||||
p_buf->hdr.layer_specific = chnl;
|
||||
p_buf->hdr.event = BTA_AV_API_REGISTER_EVT;
|
||||
if(p_service_name)
|
||||
{
|
||||
if (p_service_name) {
|
||||
BCM_STRNCPY_S(p_buf->p_service_name, sizeof(p_buf->p_service_name), p_service_name, BTA_SERVICE_NAME_LEN);
|
||||
p_buf->p_service_name[BTA_SERVICE_NAME_LEN-1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_buf->p_service_name[BTA_SERVICE_NAME_LEN - 1] = 0;
|
||||
} else {
|
||||
p_buf->p_service_name[0] = 0;
|
||||
}
|
||||
p_buf->app_id = app_id;
|
||||
@ -146,8 +139,7 @@ void BTA_AvDeregister(tBTA_AV_HNDL hndl)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
|
||||
p_buf->layer_specific = hndl;
|
||||
p_buf->event = BTA_AV_API_DEREGISTER_EVT;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
@ -170,8 +162,7 @@ void BTA_AvOpen(BD_ADDR bd_addr, tBTA_AV_HNDL handle, BOOLEAN use_rc, tBTA_SEC s
|
||||
{
|
||||
tBTA_AV_API_OPEN *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_OPEN *) GKI_getbuf(sizeof(tBTA_AV_API_OPEN))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_OPEN *) GKI_getbuf(sizeof(tBTA_AV_API_OPEN))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_OPEN_EVT;
|
||||
p_buf->hdr.layer_specific = handle;
|
||||
bdcpy(p_buf->bd_addr, bd_addr);
|
||||
@ -196,8 +187,7 @@ void BTA_AvClose(tBTA_AV_HNDL handle)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
|
||||
p_buf->event = BTA_AV_API_CLOSE_EVT;
|
||||
p_buf->layer_specific = handle;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
@ -217,8 +207,7 @@ void BTA_AvDisconnect(BD_ADDR bd_addr)
|
||||
{
|
||||
tBTA_AV_API_DISCNT *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_DISCNT *) GKI_getbuf(sizeof(tBTA_AV_API_DISCNT))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_DISCNT *) GKI_getbuf(sizeof(tBTA_AV_API_DISCNT))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_DISCONNECT_EVT;
|
||||
bdcpy(p_buf->bd_addr, bd_addr);
|
||||
bta_sys_sendmsg(p_buf);
|
||||
@ -238,8 +227,7 @@ void BTA_AvStart(void)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
|
||||
p_buf->event = BTA_AV_API_START_EVT;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
@ -258,8 +246,7 @@ void BTA_AvEnable_Sink(int enable)
|
||||
{
|
||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||
BT_HDR *p_buf;
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
|
||||
p_buf->event = BTA_AV_API_SINK_ENABLE_EVT;
|
||||
p_buf->layer_specific = enable;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
@ -284,8 +271,7 @@ void BTA_AvStop(BOOLEAN suspend)
|
||||
{
|
||||
tBTA_AV_API_STOP *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_STOP *) GKI_getbuf(sizeof(tBTA_AV_API_STOP))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_STOP *) GKI_getbuf(sizeof(tBTA_AV_API_STOP))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_STOP_EVT;
|
||||
p_buf->flush = TRUE;
|
||||
p_buf->suspend = suspend;
|
||||
@ -311,8 +297,7 @@ void BTA_AvReconfig(tBTA_AV_HNDL hndl, BOOLEAN suspend, UINT8 sep_info_idx,
|
||||
{
|
||||
tBTA_AV_API_RCFG *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_RCFG *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_RCFG) + num_protect))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_RCFG *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_RCFG) + num_protect))) != NULL) {
|
||||
p_buf->hdr.layer_specific = hndl;
|
||||
p_buf->hdr.event = BTA_AV_API_RECONFIG_EVT;
|
||||
p_buf->num_protect = num_protect;
|
||||
@ -339,17 +324,13 @@ void BTA_AvProtectReq(tBTA_AV_HNDL hndl, UINT8 *p_data, UINT16 len)
|
||||
{
|
||||
tBTA_AV_API_PROTECT_REQ *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_PROTECT_REQ *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_PROTECT_REQ) + len))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_PROTECT_REQ *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_PROTECT_REQ) + len))) != NULL) {
|
||||
p_buf->hdr.layer_specific = hndl;
|
||||
p_buf->hdr.event = BTA_AV_API_PROTECT_REQ_EVT;
|
||||
p_buf->len = len;
|
||||
if (p_data == NULL)
|
||||
{
|
||||
if (p_data == NULL) {
|
||||
p_buf->p_data = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_buf->p_data = (UINT8 *) (p_buf + 1);
|
||||
memcpy(p_buf->p_data, p_data, len);
|
||||
}
|
||||
@ -373,18 +354,14 @@ void BTA_AvProtectRsp(tBTA_AV_HNDL hndl, UINT8 error_code, UINT8 *p_data, UINT16
|
||||
{
|
||||
tBTA_AV_API_PROTECT_RSP *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_PROTECT_RSP *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_PROTECT_RSP) + len))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_PROTECT_RSP *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_PROTECT_RSP) + len))) != NULL) {
|
||||
p_buf->hdr.layer_specific = hndl;
|
||||
p_buf->hdr.event = BTA_AV_API_PROTECT_RSP_EVT;
|
||||
p_buf->len = len;
|
||||
p_buf->error_code = error_code;
|
||||
if (p_data == NULL)
|
||||
{
|
||||
if (p_data == NULL) {
|
||||
p_buf->p_data = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_buf->p_data = (UINT8 *) (p_buf + 1);
|
||||
memcpy(p_buf->p_data, p_data, len);
|
||||
}
|
||||
@ -406,8 +383,7 @@ void BTA_AvRemoteCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_RC rc_id, tBTA_AV_STA
|
||||
{
|
||||
tBTA_AV_API_REMOTE_CMD *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_REMOTE_CMD *) GKI_getbuf(sizeof(tBTA_AV_API_REMOTE_CMD))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_REMOTE_CMD *) GKI_getbuf(sizeof(tBTA_AV_API_REMOTE_CMD))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_REMOTE_CMD_EVT;
|
||||
p_buf->hdr.layer_specific = rc_handle;
|
||||
p_buf->msg.op_id = rc_id;
|
||||
@ -434,8 +410,7 @@ void BTA_AvVendorCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE cmd_code, UINT8
|
||||
{
|
||||
tBTA_AV_API_VENDOR *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_VENDOR *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_VENDOR) + len))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_VENDOR *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_VENDOR) + len))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_VENDOR_CMD_EVT;
|
||||
p_buf->hdr.layer_specific = rc_handle;
|
||||
p_buf->msg.hdr.ctype = cmd_code;
|
||||
@ -444,12 +419,9 @@ void BTA_AvVendorCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE cmd_code, UINT8
|
||||
p_buf->msg.company_id = p_bta_av_cfg->company_id;
|
||||
p_buf->label = label;
|
||||
p_buf->msg.vendor_len = len;
|
||||
if (p_data == NULL)
|
||||
{
|
||||
if (p_data == NULL) {
|
||||
p_buf->msg.p_vendor_data = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_buf->msg.p_vendor_data = (UINT8 *) (p_buf + 1);
|
||||
memcpy(p_buf->msg.p_vendor_data, p_data, len);
|
||||
}
|
||||
@ -473,25 +445,22 @@ void BTA_AvVendorRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code, UINT8
|
||||
{
|
||||
tBTA_AV_API_VENDOR *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_VENDOR *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_VENDOR) + len))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_VENDOR *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_VENDOR) + len))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_VENDOR_RSP_EVT;
|
||||
p_buf->hdr.layer_specific = rc_handle;
|
||||
p_buf->msg.hdr.ctype = rsp_code;
|
||||
p_buf->msg.hdr.subunit_type = AVRC_SUB_PANEL;
|
||||
p_buf->msg.hdr.subunit_id = 0;
|
||||
if(company_id)
|
||||
if (company_id) {
|
||||
p_buf->msg.company_id = company_id;
|
||||
else
|
||||
} else {
|
||||
p_buf->msg.company_id = p_bta_av_cfg->company_id;
|
||||
}
|
||||
p_buf->label = label;
|
||||
p_buf->msg.vendor_len = len;
|
||||
if (p_data == NULL)
|
||||
{
|
||||
if (p_data == NULL) {
|
||||
p_buf->msg.p_vendor_data = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_buf->msg.p_vendor_data = (UINT8 *) (p_buf + 1);
|
||||
memcpy(p_buf->msg.p_vendor_data, p_data, len);
|
||||
}
|
||||
@ -513,8 +482,7 @@ void BTA_AvOpenRc(tBTA_AV_HNDL handle)
|
||||
{
|
||||
tBTA_AV_API_OPEN_RC *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_OPEN_RC *) GKI_getbuf(sizeof(tBTA_AV_API_OPEN_RC))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_OPEN_RC *) GKI_getbuf(sizeof(tBTA_AV_API_OPEN_RC))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_RC_OPEN_EVT;
|
||||
p_buf->hdr.layer_specific = handle;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
@ -534,8 +502,7 @@ void BTA_AvCloseRc(UINT8 rc_handle)
|
||||
{
|
||||
tBTA_AV_API_CLOSE_RC *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_CLOSE_RC *) GKI_getbuf(sizeof(tBTA_AV_API_CLOSE_RC))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_CLOSE_RC *) GKI_getbuf(sizeof(tBTA_AV_API_CLOSE_RC))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_RC_CLOSE_EVT;
|
||||
p_buf->hdr.layer_specific = rc_handle;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
@ -559,8 +526,7 @@ void BTA_AvMetaRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code,
|
||||
{
|
||||
tBTA_AV_API_META_RSP *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_META_RSP *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_META_RSP)))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_META_RSP *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_META_RSP)))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_META_RSP_EVT;
|
||||
p_buf->hdr.layer_specific = rc_handle;
|
||||
p_buf->rsp_code = rsp_code;
|
||||
@ -592,8 +558,7 @@ void BTA_AvMetaCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CMD cmd_code, BT_HDR *p
|
||||
{
|
||||
tBTA_AV_API_META_RSP *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_API_META_RSP *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_META_RSP)))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_API_META_RSP *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_API_META_RSP)))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AV_API_META_RSP_EVT;
|
||||
p_buf->hdr.layer_specific = rc_handle;
|
||||
p_buf->p_pkt = p_pkt;
|
||||
|
9
components/bt/bluedroid/bta/av/bta_av_cfg.c
Executable file → Normal file
9
components/bt/bluedroid/bta/av/bta_av_cfg.c
Executable file → Normal file
@ -88,8 +88,7 @@ const UINT8 bta_av_meta_caps_evt_ids[] = {
|
||||
#define BTA_AV_MAX_RC_BR_MTU 1008
|
||||
#endif
|
||||
|
||||
const tBTA_AV_CFG bta_av_cfg =
|
||||
{
|
||||
const tBTA_AV_CFG bta_av_cfg = {
|
||||
AVRC_CO_BROADCOM, /* AVRCP Company ID */
|
||||
#if AVRC_METADATA_INCLUDED == TRUE
|
||||
512, /* AVRCP MTU at L2CAP for control channel */
|
||||
@ -119,8 +118,7 @@ const tBTA_AV_CFG bta_av_cfg =
|
||||
|
||||
tBTA_AV_CFG *p_bta_av_cfg = (tBTA_AV_CFG *) &bta_av_cfg;
|
||||
|
||||
const UINT16 bta_av_rc_id[] =
|
||||
{
|
||||
const UINT16 bta_av_rc_id[] = {
|
||||
0x0000, /* bit mask: 0=SELECT, 1=UP, 2=DOWN, 3=LEFT,
|
||||
4=RIGHT, 5=RIGHT_UP, 6=RIGHT_DOWN, 7=LEFT_UP,
|
||||
8=LEFT_DOWN, 9=ROOT_MENU, 10=SETUP_MENU, 11=CONT_MENU,
|
||||
@ -168,8 +166,7 @@ const UINT16 bta_av_rc_id[] =
|
||||
};
|
||||
|
||||
#if (BTA_AV_RC_PASS_RSP_CODE == BTA_AV_RSP_INTERIM)
|
||||
const UINT16 bta_av_rc_id_ac[] =
|
||||
{
|
||||
const UINT16 bta_av_rc_id_ac[] = {
|
||||
0x0000, /* bit mask: 0=SELECT, 1=UP, 2=DOWN, 3=LEFT,
|
||||
4=RIGHT, 5=RIGHT_UP, 6=RIGHT_DOWN, 7=LEFT_UP,
|
||||
8=LEFT_DOWN, 9=ROOT_MENU, 10=SETUP_MENU, 11=CONT_MENU,
|
||||
|
15
components/bt/bluedroid/bta/av/bta_av_ci.c
Executable file → Normal file
15
components/bt/bluedroid/bta/av/bta_av_ci.c
Executable file → Normal file
@ -48,8 +48,7 @@ void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
|
||||
p_buf->layer_specific = chnl;
|
||||
p_buf->event = BTA_AV_CI_SRC_DATA_READY_EVT;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
@ -74,8 +73,7 @@ void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, UINT8 err_code, UINT8 category,
|
||||
{
|
||||
tBTA_AV_CI_SETCONFIG *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AV_CI_SETCONFIG *) GKI_getbuf(sizeof(tBTA_AV_CI_SETCONFIG))) != NULL)
|
||||
{
|
||||
if ((p_buf = (tBTA_AV_CI_SETCONFIG *) GKI_getbuf(sizeof(tBTA_AV_CI_SETCONFIG))) != NULL) {
|
||||
p_buf->hdr.layer_specific = hndl;
|
||||
p_buf->hdr.event = (err_code == AVDT_SUCCESS) ?
|
||||
BTA_AV_CI_SETCONFIG_OK_EVT : BTA_AV_CI_SETCONFIG_FAIL_EVT;
|
||||
@ -83,14 +81,11 @@ void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, UINT8 err_code, UINT8 category,
|
||||
p_buf->category = category;
|
||||
p_buf->recfg_needed = recfg_needed;
|
||||
p_buf->num_seid = num_seid;
|
||||
p_buf->avdt_handle= avdt_handle;
|
||||
if(p_seid && num_seid)
|
||||
{
|
||||
p_buf->avdt_handle = avdt_handle;
|
||||
if (p_seid && num_seid) {
|
||||
p_buf->p_seid = (UINT8 *)(p_buf + 1);
|
||||
memcpy(p_buf->p_seid, p_seid, num_seid);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_buf->p_seid = NULL;
|
||||
p_buf->num_seid = 0;
|
||||
}
|
||||
|
107
components/bt/bluedroid/bta/av/bta_av_int.h
Executable file → Normal file
107
components/bt/bluedroid/bta/av/bta_av_int.h
Executable file → Normal file
@ -36,8 +36,7 @@
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
/* these events are handled by the AV main state machine */
|
||||
BTA_AV_API_DISABLE_EVT = BTA_SYS_EVT_START(BTA_ID_AV),
|
||||
BTA_AV_API_REMOTE_CMD_EVT,
|
||||
@ -173,15 +172,14 @@ typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
|
||||
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
|
||||
UINT16 mtu);
|
||||
typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
|
||||
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
|
||||
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
|
||||
typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
|
||||
typedef void * (*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
|
||||
typedef void *(*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
|
||||
UINT32 *p_len, UINT32 *p_timestamp);
|
||||
typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
|
||||
|
||||
/* the call-out functions for one stream */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CO_INIT init;
|
||||
tBTA_AV_CO_DISC_RES disc_res;
|
||||
tBTA_AV_CO_GETCFG getcfg;
|
||||
@ -196,8 +194,7 @@ typedef struct
|
||||
#endif
|
||||
|
||||
/* data type for BTA_AV_API_ENABLE_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_AV_CBACK *p_cback;
|
||||
tBTA_AV_FEAT features;
|
||||
@ -205,18 +202,16 @@ typedef struct
|
||||
} tBTA_AV_API_ENABLE;
|
||||
|
||||
/* data type for BTA_AV_API_REG_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
char p_service_name[BTA_SERVICE_NAME_LEN+1];
|
||||
char p_service_name[BTA_SERVICE_NAME_LEN + 1];
|
||||
UINT8 app_id;
|
||||
tBTA_AV_DATA_CBACK *p_app_data_cback;
|
||||
tBTA_AV_CO_FUNCTS *bta_av_cos;
|
||||
} tBTA_AV_API_REG;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
BTA_AV_RS_NONE, /* straight API call */
|
||||
BTA_AV_RS_OK, /* the role switch result - successful */
|
||||
BTA_AV_RS_FAIL, /* the role switch result - failed */
|
||||
@ -224,8 +219,7 @@ enum
|
||||
};
|
||||
typedef UINT8 tBTA_AV_RS_RES;
|
||||
/* data type for BTA_AV_API_OPEN_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
BOOLEAN use_rc;
|
||||
@ -235,31 +229,27 @@ typedef struct
|
||||
} tBTA_AV_API_OPEN;
|
||||
|
||||
/* data type for BTA_AV_API_STOP_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BOOLEAN suspend;
|
||||
BOOLEAN flush;
|
||||
} tBTA_AV_API_STOP;
|
||||
|
||||
/* data type for BTA_AV_API_DISCONNECT_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
} tBTA_AV_API_DISCNT;
|
||||
|
||||
/* data type for BTA_AV_API_PROTECT_REQ_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
} tBTA_AV_API_PROTECT_REQ;
|
||||
|
||||
/* data type for BTA_AV_API_PROTECT_RSP_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
@ -267,36 +257,31 @@ typedef struct
|
||||
} tBTA_AV_API_PROTECT_RSP;
|
||||
|
||||
/* data type for BTA_AV_API_REMOTE_CMD_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tAVRC_MSG_PASS msg;
|
||||
UINT8 label;
|
||||
} tBTA_AV_API_REMOTE_CMD;
|
||||
|
||||
/* data type for BTA_AV_API_VENDOR_CMD_EVT and RSP */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tAVRC_MSG_VENDOR msg;
|
||||
UINT8 label;
|
||||
} tBTA_AV_API_VENDOR;
|
||||
|
||||
/* data type for BTA_AV_API_RC_OPEN_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_AV_API_OPEN_RC;
|
||||
|
||||
/* data type for BTA_AV_API_RC_CLOSE_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_AV_API_CLOSE_RC;
|
||||
|
||||
/* data type for BTA_AV_API_META_RSP_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BOOLEAN is_rsp;
|
||||
UINT8 label;
|
||||
@ -306,8 +291,7 @@ typedef struct
|
||||
|
||||
|
||||
/* data type for BTA_AV_API_RECONFIG_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 codec_info[AVDT_CODEC_SIZE]; /* codec configuration */
|
||||
UINT8 *p_protect_info;
|
||||
@ -317,8 +301,7 @@ typedef struct
|
||||
} tBTA_AV_API_RCFG;
|
||||
|
||||
/* data type for BTA_AV_CI_SETCONFIG_OK_EVT and BTA_AV_CI_SETCONFIG_FAIL_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_AV_HNDL hndl;
|
||||
UINT8 err_code;
|
||||
@ -341,8 +324,7 @@ typedef struct {
|
||||
} tBTA_AV_STR_MSG;
|
||||
|
||||
/* data type for BTA_AV_AVRC_MSG_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tAVRC_MSG msg;
|
||||
UINT8 handle;
|
||||
@ -351,39 +333,34 @@ typedef struct
|
||||
} tBTA_AV_RC_MSG;
|
||||
|
||||
/* data type for BTA_AV_AVRC_OPEN_EVT, BTA_AV_AVRC_CLOSE_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR peer_addr;
|
||||
UINT8 handle;
|
||||
} tBTA_AV_RC_CONN_CHG;
|
||||
|
||||
/* data type for BTA_AV_CONN_CHG_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR peer_addr;
|
||||
BOOLEAN is_up;
|
||||
} tBTA_AV_CONN_CHG;
|
||||
|
||||
/* data type for BTA_AV_ROLE_CHANGE_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 new_role;
|
||||
UINT8 hci_status;
|
||||
} tBTA_AV_ROLE_RES;
|
||||
|
||||
/* data type for BTA_AV_SDP_DISC_OK_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 avdt_version; /* AVDTP protocol version */
|
||||
} tBTA_AV_SDP_RES;
|
||||
|
||||
/* type for SEP control block */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 av_handle; /* AVDTP handle */
|
||||
tBTA_AV_CODEC codec_type; /* codec type */
|
||||
UINT8 tsep; /* SEP type of local SEP */
|
||||
@ -403,8 +380,7 @@ typedef struct
|
||||
#define BTA_AV_ROLE_SUSPEND_OPT 0x40 /* Suspend on Start option is set */
|
||||
|
||||
/* union of all event datatypes */
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
BT_HDR hdr;
|
||||
tBTA_AV_API_ENABLE api_enable;
|
||||
tBTA_AV_API_REG api_reg;
|
||||
@ -428,8 +404,7 @@ typedef union
|
||||
|
||||
typedef void (tBTA_AV_VDP_DATA_ACT)(void *p_scb);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_VDP_DATA_ACT *p_act;
|
||||
UINT8 *p_frame;
|
||||
UINT16 buf_size;
|
||||
@ -438,8 +413,7 @@ typedef struct
|
||||
UINT32 timestamp;
|
||||
} tBTA_AV_VF_INFO;
|
||||
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
tBTA_AV_VF_INFO vdp; /* used for video channels only */
|
||||
tBTA_AV_API_OPEN open; /* used only before open and role switch
|
||||
is needed on another AV channel */
|
||||
@ -465,8 +439,7 @@ typedef union
|
||||
#define BTA_AV_COLL_API_CALLED 0x02 /* API open was called while incoming timer is running */
|
||||
|
||||
/* type for AV stream control block */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
const tBTA_AV_ACT *p_act_tbl; /* the action table for stream state machine */
|
||||
const tBTA_AV_CO_FUNCTS *p_cos; /* the associated callout functions */
|
||||
tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
|
||||
@ -528,8 +501,7 @@ typedef struct
|
||||
|
||||
/* type for AV RCP control block */
|
||||
/* index to this control block is the rc handle */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 status;
|
||||
UINT8 handle;
|
||||
UINT8 shdl; /* stream handle (hdi + 1) */
|
||||
@ -538,15 +510,13 @@ typedef struct
|
||||
} tBTA_AV_RCB;
|
||||
#define BTA_AV_NUM_RCB (BTA_AV_NUM_STRS + 2)
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
BTA_AV_LCB_FREE,
|
||||
BTA_AV_LCB_FIND
|
||||
};
|
||||
|
||||
/* type for AV ACL Link control block */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BD_ADDR addr; /* peer BD address */
|
||||
UINT8 conn_msk; /* handle mask of connected stream handle */
|
||||
UINT8 lidx; /* index + 1 */
|
||||
@ -557,13 +527,12 @@ typedef void (*tBTA_AV_SACT)(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
|
||||
|
||||
/* type for AV control block */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_SCB *p_scb[BTA_AV_NUM_STRS]; /* stream control block */
|
||||
tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
|
||||
tBTA_AV_CBACK *p_cback; /* application callback function */
|
||||
tBTA_AV_RCB rcb[BTA_AV_NUM_RCB]; /* RCB control block */
|
||||
tBTA_AV_LCB lcb[BTA_AV_NUM_LINKS+1]; /* link control block */
|
||||
tBTA_AV_LCB lcb[BTA_AV_NUM_LINKS + 1]; /* link control block */
|
||||
TIMER_LIST_ENT sig_tmr; /* link timer */
|
||||
TIMER_LIST_ENT acp_sig_tmr; /* timer to monitor signalling when accepting */
|
||||
UINT32 sdp_a2d_handle; /* SDP record handle for audio src */
|
||||
@ -616,7 +585,7 @@ extern UINT16 *p_bta_av_rc_id_ac;
|
||||
extern const tBTA_AV_SACT bta_av_a2d_action[];
|
||||
// extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos;
|
||||
extern const tBTA_AV_SACT bta_av_vdp_action[];
|
||||
extern tAVDT_CTRL_CBACK * const bta_av_dt_cback[];
|
||||
extern tAVDT_CTRL_CBACK *const bta_av_dt_cback[];
|
||||
extern void bta_av_stream_data_cback(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp, UINT8 m_pt);
|
||||
|
||||
/*****************************************************************************
|
||||
@ -635,7 +604,7 @@ extern BOOLEAN bta_av_is_scb_incoming (tBTA_AV_SCB *p_scb);
|
||||
extern void bta_av_set_scb_sst_init (tBTA_AV_SCB *p_scb);
|
||||
extern BOOLEAN bta_av_is_scb_init (tBTA_AV_SCB *p_scb);
|
||||
extern void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb);
|
||||
extern tBTA_AV_LCB * bta_av_find_lcb(BD_ADDR addr, UINT8 op);
|
||||
extern tBTA_AV_LCB *bta_av_find_lcb(BD_ADDR addr, UINT8 op);
|
||||
|
||||
|
||||
/* main functions */
|
||||
@ -673,7 +642,7 @@ extern void bta_av_rc_meta_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_free_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_free_msg (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
|
||||
extern tBTA_AV_RCB * bta_av_get_rcb_by_shdl(UINT8 shdl);
|
||||
extern tBTA_AV_RCB *bta_av_get_rcb_by_shdl(UINT8 shdl);
|
||||
extern void bta_av_del_rc(tBTA_AV_RCB *p_rcb);
|
||||
|
||||
/* ssm action functions */
|
||||
|
409
components/bt/bluedroid/bta/av/bta_av_main.c
Executable file → Normal file
409
components/bt/bluedroid/bta/av/bta_av_main.c
Executable file → Normal file
@ -65,15 +65,13 @@
|
||||
#endif
|
||||
|
||||
/* state machine states */
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
BTA_AV_INIT_ST,
|
||||
BTA_AV_OPEN_ST
|
||||
};
|
||||
|
||||
/* state machine action enumeration list */
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
BTA_AV_DISABLE,
|
||||
BTA_AV_RC_OPENED,
|
||||
BTA_AV_RC_REMOTE_CMD,
|
||||
@ -93,8 +91,7 @@ enum
|
||||
typedef void (*tBTA_AV_ACTION)(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
|
||||
/* action functions */
|
||||
const tBTA_AV_ACTION bta_av_action[] =
|
||||
{
|
||||
const tBTA_AV_ACTION bta_av_action[] = {
|
||||
bta_av_disable,
|
||||
bta_av_rc_opened,
|
||||
bta_av_rc_remote_cmd,
|
||||
@ -114,41 +111,38 @@ const tBTA_AV_ACTION bta_av_action[] =
|
||||
#define BTA_AV_NUM_COLS 2 /* number of columns in state tables */
|
||||
|
||||
/* state table for init state */
|
||||
static const UINT8 bta_av_st_init[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Next state */
|
||||
/* API_DISABLE_EVT */ {BTA_AV_DISABLE, BTA_AV_INIT_ST },
|
||||
/* API_REMOTE_CMD_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* API_VENDOR_CMD_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* API_VENDOR_RSP_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* API_META_RSP_EVT */ {BTA_AV_RC_FREE_RSP, BTA_AV_INIT_ST },
|
||||
/* API_RC_CLOSE_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* AVRC_OPEN_EVT */ {BTA_AV_RC_OPENED, BTA_AV_OPEN_ST },
|
||||
/* AVRC_MSG_EVT */ {BTA_AV_RC_FREE_MSG, BTA_AV_INIT_ST },
|
||||
/* AVRC_NONE_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
static const UINT8 bta_av_st_init[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Next state */
|
||||
/* API_DISABLE_EVT */ {BTA_AV_DISABLE, BTA_AV_INIT_ST },
|
||||
/* API_REMOTE_CMD_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* API_VENDOR_CMD_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* API_VENDOR_RSP_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* API_META_RSP_EVT */ {BTA_AV_RC_FREE_RSP, BTA_AV_INIT_ST },
|
||||
/* API_RC_CLOSE_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
/* AVRC_OPEN_EVT */ {BTA_AV_RC_OPENED, BTA_AV_OPEN_ST },
|
||||
/* AVRC_MSG_EVT */ {BTA_AV_RC_FREE_MSG, BTA_AV_INIT_ST },
|
||||
/* AVRC_NONE_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
};
|
||||
|
||||
/* state table for open state */
|
||||
static const UINT8 bta_av_st_open[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Next state */
|
||||
/* API_DISABLE_EVT */ {BTA_AV_DISABLE, BTA_AV_INIT_ST },
|
||||
/* API_REMOTE_CMD_EVT */ {BTA_AV_RC_REMOTE_CMD, BTA_AV_OPEN_ST },
|
||||
/* API_VENDOR_CMD_EVT */ {BTA_AV_RC_VENDOR_CMD, BTA_AV_OPEN_ST },
|
||||
/* API_VENDOR_RSP_EVT */ {BTA_AV_RC_VENDOR_RSP, BTA_AV_OPEN_ST },
|
||||
/* API_META_RSP_EVT */ {BTA_AV_RC_META_RSP, BTA_AV_OPEN_ST },
|
||||
/* API_RC_CLOSE_EVT */ {BTA_AV_RC_CLOSE, BTA_AV_OPEN_ST },
|
||||
/* AVRC_OPEN_EVT */ {BTA_AV_RC_OPENED, BTA_AV_OPEN_ST },
|
||||
/* AVRC_MSG_EVT */ {BTA_AV_RC_MSG, BTA_AV_OPEN_ST },
|
||||
/* AVRC_NONE_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
static const UINT8 bta_av_st_open[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Next state */
|
||||
/* API_DISABLE_EVT */ {BTA_AV_DISABLE, BTA_AV_INIT_ST },
|
||||
/* API_REMOTE_CMD_EVT */ {BTA_AV_RC_REMOTE_CMD, BTA_AV_OPEN_ST },
|
||||
/* API_VENDOR_CMD_EVT */ {BTA_AV_RC_VENDOR_CMD, BTA_AV_OPEN_ST },
|
||||
/* API_VENDOR_RSP_EVT */ {BTA_AV_RC_VENDOR_RSP, BTA_AV_OPEN_ST },
|
||||
/* API_META_RSP_EVT */ {BTA_AV_RC_META_RSP, BTA_AV_OPEN_ST },
|
||||
/* API_RC_CLOSE_EVT */ {BTA_AV_RC_CLOSE, BTA_AV_OPEN_ST },
|
||||
/* AVRC_OPEN_EVT */ {BTA_AV_RC_OPENED, BTA_AV_OPEN_ST },
|
||||
/* AVRC_MSG_EVT */ {BTA_AV_RC_MSG, BTA_AV_OPEN_ST },
|
||||
/* AVRC_NONE_EVT */ {BTA_AV_IGNORE, BTA_AV_INIT_ST },
|
||||
};
|
||||
|
||||
/* type for state table */
|
||||
typedef const UINT8 (*tBTA_AV_ST_TBL)[BTA_AV_NUM_COLS];
|
||||
|
||||
/* state table */
|
||||
static const tBTA_AV_ST_TBL bta_av_st_tbl[] =
|
||||
{
|
||||
static const tBTA_AV_ST_TBL bta_av_st_tbl[] = {
|
||||
bta_av_st_init,
|
||||
bta_av_st_open
|
||||
};
|
||||
@ -167,12 +161,11 @@ static void bta_av_api_to_ssm(tBTA_AV_DATA *p_data);
|
||||
|
||||
static void bta_av_sco_chg_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8
|
||||
app_id, BD_ADDR peer_addr);
|
||||
static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status,UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
|
||||
static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
|
||||
|
||||
|
||||
/* action functions */
|
||||
const tBTA_AV_NSM_ACT bta_av_nsm_act[] =
|
||||
{
|
||||
const tBTA_AV_NSM_ACT bta_av_nsm_act[] = {
|
||||
bta_av_api_enable, /* BTA_AV_API_ENABLE_EVT */
|
||||
bta_av_api_register, /* BTA_AV_API_REGISTER_EVT */
|
||||
bta_av_api_deregister, /* BTA_AV_API_DEREGISTER_EVT */
|
||||
@ -224,17 +217,14 @@ static void bta_av_timer_cback(void *p_tle)
|
||||
tBTA_AV_SCB *p_scb = NULL;
|
||||
|
||||
/* find the SCB that has the timer */
|
||||
for(xx=0; xx<BTA_AV_NUM_STRS; xx++)
|
||||
{
|
||||
if(bta_av_cb.p_scb[xx] && &(bta_av_cb.p_scb[xx]->timer)== p)
|
||||
{
|
||||
for (xx = 0; xx < BTA_AV_NUM_STRS; xx++) {
|
||||
if (bta_av_cb.p_scb[xx] && &(bta_av_cb.p_scb[xx]->timer) == p) {
|
||||
p_scb = bta_av_cb.p_scb[xx];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_scb && (p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
if (p_scb && (p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) {
|
||||
/* send the event through the audio state machine.
|
||||
* only when the audio SM is open, the main SM opens the RC connection as INT */
|
||||
p_buf->event = p->event;
|
||||
@ -261,8 +251,9 @@ static void bta_av_api_enable(tBTA_AV_DATA *p_data)
|
||||
/* initialize control block */
|
||||
memset(&bta_av_cb, 0, sizeof(tBTA_AV_CB));
|
||||
|
||||
for(i=0; i<BTA_AV_NUM_RCB; i++)
|
||||
for (i = 0; i < BTA_AV_NUM_RCB; i++) {
|
||||
bta_av_cb.rcb[i].handle = BTA_AV_RC_HANDLE_NONE;
|
||||
}
|
||||
|
||||
bta_av_cb.rc_acp_handle = BTA_AV_RC_HANDLE_NONE;
|
||||
|
||||
@ -274,8 +265,7 @@ static void bta_av_api_enable(tBTA_AV_DATA *p_data)
|
||||
enable.features = bta_av_cb.features;
|
||||
|
||||
/* Register for SCO change event */
|
||||
if (!(bta_av_cb.features & BTA_AV_FEAT_NO_SCO_SSPD))
|
||||
{
|
||||
if (!(bta_av_cb.features & BTA_AV_FEAT_NO_SCO_SSPD)) {
|
||||
bta_sys_sco_register(bta_av_sco_chg_cback);
|
||||
}
|
||||
|
||||
@ -292,17 +282,14 @@ static void bta_av_api_enable(tBTA_AV_DATA *p_data)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static tBTA_AV_SCB * bta_av_addr_to_scb(BD_ADDR bd_addr)
|
||||
static tBTA_AV_SCB *bta_av_addr_to_scb(BD_ADDR bd_addr)
|
||||
{
|
||||
tBTA_AV_SCB * p_scb = NULL;
|
||||
tBTA_AV_SCB *p_scb = NULL;
|
||||
int xx;
|
||||
|
||||
for(xx=0; xx<BTA_AV_NUM_STRS; xx++)
|
||||
{
|
||||
if(bta_av_cb.p_scb[xx])
|
||||
{
|
||||
if(!bdcmp(bd_addr, bta_av_cb.p_scb[xx]->peer_addr))
|
||||
{
|
||||
for (xx = 0; xx < BTA_AV_NUM_STRS; xx++) {
|
||||
if (bta_av_cb.p_scb[xx]) {
|
||||
if (!bdcmp(bd_addr, bta_av_cb.p_scb[xx]->peer_addr)) {
|
||||
p_scb = bta_av_cb.p_scb[xx];
|
||||
break;
|
||||
}
|
||||
@ -320,15 +307,14 @@ static tBTA_AV_SCB * bta_av_addr_to_scb(BD_ADDR bd_addr)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_AV_SCB * bta_av_hndl_to_scb(UINT16 handle)
|
||||
tBTA_AV_SCB *bta_av_hndl_to_scb(UINT16 handle)
|
||||
{
|
||||
tBTA_AV_HNDL hndl = (tBTA_AV_HNDL)handle;
|
||||
tBTA_AV_SCB * p_scb = NULL;
|
||||
tBTA_AV_SCB *p_scb = NULL;
|
||||
UINT8 idx = (hndl & BTA_AV_HNDL_MSK);
|
||||
|
||||
if(idx && (idx <= BTA_AV_NUM_STRS) )
|
||||
{
|
||||
p_scb = bta_av_cb.p_scb[idx-1];
|
||||
if (idx && (idx <= BTA_AV_NUM_STRS) ) {
|
||||
p_scb = bta_av_cb.p_scb[idx - 1];
|
||||
}
|
||||
return p_scb;
|
||||
}
|
||||
@ -344,45 +330,34 @@ tBTA_AV_SCB * bta_av_hndl_to_scb(UINT16 handle)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static tBTA_AV_SCB * bta_av_alloc_scb(tBTA_AV_CHNL chnl)
|
||||
static tBTA_AV_SCB *bta_av_alloc_scb(tBTA_AV_CHNL chnl)
|
||||
{
|
||||
tBTA_AV_SCB *p_ret = NULL;
|
||||
int xx;
|
||||
tBTA_AV_STATUS sts = BTA_AV_SUCCESS;
|
||||
|
||||
if(chnl == BTA_AV_CHNL_VIDEO)
|
||||
{
|
||||
if(p_bta_av_cfg->p_act_tbl == NULL || p_bta_av_cfg->p_reg == NULL)
|
||||
{
|
||||
if (chnl == BTA_AV_CHNL_VIDEO) {
|
||||
if (p_bta_av_cfg->p_act_tbl == NULL || p_bta_av_cfg->p_reg == NULL) {
|
||||
APPL_TRACE_ERROR("Video streaming not supported");
|
||||
sts = BTA_AV_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* allow only one Video channel */
|
||||
if(bta_av_cb.reg_video)
|
||||
{
|
||||
if (bta_av_cb.reg_video) {
|
||||
APPL_TRACE_ERROR("Already registered");
|
||||
sts = BTA_AV_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(chnl != BTA_AV_CHNL_AUDIO)
|
||||
{
|
||||
} else if (chnl != BTA_AV_CHNL_AUDIO) {
|
||||
APPL_TRACE_ERROR("bad channel: %d\n", chnl);
|
||||
sts = BTA_AV_FAIL;
|
||||
}
|
||||
|
||||
if(sts == BTA_AV_SUCCESS)
|
||||
{
|
||||
for(xx=0; xx<BTA_AV_NUM_STRS; xx++)
|
||||
{
|
||||
if(bta_av_cb.p_scb[xx] == NULL)
|
||||
{
|
||||
if (sts == BTA_AV_SUCCESS) {
|
||||
for (xx = 0; xx < BTA_AV_NUM_STRS; xx++) {
|
||||
if (bta_av_cb.p_scb[xx] == NULL) {
|
||||
/* found an empty spot */
|
||||
p_ret = (tBTA_AV_SCB *)GKI_getbuf(sizeof(tBTA_AV_SCB));
|
||||
if(p_ret)
|
||||
{
|
||||
if (p_ret) {
|
||||
memset(p_ret, 0, sizeof(tBTA_AV_SCB));
|
||||
p_ret->rc_handle = BTA_AV_RC_HANDLE_NONE;
|
||||
p_ret->chnl = chnl;
|
||||
@ -434,11 +409,11 @@ void bta_av_conn_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p
|
||||
#endif
|
||||
{
|
||||
evt = BTA_AV_SIG_CHG_EVT;
|
||||
if(AVDT_DISCONNECT_IND_EVT == event)
|
||||
if (AVDT_DISCONNECT_IND_EVT == event) {
|
||||
p_scb = bta_av_addr_to_scb(bd_addr);
|
||||
}
|
||||
#if (defined(BTA_AV_DEBUG) && BTA_AV_DEBUG == TRUE)
|
||||
else if (AVDT_CONNECT_IND_EVT == event)
|
||||
{
|
||||
else if (AVDT_CONNECT_IND_EVT == event) {
|
||||
APPL_TRACE_DEBUG("CONN_IND is ACP:%d\n", p_data->hdr.err_param);
|
||||
}
|
||||
#endif
|
||||
@ -448,15 +423,13 @@ void bta_av_conn_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p
|
||||
//(AVDT_CONNECT_IND_EVT == event && AVDT_ACP == p_data->hdr.err_param))
|
||||
|
||||
(AVDT_CONNECT_IND_EVT == event))&& */
|
||||
(p_msg = (tBTA_AV_STR_MSG *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_STR_MSG)))) != NULL)
|
||||
{
|
||||
(p_msg = (tBTA_AV_STR_MSG *) GKI_getbuf((UINT16) (sizeof(tBTA_AV_STR_MSG)))) != NULL) {
|
||||
p_msg->hdr.event = evt;
|
||||
p_msg->hdr.layer_specific = event;
|
||||
p_msg->hdr.offset = p_data->hdr.err_param;
|
||||
bdcpy(p_msg->bd_addr, bd_addr);
|
||||
#if (defined(BTA_AV_DEBUG) && BTA_AV_DEBUG == TRUE)
|
||||
if(p_scb)
|
||||
{
|
||||
if (p_scb) {
|
||||
APPL_TRACE_DEBUG("scb hndl x%x, role x%x\n", p_scb->hndl, p_scb->role);
|
||||
}
|
||||
#endif
|
||||
@ -507,26 +480,21 @@ static void bta_av_api_sink_enable(tBTA_AV_DATA *p_data)
|
||||
UINT16 activate_sink = 0;
|
||||
activate_sink = p_data->hdr.layer_specific;
|
||||
APPL_TRACE_DEBUG("bta_av_api_sink_enable %d \n", activate_sink)
|
||||
char p_service_name[BTA_SERVICE_NAME_LEN+1];
|
||||
char p_service_name[BTA_SERVICE_NAME_LEN + 1];
|
||||
BCM_STRNCPY_S(p_service_name, sizeof(p_service_name),
|
||||
BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
|
||||
|
||||
if(activate_sink)
|
||||
{
|
||||
if (activate_sink) {
|
||||
AVDT_SINK_Activate();
|
||||
if (bta_av_cb.sdp_a2d_snk_handle == 0)
|
||||
{
|
||||
if (bta_av_cb.sdp_a2d_snk_handle == 0) {
|
||||
bta_av_cb.sdp_a2d_snk_handle = SDP_CreateRecord();
|
||||
A2D_AddRecord(UUID_SERVCLASS_AUDIO_SINK, p_service_name, NULL,
|
||||
A2D_SUPF_PLAYER, bta_av_cb.sdp_a2d_snk_handle);
|
||||
bta_sys_add_uuid(UUID_SERVCLASS_AUDIO_SINK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVDT_SINK_Deactivate();
|
||||
if (bta_av_cb.sdp_a2d_snk_handle != 0)
|
||||
{
|
||||
if (bta_av_cb.sdp_a2d_snk_handle != 0) {
|
||||
SDP_DeleteRecord(bta_av_cb.sdp_a2d_snk_handle);
|
||||
bta_av_cb.sdp_a2d_snk_handle = 0;
|
||||
bta_sys_remove_uuid(UUID_SERVCLASS_AUDIO_SINK);
|
||||
@ -555,20 +523,18 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
tBTA_AV_CODEC codec_type;
|
||||
tBTA_UTL_COD cod;
|
||||
UINT8 index = 0;
|
||||
char p_avk_service_name[BTA_SERVICE_NAME_LEN+1];
|
||||
char p_avk_service_name[BTA_SERVICE_NAME_LEN + 1];
|
||||
BCM_STRNCPY_S(p_avk_service_name, sizeof(p_avk_service_name), BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
|
||||
|
||||
memset(&cs,0,sizeof(tAVDT_CS));
|
||||
memset(&cs, 0, sizeof(tAVDT_CS));
|
||||
|
||||
registr.status = BTA_AV_FAIL_RESOURCES;
|
||||
registr.app_id = p_data->api_reg.app_id;
|
||||
registr.chnl = (tBTA_AV_CHNL)p_data->hdr.layer_specific;
|
||||
registr.p_bta_av_cos = p_data->api_reg.bta_av_cos;
|
||||
do
|
||||
{
|
||||
do {
|
||||
p_scb = bta_av_alloc_scb(registr.chnl);
|
||||
if(p_scb == NULL)
|
||||
{
|
||||
if (p_scb == NULL) {
|
||||
APPL_TRACE_ERROR("failed to alloc SCB");
|
||||
break;
|
||||
}
|
||||
@ -577,11 +543,10 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
p_scb->app_id = registr.app_id;
|
||||
|
||||
/* initialize the stream control block */
|
||||
p_scb->timer.p_cback = (TIMER_CBACK*)&bta_av_timer_cback;
|
||||
p_scb->timer.p_cback = (TIMER_CBACK *)&bta_av_timer_cback;
|
||||
registr.status = BTA_AV_SUCCESS;
|
||||
|
||||
if((bta_av_cb.reg_audio + bta_av_cb.reg_video) == 0)
|
||||
{
|
||||
if ((bta_av_cb.reg_audio + bta_av_cb.reg_video) == 0) {
|
||||
/* the first channel registered. register to AVDTP */
|
||||
reg.ctrl_mtu = p_bta_av_cfg->sig_mtu;
|
||||
reg.ret_tout = BTA_AV_RET_TOUT;
|
||||
@ -594,8 +559,7 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
bta_sys_role_chg_register(&bta_av_sys_rs_cback);
|
||||
|
||||
/* create remote control TG service if required */
|
||||
if (bta_av_cb.features & (BTA_AV_FEAT_RCTG))
|
||||
{
|
||||
if (bta_av_cb.features & (BTA_AV_FEAT_RCTG)) {
|
||||
/* register with no authorization; let AVDTP use authorization instead */
|
||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||
#if (BTA_AV_WITH_AVCTP_AUTHORIZATION == TRUE)
|
||||
@ -634,12 +598,9 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
((bta_av_cb.features & BTA_AV_FEAT_PROTECT) ? 0 : AVDT_NSC_SECURITY);
|
||||
APPL_TRACE_DEBUG("nsc_mask: 0x%x\n", cs.nsc_mask);
|
||||
|
||||
if (p_data->api_reg.p_service_name[0] == 0)
|
||||
{
|
||||
if (p_data->api_reg.p_service_name[0] == 0) {
|
||||
p_service_name = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_service_name = p_data->api_reg.p_service_name;
|
||||
}
|
||||
|
||||
@ -647,20 +608,18 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
p_scb->recfg_sup = TRUE;
|
||||
|
||||
cs.p_ctrl_cback = bta_av_dt_cback[p_scb->hdi];
|
||||
if(registr.chnl == BTA_AV_CHNL_AUDIO)
|
||||
{
|
||||
if (registr.chnl == BTA_AV_CHNL_AUDIO) {
|
||||
/* set up the audio stream control block */
|
||||
p_scb->p_act_tbl = (const tBTA_AV_ACT *)bta_av_a2d_action;
|
||||
// p_scb->p_cos = &bta_av_a2d_cos;
|
||||
p_scb->p_cos = registr.p_bta_av_cos;
|
||||
p_scb->media_type= AVDT_MEDIA_AUDIO;
|
||||
p_scb->media_type = AVDT_MEDIA_AUDIO;
|
||||
cs.cfg.psc_mask = AVDT_PSC_TRANS;
|
||||
cs.media_type = AVDT_MEDIA_AUDIO;
|
||||
cs.mtu = p_bta_av_cfg->audio_mtu;
|
||||
cs.flush_to = L2CAP_DEFAULT_FLUSH_TO;
|
||||
#if AVDT_REPORTING == TRUE
|
||||
if(bta_av_cb.features & BTA_AV_FEAT_REPORT)
|
||||
{
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_REPORT) {
|
||||
cs.cfg.psc_mask |= AVDT_PSC_REPORT;
|
||||
cs.p_report_cback = bta_av_a2dp_report_cback;
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
@ -668,46 +627,44 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if(bta_av_cb.features & BTA_AV_FEAT_DELAY_RPT)
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_DELAY_RPT) {
|
||||
cs.cfg.psc_mask |= AVDT_PSC_DELAY_RPT;
|
||||
}
|
||||
|
||||
/* keep the configuration in the stream control block */
|
||||
memcpy(&p_scb->cfg, &cs.cfg, sizeof(tAVDT_CFG));
|
||||
while(index < BTA_AV_MAX_SEPS &&
|
||||
while (index < BTA_AV_MAX_SEPS &&
|
||||
(p_scb->p_cos->init)(&codec_type, cs.cfg.codec_info,
|
||||
&cs.cfg.num_protect, cs.cfg.protect_info, index) == TRUE)
|
||||
{
|
||||
&cs.cfg.num_protect, cs.cfg.protect_info, index) == TRUE) {
|
||||
|
||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||
if(index == 1)
|
||||
{
|
||||
if (index == 1) {
|
||||
cs.tsep = AVDT_TSEP_SNK;
|
||||
cs.p_data_cback = bta_av_stream_data_cback;
|
||||
}
|
||||
APPL_TRACE_DEBUG(" SEP Type = %d\n",cs.tsep);
|
||||
APPL_TRACE_DEBUG(" SEP Type = %d\n", cs.tsep);
|
||||
#endif
|
||||
if(AVDT_CreateStream(&p_scb->seps[index].av_handle, &cs) == AVDT_SUCCESS)
|
||||
{
|
||||
if (AVDT_CreateStream(&p_scb->seps[index].av_handle, &cs) == AVDT_SUCCESS) {
|
||||
p_scb->seps[index].codec_type = codec_type;
|
||||
|
||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||
p_scb->seps[index].tsep = cs.tsep;
|
||||
if(cs.tsep == AVDT_TSEP_SNK)
|
||||
if (cs.tsep == AVDT_TSEP_SNK) {
|
||||
p_scb->seps[index].p_app_data_cback = p_data->api_reg.p_app_data_cback;
|
||||
else
|
||||
} else {
|
||||
p_scb->seps[index].p_app_data_cback = NULL; /* In case of A2DP SOURCE we don't need a callback to handle media packets */
|
||||
}
|
||||
#endif
|
||||
|
||||
APPL_TRACE_DEBUG("audio[%d] av_handle: %d codec_type: %d\n",
|
||||
index, p_scb->seps[index].av_handle, p_scb->seps[index].codec_type);
|
||||
index++;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!bta_av_cb.reg_audio)
|
||||
{
|
||||
if (!bta_av_cb.reg_audio) {
|
||||
/* create the SDP records on the 1st audio channel */
|
||||
bta_av_cb.sdp_a2d_handle = SDP_CreateRecord();
|
||||
A2D_AddRecord(UUID_SERVCLASS_AUDIO_SOURCE, p_service_name, NULL,
|
||||
@ -721,15 +678,14 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
bta_sys_add_uuid(UUID_SERVCLASS_AUDIO_SINK);
|
||||
#endif
|
||||
/* start listening when A2DP is registered */
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_RCTG)
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_RCTG) {
|
||||
bta_av_rc_create(&bta_av_cb, AVCT_ACP, 0, BTA_AV_NUM_LINKS + 1);
|
||||
}
|
||||
|
||||
/* if the AV and AVK are both supported, it cannot support the CT role */
|
||||
if (bta_av_cb.features & (BTA_AV_FEAT_RCCT))
|
||||
{
|
||||
if (bta_av_cb.features & (BTA_AV_FEAT_RCCT)) {
|
||||
/* if TG is not supported, we need to register to AVCT now */
|
||||
if ((bta_av_cb.features & (BTA_AV_FEAT_RCTG)) == 0)
|
||||
{
|
||||
if ((bta_av_cb.features & (BTA_AV_FEAT_RCTG)) == 0) {
|
||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||
#if (BTA_AV_WITH_AVCTP_AUTHORIZATION == TRUE)
|
||||
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
|
||||
@ -748,10 +704,8 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
}
|
||||
}
|
||||
bta_av_cb.reg_audio |= BTA_AV_HNDL_TO_MSK(p_scb->hdi);
|
||||
APPL_TRACE_DEBUG("reg_audio: 0x%x\n",bta_av_cb.reg_audio);
|
||||
}
|
||||
else
|
||||
{
|
||||
APPL_TRACE_DEBUG("reg_audio: 0x%x\n", bta_av_cb.reg_audio);
|
||||
} else {
|
||||
bta_av_cb.reg_video = BTA_AV_HNDL_TO_MSK(p_scb->hdi);
|
||||
bta_av_cb.sdp_vdp_handle = SDP_CreateRecord();
|
||||
/* register the video channel */
|
||||
@ -778,13 +732,10 @@ void bta_av_api_deregister(tBTA_AV_DATA *p_data)
|
||||
{
|
||||
tBTA_AV_SCB *p_scb = bta_av_hndl_to_scb(p_data->hdr.layer_specific);
|
||||
|
||||
if(p_scb)
|
||||
{
|
||||
if (p_scb) {
|
||||
p_scb->deregistring = TRUE;
|
||||
bta_av_ssm_execute(p_scb, BTA_AV_API_CLOSE_EVT, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bta_av_dereg_comp(p_data);
|
||||
}
|
||||
}
|
||||
@ -805,12 +756,10 @@ static void bta_av_ci_data(tBTA_AV_DATA *p_data)
|
||||
int i;
|
||||
UINT8 chnl = (UINT8)p_data->hdr.layer_specific;
|
||||
|
||||
for( i=0; i < BTA_AV_NUM_STRS; i++ )
|
||||
{
|
||||
for ( i = 0; i < BTA_AV_NUM_STRS; i++ ) {
|
||||
p_scb = bta_av_cb.p_scb[i];
|
||||
|
||||
if(p_scb && p_scb->chnl == chnl)
|
||||
{
|
||||
if (p_scb && p_scb->chnl == chnl) {
|
||||
bta_av_ssm_execute(p_scb, BTA_AV_SRC_DATA_READY_EVT, p_data);
|
||||
}
|
||||
}
|
||||
@ -847,8 +796,7 @@ static void bta_av_api_to_ssm(tBTA_AV_DATA *p_data)
|
||||
int xx;
|
||||
UINT16 event = p_data->hdr.event - BTA_AV_FIRST_A2S_API_EVT + BTA_AV_FIRST_A2S_SSM_EVT;
|
||||
|
||||
for(xx=0; xx<BTA_AV_NUM_STRS; xx++)
|
||||
{
|
||||
for (xx = 0; xx < BTA_AV_NUM_STRS; xx++) {
|
||||
bta_av_ssm_execute(bta_av_cb.p_scb[xx], event, p_data);
|
||||
}
|
||||
}
|
||||
@ -869,23 +817,18 @@ BOOLEAN bta_av_chk_start(tBTA_AV_SCB *p_scb)
|
||||
tBTA_AV_SCB *p_scbi;
|
||||
int i;
|
||||
|
||||
if(p_scb->chnl == BTA_AV_CHNL_AUDIO)
|
||||
{
|
||||
if (p_scb->chnl == BTA_AV_CHNL_AUDIO) {
|
||||
if ((bta_av_cb.audio_open_cnt >= 2) &&
|
||||
((0 == (p_scb->role & BTA_AV_ROLE_AD_ACP)) || /* Outgoing connection or */
|
||||
(bta_av_cb.features & BTA_AV_FEAT_ACP_START))) /* auto-starting option */
|
||||
{
|
||||
(bta_av_cb.features & BTA_AV_FEAT_ACP_START))) { /* auto-starting option */
|
||||
/* more than one audio channel is connected */
|
||||
/* if this is the 2nd stream as ACP, give INT a chance to issue the START command */
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
p_scbi = bta_av_cb.p_scb[i];
|
||||
if(p_scbi && p_scbi->chnl == BTA_AV_CHNL_AUDIO && p_scbi->co_started)
|
||||
{
|
||||
if (p_scbi && p_scbi->chnl == BTA_AV_CHNL_AUDIO && p_scbi->co_started) {
|
||||
start = TRUE;
|
||||
/* may need to update the flush timeout of this already started stream */
|
||||
if(p_scbi->co_started != bta_av_cb.audio_open_cnt)
|
||||
{
|
||||
if (p_scbi->co_started != bta_av_cb.audio_open_cnt) {
|
||||
p_scbi->co_started = bta_av_cb.audio_open_cnt;
|
||||
L2CA_SetFlushTimeout(p_scbi->peer_addr, p_bta_av_cfg->p_audio_flush_to[p_scbi->co_started - 1] );
|
||||
}
|
||||
@ -912,14 +855,11 @@ void bta_av_restore_switch (void)
|
||||
int i;
|
||||
UINT8 mask;
|
||||
|
||||
APPL_TRACE_DEBUG("reg_audio: 0x%x\n",bta_av_cb.reg_audio);
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
APPL_TRACE_DEBUG("reg_audio: 0x%x\n", bta_av_cb.reg_audio);
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
mask = BTA_AV_HNDL_TO_MSK(i);
|
||||
if (p_cb->conn_audio == mask)
|
||||
{
|
||||
if (p_cb->p_scb[i])
|
||||
{
|
||||
if (p_cb->conn_audio == mask) {
|
||||
if (p_cb->p_scb[i]) {
|
||||
bta_sys_set_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH, p_cb->p_scb[i]->peer_addr);
|
||||
}
|
||||
break;
|
||||
@ -936,7 +876,7 @@ void bta_av_restore_switch (void)
|
||||
** Returns (BTA_SYS_ROLE_CHANGE, new_role, hci_status, p_bda)
|
||||
**
|
||||
*******************************************************************************/
|
||||
static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status,UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
|
||||
static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
|
||||
{
|
||||
int i;
|
||||
tBTA_AV_SCB *p_scb = NULL;
|
||||
@ -946,14 +886,12 @@ static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status,UINT8 id, UINT8 app
|
||||
UNUSED(status);
|
||||
|
||||
APPL_TRACE_DEBUG("bta_av_sys_rs_cback: %d\n", bta_av_cb.rs_idx);
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
/* loop through all the SCBs to find matching peer addresses and report the role change event */
|
||||
/* note that more than one SCB (a2dp & vdp) maybe waiting for this event */
|
||||
p_scb = bta_av_cb.p_scb[i];
|
||||
if (p_scb && (bdcmp (peer_addr, p_scb->peer_addr) == 0) &&
|
||||
(p_buf = (tBTA_AV_ROLE_RES *) GKI_getbuf(sizeof(tBTA_AV_ROLE_RES))) != NULL)
|
||||
{
|
||||
(p_buf = (tBTA_AV_ROLE_RES *) GKI_getbuf(sizeof(tBTA_AV_ROLE_RES))) != NULL) {
|
||||
APPL_TRACE_DEBUG("new_role:%d, hci_status:x%x hndl: x%x\n", id, app_id, p_scb->hndl);
|
||||
/*
|
||||
if ((id != BTM_ROLE_MASTER) && (app_id != HCI_SUCCESS))
|
||||
@ -974,31 +912,28 @@ static void bta_av_sys_rs_cback (tBTA_SYS_CONN_STATUS status,UINT8 id, UINT8 app
|
||||
/* restore role switch policy, if role switch failed */
|
||||
if ((HCI_SUCCESS != app_id) &&
|
||||
(BTM_GetRole (peer_addr, &cur_role) == BTM_SUCCESS) &&
|
||||
(cur_role == BTM_ROLE_SLAVE) )
|
||||
{
|
||||
(cur_role == BTM_ROLE_SLAVE) ) {
|
||||
bta_sys_set_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH, peer_addr);
|
||||
}
|
||||
|
||||
/* if BTA_AvOpen() was called for other device, which caused the role switch of the peer_addr, */
|
||||
/* we need to continue opening process for the BTA_AvOpen(). */
|
||||
if ((bta_av_cb.rs_idx != 0) && (bta_av_cb.rs_idx != peer_idx))
|
||||
{
|
||||
if ((bta_av_cb.rs_idx -1) < BTA_AV_NUM_STRS)
|
||||
{
|
||||
if ((bta_av_cb.rs_idx != 0) && (bta_av_cb.rs_idx != peer_idx)) {
|
||||
if ((bta_av_cb.rs_idx - 1) < BTA_AV_NUM_STRS) {
|
||||
p_scb = bta_av_cb.p_scb[bta_av_cb.rs_idx - 1];
|
||||
}
|
||||
if (p_scb && p_scb->q_tag == BTA_AV_Q_TAG_OPEN)
|
||||
{
|
||||
if (p_scb && p_scb->q_tag == BTA_AV_Q_TAG_OPEN) {
|
||||
APPL_TRACE_DEBUG ("bta_av_sys_rs_cback: rs_idx(%d), hndl:x%x q_tag: %d\n",
|
||||
bta_av_cb.rs_idx, p_scb->hndl, p_scb->q_tag);
|
||||
|
||||
if(HCI_SUCCESS == app_id || HCI_ERR_NO_CONNECTION == app_id)
|
||||
if (HCI_SUCCESS == app_id || HCI_ERR_NO_CONNECTION == app_id) {
|
||||
p_scb->q_info.open.switch_res = BTA_AV_RS_OK;
|
||||
else
|
||||
} else {
|
||||
p_scb->q_info.open.switch_res = BTA_AV_RS_FAIL;
|
||||
}
|
||||
|
||||
/* Continue av open process */
|
||||
bta_av_do_disc_a2d (p_scb, (tBTA_AV_DATA *)&(p_scb->q_info.open));
|
||||
bta_av_do_disc_a2d (p_scb, (tBTA_AV_DATA *) & (p_scb->q_info.open));
|
||||
}
|
||||
|
||||
bta_av_cb.rs_idx = 0;
|
||||
@ -1026,17 +961,14 @@ static void bta_av_sco_chg_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8
|
||||
UNUSED(peer_addr);
|
||||
|
||||
APPL_TRACE_DEBUG("bta_av_sco_chg_cback:%d status:%d\n", id, status);
|
||||
if(id)
|
||||
{
|
||||
if (id) {
|
||||
bta_av_cb.sco_occupied = TRUE;
|
||||
|
||||
/* either BTA_SYS_SCO_OPEN or BTA_SYS_SCO_CLOSE with remaining active SCO */
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
p_scb = bta_av_cb.p_scb[i];
|
||||
|
||||
if( p_scb && p_scb->co_started && (p_scb->sco_suspend == FALSE))
|
||||
{
|
||||
if ( p_scb && p_scb->co_started && (p_scb->sco_suspend == FALSE)) {
|
||||
APPL_TRACE_DEBUG("suspending scb:%d\n", i);
|
||||
/* scb is used and started, not suspended automatically */
|
||||
p_scb->sco_suspend = TRUE;
|
||||
@ -1045,17 +977,13 @@ static void bta_av_sco_chg_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8
|
||||
bta_av_ssm_execute(p_scb, BTA_AV_AP_STOP_EVT, (tBTA_AV_DATA *)&stop);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bta_av_cb.sco_occupied = FALSE;
|
||||
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
p_scb = bta_av_cb.p_scb[i];
|
||||
|
||||
if( p_scb && p_scb->sco_suspend ) /* scb is used and suspended for SCO */
|
||||
{
|
||||
if ( p_scb && p_scb->sco_suspend ) { /* scb is used and suspended for SCO */
|
||||
APPL_TRACE_DEBUG("starting scb:%d\n", i);
|
||||
bta_av_ssm_execute(p_scb, BTA_AV_AP_START_EVT, NULL);
|
||||
}
|
||||
@ -1082,22 +1010,19 @@ BOOLEAN bta_av_switch_if_needed(tBTA_AV_SCB *p_scb)
|
||||
int i;
|
||||
UINT8 mask;
|
||||
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
mask = BTA_AV_HNDL_TO_MSK(i);
|
||||
p_scbi = bta_av_cb.p_scb[i];
|
||||
if( p_scbi && (p_scb->hdi != i) && /* not the original channel */
|
||||
if ( p_scbi && (p_scb->hdi != i) && /* not the original channel */
|
||||
((bta_av_cb.conn_audio & mask) ||/* connected audio */
|
||||
(bta_av_cb.conn_video & mask)) ) /* connected video */
|
||||
{
|
||||
(bta_av_cb.conn_video & mask)) ) { /* connected video */
|
||||
BTM_GetRole(p_scbi->peer_addr, &role);
|
||||
/* this channel is open - clear the role switch link policy for this link */
|
||||
if(BTM_ROLE_MASTER != role)
|
||||
{
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_MASTER)
|
||||
if (BTM_ROLE_MASTER != role) {
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_MASTER) {
|
||||
bta_sys_clear_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH, p_scbi->peer_addr);
|
||||
if (BTM_CMD_STARTED != BTM_SwitchRole(p_scbi->peer_addr, BTM_ROLE_MASTER, NULL))
|
||||
{
|
||||
}
|
||||
if (BTM_CMD_STARTED != BTM_SwitchRole(p_scbi->peer_addr, BTM_ROLE_MASTER, NULL)) {
|
||||
/* can not switch role on SCBI
|
||||
* start the timer on SCB - because this function is ONLY called when SCB gets API_OPEN */
|
||||
bta_sys_start_timer(&p_scb->timer, BTA_AV_AVRC_TIMER_EVT, BTA_AV_RS_TIME_VAL);
|
||||
@ -1127,18 +1052,16 @@ BOOLEAN bta_av_link_role_ok(tBTA_AV_SCB *p_scb, UINT8 bits)
|
||||
UINT8 role;
|
||||
BOOLEAN is_ok = TRUE;
|
||||
|
||||
if (BTM_GetRole(p_scb->peer_addr, &role) == BTM_SUCCESS)
|
||||
{
|
||||
if (BTM_GetRole(p_scb->peer_addr, &role) == BTM_SUCCESS) {
|
||||
LOG_INFO("%s hndl:x%x role:%d conn_audio:x%x bits:%d features:x%x\n",
|
||||
__func__, p_scb->hndl, role, bta_av_cb.conn_audio, bits,
|
||||
bta_av_cb.features);
|
||||
if (BTM_ROLE_MASTER != role && (A2D_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER)))
|
||||
{
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_MASTER)
|
||||
if (BTM_ROLE_MASTER != role && (A2D_BitsSet(bta_av_cb.conn_audio) > bits || (bta_av_cb.features & BTA_AV_FEAT_MASTER))) {
|
||||
if (bta_av_cb.features & BTA_AV_FEAT_MASTER) {
|
||||
bta_sys_clear_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH, p_scb->peer_addr);
|
||||
}
|
||||
|
||||
if (BTM_CMD_STARTED != BTM_SwitchRole(p_scb->peer_addr, BTM_ROLE_MASTER, NULL))
|
||||
{
|
||||
if (BTM_CMD_STARTED != BTM_SwitchRole(p_scb->peer_addr, BTM_ROLE_MASTER, NULL)) {
|
||||
/* can not switch role on SCB - start the timer on SCB */
|
||||
}
|
||||
is_ok = FALSE;
|
||||
@ -1169,27 +1092,23 @@ UINT16 bta_av_chk_mtu(tBTA_AV_SCB *p_scb, UINT16 mtu)
|
||||
UNUSED(mtu);
|
||||
|
||||
/* TODO_MV mess with the mtu according to the number of EDR/non-EDR headsets */
|
||||
if(p_scb->chnl == BTA_AV_CHNL_AUDIO)
|
||||
{
|
||||
if(bta_av_cb.audio_open_cnt >= 2)
|
||||
{
|
||||
if (p_scb->chnl == BTA_AV_CHNL_AUDIO) {
|
||||
if (bta_av_cb.audio_open_cnt >= 2) {
|
||||
/* more than one audio channel is connected */
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
p_scbi = bta_av_cb.p_scb[i];
|
||||
if((p_scb != p_scbi) && p_scbi && (p_scbi->chnl == BTA_AV_CHNL_AUDIO) )
|
||||
{
|
||||
if ((p_scb != p_scbi) && p_scbi && (p_scbi->chnl == BTA_AV_CHNL_AUDIO) ) {
|
||||
mask = BTA_AV_HNDL_TO_MSK(i);
|
||||
APPL_TRACE_DEBUG("[%d] mtu: %d, mask:0x%x\n",
|
||||
i, p_scbi->stream_mtu, mask);
|
||||
if(bta_av_cb.conn_audio & mask)
|
||||
{
|
||||
if(ret_mtu > p_scbi->stream_mtu)
|
||||
if (bta_av_cb.conn_audio & mask) {
|
||||
if (ret_mtu > p_scbi->stream_mtu) {
|
||||
ret_mtu = p_scbi->stream_mtu;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
APPL_TRACE_DEBUG("bta_av_chk_mtu audio count:%d, conn_audio:0x%x, ret:%d\n",
|
||||
bta_av_cb.audio_open_cnt, bta_av_cb.conn_audio, ret_mtu);
|
||||
}
|
||||
@ -1212,25 +1131,22 @@ void bta_av_dup_audio_buf(tBTA_AV_SCB *p_scb, BT_HDR *p_buf)
|
||||
UINT16 size, copy_size;
|
||||
BT_HDR *p_new;
|
||||
|
||||
if(!p_buf)
|
||||
if (!p_buf) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(bta_av_cb.audio_open_cnt >= 2)
|
||||
{
|
||||
if (bta_av_cb.audio_open_cnt >= 2) {
|
||||
size = GKI_get_buf_size(p_buf);
|
||||
copy_size = BT_HDR_SIZE + p_buf->len + p_buf->offset;
|
||||
/* more than one audio channel is connected */
|
||||
for(i=0; i<BTA_AV_NUM_STRS; i++)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_NUM_STRS; i++) {
|
||||
p_scbi = bta_av_cb.p_scb[i];
|
||||
if( (p_scb->hdi != i) && /* not the original channel */
|
||||
if ( (p_scb->hdi != i) && /* not the original channel */
|
||||
(bta_av_cb.conn_audio & BTA_AV_HNDL_TO_MSK(i)) && /* connected audio */
|
||||
p_scbi && p_scbi->co_started ) /* scb is used and started */
|
||||
{
|
||||
p_scbi && p_scbi->co_started ) { /* scb is used and started */
|
||||
/* enqueue the data only when the stream is started */
|
||||
p_new = (BT_HDR *)GKI_getbuf(size);
|
||||
if(p_new)
|
||||
{
|
||||
if (p_new) {
|
||||
memcpy(p_new, p_buf, copy_size);
|
||||
list_append(p_scbi->a2d_list, p_new);
|
||||
if (list_length(p_scbi->a2d_list) > p_bta_av_cfg->audio_mqs) {
|
||||
@ -1279,8 +1195,7 @@ void bta_av_sm_execute(tBTA_AV_CB *p_cb, UINT16 event, tBTA_AV_DATA *p_data)
|
||||
APPL_TRACE_EVENT("next state=%d\n", p_cb->state);
|
||||
|
||||
/* execute action functions */
|
||||
if ((action = state_table[event][BTA_AV_ACTION_COL]) != BTA_AV_IGNORE)
|
||||
{
|
||||
if ((action = state_table[event][BTA_AV_ACTION_COL]) != BTA_AV_IGNORE) {
|
||||
(*bta_av_action[action])(p_cb, p_data);
|
||||
}
|
||||
}
|
||||
@ -1301,13 +1216,11 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
|
||||
UINT16 event = p_msg->event;
|
||||
UINT16 first_event = BTA_AV_FIRST_NSM_EVT;
|
||||
|
||||
if (event > BTA_AV_LAST_EVT)
|
||||
{
|
||||
if (event > BTA_AV_LAST_EVT) {
|
||||
return TRUE; /* to free p_msg */
|
||||
}
|
||||
|
||||
if(event >= first_event)
|
||||
{
|
||||
if (event >= first_event) {
|
||||
#if (defined(BTA_AV_DEBUG) && BTA_AV_DEBUG == TRUE)
|
||||
APPL_TRACE_VERBOSE("AV nsm event=0x%x(%s)\n", event, bta_av_evt_code(event));
|
||||
#else
|
||||
@ -1315,9 +1228,7 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
|
||||
#endif
|
||||
/* non state machine events */
|
||||
(*bta_av_nsm_act[event - BTA_AV_FIRST_NSM_EVT]) ((tBTA_AV_DATA *) p_msg);
|
||||
}
|
||||
else if (event >= BTA_AV_FIRST_SM_EVT && event <= BTA_AV_LAST_SM_EVT)
|
||||
{
|
||||
} else if (event >= BTA_AV_FIRST_SM_EVT && event <= BTA_AV_LAST_SM_EVT) {
|
||||
#if (defined(BTA_AV_DEBUG) && BTA_AV_DEBUG == TRUE)
|
||||
APPL_TRACE_VERBOSE("AV sm event=0x%x(%s)\n", event, bta_av_evt_code(event));
|
||||
#else
|
||||
@ -1325,9 +1236,7 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
|
||||
#endif
|
||||
/* state machine events */
|
||||
bta_av_sm_execute(&bta_av_cb, p_msg->event, (tBTA_AV_DATA *) p_msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
APPL_TRACE_VERBOSE("handle=0x%x\n", p_msg->layer_specific);
|
||||
/* stream state machine events */
|
||||
bta_av_ssm_execute( bta_av_hndl_to_scb(p_msg->layer_specific),
|
||||
@ -1352,8 +1261,7 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
|
||||
*******************************************************************************/
|
||||
static char *bta_av_st_code(UINT8 state)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
switch (state) {
|
||||
case BTA_AV_INIT_ST: return "INIT";
|
||||
case BTA_AV_OPEN_ST: return "OPEN";
|
||||
default: return "unknown";
|
||||
@ -1370,8 +1278,7 @@ static char *bta_av_st_code(UINT8 state)
|
||||
*******************************************************************************/
|
||||
char *bta_av_evt_code(UINT16 evt_code)
|
||||
{
|
||||
switch(evt_code)
|
||||
{
|
||||
switch (evt_code) {
|
||||
case BTA_AV_API_DISABLE_EVT: return "API_DISABLE";
|
||||
case BTA_AV_API_REMOTE_CMD_EVT: return "API_REMOTE_CMD";
|
||||
case BTA_AV_API_VENDOR_CMD_EVT: return "API_VENDOR_CMD";
|
||||
|
180
components/bt/bluedroid/bta/av/bta_av_sbc.c
Executable file → Normal file
180
components/bt/bluedroid/bta/av/bta_av_sbc.c
Executable file → Normal file
@ -36,8 +36,7 @@ typedef int (tBTA_AV_SBC_ACT)(void *p_src, void *p_dst,
|
||||
UINT32 src_samples, UINT32 dst_samples,
|
||||
UINT32 *p_ret);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
INT32 cur_pos; /* current position */
|
||||
UINT32 src_sps; /* samples per second (source audio data) */
|
||||
UINT32 dst_sps; /* samples per second (converted audio data) */
|
||||
@ -71,32 +70,23 @@ void bta_av_sbc_init_up_sample (UINT32 src_sps, UINT32 dst_sps, UINT16 bits, UIN
|
||||
bta_av_sbc_ups_cb.src_sps = src_sps;
|
||||
bta_av_sbc_ups_cb.dst_sps = dst_sps;
|
||||
bta_av_sbc_ups_cb.bits = bits;
|
||||
bta_av_sbc_ups_cb.n_channels= n_channels;
|
||||
bta_av_sbc_ups_cb.n_channels = n_channels;
|
||||
|
||||
if(n_channels == 1)
|
||||
{
|
||||
if (n_channels == 1) {
|
||||
/* mono */
|
||||
if(bits == 8)
|
||||
{
|
||||
if (bits == 8) {
|
||||
bta_av_sbc_ups_cb.p_act = bta_av_sbc_up_sample_8m;
|
||||
bta_av_sbc_ups_cb.div = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bta_av_sbc_ups_cb.p_act = bta_av_sbc_up_sample_16m;
|
||||
bta_av_sbc_ups_cb.div = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* stereo */
|
||||
if(bits == 8)
|
||||
{
|
||||
if (bits == 8) {
|
||||
bta_av_sbc_ups_cb.p_act = bta_av_sbc_up_sample_8s;
|
||||
bta_av_sbc_ups_cb.div = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bta_av_sbc_ups_cb.p_act = bta_av_sbc_up_sample_16s;
|
||||
bta_av_sbc_ups_cb.div = 4;
|
||||
}
|
||||
@ -135,14 +125,11 @@ int bta_av_sbc_up_sample (void *p_src, void *p_dst,
|
||||
UINT32 src;
|
||||
UINT32 dst;
|
||||
|
||||
if(bta_av_sbc_ups_cb.p_act)
|
||||
{
|
||||
src = src_samples/bta_av_sbc_ups_cb.div;
|
||||
dst = dst_samples/bta_av_sbc_ups_cb.div;
|
||||
if (bta_av_sbc_ups_cb.p_act) {
|
||||
src = src_samples / bta_av_sbc_ups_cb.div;
|
||||
dst = dst_samples / bta_av_sbc_ups_cb.div;
|
||||
return (*bta_av_sbc_ups_cb.p_act)(p_src, p_dst, src, dst, p_ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
*p_ret = 0;
|
||||
return 0;
|
||||
}
|
||||
@ -176,8 +163,7 @@ int bta_av_sbc_up_sample_16s (void *p_src, void *p_dst,
|
||||
UINT32 src_sps = bta_av_sbc_ups_cb.src_sps;
|
||||
UINT32 dst_sps = bta_av_sbc_ups_cb.dst_sps;
|
||||
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples)
|
||||
{
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples) {
|
||||
*p_dst_tmp++ = *p_worker1;
|
||||
*p_dst_tmp++ = *p_worker2;
|
||||
|
||||
@ -187,13 +173,11 @@ int bta_av_sbc_up_sample_16s (void *p_src, void *p_dst,
|
||||
|
||||
bta_av_sbc_ups_cb.cur_pos = dst_sps;
|
||||
|
||||
while (src_samples-- && dst_samples)
|
||||
{
|
||||
while (src_samples-- && dst_samples) {
|
||||
*p_worker1 = *p_src_tmp++;
|
||||
*p_worker2 = *p_src_tmp++;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
*p_dst_tmp++ = *p_worker1;
|
||||
*p_dst_tmp++ = *p_worker2;
|
||||
|
||||
@ -204,8 +188,9 @@ int bta_av_sbc_up_sample_16s (void *p_src, void *p_dst,
|
||||
bta_av_sbc_ups_cb.cur_pos += dst_sps;
|
||||
}
|
||||
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps)
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps) {
|
||||
bta_av_sbc_ups_cb.cur_pos = 0;
|
||||
}
|
||||
|
||||
*p_ret = ((char *)p_src_tmp - (char *)p_src);
|
||||
return ((char *)p_dst_tmp - (char *)p_dst);
|
||||
@ -238,8 +223,7 @@ int bta_av_sbc_up_sample_16m (void *p_src, void *p_dst,
|
||||
UINT32 src_sps = bta_av_sbc_ups_cb.src_sps;
|
||||
UINT32 dst_sps = bta_av_sbc_ups_cb.dst_sps;
|
||||
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples)
|
||||
{
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples) {
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
|
||||
@ -251,12 +235,10 @@ int bta_av_sbc_up_sample_16m (void *p_src, void *p_dst,
|
||||
|
||||
bta_av_sbc_ups_cb.cur_pos = dst_sps;
|
||||
|
||||
while (src_samples-- && dst_samples)
|
||||
{
|
||||
while (src_samples-- && dst_samples) {
|
||||
*p_worker = *p_src_tmp++;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
|
||||
@ -269,8 +251,9 @@ int bta_av_sbc_up_sample_16m (void *p_src, void *p_dst,
|
||||
bta_av_sbc_ups_cb.cur_pos += dst_sps;
|
||||
}
|
||||
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps)
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps) {
|
||||
bta_av_sbc_ups_cb.cur_pos = 0;
|
||||
}
|
||||
|
||||
*p_ret = ((char *)p_src_tmp - (char *)p_src);
|
||||
return ((char *)p_dst_tmp - (char *)p_dst);
|
||||
@ -304,8 +287,7 @@ int bta_av_sbc_up_sample_8s (void *p_src, void *p_dst,
|
||||
UINT32 src_sps = bta_av_sbc_ups_cb.src_sps;
|
||||
UINT32 dst_sps = bta_av_sbc_ups_cb.dst_sps;
|
||||
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples)
|
||||
{
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples) {
|
||||
*p_dst_tmp++ = *p_worker1;
|
||||
*p_dst_tmp++ = *p_worker2;
|
||||
|
||||
@ -316,8 +298,7 @@ int bta_av_sbc_up_sample_8s (void *p_src, void *p_dst,
|
||||
|
||||
bta_av_sbc_ups_cb.cur_pos = dst_sps;
|
||||
|
||||
while (src_samples -- && dst_samples)
|
||||
{
|
||||
while (src_samples -- && dst_samples) {
|
||||
*p_worker1 = *(UINT8 *)p_src_tmp++;
|
||||
*p_worker1 -= 0x80;
|
||||
*p_worker1 <<= 8;
|
||||
@ -325,8 +306,7 @@ int bta_av_sbc_up_sample_8s (void *p_src, void *p_dst,
|
||||
*p_worker2 -= 0x80;
|
||||
*p_worker2 <<= 8;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
*p_dst_tmp++ = *p_worker1;
|
||||
*p_dst_tmp++ = *p_worker2;
|
||||
|
||||
@ -338,8 +318,9 @@ int bta_av_sbc_up_sample_8s (void *p_src, void *p_dst,
|
||||
bta_av_sbc_ups_cb.cur_pos += dst_sps;
|
||||
}
|
||||
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps)
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps) {
|
||||
bta_av_sbc_ups_cb.cur_pos = 0;
|
||||
}
|
||||
|
||||
*p_ret = ((char *)p_src_tmp - (char *)p_src);
|
||||
return ((char *)p_dst_tmp - (char *)p_dst);
|
||||
@ -372,8 +353,7 @@ int bta_av_sbc_up_sample_8m (void *p_src, void *p_dst,
|
||||
UINT32 src_sps = bta_av_sbc_ups_cb.src_sps;
|
||||
UINT32 dst_sps = bta_av_sbc_ups_cb.dst_sps;
|
||||
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples)
|
||||
{
|
||||
while (bta_av_sbc_ups_cb.cur_pos > 0 && dst_samples) {
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
|
||||
@ -384,14 +364,12 @@ int bta_av_sbc_up_sample_8m (void *p_src, void *p_dst,
|
||||
|
||||
bta_av_sbc_ups_cb.cur_pos = dst_sps;
|
||||
|
||||
while (src_samples-- && dst_samples)
|
||||
{
|
||||
while (src_samples-- && dst_samples) {
|
||||
*p_worker = *(UINT8 *)p_src_tmp++;
|
||||
*p_worker -= 0x80;
|
||||
*p_worker <<= 8;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
*p_dst_tmp++ = *p_worker;
|
||||
|
||||
@ -403,8 +381,9 @@ int bta_av_sbc_up_sample_8m (void *p_src, void *p_dst,
|
||||
bta_av_sbc_ups_cb.cur_pos += dst_sps;
|
||||
}
|
||||
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps)
|
||||
if (bta_av_sbc_ups_cb.cur_pos == (INT32)dst_sps) {
|
||||
bta_av_sbc_ups_cb.cur_pos = 0;
|
||||
}
|
||||
|
||||
*p_ret = ((char *)p_src_tmp - (char *)p_src);
|
||||
return ((char *)p_dst_tmp - (char *)p_dst);
|
||||
@ -433,80 +412,61 @@ UINT8 bta_av_sbc_cfg_for_cap(UINT8 *p_peer, tA2D_SBC_CIE *p_cap, tA2D_SBC_CIE *p
|
||||
UNUSED(p_cap);
|
||||
|
||||
/* parse peer capabilities */
|
||||
if ((status = A2D_ParsSbcInfo(&peer_cie, p_peer, TRUE)) != 0)
|
||||
{
|
||||
if ((status = A2D_ParsSbcInfo(&peer_cie, p_peer, TRUE)) != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Check if the peer supports our channel mode */
|
||||
if (peer_cie.ch_mode & p_pref->ch_mode)
|
||||
{
|
||||
if (peer_cie.ch_mode & p_pref->ch_mode) {
|
||||
peer_cie.ch_mode = p_pref->ch_mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
APPL_TRACE_ERROR("bta_av_sbc_cfg_for_cap: ch_mode(0x%02X) not supported", p_pref->ch_mode);
|
||||
return A2D_FAIL;
|
||||
}
|
||||
|
||||
/* Check if the peer supports our sampling freq */
|
||||
if (peer_cie.samp_freq & p_pref->samp_freq)
|
||||
{
|
||||
if (peer_cie.samp_freq & p_pref->samp_freq) {
|
||||
peer_cie.samp_freq = p_pref->samp_freq;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
APPL_TRACE_ERROR("bta_av_sbc_cfg_for_cap: samp_freq(0x%02X) not supported", p_pref->samp_freq);
|
||||
return A2D_FAIL;
|
||||
}
|
||||
|
||||
/* Check if the peer supports our block len */
|
||||
if (peer_cie.block_len & p_pref->block_len)
|
||||
{
|
||||
if (peer_cie.block_len & p_pref->block_len) {
|
||||
peer_cie.block_len = p_pref->block_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
APPL_TRACE_ERROR("bta_av_sbc_cfg_for_cap: block_len(0x%02X) not supported", p_pref->block_len);
|
||||
return A2D_FAIL;
|
||||
}
|
||||
|
||||
/* Check if the peer supports our num subbands */
|
||||
if (peer_cie.num_subbands & p_pref->num_subbands)
|
||||
{
|
||||
if (peer_cie.num_subbands & p_pref->num_subbands) {
|
||||
peer_cie.num_subbands = p_pref->num_subbands;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
APPL_TRACE_ERROR("bta_av_sbc_cfg_for_cap: num_subbands(0x%02X) not supported", p_pref->num_subbands);
|
||||
return A2D_FAIL;
|
||||
}
|
||||
|
||||
/* Check if the peer supports our alloc method */
|
||||
if (peer_cie.alloc_mthd & p_pref->alloc_mthd)
|
||||
{
|
||||
if (peer_cie.alloc_mthd & p_pref->alloc_mthd) {
|
||||
peer_cie.alloc_mthd = p_pref->alloc_mthd;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
APPL_TRACE_ERROR("bta_av_sbc_cfg_for_cap: alloc_mthd(0x%02X) not supported", p_pref->alloc_mthd);
|
||||
return A2D_FAIL;
|
||||
}
|
||||
|
||||
/* max bitpool */
|
||||
if (p_pref->max_bitpool != 0 && p_pref->max_bitpool < peer_cie.max_bitpool)
|
||||
{
|
||||
if (p_pref->max_bitpool != 0 && p_pref->max_bitpool < peer_cie.max_bitpool) {
|
||||
peer_cie.max_bitpool = p_pref->max_bitpool;
|
||||
}
|
||||
|
||||
/* min bitpool */
|
||||
if (p_pref->min_bitpool != 0 && p_pref->min_bitpool > peer_cie.min_bitpool)
|
||||
{
|
||||
if (p_pref->min_bitpool != 0 && p_pref->min_bitpool > peer_cie.min_bitpool) {
|
||||
peer_cie.min_bitpool = p_pref->min_bitpool;
|
||||
}
|
||||
|
||||
if (status == A2D_SUCCESS)
|
||||
{
|
||||
if (status == A2D_SUCCESS) {
|
||||
/* build configuration */
|
||||
A2D_BldSbcInfo(A2D_MEDIA_TYPE_AUDIO, &peer_cie, p_peer);
|
||||
}
|
||||
@ -529,8 +489,7 @@ UINT8 bta_av_sbc_cfg_matches_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap)
|
||||
tA2D_SBC_CIE cfg_cie;
|
||||
|
||||
/* parse configuration */
|
||||
if ((status = A2D_ParsSbcInfo(&cfg_cie, p_cfg, TRUE)) != 0)
|
||||
{
|
||||
if ((status = A2D_ParsSbcInfo(&cfg_cie, p_cfg, TRUE)) != 0) {
|
||||
APPL_TRACE_ERROR(" bta_av_sbc_cfg_matches_cap Parsing Failed %d", status);
|
||||
return status;
|
||||
}
|
||||
@ -546,38 +505,31 @@ UINT8 bta_av_sbc_cfg_matches_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap)
|
||||
APPL_TRACE_DEBUG(" Min_bitpool peer: 0%x, capability 0%x", cfg_cie.min_bitpool, p_cap->min_bitpool);
|
||||
|
||||
/* sampling frequency */
|
||||
if ((cfg_cie.samp_freq & p_cap->samp_freq) == 0)
|
||||
{
|
||||
if ((cfg_cie.samp_freq & p_cap->samp_freq) == 0) {
|
||||
status = A2D_NS_SAMP_FREQ;
|
||||
}
|
||||
/* channel mode */
|
||||
else if ((cfg_cie.ch_mode & p_cap->ch_mode) == 0)
|
||||
{
|
||||
else if ((cfg_cie.ch_mode & p_cap->ch_mode) == 0) {
|
||||
status = A2D_NS_CH_MODE;
|
||||
}
|
||||
/* block length */
|
||||
else if ((cfg_cie.block_len & p_cap->block_len) == 0)
|
||||
{
|
||||
else if ((cfg_cie.block_len & p_cap->block_len) == 0) {
|
||||
status = A2D_BAD_BLOCK_LEN;
|
||||
}
|
||||
/* subbands */
|
||||
else if ((cfg_cie.num_subbands & p_cap->num_subbands) == 0)
|
||||
{
|
||||
else if ((cfg_cie.num_subbands & p_cap->num_subbands) == 0) {
|
||||
status = A2D_NS_SUBBANDS;
|
||||
}
|
||||
/* allocation method */
|
||||
else if ((cfg_cie.alloc_mthd & p_cap->alloc_mthd) == 0)
|
||||
{
|
||||
else if ((cfg_cie.alloc_mthd & p_cap->alloc_mthd) == 0) {
|
||||
status = A2D_NS_ALLOC_MTHD;
|
||||
}
|
||||
/* max bitpool */
|
||||
else if (cfg_cie.max_bitpool > p_cap->max_bitpool)
|
||||
{
|
||||
else if (cfg_cie.max_bitpool > p_cap->max_bitpool) {
|
||||
status = A2D_NS_MAX_BITPOOL;
|
||||
}
|
||||
/* min bitpool */
|
||||
else if (cfg_cie.min_bitpool < p_cap->min_bitpool)
|
||||
{
|
||||
else if (cfg_cie.min_bitpool < p_cap->min_bitpool) {
|
||||
status = A2D_NS_MIN_BITPOOL;
|
||||
}
|
||||
|
||||
@ -601,8 +553,7 @@ UINT8 bta_av_sbc_cfg_in_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap)
|
||||
tA2D_SBC_CIE cfg_cie;
|
||||
|
||||
/* parse configuration */
|
||||
if ((status = A2D_ParsSbcInfo(&cfg_cie, p_cfg, FALSE)) != 0)
|
||||
{
|
||||
if ((status = A2D_ParsSbcInfo(&cfg_cie, p_cfg, FALSE)) != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -610,38 +561,31 @@ UINT8 bta_av_sbc_cfg_in_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap)
|
||||
|
||||
|
||||
/* sampling frequency */
|
||||
if ((cfg_cie.samp_freq & p_cap->samp_freq) == 0)
|
||||
{
|
||||
if ((cfg_cie.samp_freq & p_cap->samp_freq) == 0) {
|
||||
status = A2D_NS_SAMP_FREQ;
|
||||
}
|
||||
/* channel mode */
|
||||
else if ((cfg_cie.ch_mode & p_cap->ch_mode) == 0)
|
||||
{
|
||||
else if ((cfg_cie.ch_mode & p_cap->ch_mode) == 0) {
|
||||
status = A2D_NS_CH_MODE;
|
||||
}
|
||||
/* block length */
|
||||
else if ((cfg_cie.block_len & p_cap->block_len) == 0)
|
||||
{
|
||||
else if ((cfg_cie.block_len & p_cap->block_len) == 0) {
|
||||
status = A2D_BAD_BLOCK_LEN;
|
||||
}
|
||||
/* subbands */
|
||||
else if ((cfg_cie.num_subbands & p_cap->num_subbands) == 0)
|
||||
{
|
||||
else if ((cfg_cie.num_subbands & p_cap->num_subbands) == 0) {
|
||||
status = A2D_NS_SUBBANDS;
|
||||
}
|
||||
/* allocation method */
|
||||
else if ((cfg_cie.alloc_mthd & p_cap->alloc_mthd) == 0)
|
||||
{
|
||||
else if ((cfg_cie.alloc_mthd & p_cap->alloc_mthd) == 0) {
|
||||
status = A2D_NS_ALLOC_MTHD;
|
||||
}
|
||||
/* max bitpool */
|
||||
else if (cfg_cie.max_bitpool > p_cap->max_bitpool)
|
||||
{
|
||||
else if (cfg_cie.max_bitpool > p_cap->max_bitpool) {
|
||||
status = A2D_NS_MAX_BITPOOL;
|
||||
}
|
||||
/* min bitpool */
|
||||
else if (cfg_cie.min_bitpool < p_cap->min_bitpool)
|
||||
{
|
||||
else if (cfg_cie.min_bitpool < p_cap->min_bitpool) {
|
||||
status = A2D_NS_MIN_BITPOOL;
|
||||
}
|
||||
|
||||
|
505
components/bt/bluedroid/bta/av/bta_av_ssm.c
Executable file → Normal file
505
components/bt/bluedroid/bta/av/bta_av_ssm.c
Executable file → Normal file
@ -34,8 +34,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/* state machine states */
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
BTA_AV_INIT_SST,
|
||||
BTA_AV_INCOMING_SST,
|
||||
BTA_AV_OPENING_SST,
|
||||
@ -46,8 +45,7 @@ enum
|
||||
|
||||
|
||||
/* state machine action enumeration list */
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
BTA_AV_DO_DISC,
|
||||
BTA_AV_CLEANUP,
|
||||
BTA_AV_FREE_SDB,
|
||||
@ -109,251 +107,244 @@ enum
|
||||
#define BTA_AV_NUM_COLS 3 /* number of columns in state tables */
|
||||
|
||||
/* state table for init state */
|
||||
static const UINT8 bta_av_sst_init[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_DO_DISC, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_CLEANUP, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST }
|
||||
static const UINT8 bta_av_sst_init[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_DO_DISC, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_CLEANUP, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST }
|
||||
};
|
||||
|
||||
/* state table for incoming state */
|
||||
static const UINT8 bta_av_sst_incoming[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_OPEN_AT_INC, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_CCO_CLOSE, BTA_AV_DISCONNECT_REQ, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SECURITY_REQ, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SECURITY_RSP, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SETCONFIG_RSP, BTA_AV_ST_RC_TIMER, BTA_AV_INCOMING_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_CLEANUP, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_DISC_RES_AS_ACP,BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SAVE_CAPS, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_STR_OPENED, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_CCO_CLOSE, BTA_AV_CLEANUP, BTA_AV_INIT_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_CONFIG_IND, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_IND, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SECURITY_CFM, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_CCO_CLOSE, BTA_AV_CLEANUP, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST }
|
||||
static const UINT8 bta_av_sst_incoming[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_OPEN_AT_INC, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_CCO_CLOSE, BTA_AV_DISCONNECT_REQ, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SECURITY_REQ, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SECURITY_RSP, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SETCONFIG_RSP, BTA_AV_ST_RC_TIMER, BTA_AV_INCOMING_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_CLEANUP, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_DISC_RES_AS_ACP, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SAVE_CAPS, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_STR_OPENED, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_CCO_CLOSE, BTA_AV_CLEANUP, BTA_AV_INIT_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_CONFIG_IND, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_IND, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SECURITY_CFM, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_CCO_CLOSE, BTA_AV_CLEANUP, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST }
|
||||
};
|
||||
|
||||
/* state table for opening state */
|
||||
static const UINT8 bta_av_sst_opening[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DO_CLOSE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SECURITY_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SECURITY_RSP, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_CONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_CONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_DISC_RESULTS, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_OPEN_FAILED, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_GETCAP_RESULTS, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_OPEN_FAILED, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_ST_RC_TIMER, BTA_AV_STR_OPENED, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_OPEN_FAILED, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_CONFIG_IND, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_IND, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SECURITY_CFM, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SWITCH_ROLE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_DISCOVER_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_CONN_FAILED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_ROLE_RES, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST }
|
||||
static const UINT8 bta_av_sst_opening[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DO_CLOSE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SECURITY_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SECURITY_RSP, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_CONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_CONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_DISC_RESULTS, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_OPEN_FAILED, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_GETCAP_RESULTS, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_OPEN_FAILED, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_ST_RC_TIMER, BTA_AV_STR_OPENED, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_OPEN_FAILED, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_CONFIG_IND, BTA_AV_SIGNORE, BTA_AV_INCOMING_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_IND, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SECURITY_CFM, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SWITCH_ROLE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_DISCOVER_REQ, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_CONN_FAILED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_ROLE_RES, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_OPENING_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPENING_SST }
|
||||
};
|
||||
|
||||
/* state table for open state */
|
||||
static const UINT8 bta_av_sst_open[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DO_CLOSE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_DO_START, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_STR_STOPPED, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_RECONFIG, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SECURITY_REQ, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SECURITY_RSP, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SET_USE_RC, BTA_AV_OPEN_RC, BTA_AV_OPEN_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_DATA_PATH, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SAVE_CAPS, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_START_OK, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_START_FAILED, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_IND, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SECURITY_CFM, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_CLR_CONG, BTA_AV_DATA_PATH, BTA_AV_OPEN_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SUSPEND_CFM, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_OPEN_RC, BTA_AV_CHK_2ND_START, BTA_AV_OPEN_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_ROLE_RES, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST }
|
||||
static const UINT8 bta_av_sst_open[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DO_CLOSE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_DO_START, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_STR_STOPPED, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_RECONFIG, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SECURITY_REQ, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SECURITY_RSP, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SET_USE_RC, BTA_AV_OPEN_RC, BTA_AV_OPEN_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_DATA_PATH, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SAVE_CAPS, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_START_OK, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_START_FAILED, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_IND, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SECURITY_CFM, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_CLR_CONG, BTA_AV_DATA_PATH, BTA_AV_OPEN_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SUSPEND_CFM, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_OPEN_RC, BTA_AV_CHK_2ND_START, BTA_AV_OPEN_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_ROLE_RES, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_OPEN_SST }
|
||||
};
|
||||
|
||||
/* state table for reconfig state */
|
||||
static const UINT8 bta_av_sst_rcfg[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_DISC_RESULTS, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_GETCAP_RESULTS, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_RCFG_STR_OK, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_RCFG_FAILED, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_RCFG_CONNECT, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SUSPEND_CONT, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_RCFG_CFM, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_RCFG_OPEN, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_RCFG_DISCNTD, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST }
|
||||
static const UINT8 bta_av_sst_rcfg[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_FREE_SDB, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_DISC_RESULTS, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_GETCAP_RESULTS, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_RCFG_STR_OK, BTA_AV_SIGNORE, BTA_AV_OPEN_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_RCFG_FAILED, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_RCFG_CONNECT, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SUSPEND_CONT, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_RCFG_CFM, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_RCFG_OPEN, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_RCFG_DISCNTD, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_DELAY_CO, BTA_AV_SIGNORE, BTA_AV_RCFG_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_RCFG_SST }
|
||||
};
|
||||
|
||||
/* state table for closing state */
|
||||
static const UINT8 bta_av_sst_closing[][BTA_AV_NUM_COLS] =
|
||||
{
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_SDP_FAILED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_SDP_FAILED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_DO_CLOSE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_REJ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST }
|
||||
static const UINT8 bta_av_sst_closing[][BTA_AV_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* AP_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_CLOSE_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_START_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AP_STOP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_RECONFIG_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_PROTECT_REQ_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_PROTECT_RSP_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* API_RC_OPEN_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* SRC_DATA_READY_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* CI_SETCONFIG_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* CI_SETCONFIG_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* SDP_DISC_OK_EVT */ {BTA_AV_SDP_FAILED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* SDP_DISC_FAIL_EVT */ {BTA_AV_SDP_FAILED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* STR_DISC_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_DISC_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_GETCAP_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_GETCAP_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_OPEN_OK_EVT */ {BTA_AV_DO_CLOSE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_OPEN_FAIL_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_START_OK_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_START_FAIL_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_CLOSE_EVT */ {BTA_AV_DISCONNECT_REQ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_CONFIG_IND_EVT */ {BTA_AV_SETCONFIG_REJ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_SECURITY_IND_EVT */ {BTA_AV_SECURITY_REJ, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_SECURITY_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_WRITE_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_SUSPEND_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* STR_RECONFIG_CFM_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVRC_TIMER_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVDT_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVDT_DISCONNECT_EVT */ {BTA_AV_STR_CLOSED, BTA_AV_SIGNORE, BTA_AV_INIT_SST },
|
||||
/* ROLE_CHANGE_EVT*/ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* AVDT_DELAY_RPT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST },
|
||||
/* ACP_CONNECT_EVT */ {BTA_AV_SIGNORE, BTA_AV_SIGNORE, BTA_AV_CLOSING_SST }
|
||||
};
|
||||
|
||||
/* type for state table */
|
||||
typedef const UINT8 (*tBTA_AV_SST_TBL)[BTA_AV_NUM_COLS];
|
||||
|
||||
/* state table */
|
||||
static const tBTA_AV_SST_TBL bta_av_sst_tbl[] =
|
||||
{
|
||||
static const tBTA_AV_SST_TBL bta_av_sst_tbl[] = {
|
||||
bta_av_sst_init,
|
||||
bta_av_sst_incoming,
|
||||
bta_av_sst_opening,
|
||||
@ -382,11 +373,11 @@ BOOLEAN bta_av_is_rcfg_sst (tBTA_AV_SCB *p_scb)
|
||||
{
|
||||
BOOLEAN is_rcfg_sst = FALSE;
|
||||
|
||||
if (p_scb != NULL)
|
||||
{
|
||||
if (p_scb->state == BTA_AV_RCFG_SST)
|
||||
if (p_scb != NULL) {
|
||||
if (p_scb->state == BTA_AV_RCFG_SST) {
|
||||
is_rcfg_sst = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return is_rcfg_sst;
|
||||
}
|
||||
@ -407,8 +398,7 @@ void bta_av_ssm_execute(tBTA_AV_SCB *p_scb, UINT16 event, tBTA_AV_DATA *p_data)
|
||||
UINT8 action;
|
||||
int i, xx;
|
||||
|
||||
if(p_scb == NULL)
|
||||
{
|
||||
if (p_scb == NULL) {
|
||||
/* this stream is not registered */
|
||||
APPL_TRACE_EVENT("AV channel not registered");
|
||||
return;
|
||||
@ -418,14 +408,10 @@ void bta_av_ssm_execute(tBTA_AV_SCB *p_scb, UINT16 event, tBTA_AV_DATA *p_data)
|
||||
/* When ACP_CONNECT_EVT was received, we put first available scb to */
|
||||
/* to Incoming state. Later, when STR_CONFIG_IND_EVT is coming, we */
|
||||
/* know if it is A2DP or VDP. */
|
||||
if ((p_scb->state == BTA_AV_INIT_SST) && (event == BTA_AV_STR_CONFIG_IND_EVT))
|
||||
{
|
||||
for (xx = 0; xx < BTA_AV_NUM_STRS; xx++)
|
||||
{
|
||||
if (bta_av_cb.p_scb[xx])
|
||||
{
|
||||
if (bta_av_cb.p_scb[xx]->state == BTA_AV_INCOMING_SST)
|
||||
{
|
||||
if ((p_scb->state == BTA_AV_INIT_SST) && (event == BTA_AV_STR_CONFIG_IND_EVT)) {
|
||||
for (xx = 0; xx < BTA_AV_NUM_STRS; xx++) {
|
||||
if (bta_av_cb.p_scb[xx]) {
|
||||
if (bta_av_cb.p_scb[xx]->state == BTA_AV_INCOMING_SST) {
|
||||
bta_av_cb.p_scb[xx]->state = BTA_AV_INIT_SST;
|
||||
bta_av_cb.p_scb[xx]->coll_mask = 0;
|
||||
p_scb->state = BTA_AV_INCOMING_SST;
|
||||
@ -451,15 +437,13 @@ void bta_av_ssm_execute(tBTA_AV_SCB *p_scb, UINT16 event, tBTA_AV_DATA *p_data)
|
||||
p_scb->state = state_table[event][BTA_AV_SNEXT_STATE];
|
||||
|
||||
/* execute action functions */
|
||||
for(i=0; i< BTA_AV_SACTIONS; i++)
|
||||
{
|
||||
if ((action = state_table[event][i]) != BTA_AV_SIGNORE)
|
||||
{
|
||||
for (i = 0; i < BTA_AV_SACTIONS; i++) {
|
||||
if ((action = state_table[event][i]) != BTA_AV_SIGNORE) {
|
||||
(*p_scb->p_act_tbl[action])(p_scb, p_data);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -477,11 +461,11 @@ BOOLEAN bta_av_is_scb_opening (tBTA_AV_SCB *p_scb)
|
||||
{
|
||||
BOOLEAN is_opening = FALSE;
|
||||
|
||||
if (p_scb)
|
||||
{
|
||||
if (p_scb->state == BTA_AV_OPENING_SST)
|
||||
if (p_scb) {
|
||||
if (p_scb->state == BTA_AV_OPENING_SST) {
|
||||
is_opening = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return is_opening;
|
||||
}
|
||||
@ -500,11 +484,11 @@ BOOLEAN bta_av_is_scb_incoming (tBTA_AV_SCB *p_scb)
|
||||
{
|
||||
BOOLEAN is_incoming = FALSE;
|
||||
|
||||
if (p_scb)
|
||||
{
|
||||
if (p_scb->state == BTA_AV_INCOMING_SST)
|
||||
if (p_scb) {
|
||||
if (p_scb->state == BTA_AV_INCOMING_SST) {
|
||||
is_incoming = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return is_incoming;
|
||||
}
|
||||
@ -521,8 +505,7 @@ BOOLEAN bta_av_is_scb_incoming (tBTA_AV_SCB *p_scb)
|
||||
*******************************************************************************/
|
||||
void bta_av_set_scb_sst_init (tBTA_AV_SCB *p_scb)
|
||||
{
|
||||
if (p_scb)
|
||||
{
|
||||
if (p_scb) {
|
||||
p_scb->state = BTA_AV_INIT_SST;
|
||||
}
|
||||
}
|
||||
@ -541,11 +524,11 @@ BOOLEAN bta_av_is_scb_init (tBTA_AV_SCB *p_scb)
|
||||
{
|
||||
BOOLEAN is_init = FALSE;
|
||||
|
||||
if (p_scb)
|
||||
{
|
||||
if (p_scb->state == BTA_AV_INIT_SST)
|
||||
if (p_scb) {
|
||||
if (p_scb->state == BTA_AV_INIT_SST) {
|
||||
is_init = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return is_init;
|
||||
}
|
||||
@ -562,8 +545,7 @@ BOOLEAN bta_av_is_scb_init (tBTA_AV_SCB *p_scb)
|
||||
*******************************************************************************/
|
||||
void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb)
|
||||
{
|
||||
if (p_scb)
|
||||
{
|
||||
if (p_scb) {
|
||||
p_scb->state = BTA_AV_INCOMING_SST;
|
||||
}
|
||||
}
|
||||
@ -583,8 +565,7 @@ void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb)
|
||||
*******************************************************************************/
|
||||
static char *bta_av_sst_code(UINT8 state)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
switch (state) {
|
||||
case BTA_AV_INIT_SST: return "INIT";
|
||||
case BTA_AV_INCOMING_SST: return "INCOMING";
|
||||
case BTA_AV_OPENING_SST: return "OPENING";
|
||||
|
0
components/bt/bluedroid/bta/include/bta_ar_api.h
Executable file → Normal file
0
components/bt/bluedroid/bta/include/bta_ar_api.h
Executable file → Normal file
74
components/bt/bluedroid/bta/include/bta_av_api.h
Executable file → Normal file
74
components/bt/bluedroid/bta/include/bta_av_api.h
Executable file → Normal file
@ -100,7 +100,7 @@ typedef UINT8 tBTA_AV_HNDL;
|
||||
#endif
|
||||
|
||||
#ifndef BTA_AV_MAX_A2DP_MTU
|
||||
/*#define BTA_AV_MAX_A2DP_MTU 668 //224 (DM5) * 3 - 4(L2CAP header) */
|
||||
/*#define BTA_AV_MAX_A2DP_MTU 668 //224 (DM5) * 3 - 4(L2CAP header) */
|
||||
#define BTA_AV_MAX_A2DP_MTU 1008
|
||||
#endif
|
||||
|
||||
@ -271,15 +271,14 @@ typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
|
||||
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
|
||||
UINT16 mtu);
|
||||
typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
|
||||
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
|
||||
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
|
||||
typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
|
||||
typedef void * (*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
|
||||
typedef void *(*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
|
||||
UINT32 *p_len, UINT32 *p_timestamp);
|
||||
typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
|
||||
|
||||
/* the call-out functions for one stream */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CO_INIT init;
|
||||
tBTA_AV_CO_DISC_RES disc_res;
|
||||
tBTA_AV_CO_GETCFG getcfg;
|
||||
@ -295,14 +294,12 @@ typedef struct
|
||||
typedef UINT8 tBTA_AV_EVT;
|
||||
|
||||
/* Event associated with BTA_AV_ENABLE_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_FEAT features;
|
||||
} tBTA_AV_ENABLE;
|
||||
|
||||
/* Event associated with BTA_AV_REGISTER_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl; /* audio/video */
|
||||
tBTA_AV_HNDL hndl; /* Handle associated with the stream. */
|
||||
UINT8 app_id; /* ID associated with call to BTA_AvRegister() */
|
||||
@ -315,8 +312,7 @@ typedef struct
|
||||
#define BTA_AV_EDR_3MBPS 0x02
|
||||
typedef UINT8 tBTA_AV_EDR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_HNDL hndl;
|
||||
BD_ADDR bd_addr;
|
||||
@ -327,16 +323,14 @@ typedef struct
|
||||
} tBTA_AV_OPEN;
|
||||
|
||||
/* data associated with BTA_AV_CLOSE_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_HNDL hndl;
|
||||
UINT8 disc_rsn; /* disconnection reason */
|
||||
} tBTA_AV_CLOSE;
|
||||
|
||||
/* data associated with BTA_AV_START_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_HNDL hndl;
|
||||
tBTA_AV_STATUS status;
|
||||
@ -345,8 +339,7 @@ typedef struct
|
||||
} tBTA_AV_START;
|
||||
|
||||
/* data associated with BTA_AV_SUSPEND_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_HNDL hndl;
|
||||
BOOLEAN initiator; /* TRUE, if local device initiates the SUSPEND */
|
||||
@ -354,16 +347,14 @@ typedef struct
|
||||
} tBTA_AV_SUSPEND;
|
||||
|
||||
/* data associated with BTA_AV_RECONFIG_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_HNDL hndl;
|
||||
tBTA_AV_STATUS status;
|
||||
} tBTA_AV_RECONFIG;
|
||||
|
||||
/* data associated with BTA_AV_PROTECT_REQ_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_HNDL hndl;
|
||||
UINT8 *p_data;
|
||||
@ -371,8 +362,7 @@ typedef struct
|
||||
} tBTA_AV_PROTECT_REQ;
|
||||
|
||||
/* data associated with BTA_AV_PROTECT_RSP_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_HNDL hndl;
|
||||
UINT8 *p_data;
|
||||
@ -381,8 +371,7 @@ typedef struct
|
||||
} tBTA_AV_PROTECT_RSP;
|
||||
|
||||
/* data associated with BTA_AV_RC_OPEN_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
tBTA_AV_FEAT peer_features;
|
||||
BD_ADDR peer_addr;
|
||||
@ -390,22 +379,19 @@ typedef struct
|
||||
} tBTA_AV_RC_OPEN;
|
||||
|
||||
/* data associated with BTA_AV_RC_CLOSE_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
BD_ADDR peer_addr;
|
||||
} tBTA_AV_RC_CLOSE;
|
||||
|
||||
/* data associated with BTA_AV_RC_FEAT_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
tBTA_AV_FEAT peer_features;
|
||||
} tBTA_AV_RC_FEAT;
|
||||
|
||||
/* data associated with BTA_AV_REMOTE_CMD_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
tBTA_AV_RC rc_id;
|
||||
tBTA_AV_STATE key_state;
|
||||
@ -416,8 +402,7 @@ typedef struct
|
||||
} tBTA_AV_REMOTE_CMD;
|
||||
|
||||
/* data associated with BTA_AV_REMOTE_RSP_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
tBTA_AV_RC rc_id;
|
||||
tBTA_AV_STATE key_state;
|
||||
@ -428,8 +413,7 @@ typedef struct
|
||||
} tBTA_AV_REMOTE_RSP;
|
||||
|
||||
/* data associated with BTA_AV_VENDOR_CMD_EVT, BTA_AV_VENDOR_RSP_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
UINT16 len; /* Max vendor dependent message is 512 */
|
||||
UINT8 label;
|
||||
@ -439,8 +423,7 @@ typedef struct
|
||||
} tBTA_AV_VENDOR;
|
||||
|
||||
/* data associated with BTA_AV_META_MSG_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 rc_handle;
|
||||
UINT16 len;
|
||||
UINT8 label;
|
||||
@ -451,22 +434,19 @@ typedef struct
|
||||
} tBTA_AV_META_MSG;
|
||||
|
||||
/* data associated with BTA_AV_PENDING_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr;
|
||||
} tBTA_AV_PEND;
|
||||
|
||||
/* data associated with BTA_AV_REJECT_EVT */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr;
|
||||
tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the connection. */
|
||||
} tBTA_AV_REJECT;
|
||||
|
||||
|
||||
/* union of data associated with AV callback */
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
tBTA_AV_CHNL chnl;
|
||||
tBTA_AV_ENABLE enable;
|
||||
tBTA_AV_REGISTER registr;
|
||||
@ -490,8 +470,7 @@ typedef union
|
||||
} tBTA_AV;
|
||||
|
||||
/* union of data associated with AV Media callback */
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
BT_HDR *p_data;
|
||||
UINT8 *codec_info;
|
||||
} tBTA_AV_MEDIA;
|
||||
@ -523,8 +502,7 @@ typedef void (*tBTA_AV_ACT)(void *p_cb, void *p_data);
|
||||
typedef void (tBTA_AV_REG) (tAVDT_CS *p_cs, char *p_service_name, void *p_data);
|
||||
|
||||
/* AV configuration structure */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT32 company_id; /* AVRCP Company ID */
|
||||
UINT16 avrc_mtu; /* AVRCP MTU at L2CAP for control channel */
|
||||
UINT16 avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */
|
||||
@ -599,7 +577,7 @@ void BTA_AvDisable(void);
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name,
|
||||
UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS * bta_av_cos);
|
||||
UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS *bta_av_cos);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
0
components/bt/bluedroid/bta/include/bta_av_ci.h
Executable file → Normal file
0
components/bt/bluedroid/bta/include/bta_av_ci.h
Executable file → Normal file
12
components/bt/bluedroid/bta/include/bta_av_co.h
Executable file → Normal file
12
components/bt/bluedroid/bta/include/bta_av_co.h
Executable file → Normal file
@ -50,8 +50,7 @@
|
||||
|
||||
#define BTA_AV_CO_DEFAULT_AUDIO_OFFSET AVDT_MEDIA_OFFSET
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
BTA_AV_CO_ST_INIT,
|
||||
BTA_AV_CO_ST_IN,
|
||||
BTA_AV_CO_ST_OUT,
|
||||
@ -61,8 +60,7 @@ enum
|
||||
|
||||
|
||||
/* data type for the Audio Codec Information*/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT16 bit_rate; /* SBC encoder bit rate in kbps */
|
||||
UINT16 bit_rate_busy; /* SBC encoder bit rate in kbps */
|
||||
UINT16 bit_rate_swampd;/* SBC encoder bit rate in kbps */
|
||||
@ -162,7 +160,7 @@ extern UINT8 bta_av_co_video_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_ty
|
||||
*******************************************************************************/
|
||||
extern void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
|
||||
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
|
||||
UINT8 num_protect, UINT8 *p_protect_info,UINT8 t_local_sep, UINT8 avdt_handle);
|
||||
UINT8 num_protect, UINT8 *p_protect_info, UINT8 t_local_sep, UINT8 avdt_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -307,7 +305,7 @@ extern void bta_av_co_video_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
|
||||
** Otherwise, a GKI buffer (BT_HDR*) containing the audio data.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void * bta_av_co_audio_src_data_path(tBTA_AV_CODEC codec_type,
|
||||
extern void *bta_av_co_audio_src_data_path(tBTA_AV_CODEC codec_type,
|
||||
UINT32 *p_len, UINT32 *p_timestamp);
|
||||
|
||||
/*******************************************************************************
|
||||
@ -321,7 +319,7 @@ extern void * bta_av_co_audio_src_data_path(tBTA_AV_CODEC codec_type,
|
||||
** Otherwise, a video data buffer (UINT8*).
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void * bta_av_co_video_src_data_path(tBTA_AV_CODEC codec_type,
|
||||
extern void *bta_av_co_video_src_data_path(tBTA_AV_CODEC codec_type,
|
||||
UINT32 *p_len, UINT32 *p_timestamp);
|
||||
|
||||
/*******************************************************************************
|
||||
|
0
components/bt/bluedroid/bta/include/bta_av_sbc.h
Executable file → Normal file
0
components/bt/bluedroid/bta/include/bta_av_sbc.h
Executable file → Normal file
@ -120,17 +120,15 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
||||
p_auth_cmpl->key_present, p_auth_cmpl->key_type);
|
||||
|
||||
bdcpy(bd_addr.address, p_auth_cmpl->bd_addr);
|
||||
if ( (p_auth_cmpl->success == TRUE) && (p_auth_cmpl->key_present) )
|
||||
{
|
||||
#if 0
|
||||
if ( (p_auth_cmpl->success == TRUE) && (p_auth_cmpl->key_present) ) {
|
||||
#if 0
|
||||
if ((p_auth_cmpl->key_type < HCI_LKEY_TYPE_DEBUG_COMB) ||
|
||||
(p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) ||
|
||||
(p_auth_cmpl->key_type == HCI_LKEY_TYPE_CHANGED_COMB) ||
|
||||
(p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB_P_256)
|
||||
)
|
||||
#endif
|
||||
if (1)
|
||||
{
|
||||
#endif
|
||||
if (1) {
|
||||
bt_status_t ret;
|
||||
LOG_DEBUG("%s: Storing link key. key_type=0x%x",
|
||||
__FUNCTION__, p_auth_cmpl->key_type);
|
||||
@ -138,23 +136,17 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
||||
p_auth_cmpl->key, p_auth_cmpl->key_type,
|
||||
16);
|
||||
BTC_ASSERTC(ret == BT_STATUS_SUCCESS, "storing link key failed", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LOG_DEBUG("%s: Temporary key. Not storing. key_type=0x%x",
|
||||
__FUNCTION__, p_auth_cmpl->key_type);
|
||||
}
|
||||
}
|
||||
|
||||
// Skip SDP for certain HID Devices
|
||||
if (p_auth_cmpl->success)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p_auth_cmpl->success) {
|
||||
} else {
|
||||
// Map the HCI fail reason to bt status
|
||||
switch(p_auth_cmpl->fail_reason)
|
||||
{
|
||||
switch (p_auth_cmpl->fail_reason) {
|
||||
case HCI_ERR_PAGE_TIMEOUT:
|
||||
LOG_WARN("%s() - Pairing timeout; retrying () ...", __FUNCTION__);
|
||||
return;
|
||||
|
78
components/bt/bluedroid/stack/a2dp/a2d_api.c
Executable file → Normal file
78
components/bt/bluedroid/stack/a2dp/a2d_api.c
Executable file → Normal file
@ -63,45 +63,38 @@ static void a2d_sdp_cback(UINT16 status)
|
||||
|
||||
A2D_TRACE_API("a2d_sdp_cback status: %d", status);
|
||||
|
||||
if (status == SDP_SUCCESS)
|
||||
{
|
||||
if (status == SDP_SUCCESS) {
|
||||
/* loop through all records we found */
|
||||
do
|
||||
{
|
||||
do {
|
||||
/* get next record; if none found, we're done */
|
||||
if ((p_rec = SDP_FindServiceInDb(a2d_cb.find.p_db,
|
||||
a2d_cb.find.service_uuid, p_rec)) == NULL)
|
||||
{
|
||||
a2d_cb.find.service_uuid, p_rec)) == NULL) {
|
||||
break;
|
||||
}
|
||||
memset(&a2d_svc, 0, sizeof(tA2D_Service));
|
||||
|
||||
/* get service name */
|
||||
if ((p_attr = SDP_FindAttributeInRec(p_rec,
|
||||
ATTR_ID_SERVICE_NAME)) != NULL)
|
||||
{
|
||||
ATTR_ID_SERVICE_NAME)) != NULL) {
|
||||
a2d_svc.p_service_name = (char *) p_attr->attr_value.v.array;
|
||||
a2d_svc.service_len = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
|
||||
}
|
||||
|
||||
/* get provider name */
|
||||
if ((p_attr = SDP_FindAttributeInRec(p_rec,
|
||||
ATTR_ID_PROVIDER_NAME)) != NULL)
|
||||
{
|
||||
ATTR_ID_PROVIDER_NAME)) != NULL) {
|
||||
a2d_svc.p_provider_name = (char *) p_attr->attr_value.v.array;
|
||||
a2d_svc.provider_len = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
|
||||
}
|
||||
|
||||
/* get supported features */
|
||||
if ((p_attr = SDP_FindAttributeInRec(p_rec,
|
||||
ATTR_ID_SUPPORTED_FEATURES)) != NULL)
|
||||
{
|
||||
ATTR_ID_SUPPORTED_FEATURES)) != NULL) {
|
||||
a2d_svc.features = p_attr->attr_value.v.u16;
|
||||
}
|
||||
|
||||
/* get AVDTP version */
|
||||
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_AVDTP, &elem))
|
||||
{
|
||||
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_AVDTP, &elem)) {
|
||||
a2d_svc.avdt_version = elem.params[0];
|
||||
A2D_TRACE_DEBUG("avdt_version: 0x%x", a2d_svc.avdt_version);
|
||||
}
|
||||
@ -115,8 +108,7 @@ static void a2d_sdp_cback(UINT16 status)
|
||||
|
||||
a2d_cb.find.service_uuid = 0;
|
||||
/* return info from sdp record in app callback function */
|
||||
if (a2d_cb.find.p_cback != NULL)
|
||||
{
|
||||
if (a2d_cb.find.p_cback != NULL) {
|
||||
(*a2d_cb.find.p_cback)(found, &a2d_svc);
|
||||
}
|
||||
|
||||
@ -179,14 +171,15 @@ tA2D_STATUS A2D_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_pro
|
||||
|
||||
A2D_TRACE_API("A2D_AddRecord uuid: %x", service_uuid);
|
||||
|
||||
if( (sdp_handle == 0) ||
|
||||
(service_uuid != UUID_SERVCLASS_AUDIO_SOURCE && service_uuid != UUID_SERVCLASS_AUDIO_SINK) )
|
||||
if ( (sdp_handle == 0) ||
|
||||
(service_uuid != UUID_SERVCLASS_AUDIO_SOURCE && service_uuid != UUID_SERVCLASS_AUDIO_SINK) ) {
|
||||
return A2D_INVALID_PARAMS;
|
||||
}
|
||||
|
||||
/* add service class id list */
|
||||
result &= SDP_AddServiceClassIdList(sdp_handle, 1, &service_uuid);
|
||||
|
||||
memset((void*) proto_list, 0 , A2D_NUM_PROTO_ELEMS*sizeof(tSDP_PROTOCOL_ELEM));
|
||||
memset((void *) proto_list, 0 , A2D_NUM_PROTO_ELEMS * sizeof(tSDP_PROTOCOL_ELEM));
|
||||
|
||||
/* add protocol descriptor list */
|
||||
proto_list[0].protocol_uuid = UUID_PROTOCOL_L2CAP;
|
||||
@ -202,26 +195,23 @@ tA2D_STATUS A2D_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_pro
|
||||
result &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_ADV_AUDIO_DISTRIBUTION, A2D_VERSION);
|
||||
|
||||
/* add supported feature */
|
||||
if (features != 0)
|
||||
{
|
||||
if (features != 0) {
|
||||
p = temp;
|
||||
UINT16_TO_BE_STREAM(p, features);
|
||||
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
|
||||
(UINT32)2, (UINT8*)temp);
|
||||
(UINT32)2, (UINT8 *)temp);
|
||||
}
|
||||
|
||||
/* add provider name */
|
||||
if (p_provider_name != NULL)
|
||||
{
|
||||
if (p_provider_name != NULL) {
|
||||
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_PROVIDER_NAME, TEXT_STR_DESC_TYPE,
|
||||
(UINT32)(strlen(p_provider_name)+1), (UINT8 *) p_provider_name);
|
||||
(UINT32)(strlen(p_provider_name) + 1), (UINT8 *) p_provider_name);
|
||||
}
|
||||
|
||||
/* add service name */
|
||||
if (p_service_name != NULL)
|
||||
{
|
||||
if (p_service_name != NULL) {
|
||||
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SERVICE_NAME, TEXT_STR_DESC_TYPE,
|
||||
(UINT32)(strlen(p_service_name)+1), (UINT8 *) p_service_name);
|
||||
(UINT32)(strlen(p_service_name) + 1), (UINT8 *) p_service_name);
|
||||
}
|
||||
|
||||
/* add browse group list */
|
||||
@ -277,23 +267,25 @@ tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
ATTR_ID_SUPPORTED_FEATURES,
|
||||
ATTR_ID_SERVICE_NAME,
|
||||
ATTR_ID_PROTOCOL_DESC_LIST,
|
||||
ATTR_ID_PROVIDER_NAME};
|
||||
ATTR_ID_PROVIDER_NAME
|
||||
};
|
||||
|
||||
A2D_TRACE_API("A2D_FindService uuid: %x", service_uuid);
|
||||
if( (service_uuid != UUID_SERVCLASS_AUDIO_SOURCE && service_uuid != UUID_SERVCLASS_AUDIO_SINK) ||
|
||||
p_db == NULL || p_db->p_db == NULL || p_cback == NULL)
|
||||
if ( (service_uuid != UUID_SERVCLASS_AUDIO_SOURCE && service_uuid != UUID_SERVCLASS_AUDIO_SINK) ||
|
||||
p_db == NULL || p_db->p_db == NULL || p_cback == NULL) {
|
||||
return A2D_INVALID_PARAMS;
|
||||
}
|
||||
|
||||
if( a2d_cb.find.service_uuid == UUID_SERVCLASS_AUDIO_SOURCE ||
|
||||
a2d_cb.find.service_uuid == UUID_SERVCLASS_AUDIO_SINK)
|
||||
if ( a2d_cb.find.service_uuid == UUID_SERVCLASS_AUDIO_SOURCE ||
|
||||
a2d_cb.find.service_uuid == UUID_SERVCLASS_AUDIO_SINK) {
|
||||
return A2D_BUSY;
|
||||
}
|
||||
|
||||
/* set up discovery database */
|
||||
uuid_list.len = LEN_UUID_16;
|
||||
uuid_list.uu.uuid16 = service_uuid;
|
||||
|
||||
if(p_db->p_attrs == NULL || p_db->num_attr == 0)
|
||||
{
|
||||
if (p_db->p_attrs == NULL || p_db->num_attr == 0) {
|
||||
p_db->p_attrs = a2d_attr_list;
|
||||
p_db->num_attr = A2D_NUM_ATTR;
|
||||
}
|
||||
@ -301,8 +293,7 @@ tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
result = SDP_InitDiscoveryDb(p_db->p_db, p_db->db_len, 1, &uuid_list, p_db->num_attr,
|
||||
p_db->p_attrs);
|
||||
|
||||
if (result == TRUE)
|
||||
{
|
||||
if (result == TRUE) {
|
||||
/* store service_uuid and discovery db pointer */
|
||||
a2d_cb.find.p_db = p_db->p_db;
|
||||
a2d_cb.find.service_uuid = service_uuid;
|
||||
@ -310,8 +301,7 @@ tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
|
||||
/* perform service search */
|
||||
result = SDP_ServiceSearchAttributeRequest(bd_addr, p_db->p_db, a2d_sdp_cback);
|
||||
if(FALSE == result)
|
||||
{
|
||||
if (FALSE == result) {
|
||||
a2d_cb.find.service_uuid = 0;
|
||||
}
|
||||
}
|
||||
@ -342,8 +332,9 @@ tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
******************************************************************************/
|
||||
UINT8 A2D_SetTraceLevel (UINT8 new_level)
|
||||
{
|
||||
if (new_level != 0xFF)
|
||||
if (new_level != 0xFF) {
|
||||
a2d_cb.trace_level = new_level;
|
||||
}
|
||||
|
||||
return (a2d_cb.trace_level);
|
||||
}
|
||||
@ -360,12 +351,11 @@ UINT8 A2D_BitsSet(UINT8 num)
|
||||
{
|
||||
UINT8 count;
|
||||
BOOLEAN res;
|
||||
if(num == 0)
|
||||
if (num == 0) {
|
||||
res = A2D_SET_ZERO_BIT;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
count = (num & (num - 1));
|
||||
res = ((count==0)?A2D_SET_ONE_BIT:A2D_SET_MULTL_BIT);
|
||||
res = ((count == 0) ? A2D_SET_ONE_BIT : A2D_SET_MULTL_BIT);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
102
components/bt/bluedroid/stack/a2dp/a2d_sbc.c
Executable file → Normal file
102
components/bt/bluedroid/stack/a2dp/a2d_sbc.c
Executable file → Normal file
@ -92,14 +92,12 @@
|
||||
|
||||
#define A2D_SBC_GET_IDX(sc) (((sc) & 0x3) + (((sc) & 0x30) >> 2))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 use;
|
||||
UINT8 idx;
|
||||
} tA2D_SBC_FR_CB;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tA2D_SBC_FR_CB fr[2];
|
||||
UINT8 index;
|
||||
UINT8 base;
|
||||
@ -121,17 +119,18 @@ void A2D_SbcChkFrInit(UINT8 *p_pkt)
|
||||
UINT8 num_chnl = 1;
|
||||
UINT8 num_subband = 4;
|
||||
|
||||
if((p_pkt[0] & A2D_SBC_SYNC_MASK) == 0)
|
||||
{
|
||||
if ((p_pkt[0] & A2D_SBC_SYNC_MASK) == 0) {
|
||||
a2d_cb.use_desc = TRUE;
|
||||
fmt = p_pkt[1];
|
||||
p_pkt[0] |= A2D_SBC_SYNC_MASK;
|
||||
memset(&a2d_sbc_ds_cb, 0, sizeof(tA2D_SBC_DS_CB));
|
||||
if(fmt & A2D_SBC_CH_M_BITS)
|
||||
if (fmt & A2D_SBC_CH_M_BITS) {
|
||||
num_chnl = 2;
|
||||
if(fmt & A2D_SBC_SUBBAND_BIT)
|
||||
}
|
||||
if (fmt & A2D_SBC_SUBBAND_BIT) {
|
||||
num_subband = 8;
|
||||
a2d_sbc_ds_cb.base = 6 + num_chnl*num_subband/2;
|
||||
}
|
||||
a2d_sbc_ds_cb.base = 6 + num_chnl * num_subband / 2;
|
||||
/*printf("base: %d\n", a2d_sbc_ds_cb.base);
|
||||
a2d_count = 0;*/
|
||||
}
|
||||
@ -150,8 +149,7 @@ void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len)
|
||||
tA2D_SBC_FR_CB *p_cur, *p_last;
|
||||
UINT32 idx, tmp, tmp2;
|
||||
|
||||
if(a2d_cb.use_desc)
|
||||
{
|
||||
if (a2d_cb.use_desc) {
|
||||
/* c2l */
|
||||
p_last = &a2d_sbc_ds_cb.fr[A2D_SBC_LIDX];
|
||||
p_cur = &a2d_sbc_ds_cb.fr[A2D_SBC_CIDX];
|
||||
@ -160,7 +158,7 @@ void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len)
|
||||
/* getc */
|
||||
p_cur->use = p_pkt[A2D_SBC_CRC_IDX] & A2D_SBC_USE_MASK;
|
||||
p_cur->idx = A2D_SBC_GET_IDX(p_pkt[A2D_SBC_CRC_IDX]);
|
||||
a2d_sbc_ds_cb.index = (p_cur->use)?A2D_SBC_CIDX:A2D_SBC_LIDX;
|
||||
a2d_sbc_ds_cb.index = (p_cur->use) ? A2D_SBC_CIDX : A2D_SBC_LIDX;
|
||||
/*
|
||||
printf("%05d: ar[%02d]: x%02x, msk: x%02x, use: %s, idx: %02d, ",
|
||||
a2d_count++,
|
||||
@ -169,12 +167,10 @@ void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len)
|
||||
*/
|
||||
/* descramble */
|
||||
idx = a2d_sbc_ds_cb.fr[a2d_sbc_ds_cb.index].idx;
|
||||
if(idx > 0)
|
||||
{
|
||||
if (idx > 0) {
|
||||
p_pkt = &p_pkt[a2d_sbc_ds_cb.base];
|
||||
if((idx&1) && (len > (a2d_sbc_ds_cb.base+(idx<<1))))
|
||||
{
|
||||
tmp2 = (idx<<1);
|
||||
if ((idx & 1) && (len > (a2d_sbc_ds_cb.base + (idx << 1)))) {
|
||||
tmp2 = (idx << 1);
|
||||
tmp = p_pkt[idx];
|
||||
p_pkt[idx] = p_pkt[tmp2];
|
||||
p_pkt[tmp2] = tmp;
|
||||
@ -182,11 +178,9 @@ void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len)
|
||||
printf("tmp2: %02d, len: %d, idx: %d\n",
|
||||
tmp2, len, a2d_sbc_ds_cb.fr[a2d_sbc_ds_cb.index].idx);
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
tmp2 = p_pkt[idx];
|
||||
tmp = (tmp2>>3)+(tmp2<<5);
|
||||
tmp = (tmp2 >> 3) + (tmp2 << 5);
|
||||
p_pkt[idx] = (UINT8)tmp;
|
||||
/*
|
||||
printf("tmp: x%02x, len: %d, idx: %d(cmp:%d)\n",
|
||||
@ -226,7 +220,7 @@ tA2D_STATUS A2D_BldSbcInfo(UINT8 media_type, tA2D_SBC_CIE *p_ie, UINT8 *p_result
|
||||
{
|
||||
tA2D_STATUS status;
|
||||
|
||||
if( p_ie == NULL || p_result == NULL ||
|
||||
if ( p_ie == NULL || p_result == NULL ||
|
||||
(p_ie->samp_freq & ~A2D_SBC_IE_SAMP_FREQ_MSK) ||
|
||||
(p_ie->ch_mode & ~A2D_SBC_IE_CH_MD_MSK) ||
|
||||
(p_ie->block_len & ~A2D_SBC_IE_BLOCKS_MSK) ||
|
||||
@ -236,13 +230,10 @@ tA2D_STATUS A2D_BldSbcInfo(UINT8 media_type, tA2D_SBC_CIE *p_ie, UINT8 *p_result
|
||||
(p_ie->max_bitpool < A2D_SBC_IE_MIN_BITPOOL) ||
|
||||
(p_ie->max_bitpool > A2D_SBC_IE_MAX_BITPOOL) ||
|
||||
(p_ie->min_bitpool < A2D_SBC_IE_MIN_BITPOOL) ||
|
||||
(p_ie->min_bitpool > A2D_SBC_IE_MAX_BITPOOL) )
|
||||
{
|
||||
(p_ie->min_bitpool > A2D_SBC_IE_MAX_BITPOOL) ) {
|
||||
/* if any unused bit is set */
|
||||
status = A2D_INVALID_PARAMS;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
status = A2D_SUCCESS;
|
||||
*p_result++ = A2D_SBC_INFO_LEN;
|
||||
*p_result++ = media_type;
|
||||
@ -282,17 +273,15 @@ tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
tA2D_STATUS status;
|
||||
UINT8 losc;
|
||||
|
||||
if( p_ie == NULL || p_info == NULL)
|
||||
if ( p_ie == NULL || p_info == NULL) {
|
||||
status = A2D_INVALID_PARAMS;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
losc = *p_info++;
|
||||
p_info++;
|
||||
/* If the function is called for the wrong Media Type or Media Codec Type */
|
||||
if(losc != A2D_SBC_INFO_LEN || *p_info != A2D_MEDIA_CT_SBC)
|
||||
if (losc != A2D_SBC_INFO_LEN || *p_info != A2D_MEDIA_CT_SBC) {
|
||||
status = A2D_WRONG_CODEC;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_info++;
|
||||
p_ie->samp_freq = *p_info & A2D_SBC_IE_SAMP_FREQ_MSK;
|
||||
p_ie->ch_mode = *p_info & A2D_SBC_IE_CH_MD_MSK;
|
||||
@ -304,28 +293,34 @@ tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
p_ie->min_bitpool = *p_info++;
|
||||
p_ie->max_bitpool = *p_info;
|
||||
status = A2D_SUCCESS;
|
||||
if(p_ie->min_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->min_bitpool > A2D_SBC_IE_MAX_BITPOOL )
|
||||
if (p_ie->min_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->min_bitpool > A2D_SBC_IE_MAX_BITPOOL ) {
|
||||
status = A2D_BAD_MIN_BITPOOL;
|
||||
}
|
||||
|
||||
if(p_ie->max_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->max_bitpool > A2D_SBC_IE_MAX_BITPOOL ||
|
||||
p_ie->max_bitpool < p_ie->min_bitpool)
|
||||
if (p_ie->max_bitpool < A2D_SBC_IE_MIN_BITPOOL || p_ie->max_bitpool > A2D_SBC_IE_MAX_BITPOOL ||
|
||||
p_ie->max_bitpool < p_ie->min_bitpool) {
|
||||
status = A2D_BAD_MAX_BITPOOL;
|
||||
}
|
||||
|
||||
if(for_caps == FALSE)
|
||||
{
|
||||
if(A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT)
|
||||
if (for_caps == FALSE) {
|
||||
if (A2D_BitsSet(p_ie->samp_freq) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_SAMP_FREQ;
|
||||
if(A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT)
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->ch_mode) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_CH_MODE;
|
||||
if(A2D_BitsSet(p_ie->block_len) != A2D_SET_ONE_BIT)
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->block_len) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_BLOCK_LEN;
|
||||
if(A2D_BitsSet(p_ie->num_subbands) != A2D_SET_ONE_BIT)
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->num_subbands) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_SUBBANDS;
|
||||
if(A2D_BitsSet(p_ie->alloc_mthd) != A2D_SET_ONE_BIT)
|
||||
}
|
||||
if (A2D_BitsSet(p_ie->alloc_mthd) != A2D_SET_ONE_BIT) {
|
||||
status = A2D_BAD_ALLOC_MTHD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -353,15 +348,17 @@ tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info, BOOLEAN for_caps)
|
||||
******************************************************************************/
|
||||
void A2D_BldSbcMplHdr(UINT8 *p_dst, BOOLEAN frag, BOOLEAN start, BOOLEAN last, UINT8 num)
|
||||
{
|
||||
if(p_dst)
|
||||
{
|
||||
if (p_dst) {
|
||||
*p_dst = 0;
|
||||
if(frag)
|
||||
if (frag) {
|
||||
*p_dst |= A2D_SBC_HDR_F_MSK;
|
||||
if(start)
|
||||
}
|
||||
if (start) {
|
||||
*p_dst |= A2D_SBC_HDR_S_MSK;
|
||||
if(last)
|
||||
}
|
||||
if (last) {
|
||||
*p_dst |= A2D_SBC_HDR_L_MSK;
|
||||
}
|
||||
*p_dst |= (A2D_SBC_HDR_NUM_MSK & num);
|
||||
}
|
||||
}
|
||||
@ -390,11 +387,10 @@ void A2D_BldSbcMplHdr(UINT8 *p_dst, BOOLEAN frag, BOOLEAN start, BOOLEAN last, U
|
||||
******************************************************************************/
|
||||
void A2D_ParsSbcMplHdr(UINT8 *p_src, BOOLEAN *p_frag, BOOLEAN *p_start, BOOLEAN *p_last, UINT8 *p_num)
|
||||
{
|
||||
if(p_src && p_frag && p_start && p_last && p_num)
|
||||
{
|
||||
*p_frag = (*p_src & A2D_SBC_HDR_F_MSK) ? TRUE: FALSE;
|
||||
*p_start= (*p_src & A2D_SBC_HDR_S_MSK) ? TRUE: FALSE;
|
||||
*p_last = (*p_src & A2D_SBC_HDR_L_MSK) ? TRUE: FALSE;
|
||||
if (p_src && p_frag && p_start && p_last && p_num) {
|
||||
*p_frag = (*p_src & A2D_SBC_HDR_F_MSK) ? TRUE : FALSE;
|
||||
*p_start = (*p_src & A2D_SBC_HDR_S_MSK) ? TRUE : FALSE;
|
||||
*p_last = (*p_src & A2D_SBC_HDR_L_MSK) ? TRUE : FALSE;
|
||||
*p_num = (*p_src & A2D_SBC_HDR_NUM_MSK);
|
||||
}
|
||||
}
|
||||
|
6
components/bt/bluedroid/stack/a2dp/include/a2d_int.h
Executable file → Normal file
6
components/bt/bluedroid/stack/a2dp/include/a2d_int.h
Executable file → Normal file
@ -42,15 +42,13 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control block used by A2D_FindService(). */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tA2D_FIND_CBACK *p_cback; /* pointer to application callback */
|
||||
tSDP_DISCOVERY_DB *p_db; /* pointer to discovery database */
|
||||
UINT16 service_uuid; /* service UUID of search */
|
||||
} tA2D_FIND_CB;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tA2D_FIND_CB find; /* find service control block */
|
||||
UINT8 trace_level;
|
||||
BOOLEAN use_desc;
|
||||
|
104
components/bt/bluedroid/stack/avct/avct_api.c
Executable file → Normal file
104
components/bt/bluedroid/stack/avct/avct_api.c
Executable file → Normal file
@ -77,8 +77,9 @@ void AVCT_Register(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask)
|
||||
BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0);
|
||||
BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0);
|
||||
|
||||
if (mtu_br < AVCT_MIN_BROWSE_MTU)
|
||||
if (mtu_br < AVCT_MIN_BROWSE_MTU) {
|
||||
mtu_br = AVCT_MIN_BROWSE_MTU;
|
||||
}
|
||||
avct_cb.mtu_br = mtu_br;
|
||||
#endif
|
||||
|
||||
@ -88,8 +89,9 @@ void AVCT_Register(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask)
|
||||
avct_cb.trace_level = BT_TRACE_LEVEL_NONE;
|
||||
#endif
|
||||
|
||||
if (mtu < AVCT_MIN_CONTROL_MTU)
|
||||
if (mtu < AVCT_MIN_CONTROL_MTU) {
|
||||
mtu = AVCT_MIN_CONTROL_MTU;
|
||||
}
|
||||
/* store mtu */
|
||||
avct_cb.mtu = mtu;
|
||||
}
|
||||
@ -141,37 +143,29 @@ UINT16 AVCT_CreateConn(UINT8 *p_handle, tAVCT_CC *p_cc, BD_ADDR peer_addr)
|
||||
AVCT_TRACE_API("AVCT_CreateConn: %d, control:%d", p_cc->role, p_cc->control);
|
||||
|
||||
/* Allocate ccb; if no ccbs, return failure */
|
||||
if ((p_ccb = avct_ccb_alloc(p_cc)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avct_ccb_alloc(p_cc)) == NULL) {
|
||||
result = AVCT_NO_RESOURCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* get handle */
|
||||
*p_handle = avct_ccb_to_idx(p_ccb);
|
||||
|
||||
/* if initiator connection */
|
||||
if (p_cc->role == AVCT_INT)
|
||||
{
|
||||
if (p_cc->role == AVCT_INT) {
|
||||
/* find link; if none allocate a new one */
|
||||
if ((p_lcb = avct_lcb_by_bd(peer_addr)) == NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_alloc(peer_addr)) == NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_bd(peer_addr)) == NULL) {
|
||||
if ((p_lcb = avct_lcb_alloc(peer_addr)) == NULL) {
|
||||
/* no link resources; free ccb as well */
|
||||
avct_ccb_dealloc(p_ccb, AVCT_NO_EVT, 0, NULL);
|
||||
result = AVCT_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
/* check if PID already in use */
|
||||
else if (avct_lcb_has_pid(p_lcb, p_cc->pid))
|
||||
{
|
||||
else if (avct_lcb_has_pid(p_lcb, p_cc->pid)) {
|
||||
avct_ccb_dealloc(p_ccb, AVCT_NO_EVT, 0, NULL);
|
||||
result = AVCT_PID_IN_USE;
|
||||
}
|
||||
|
||||
if (result == AVCT_SUCCESS)
|
||||
{
|
||||
if (result == AVCT_SUCCESS) {
|
||||
/* bind lcb to ccb */
|
||||
p_ccb->p_lcb = p_lcb;
|
||||
AVCT_TRACE_DEBUG("ch_state: %d", p_lcb->ch_state);
|
||||
@ -203,18 +197,15 @@ UINT16 AVCT_RemoveConn(UINT8 handle)
|
||||
AVCT_TRACE_API("AVCT_RemoveConn");
|
||||
|
||||
/* map handle to ccb */
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) {
|
||||
result = AVCT_BAD_HANDLE;
|
||||
}
|
||||
/* if connection not bound to lcb, dealloc */
|
||||
else if (p_ccb->p_lcb == NULL)
|
||||
{
|
||||
else if (p_ccb->p_lcb == NULL) {
|
||||
avct_ccb_dealloc(p_ccb, AVCT_NO_EVT, 0, NULL);
|
||||
}
|
||||
/* send unbind event to lcb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
avct_lcb_event(p_ccb->p_lcb, AVCT_LCB_UL_UNBIND_EVT, (tAVCT_LCB_EVT *) &p_ccb);
|
||||
}
|
||||
return result;
|
||||
@ -247,44 +238,32 @@ UINT16 AVCT_CreateBrowse (UINT8 handle, UINT8 role)
|
||||
AVCT_TRACE_API("AVCT_CreateBrowse: %d", role);
|
||||
|
||||
/* map handle to ccb */
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) {
|
||||
return AVCT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* mark this CCB as supporting browsing channel */
|
||||
if ((p_ccb->allocated & AVCT_ALOC_BCB) == 0)
|
||||
{
|
||||
if ((p_ccb->allocated & AVCT_ALOC_BCB) == 0) {
|
||||
p_ccb->allocated |= AVCT_ALOC_BCB;
|
||||
}
|
||||
}
|
||||
|
||||
/* if initiator connection */
|
||||
if (role == AVCT_INT)
|
||||
{
|
||||
if (role == AVCT_INT) {
|
||||
/* the link control block must exist before this function is called as INT. */
|
||||
if ((p_ccb->p_lcb == NULL) || (p_ccb->p_lcb->allocated == 0))
|
||||
{
|
||||
if ((p_ccb->p_lcb == NULL) || (p_ccb->p_lcb->allocated == 0)) {
|
||||
result = AVCT_NOT_OPEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* find link; if none allocate a new one */
|
||||
index = p_ccb->p_lcb->allocated;
|
||||
if (index > AVCT_NUM_LINKS)
|
||||
{
|
||||
if (index > AVCT_NUM_LINKS) {
|
||||
result = AVCT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_bcb = &avct_cb.bcb[index - 1];
|
||||
p_bcb->allocated = index;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == AVCT_SUCCESS)
|
||||
{
|
||||
if (result == AVCT_SUCCESS) {
|
||||
/* bind bcb to ccb */
|
||||
p_ccb->p_bcb = p_bcb;
|
||||
AVCT_TRACE_DEBUG("ch_state: %d", p_bcb->ch_state);
|
||||
@ -322,11 +301,9 @@ UINT16 AVCT_RemoveBrowse (UINT8 handle)
|
||||
AVCT_TRACE_API("AVCT_RemoveBrowse");
|
||||
|
||||
/* map handle to ccb */
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) {
|
||||
result = AVCT_BAD_HANDLE;
|
||||
}
|
||||
else if (p_ccb->p_bcb != NULL)
|
||||
} else if (p_ccb->p_bcb != NULL)
|
||||
/* send unbind event to bcb */
|
||||
{
|
||||
avct_bcb_event(p_ccb->p_bcb, AVCT_LCB_UL_UNBIND_EVT, (tAVCT_LCB_EVT *) &p_ccb);
|
||||
@ -354,8 +331,7 @@ UINT16 AVCT_GetBrowseMtu (UINT8 handle)
|
||||
#if (AVCT_BROWSE_INCLUDED == TRUE)
|
||||
tAVCT_CCB *p_ccb;
|
||||
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) != NULL && p_ccb->p_bcb != NULL)
|
||||
{
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) != NULL && p_ccb->p_bcb != NULL) {
|
||||
peer_mtu = p_ccb->p_bcb->peer_mtu;
|
||||
}
|
||||
#else
|
||||
@ -380,10 +356,8 @@ UINT16 AVCT_GetPeerMtu (UINT8 handle)
|
||||
tAVCT_CCB *p_ccb;
|
||||
|
||||
/* map handle to ccb */
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) != NULL)
|
||||
{
|
||||
if (p_ccb->p_lcb)
|
||||
{
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) != NULL) {
|
||||
if (p_ccb->p_lcb) {
|
||||
peer_mtu = p_ccb->p_lcb->peer_mtu;
|
||||
}
|
||||
}
|
||||
@ -421,27 +395,23 @@ UINT16 AVCT_MsgReq(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR *p_msg)
|
||||
AVCT_TRACE_API("AVCT_MsgReq");
|
||||
|
||||
/* verify p_msg parameter */
|
||||
if (p_msg == NULL)
|
||||
{
|
||||
if (p_msg == NULL) {
|
||||
return AVCT_NO_RESOURCES;
|
||||
}
|
||||
AVCT_TRACE_API("len: %d", p_msg->len);
|
||||
|
||||
/* map handle to ccb */
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) {
|
||||
result = AVCT_BAD_HANDLE;
|
||||
GKI_freebuf(p_msg);
|
||||
}
|
||||
/* verify channel is bound to link */
|
||||
else if (p_ccb->p_lcb == NULL)
|
||||
{
|
||||
else if (p_ccb->p_lcb == NULL) {
|
||||
result = AVCT_NOT_OPEN;
|
||||
GKI_freebuf(p_msg);
|
||||
}
|
||||
|
||||
if (result == AVCT_SUCCESS)
|
||||
{
|
||||
if (result == AVCT_SUCCESS) {
|
||||
ul_msg.p_buf = p_msg;
|
||||
ul_msg.p_ccb = p_ccb;
|
||||
ul_msg.label = label;
|
||||
@ -449,16 +419,12 @@ UINT16 AVCT_MsgReq(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR *p_msg)
|
||||
|
||||
#if (AVCT_BROWSE_INCLUDED == TRUE)
|
||||
/* send msg event to bcb */
|
||||
if (p_msg->layer_specific == AVCT_DATA_BROWSE)
|
||||
{
|
||||
if (p_ccb->p_bcb == NULL && (p_ccb->allocated & AVCT_ALOC_BCB) == 0)
|
||||
{
|
||||
if (p_msg->layer_specific == AVCT_DATA_BROWSE) {
|
||||
if (p_ccb->p_bcb == NULL && (p_ccb->allocated & AVCT_ALOC_BCB) == 0) {
|
||||
/* BCB channel is not open and not allocated */
|
||||
result = AVCT_BAD_HANDLE;
|
||||
GKI_freebuf(p_msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_ccb->p_bcb = avct_bcb_by_lcb(p_ccb->p_lcb);
|
||||
avct_bcb_event(p_ccb->p_bcb, AVCT_LCB_UL_MSG_EVT, (tAVCT_LCB_EVT *) &ul_msg);
|
||||
}
|
||||
|
27
components/bt/bluedroid/stack/avct/avct_ccb.c
Executable file → Normal file
27
components/bt/bluedroid/stack/avct/avct_ccb.c
Executable file → Normal file
@ -46,10 +46,8 @@ tAVCT_CCB *avct_ccb_alloc(tAVCT_CC *p_cc)
|
||||
tAVCT_CCB *p_ccb = &avct_cb.ccb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
if (!p_ccb->allocated)
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
if (!p_ccb->allocated) {
|
||||
p_ccb->allocated = AVCT_ALOC_LCB;
|
||||
memcpy(&p_ccb->cc, p_cc, sizeof(tAVCT_CC));
|
||||
AVCT_TRACE_DEBUG("avct_ccb_alloc %d", i);
|
||||
@ -57,8 +55,7 @@ tAVCT_CCB *avct_ccb_alloc(tAVCT_CC *p_cc)
|
||||
}
|
||||
}
|
||||
|
||||
if (i == AVCT_NUM_CONN)
|
||||
{
|
||||
if (i == AVCT_NUM_CONN) {
|
||||
/* out of ccbs */
|
||||
p_ccb = NULL;
|
||||
AVCT_TRACE_WARNING("Out of ccbs");
|
||||
@ -83,10 +80,9 @@ void avct_ccb_dealloc(tAVCT_CCB *p_ccb, UINT8 event, UINT16 result, BD_ADDR bd_a
|
||||
|
||||
AVCT_TRACE_DEBUG("avct_ccb_dealloc %d", avct_ccb_to_idx(p_ccb));
|
||||
#if (AVCT_BROWSE_INCLUDED == TRUE)
|
||||
if(p_ccb->p_bcb == NULL)
|
||||
if (p_ccb->p_bcb == NULL) {
|
||||
memset(p_ccb, 0, sizeof(tAVCT_CCB));
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* control channel is down, but the browsing channel is still connected 0 disconnect it now */
|
||||
avct_bcb_event(p_ccb->p_bcb, AVCT_LCB_UL_UNBIND_EVT, (tAVCT_LCB_EVT *) &p_ccb);
|
||||
p_ccb->p_lcb = NULL;
|
||||
@ -95,8 +91,7 @@ void avct_ccb_dealloc(tAVCT_CCB *p_ccb, UINT8 event, UINT16 result, BD_ADDR bd_a
|
||||
memset(p_ccb, 0, sizeof(tAVCT_CCB));
|
||||
#endif
|
||||
|
||||
if (event != AVCT_NO_EVT)
|
||||
{
|
||||
if (event != AVCT_NO_EVT) {
|
||||
(*p_cback)(avct_ccb_to_idx(p_ccb), event, result, bd_addr);
|
||||
}
|
||||
}
|
||||
@ -132,19 +127,15 @@ tAVCT_CCB *avct_ccb_by_idx(UINT8 idx)
|
||||
tAVCT_CCB *p_ccb;
|
||||
|
||||
/* verify index */
|
||||
if (idx < AVCT_NUM_CONN)
|
||||
{
|
||||
if (idx < AVCT_NUM_CONN) {
|
||||
p_ccb = &avct_cb.ccb[idx];
|
||||
|
||||
/* verify ccb is allocated */
|
||||
if (!p_ccb->allocated)
|
||||
{
|
||||
if (!p_ccb->allocated) {
|
||||
p_ccb = NULL;
|
||||
AVCT_TRACE_WARNING("ccb %d not allocated", idx);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_ccb = NULL;
|
||||
AVCT_TRACE_WARNING("No ccb for idx %d", idx);
|
||||
}
|
||||
|
106
components/bt/bluedroid/stack/avct/avct_l2c.c
Executable file → Normal file
106
components/bt/bluedroid/stack/avct/avct_l2c.c
Executable file → Normal file
@ -78,13 +78,10 @@ static BOOLEAN avct_l2c_is_passive (tAVCT_LCB *p_lcb)
|
||||
tAVCT_CCB *p_ccb = &avct_cb.ccb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_is_ct control:x%x", p_ccb->cc.control);
|
||||
if (p_ccb->cc.control & AVCT_PASSIVE)
|
||||
{
|
||||
if (p_ccb->cc.control & AVCT_PASSIVE) {
|
||||
is_passive = TRUE;
|
||||
break;
|
||||
}
|
||||
@ -111,33 +108,26 @@ void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
|
||||
UNUSED(psm);
|
||||
|
||||
/* do we already have a channel for this peer? */
|
||||
if ((p_lcb = avct_lcb_by_bd(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_bd(bd_addr)) == NULL) {
|
||||
/* no, allocate lcb */
|
||||
if ((p_lcb = avct_lcb_alloc(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_alloc(bd_addr)) == NULL) {
|
||||
/* no ccb available, reject L2CAP connection */
|
||||
result = L2CAP_CONN_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
/* else we already have a channel for this peer */
|
||||
else
|
||||
{
|
||||
if (!avct_l2c_is_passive (p_lcb) || (p_lcb->ch_state == AVCT_CH_OPEN))
|
||||
{
|
||||
else {
|
||||
if (!avct_l2c_is_passive (p_lcb) || (p_lcb->ch_state == AVCT_CH_OPEN)) {
|
||||
/* this LCB included CT role - reject */
|
||||
result = L2CAP_CONN_NO_RESOURCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* TG role only - accept the connection from CT. move the channel ID to the conflict list */
|
||||
p_lcb->conflict_lcid = p_lcb->ch_lcid;
|
||||
AVCT_TRACE_DEBUG("avct_l2c_connect_ind_cback conflict_lcid:0x%x", p_lcb->conflict_lcid);
|
||||
}
|
||||
}
|
||||
|
||||
if(p_lcb)
|
||||
{
|
||||
if (p_lcb) {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_connect_ind_cback: 0x%x, res: %d, ch_state: %d",
|
||||
lcid, result, p_lcb->ch_state);
|
||||
}
|
||||
@ -145,8 +135,7 @@ void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
|
||||
L2CA_ConnectRsp(bd_addr, id, lcid, result, 0);
|
||||
|
||||
/* if result ok, proceed with connection */
|
||||
if (result == L2CAP_CONN_OK)
|
||||
{
|
||||
if (result == L2CAP_CONN_OK) {
|
||||
/* store LCID */
|
||||
p_lcb->ch_lcid = lcid;
|
||||
|
||||
@ -162,8 +151,9 @@ void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
|
||||
}
|
||||
|
||||
#if (BT_USE_TRACES == TRUE)
|
||||
if(p_lcb)
|
||||
if (p_lcb) {
|
||||
AVCT_TRACE_DEBUG("ch_state cni: %d ", p_lcb->ch_state);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -183,16 +173,13 @@ void avct_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
|
||||
tL2CAP_CFG_INFO cfg;
|
||||
|
||||
/* look up lcb for this channel */
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_connect_cfm_cback lcid:0x%x result: %d ch_state: %d, conflict_lcid:0x%x",
|
||||
lcid, result, p_lcb->ch_state, p_lcb->conflict_lcid);
|
||||
/* if in correct state */
|
||||
if (p_lcb->ch_state == AVCT_CH_CONN)
|
||||
{
|
||||
if (p_lcb->ch_state == AVCT_CH_CONN) {
|
||||
/* if result successful */
|
||||
if (result == L2CAP_CONN_OK)
|
||||
{
|
||||
if (result == L2CAP_CONN_OK) {
|
||||
/* set channel state */
|
||||
p_lcb->ch_state = AVCT_CH_CFG;
|
||||
|
||||
@ -204,21 +191,18 @@ void avct_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
|
||||
AVCT_TRACE_DEBUG("avct_l2c snd Cfg Req");
|
||||
}
|
||||
/* else failure */
|
||||
else
|
||||
{
|
||||
else {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_connect_cfm_cback conflict_lcid:0x%x", p_lcb->conflict_lcid);
|
||||
if (p_lcb->conflict_lcid == lcid)
|
||||
if (p_lcb->conflict_lcid == lcid) {
|
||||
p_lcb->conflict_lcid = 0;
|
||||
else
|
||||
} else {
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, (tAVCT_LCB_EVT *) &result);
|
||||
}
|
||||
}
|
||||
else if (p_lcb->conflict_lcid == lcid)
|
||||
{
|
||||
} else if (p_lcb->conflict_lcid == lcid) {
|
||||
/* we must be in AVCT_CH_CFG state for the ch_lcid channel */
|
||||
AVCT_TRACE_DEBUG("avct_l2c_connect_cfm_cback ch_state: %d, conflict_lcid:0x%x", p_lcb->ch_state, p_lcb->conflict_lcid);
|
||||
if (result == L2CAP_CONN_OK)
|
||||
{
|
||||
if (result == L2CAP_CONN_OK) {
|
||||
/* just in case the peer also accepts our connection - Send L2CAP disconnect req */
|
||||
L2CA_DisconnectReq(lcid);
|
||||
}
|
||||
@ -243,29 +227,24 @@ void avct_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
|
||||
tAVCT_LCB *p_lcb;
|
||||
|
||||
/* look up lcb for this channel */
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_config_cfm_cback: 0x%x, ch_state: %d, res: %d",
|
||||
lcid, p_lcb->ch_state, p_cfg->result);
|
||||
/* if in correct state */
|
||||
if (p_lcb->ch_state == AVCT_CH_CFG)
|
||||
{
|
||||
if (p_lcb->ch_state == AVCT_CH_CFG) {
|
||||
/* if result successful */
|
||||
if (p_cfg->result == L2CAP_CFG_OK)
|
||||
{
|
||||
if (p_cfg->result == L2CAP_CFG_OK) {
|
||||
/* update flags */
|
||||
p_lcb->ch_flags |= AVCT_L2C_CFG_CFM_DONE;
|
||||
|
||||
/* if configuration complete */
|
||||
if (p_lcb->ch_flags & AVCT_L2C_CFG_IND_DONE)
|
||||
{
|
||||
if (p_lcb->ch_flags & AVCT_L2C_CFG_IND_DONE) {
|
||||
p_lcb->ch_state = AVCT_CH_OPEN;
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_LL_OPEN_EVT, NULL);
|
||||
}
|
||||
}
|
||||
/* else failure */
|
||||
else
|
||||
{
|
||||
else {
|
||||
AVCT_TRACE_DEBUG("ERROR avct_l2c_config_cfm_cback L2CA_DisconnectReq %d ", p_lcb->ch_state);
|
||||
/* store result value */
|
||||
p_lcb->ch_result = p_cfg->result;
|
||||
@ -293,16 +272,12 @@ void avct_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
|
||||
tAVCT_LCB *p_lcb;
|
||||
|
||||
/* look up lcb for this channel */
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_config_ind_cback: 0x%x, ch_state: %d", lcid, p_lcb->ch_state);
|
||||
/* store the mtu in tbl */
|
||||
if (p_cfg->mtu_present)
|
||||
{
|
||||
if (p_cfg->mtu_present) {
|
||||
p_lcb->peer_mtu = p_cfg->mtu;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_lcb->peer_mtu = L2CAP_DEFAULT_MTU;
|
||||
}
|
||||
|
||||
@ -312,14 +287,12 @@ void avct_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
|
||||
L2CA_ConfigRsp(lcid, p_cfg);
|
||||
|
||||
/* if first config ind */
|
||||
if ((p_lcb->ch_flags & AVCT_L2C_CFG_IND_DONE) == 0)
|
||||
{
|
||||
if ((p_lcb->ch_flags & AVCT_L2C_CFG_IND_DONE) == 0) {
|
||||
/* update flags */
|
||||
p_lcb->ch_flags |= AVCT_L2C_CFG_IND_DONE;
|
||||
|
||||
/* if configuration complete */
|
||||
if (p_lcb->ch_flags & AVCT_L2C_CFG_CFM_DONE)
|
||||
{
|
||||
if (p_lcb->ch_flags & AVCT_L2C_CFG_CFM_DONE) {
|
||||
p_lcb->ch_state = AVCT_CH_OPEN;
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_LL_OPEN_EVT, NULL);
|
||||
}
|
||||
@ -344,11 +317,9 @@ void avct_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
|
||||
UINT16 result = AVCT_RESULT_FAIL;
|
||||
|
||||
/* look up lcb for this channel */
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_disconnect_ind_cback: 0x%x, ch_state: %d", lcid, p_lcb->ch_state);
|
||||
if (ack_needed)
|
||||
{
|
||||
if (ack_needed) {
|
||||
/* send L2CAP disconnect response */
|
||||
L2CA_DisconnectRsp(lcid);
|
||||
}
|
||||
@ -374,8 +345,7 @@ void avct_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
|
||||
UINT16 res;
|
||||
|
||||
/* look up lcb for this channel */
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) {
|
||||
AVCT_TRACE_DEBUG("avct_l2c_disconnect_cfm_cback: 0x%x, ch_state: %d, res: %d",
|
||||
lcid, p_lcb->ch_state, result);
|
||||
/* result value may be previously stored */
|
||||
@ -403,8 +373,7 @@ void avct_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested)
|
||||
|
||||
AVCT_TRACE_DEBUG("avct_l2c_congestion_ind_cback: 0x%x", lcid);
|
||||
/* look up lcb for this channel */
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) {
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_LL_CONG_EVT, (tAVCT_LCB_EVT *) &is_congested);
|
||||
}
|
||||
}
|
||||
@ -425,12 +394,9 @@ void avct_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
|
||||
|
||||
AVCT_TRACE_DEBUG("avct_l2c_data_ind_cback: 0x%x", lcid);
|
||||
/* look up lcb for this channel */
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) {
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_LL_MSG_EVT, (tAVCT_LCB_EVT *) &p_buf);
|
||||
}
|
||||
else /* prevent buffer leak */
|
||||
{
|
||||
} else { /* prevent buffer leak */
|
||||
AVCT_TRACE_WARNING("ERROR -> avct_l2c_data_ind_cback drop buffer");
|
||||
GKI_freebuf(p_buf);
|
||||
}
|
||||
|
150
components/bt/bluedroid/stack/avct/avct_lcb.c
Executable file → Normal file
150
components/bt/bluedroid/stack/avct/avct_lcb.c
Executable file → Normal file
@ -40,7 +40,7 @@
|
||||
#if BT_TRACE_VERBOSE == TRUE
|
||||
|
||||
/* verbose state strings for trace */
|
||||
const char * const avct_lcb_st_str[] = {
|
||||
const char *const avct_lcb_st_str[] = {
|
||||
"LCB_IDLE_ST",
|
||||
"LCB_OPENING_ST",
|
||||
"LCB_OPEN_ST",
|
||||
@ -48,7 +48,7 @@ const char * const avct_lcb_st_str[] = {
|
||||
};
|
||||
|
||||
/* verbose event strings for trace */
|
||||
const char * const avct_lcb_evt_str[] = {
|
||||
const char *const avct_lcb_evt_str[] = {
|
||||
"UL_BIND_EVT",
|
||||
"UL_UNBIND_EVT",
|
||||
"UL_MSG_EVT",
|
||||
@ -122,54 +122,54 @@ const tAVCT_LCB_ACTION avct_lcb_action[] = {
|
||||
|
||||
/* state table for idle state */
|
||||
const UINT8 avct_lcb_st_idle[][AVCT_LCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_CHNL_OPEN, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_UNBIND_DISC, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_OPEN_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_IND, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_CHNL_OPEN, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_UNBIND_DISC, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_OPEN_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_IND, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST}
|
||||
};
|
||||
|
||||
/* state table for opening state */
|
||||
const UINT8 avct_lcb_st_opening[][AVCT_LCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_UNBIND_DISC, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_CHNL_DISC, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_OPEN_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_OPEN_FAIL, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_CONG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_UNBIND_DISC, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_CHNL_DISC, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_OPEN_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_OPEN_FAIL, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_CONG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST}
|
||||
};
|
||||
|
||||
/* state table for open state */
|
||||
const UINT8 avct_lcb_st_open[][AVCT_LCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_BIND_CONN, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_CHK_DISC, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_SEND_MSG, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_CHNL_DISC, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_IND, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_CONG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_BIND_CONN, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_CHK_DISC, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_SEND_MSG, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_CHNL_DISC, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_IND, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_CONG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}
|
||||
};
|
||||
|
||||
/* state table for closing state */
|
||||
const UINT8 avct_lcb_st_closing[][AVCT_LCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_BIND_FAIL, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_CFM, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* UL_BIND_EVT */ {AVCT_LCB_BIND_FAIL, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* UL_UNBIND_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* INT_CLOSE_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_CFM, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST},
|
||||
/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST},
|
||||
/* LL_CONG_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}
|
||||
};
|
||||
|
||||
/* type for state table */
|
||||
@ -212,14 +212,10 @@ void avct_lcb_event(tAVCT_LCB *p_lcb, UINT8 event, tAVCT_LCB_EVT *p_data)
|
||||
p_lcb->state = state_table[event][AVCT_LCB_NEXT_STATE];
|
||||
|
||||
/* execute action functions */
|
||||
for (i = 0; i < AVCT_LCB_ACTIONS; i++)
|
||||
{
|
||||
if ((action = state_table[event][i]) != AVCT_LCB_IGNORE)
|
||||
{
|
||||
for (i = 0; i < AVCT_LCB_ACTIONS; i++) {
|
||||
if ((action = state_table[event][i]) != AVCT_LCB_IGNORE) {
|
||||
(*avct_lcb_action[action])(p_lcb, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -255,14 +251,10 @@ void avct_bcb_event(tAVCT_BCB *p_bcb, UINT8 event, tAVCT_LCB_EVT *p_data)
|
||||
p_bcb->state = state_table[event][AVCT_LCB_NEXT_STATE];
|
||||
|
||||
/* execute action functions */
|
||||
for (i = 0; i < AVCT_LCB_ACTIONS; i++)
|
||||
{
|
||||
if ((action = state_table[event][i]) != AVCT_LCB_IGNORE)
|
||||
{
|
||||
for (i = 0; i < AVCT_LCB_ACTIONS; i++) {
|
||||
if ((action = state_table[event][i]) != AVCT_LCB_IGNORE) {
|
||||
(*avct_bcb_action[action])(p_bcb, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -284,17 +276,14 @@ tAVCT_LCB *avct_lcb_by_bd(BD_ADDR bd_addr)
|
||||
tAVCT_LCB *p_lcb = &avct_cb.lcb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++)
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++) {
|
||||
/* if allocated lcb has matching lcb */
|
||||
if (p_lcb->allocated && (!memcmp(p_lcb->peer_addr, bd_addr, BD_ADDR_LEN)))
|
||||
{
|
||||
if (p_lcb->allocated && (!memcmp(p_lcb->peer_addr, bd_addr, BD_ADDR_LEN))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == AVCT_NUM_LINKS)
|
||||
{
|
||||
if (i == AVCT_NUM_LINKS) {
|
||||
/* if no lcb found */
|
||||
p_lcb = NULL;
|
||||
|
||||
@ -319,10 +308,8 @@ tAVCT_LCB *avct_lcb_alloc(BD_ADDR bd_addr)
|
||||
tAVCT_LCB *p_lcb = &avct_cb.lcb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++)
|
||||
{
|
||||
if (!p_lcb->allocated)
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++) {
|
||||
if (!p_lcb->allocated) {
|
||||
p_lcb->allocated = (UINT8)(i + 1);
|
||||
memcpy(p_lcb->peer_addr, bd_addr, BD_ADDR_LEN);
|
||||
AVCT_TRACE_DEBUG("avct_lcb_alloc %d", p_lcb->allocated);
|
||||
@ -330,8 +317,7 @@ tAVCT_LCB *avct_lcb_alloc(BD_ADDR bd_addr)
|
||||
}
|
||||
}
|
||||
|
||||
if (i == AVCT_NUM_LINKS)
|
||||
{
|
||||
if (i == AVCT_NUM_LINKS) {
|
||||
/* out of lcbs */
|
||||
p_lcb = NULL;
|
||||
AVCT_TRACE_WARNING("Out of lcbs");
|
||||
@ -358,13 +344,10 @@ void avct_lcb_dealloc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
|
||||
AVCT_TRACE_DEBUG("avct_lcb_dealloc %d", p_lcb->allocated);
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
/* if ccb allocated and */
|
||||
if (p_ccb->allocated)
|
||||
{
|
||||
if (p_ccb->p_lcb == p_lcb)
|
||||
{
|
||||
if (p_ccb->allocated) {
|
||||
if (p_ccb->p_lcb == p_lcb) {
|
||||
AVCT_TRACE_DEBUG("avct_lcb_dealloc used by ccb: %d", i);
|
||||
found = TRUE;
|
||||
break;
|
||||
@ -372,13 +355,11 @@ void avct_lcb_dealloc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
if (!found) {
|
||||
AVCT_TRACE_DEBUG("avct_lcb_dealloc now");
|
||||
|
||||
/* clear reassembled msg buffer if in use */
|
||||
if (p_lcb->p_rx_msg != NULL)
|
||||
{
|
||||
if (p_lcb->p_rx_msg != NULL) {
|
||||
GKI_freebuf(p_lcb->p_rx_msg);
|
||||
}
|
||||
memset(p_lcb, 0, sizeof(tAVCT_LCB));
|
||||
@ -400,16 +381,13 @@ tAVCT_LCB *avct_lcb_by_lcid(UINT16 lcid)
|
||||
tAVCT_LCB *p_lcb = &avct_cb.lcb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++)
|
||||
{
|
||||
if (p_lcb->allocated && ((p_lcb->ch_lcid == lcid) || (p_lcb->conflict_lcid == lcid)))
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++) {
|
||||
if (p_lcb->allocated && ((p_lcb->ch_lcid == lcid) || (p_lcb->conflict_lcid == lcid))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == AVCT_NUM_LINKS)
|
||||
{
|
||||
if (i == AVCT_NUM_LINKS) {
|
||||
/* out of lcbs */
|
||||
p_lcb = NULL;
|
||||
AVCT_TRACE_WARNING("No lcb for lcid %x", lcid);
|
||||
@ -433,10 +411,8 @@ tAVCT_CCB *avct_lcb_has_pid(tAVCT_LCB *p_lcb, UINT16 pid)
|
||||
tAVCT_CCB *p_ccb = &avct_cb.ccb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb) && (p_ccb->cc.pid == pid))
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb) && (p_ccb->cc.pid == pid)) {
|
||||
return p_ccb;
|
||||
}
|
||||
}
|
||||
@ -459,12 +435,10 @@ BOOLEAN avct_lcb_last_ccb(tAVCT_LCB *p_lcb, tAVCT_CCB *p_ccb_last)
|
||||
int i;
|
||||
|
||||
AVCT_TRACE_WARNING("avct_lcb_last_ccb");
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
AVCT_TRACE_WARNING("%x: aloc:%d, lcb:%p/%p, ccb:%p/%p",
|
||||
i, p_ccb->allocated, p_ccb->p_lcb, p_lcb, p_ccb, p_ccb_last);
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb) && (p_ccb != p_ccb_last))
|
||||
{
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb) && (p_ccb != p_ccb_last)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
194
components/bt/bluedroid/stack/avct/avct_lcb_act.c
Executable file → Normal file
194
components/bt/bluedroid/stack/avct/avct_lcb_act.c
Executable file → Normal file
@ -64,18 +64,15 @@ static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
|
||||
AVCT_PRS_PKT_TYPE(p, pkt_type);
|
||||
|
||||
/* quick sanity check on length */
|
||||
if (p_buf->len < avct_lcb_pkt_type_len[pkt_type])
|
||||
{
|
||||
if (p_buf->len < avct_lcb_pkt_type_len[pkt_type]) {
|
||||
GKI_freebuf(p_buf);
|
||||
AVCT_TRACE_WARNING("Bad length during reassembly");
|
||||
p_ret = NULL;
|
||||
}
|
||||
/* single packet */
|
||||
else if (pkt_type == AVCT_PKT_TYPE_SINGLE)
|
||||
{
|
||||
else if (pkt_type == AVCT_PKT_TYPE_SINGLE) {
|
||||
/* if reassembly in progress drop message and process new single */
|
||||
if (p_lcb->p_rx_msg != NULL)
|
||||
{
|
||||
if (p_lcb->p_rx_msg != NULL) {
|
||||
GKI_freebuf(p_lcb->p_rx_msg);
|
||||
p_lcb->p_rx_msg = NULL;
|
||||
AVCT_TRACE_WARNING("Got single during reassembly");
|
||||
@ -83,11 +80,9 @@ static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
|
||||
p_ret = p_buf;
|
||||
}
|
||||
/* start packet */
|
||||
else if (pkt_type == AVCT_PKT_TYPE_START)
|
||||
{
|
||||
else if (pkt_type == AVCT_PKT_TYPE_START) {
|
||||
/* if reassembly in progress drop message and process new start */
|
||||
if (p_lcb->p_rx_msg != NULL)
|
||||
{
|
||||
if (p_lcb->p_rx_msg != NULL) {
|
||||
GKI_freebuf(p_lcb->p_rx_msg);
|
||||
AVCT_TRACE_WARNING("Got start during reassembly");
|
||||
}
|
||||
@ -95,14 +90,11 @@ static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
|
||||
* not aware of possible packet size after reassembly they
|
||||
* would have allocated smaller buffer.
|
||||
*/
|
||||
p_lcb->p_rx_msg = (BT_HDR*)GKI_getbuf(GKI_MAX_BUF_SIZE);
|
||||
if (p_lcb->p_rx_msg == NULL)
|
||||
{
|
||||
p_lcb->p_rx_msg = (BT_HDR *)GKI_getbuf(GKI_MAX_BUF_SIZE);
|
||||
if (p_lcb->p_rx_msg == NULL) {
|
||||
AVCT_TRACE_ERROR ("Cannot alloc buffer for reassembly !!");
|
||||
GKI_freebuf(p_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
memcpy (p_lcb->p_rx_msg, p_buf,
|
||||
sizeof(BT_HDR) + p_buf->offset + p_buf->len);
|
||||
/* Free original buffer */
|
||||
@ -123,17 +115,13 @@ static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
|
||||
p_ret = NULL;
|
||||
}
|
||||
/* continue or end */
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* if no reassembly in progress drop message */
|
||||
if (p_lcb->p_rx_msg == NULL)
|
||||
{
|
||||
if (p_lcb->p_rx_msg == NULL) {
|
||||
GKI_freebuf(p_buf);
|
||||
AVCT_TRACE_WARNING("Pkt type=%d out of order", pkt_type);
|
||||
p_ret = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* get size of buffer holding assembled message */
|
||||
buf_len = GKI_get_buf_size(p_lcb->p_rx_msg) - sizeof(BT_HDR);
|
||||
|
||||
@ -142,30 +130,24 @@ static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
|
||||
p_buf->len -= AVCT_HDR_LEN_CONT;
|
||||
|
||||
/* verify length */
|
||||
if ((p_lcb->p_rx_msg->offset + p_buf->len) > buf_len)
|
||||
{
|
||||
if ((p_lcb->p_rx_msg->offset + p_buf->len) > buf_len) {
|
||||
/* won't fit; free everything */
|
||||
GKI_freebuf(p_lcb->p_rx_msg);
|
||||
p_lcb->p_rx_msg = NULL;
|
||||
GKI_freebuf(p_buf);
|
||||
p_ret = NULL;
|
||||
AVCT_TRACE_WARNING("Fragmented message to big!");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* copy contents of p_buf to p_rx_msg */
|
||||
memcpy((UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset,
|
||||
(UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len);
|
||||
|
||||
if (pkt_type == AVCT_PKT_TYPE_END)
|
||||
{
|
||||
if (pkt_type == AVCT_PKT_TYPE_END) {
|
||||
p_lcb->p_rx_msg->offset -= p_lcb->p_rx_msg->len;
|
||||
p_lcb->p_rx_msg->len += p_buf->len;
|
||||
p_ret = p_lcb->p_rx_msg;
|
||||
p_lcb->p_rx_msg = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_lcb->p_rx_msg->offset += p_buf->len;
|
||||
p_lcb->p_rx_msg->len += p_buf->len;
|
||||
p_ret = NULL;
|
||||
@ -196,8 +178,7 @@ void avct_lcb_chnl_open(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
BTM_SetOutService(p_lcb->peer_addr, BTM_SEC_SERVICE_AVCTP, 0);
|
||||
/* call l2cap connect req */
|
||||
p_lcb->ch_state = AVCT_CH_CONN;
|
||||
if ((p_lcb->ch_lcid = L2CA_ConnectReq(AVCT_PSM, p_lcb->peer_addr)) == 0)
|
||||
{
|
||||
if ((p_lcb->ch_lcid = L2CA_ConnectReq(AVCT_PSM, p_lcb->peer_addr)) == 0) {
|
||||
/* if connect req failed, send ourselves close event */
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, (tAVCT_LCB_EVT *) &result);
|
||||
}
|
||||
@ -239,14 +220,11 @@ void avct_lcb_open_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
int i;
|
||||
BOOLEAN bind = FALSE;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
/* if ccb allocated and */
|
||||
if (p_ccb->allocated)
|
||||
{
|
||||
if (p_ccb->allocated) {
|
||||
/* if bound to this lcb send connect confirm event */
|
||||
if (p_ccb->p_lcb == p_lcb)
|
||||
{
|
||||
if (p_ccb->p_lcb == p_lcb) {
|
||||
bind = TRUE;
|
||||
L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH);
|
||||
p_ccb->cc.p_ctrl_cback(avct_ccb_to_idx(p_ccb), AVCT_CONNECT_CFM_EVT,
|
||||
@ -254,8 +232,7 @@ void avct_lcb_open_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
}
|
||||
/* if unbound acceptor and lcb doesn't already have a ccb for this PID */
|
||||
else if ((p_ccb->p_lcb == NULL) && (p_ccb->cc.role == AVCT_ACP) &&
|
||||
(avct_lcb_has_pid(p_lcb, p_ccb->cc.pid) == NULL))
|
||||
{
|
||||
(avct_lcb_has_pid(p_lcb, p_ccb->cc.pid) == NULL)) {
|
||||
/* bind ccb to lcb and send connect ind event */
|
||||
bind = TRUE;
|
||||
p_ccb->p_lcb = p_lcb;
|
||||
@ -267,8 +244,7 @@ void avct_lcb_open_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
}
|
||||
|
||||
/* if no ccbs bound to this lcb, disconnect */
|
||||
if (bind == FALSE)
|
||||
{
|
||||
if (bind == FALSE) {
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
|
||||
}
|
||||
}
|
||||
@ -289,10 +265,8 @@ void avct_lcb_open_fail(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
tAVCT_CCB *p_ccb = &avct_cb.ccb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) {
|
||||
avct_ccb_dealloc(p_ccb, AVCT_CONNECT_CFM_EVT,
|
||||
p_data->result, p_lcb->peer_addr);
|
||||
}
|
||||
@ -316,17 +290,12 @@ void avct_lcb_close_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
int i;
|
||||
UNUSED(p_data);
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
|
||||
{
|
||||
if (p_ccb->cc.role == AVCT_INT)
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) {
|
||||
if (p_ccb->cc.role == AVCT_INT) {
|
||||
avct_ccb_dealloc(p_ccb, AVCT_DISCONNECT_IND_EVT,
|
||||
0, p_lcb->peer_addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_ccb->p_lcb = NULL;
|
||||
(*p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_ccb), AVCT_DISCONNECT_IND_EVT,
|
||||
0, p_lcb->peer_addr);
|
||||
@ -352,27 +321,19 @@ void avct_lcb_close_cfm(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
int i;
|
||||
UINT8 event;
|
||||
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) {
|
||||
/* if this ccb initiated close send disconnect cfm otherwise ind */
|
||||
if (p_ccb->ch_close)
|
||||
{
|
||||
if (p_ccb->ch_close) {
|
||||
p_ccb->ch_close = FALSE;
|
||||
event = AVCT_DISCONNECT_CFM_EVT;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
event = AVCT_DISCONNECT_IND_EVT;
|
||||
}
|
||||
|
||||
if (p_ccb->cc.role == AVCT_INT)
|
||||
{
|
||||
if (p_ccb->cc.role == AVCT_INT) {
|
||||
avct_ccb_dealloc(p_ccb, event, p_data->result, p_lcb->peer_addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_ccb->p_lcb = NULL;
|
||||
(*p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_ccb), event,
|
||||
p_data->result, p_lcb->peer_addr);
|
||||
@ -416,14 +377,11 @@ void avct_lcb_chk_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
#if (AVCT_BROWSE_INCLUDED == TRUE)
|
||||
avct_close_bcb(p_lcb, p_data);
|
||||
#endif
|
||||
if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb))
|
||||
{
|
||||
if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb)) {
|
||||
AVCT_TRACE_WARNING("closing");
|
||||
p_data->p_ccb->ch_close = TRUE;
|
||||
avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVCT_TRACE_WARNING("dealloc ccb");
|
||||
avct_lcb_unbind_disc(p_lcb, p_data);
|
||||
}
|
||||
@ -484,22 +442,17 @@ void avct_lcb_cong_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
/* set event */
|
||||
event = (p_data->cong) ? AVCT_CONG_IND_EVT : AVCT_UNCONG_IND_EVT;
|
||||
p_lcb->cong = p_data->cong;
|
||||
if (p_lcb->cong == FALSE && GKI_getfirst(&p_lcb->tx_q))
|
||||
{
|
||||
while ( !p_lcb->cong && (p_buf = (BT_HDR *)GKI_dequeue(&p_lcb->tx_q)) != NULL)
|
||||
{
|
||||
if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED)
|
||||
{
|
||||
if (p_lcb->cong == FALSE && GKI_getfirst(&p_lcb->tx_q)) {
|
||||
while ( !p_lcb->cong && (p_buf = (BT_HDR *)GKI_dequeue(&p_lcb->tx_q)) != NULL) {
|
||||
if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) {
|
||||
p_lcb->cong = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* send event to all ccbs on this lcb */
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
|
||||
{
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb))
|
||||
{
|
||||
for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
|
||||
if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) {
|
||||
(*p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_ccb), event, 0, p_lcb->peer_addr);
|
||||
}
|
||||
}
|
||||
@ -550,31 +503,26 @@ void avct_lcb_send_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
curr_msg_len = p_data->ul_msg.p_buf->len;
|
||||
|
||||
/* initialize packet type and other stuff */
|
||||
if (curr_msg_len <= (p_lcb->peer_mtu - AVCT_HDR_LEN_SINGLE))
|
||||
{
|
||||
if (curr_msg_len <= (p_lcb->peer_mtu - AVCT_HDR_LEN_SINGLE)) {
|
||||
pkt_type = AVCT_PKT_TYPE_SINGLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pkt_type = AVCT_PKT_TYPE_START;
|
||||
temp = (curr_msg_len + AVCT_HDR_LEN_START - p_lcb->peer_mtu);
|
||||
nosp = temp / (p_lcb->peer_mtu - 1) + 1;
|
||||
if ( (temp % (p_lcb->peer_mtu - 1)) != 0)
|
||||
if ( (temp % (p_lcb->peer_mtu - 1)) != 0) {
|
||||
nosp++;
|
||||
}
|
||||
}
|
||||
|
||||
/* while we haven't sent all packets */
|
||||
while (curr_msg_len != 0)
|
||||
{
|
||||
while (curr_msg_len != 0) {
|
||||
/* set header len */
|
||||
hdr_len = avct_lcb_pkt_type_len[pkt_type];
|
||||
|
||||
/* if remaining msg must be fragmented */
|
||||
if (p_data->ul_msg.p_buf->len > (p_lcb->peer_mtu - hdr_len))
|
||||
{
|
||||
if (p_data->ul_msg.p_buf->len > (p_lcb->peer_mtu - hdr_len)) {
|
||||
/* get a new buffer for fragment we are sending */
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(buf_size)) == NULL)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(buf_size)) == NULL) {
|
||||
/* whoops; free original msg buf and bail */
|
||||
AVCT_TRACE_ERROR ("avct_lcb_send_msg cannot alloc buffer!!");
|
||||
GKI_freebuf(p_data->ul_msg.p_buf);
|
||||
@ -590,9 +538,7 @@ void avct_lcb_send_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
|
||||
p_data->ul_msg.p_buf->offset += p_buf->len;
|
||||
p_data->ul_msg.p_buf->len -= p_buf->len;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_buf = p_data->ul_msg.p_buf;
|
||||
}
|
||||
|
||||
@ -605,36 +551,28 @@ void avct_lcb_send_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
|
||||
/* build header */
|
||||
AVCT_BLD_HDR(p, p_data->ul_msg.label, pkt_type, p_data->ul_msg.cr);
|
||||
if (pkt_type == AVCT_PKT_TYPE_START)
|
||||
{
|
||||
if (pkt_type == AVCT_PKT_TYPE_START) {
|
||||
UINT8_TO_STREAM(p, nosp);
|
||||
}
|
||||
if ((pkt_type == AVCT_PKT_TYPE_START) || (pkt_type == AVCT_PKT_TYPE_SINGLE))
|
||||
{
|
||||
if ((pkt_type == AVCT_PKT_TYPE_START) || (pkt_type == AVCT_PKT_TYPE_SINGLE)) {
|
||||
UINT16_TO_BE_STREAM(p, p_data->ul_msg.p_ccb->cc.pid);
|
||||
}
|
||||
|
||||
if (p_lcb->cong == TRUE)
|
||||
{
|
||||
if (p_lcb->cong == TRUE) {
|
||||
GKI_enqueue (&p_lcb->tx_q, p_buf);
|
||||
}
|
||||
|
||||
/* send message to L2CAP */
|
||||
else
|
||||
{
|
||||
if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED)
|
||||
{
|
||||
else {
|
||||
if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) {
|
||||
p_lcb->cong = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* update pkt type for next packet */
|
||||
if (curr_msg_len > (p_lcb->peer_mtu - AVCT_HDR_LEN_END))
|
||||
{
|
||||
if (curr_msg_len > (p_lcb->peer_mtu - AVCT_HDR_LEN_END)) {
|
||||
pkt_type = AVCT_PKT_TYPE_CONT;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pkt_type = AVCT_PKT_TYPE_END;
|
||||
}
|
||||
}
|
||||
@ -656,8 +594,9 @@ void avct_lcb_free_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
{
|
||||
UNUSED(p_lcb);
|
||||
|
||||
if (p_data)
|
||||
if (p_data) {
|
||||
GKI_freebuf(p_data->p_buf);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -685,8 +624,7 @@ void avct_lcb_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
p_data->p_buf->layer_specific = AVCT_DATA_CTRL;
|
||||
|
||||
/* reassemble message; if no message available (we received a fragment) return */
|
||||
if ((p_data->p_buf = avct_lcb_msg_asmbl(p_lcb, p_data->p_buf)) == NULL)
|
||||
{
|
||||
if ((p_data->p_buf = avct_lcb_msg_asmbl(p_lcb, p_data->p_buf)) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -697,8 +635,7 @@ void avct_lcb_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
UNUSED(type);
|
||||
|
||||
/* check for invalid cr_ipid */
|
||||
if (cr_ipid == AVCT_CR_IPID_INVALID)
|
||||
{
|
||||
if (cr_ipid == AVCT_CR_IPID_INVALID) {
|
||||
AVCT_TRACE_WARNING("Invalid cr_ipid %d", cr_ipid);
|
||||
GKI_freebuf(p_data->p_buf);
|
||||
return;
|
||||
@ -706,24 +643,19 @@ void avct_lcb_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||
|
||||
/* parse and lookup PID */
|
||||
BE_STREAM_TO_UINT16(pid, p);
|
||||
if ((p_ccb = avct_lcb_has_pid(p_lcb, pid)) != NULL)
|
||||
{
|
||||
if ((p_ccb = avct_lcb_has_pid(p_lcb, pid)) != NULL) {
|
||||
/* PID found; send msg up, adjust bt hdr and call msg callback */
|
||||
p_data->p_buf->offset += AVCT_HDR_LEN_SINGLE;
|
||||
p_data->p_buf->len -= AVCT_HDR_LEN_SINGLE;
|
||||
(*p_ccb->cc.p_msg_cback)(avct_ccb_to_idx(p_ccb), label, cr_ipid, p_data->p_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* PID not found; drop message */
|
||||
AVCT_TRACE_WARNING("No ccb for PID=%x", pid);
|
||||
GKI_freebuf(p_data->p_buf);
|
||||
|
||||
/* if command send reject */
|
||||
if (cr_ipid == AVCT_CMD)
|
||||
{
|
||||
if ((p_buf = (BT_HDR *) GKI_getpoolbuf(AVCT_CMD_POOL_ID)) != NULL)
|
||||
{
|
||||
if (cr_ipid == AVCT_CMD) {
|
||||
if ((p_buf = (BT_HDR *) GKI_getpoolbuf(AVCT_CMD_POOL_ID)) != NULL) {
|
||||
p_buf->len = AVCT_HDR_LEN_SINGLE;
|
||||
p_buf->offset = AVCT_MSG_OFFSET - AVCT_HDR_LEN_SINGLE;
|
||||
p = (UINT8 *)(p_buf + 1) + p_buf->offset;
|
||||
|
0
components/bt/bluedroid/stack/avct/include/avct_int.h
Executable file → Normal file
0
components/bt/bluedroid/stack/avct/include/avct_int.h
Executable file → Normal file
137
components/bt/bluedroid/stack/avdt/avdt_ad.c
Executable file → Normal file
137
components/bt/bluedroid/stack/avdt/avdt_ad.c
Executable file → Normal file
@ -50,12 +50,9 @@ UINT8 avdt_ad_type_to_tcid(UINT8 type, tAVDT_SCB *p_scb)
|
||||
{
|
||||
UINT8 scb_idx;
|
||||
|
||||
if (type == AVDT_CHAN_SIG)
|
||||
{
|
||||
if (type == AVDT_CHAN_SIG) {
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
scb_idx = avdt_scb_to_hdl(p_scb) - 1;
|
||||
/*
|
||||
AVDT_TRACE_DEBUG("type: %d, tcid: %d", type, ((scb_idx * (AVDT_CHAN_NUM_TYPES - 1)) + type));
|
||||
@ -78,12 +75,9 @@ static UINT8 avdt_ad_tcid_to_type(UINT8 tcid)
|
||||
{
|
||||
UINT8 type;
|
||||
|
||||
if (tcid == 0)
|
||||
{
|
||||
if (tcid == 0) {
|
||||
type = AVDT_CHAN_SIG;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* tcid translates to type based on number of channels, as follows:
|
||||
** only media channel : tcid=1,2,3,4,5,6... type=1,1,1,1,1,1...
|
||||
** media and report : tcid=1,2,3,4,5,6... type=1,2,1,2,1,2...
|
||||
@ -113,8 +107,7 @@ void avdt_ad_init(void)
|
||||
memset(&avdt_cb.ad, 0, sizeof(tAVDT_AD));
|
||||
|
||||
/* make sure the peer_mtu is a valid value */
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++)
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++) {
|
||||
p_tbl->peer_mtu = L2CAP_DEFAULT_MTU;
|
||||
}
|
||||
}
|
||||
@ -139,42 +132,31 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state)
|
||||
tAVDT_TC_TBL *p_tbl = avdt_cb.ad.tc_tbl;
|
||||
UINT8 ccb_idx;
|
||||
|
||||
if (p_ccb == NULL)
|
||||
{
|
||||
if (p_ccb == NULL) {
|
||||
/* resending security req */
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++)
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++) {
|
||||
/* must be AVDT_CHAN_SIG - tcid always zero */
|
||||
if ((p_tbl->tcid == 0) &&
|
||||
(p_tbl->state == state))
|
||||
{
|
||||
(p_tbl->state == state)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ccb_idx = avdt_ccb_to_idx(p_ccb);
|
||||
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++)
|
||||
{
|
||||
if (type == AVDT_CHAN_SIG)
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++) {
|
||||
if (type == AVDT_CHAN_SIG) {
|
||||
/* if control channel, tcid always zero */
|
||||
if ((p_tbl->tcid == 0) &&
|
||||
(p_tbl->ccb_idx == ccb_idx) &&
|
||||
(p_tbl->state == state))
|
||||
{
|
||||
(p_tbl->state == state)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* if other channel, tcid is always > zero */
|
||||
if ((p_tbl->tcid > 0) &&
|
||||
(p_tbl->ccb_idx == ccb_idx) &&
|
||||
(p_tbl->state == state))
|
||||
{
|
||||
(p_tbl->state == state)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -182,8 +164,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state)
|
||||
}
|
||||
|
||||
/* if nothing found return null */
|
||||
if (i == AVDT_NUM_TC_TBL)
|
||||
{
|
||||
if (i == AVDT_NUM_TC_TBL) {
|
||||
p_tbl = NULL;
|
||||
}
|
||||
|
||||
@ -207,12 +188,9 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(UINT16 lcid)
|
||||
|
||||
idx = avdt_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID];
|
||||
|
||||
if (idx < AVDT_NUM_TC_TBL)
|
||||
{
|
||||
if (idx < AVDT_NUM_TC_TBL) {
|
||||
return &avdt_cb.ad.tc_tbl[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -239,10 +217,8 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_
|
||||
/* get tcid from type, scb */
|
||||
tcid = avdt_ad_type_to_tcid(type, p_scb);
|
||||
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++)
|
||||
{
|
||||
if ((p_tbl->tcid == tcid) && (p_tbl->ccb_idx == ccb_idx))
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++) {
|
||||
if ((p_tbl->tcid == tcid) && (p_tbl->ccb_idx == ccb_idx)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -269,10 +245,8 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb)
|
||||
tAVDT_TC_TBL *p_tbl = avdt_cb.ad.tc_tbl;
|
||||
|
||||
/* find next free entry in tc table */
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++)
|
||||
{
|
||||
if (p_tbl->state == AVDT_AD_ST_UNUSED)
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_TC_TBL; i++, p_tbl++) {
|
||||
if (p_tbl->state == AVDT_AD_ST_UNUSED) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -339,19 +313,16 @@ void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, UINT16 reason)
|
||||
p_tbl->tcid, close.old_tc_state);
|
||||
|
||||
/* if signaling channel, notify ccb that channel open */
|
||||
if (p_tbl->tcid == 0)
|
||||
{
|
||||
if (p_tbl->tcid == 0) {
|
||||
p_ccb = avdt_ccb_by_idx(p_tbl->ccb_idx);
|
||||
p_ccb->disc_rsn = (reason == AVDT_DISC_RSN_ABNORMAL) ? AVDT_DISC_RSN_ABNORMAL : AVDT_DISC_RSN_NORMAL;
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_LL_CLOSE_EVT, NULL);
|
||||
}
|
||||
/* if media or other channel, notify scb that channel close */
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* look up scb in stream routing table by ccb, tcid */
|
||||
p_scb = avdt_scb_by_hdl(avdt_cb.ad.rt_tbl[p_tbl->ccb_idx][p_tbl->tcid].scb_hdl);
|
||||
if (p_scb != NULL)
|
||||
{
|
||||
if (p_scb != NULL) {
|
||||
close.tcid = p_tbl->tcid;
|
||||
close.type = avdt_ad_tcid_to_type(p_tbl->tcid);
|
||||
close.disc_rsn = (reason == AVDT_DISC_RSN_ABNORMAL) ? AVDT_DISC_RSN_ABNORMAL : AVDT_DISC_RSN_NORMAL;
|
||||
@ -382,8 +353,7 @@ void avdt_ad_tc_open_ind(tAVDT_TC_TBL *p_tbl)
|
||||
p_tbl->state = AVDT_AD_ST_OPEN;
|
||||
|
||||
/* if signaling channel, notify ccb that channel open */
|
||||
if (p_tbl->tcid == 0)
|
||||
{
|
||||
if (p_tbl->tcid == 0) {
|
||||
/* set the signal channel to use high priority within the ACL link */
|
||||
L2CA_SetTxPriority(avdt_cb.ad.rt_tbl[p_tbl->ccb_idx][AVDT_CHAN_SIG].lcid, L2CAP_CHNL_PRIORITY_HIGH);
|
||||
|
||||
@ -391,21 +361,18 @@ void avdt_ad_tc_open_ind(tAVDT_TC_TBL *p_tbl)
|
||||
/* use err_param to indicate the role of connection.
|
||||
* AVDT_ACP, if ACP */
|
||||
evt.err_param = AVDT_INT;
|
||||
if(p_tbl->cfg_flags & AVDT_L2C_CFG_CONN_ACP)
|
||||
{
|
||||
if (p_tbl->cfg_flags & AVDT_L2C_CFG_CONN_ACP) {
|
||||
evt.err_param = AVDT_ACP;
|
||||
}
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_LL_OPEN_EVT, (tAVDT_CCB_EVT *)&evt);
|
||||
}
|
||||
/* if media or other channel, notify scb that channel open */
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* look up scb in stream routing table by ccb, tcid */
|
||||
p_scb = avdt_scb_by_hdl(avdt_cb.ad.rt_tbl[p_tbl->ccb_idx][p_tbl->tcid].scb_hdl);
|
||||
|
||||
/* put lcid in event data */
|
||||
if (p_scb != NULL)
|
||||
{
|
||||
if (p_scb != NULL) {
|
||||
open.peer_mtu = p_tbl->peer_mtu;
|
||||
open.lcid = avdt_cb.ad.rt_tbl[p_tbl->ccb_idx][p_tbl->tcid].lcid;
|
||||
open.hdr.err_code = avdt_ad_tcid_to_type(p_tbl->tcid);
|
||||
@ -435,18 +402,15 @@ void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, BOOLEAN is_congested)
|
||||
tAVDT_SCB *p_scb;
|
||||
|
||||
/* if signaling channel, notify ccb of congestion */
|
||||
if (p_tbl->tcid == 0)
|
||||
{
|
||||
if (p_tbl->tcid == 0) {
|
||||
p_ccb = avdt_ccb_by_idx(p_tbl->ccb_idx);
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_LL_CONG_EVT, (tAVDT_CCB_EVT *) &is_congested);
|
||||
}
|
||||
/* if media or other channel, notify scb that channel open */
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* look up scb in stream routing table by ccb, tcid */
|
||||
p_scb = avdt_scb_by_hdl(avdt_cb.ad.rt_tbl[p_tbl->ccb_idx][p_tbl->tcid].scb_hdl);
|
||||
if (p_scb != NULL)
|
||||
{
|
||||
if (p_scb != NULL) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_TC_CONG_EVT, (tAVDT_SCB_EVT *) &is_congested);
|
||||
}
|
||||
}
|
||||
@ -475,21 +439,16 @@ void avdt_ad_tc_data_ind(tAVDT_TC_TBL *p_tbl, BT_HDR *p_buf)
|
||||
|
||||
|
||||
/* if signaling channel, handle control message */
|
||||
if (p_tbl->tcid == 0)
|
||||
{
|
||||
if (p_tbl->tcid == 0) {
|
||||
p_ccb = avdt_ccb_by_idx(p_tbl->ccb_idx);
|
||||
avdt_msg_ind(p_ccb, p_buf);
|
||||
}
|
||||
/* if media or other channel, send event to scb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
p_scb = avdt_scb_by_hdl(avdt_cb.ad.rt_tbl[p_tbl->ccb_idx][p_tbl->tcid].scb_hdl);
|
||||
if (p_scb != NULL)
|
||||
{
|
||||
if (p_scb != NULL) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_TC_DATA_EVT, (tAVDT_SCB_EVT *) &p_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GKI_freebuf(p_buf);
|
||||
AVDT_TRACE_ERROR(" avdt_ad_tc_data_ind buffer freed");
|
||||
}
|
||||
@ -544,8 +503,7 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
|
||||
tAVDT_TC_TBL *p_tbl;
|
||||
UINT16 lcid;
|
||||
|
||||
if((p_tbl = avdt_ad_tc_tbl_alloc(p_ccb)) == NULL)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_alloc(p_ccb)) == NULL) {
|
||||
AVDT_TRACE_ERROR("avdt_ad_open_req: Cannot allocate p_tbl");
|
||||
return;
|
||||
}
|
||||
@ -555,14 +513,11 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
|
||||
AVDT_TRACE_DEBUG("avdt_ad_open_req: type: %d, role: %d, tcid:%d\n",
|
||||
type, role, p_tbl->tcid);
|
||||
|
||||
if (type == AVDT_CHAN_SIG)
|
||||
{
|
||||
if (type == AVDT_CHAN_SIG) {
|
||||
/* if signaling, get mtu from registration control block */
|
||||
p_tbl->my_mtu = avdt_cb.rcb.ctrl_mtu;
|
||||
p_tbl->my_flush_to = L2CAP_DEFAULT_FLUSH_TO;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* otherwise get mtu from scb */
|
||||
p_tbl->my_mtu = p_scb->cs.mtu;
|
||||
p_tbl->my_flush_to = p_scb->cs.flush_to;
|
||||
@ -575,18 +530,15 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
|
||||
}
|
||||
|
||||
/* if we're acceptor, we're done; just sit back and listen */
|
||||
if (role == AVDT_ACP)
|
||||
{
|
||||
if (role == AVDT_ACP) {
|
||||
p_tbl->state = AVDT_AD_ST_ACP;
|
||||
}
|
||||
/* else we're inititator, start the L2CAP connection */
|
||||
else
|
||||
{
|
||||
else {
|
||||
p_tbl->state = AVDT_AD_ST_CONN;
|
||||
|
||||
/* call l2cap connect req */
|
||||
if ((lcid = L2CA_ConnectReq(AVDT_PSM, p_ccb->peer_addr)) != 0)
|
||||
{
|
||||
if ((lcid = L2CA_ConnectReq(AVDT_PSM, p_ccb->peer_addr)) != 0) {
|
||||
/* if connect req ok, store tcid in lcid table */
|
||||
avdt_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl);
|
||||
AVDT_TRACE_DEBUG("avdt_cb.ad.lcid_tbl[%d] = %d\n",
|
||||
@ -596,9 +548,7 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
|
||||
AVDT_TRACE_DEBUG("avdt_cb.ad.rt_tbl[%d][%d].lcid = 0x%x\n",
|
||||
avdt_ccb_to_idx(p_ccb), p_tbl->tcid,
|
||||
lcid);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* if connect req failed, call avdt_ad_tc_close_ind() */
|
||||
avdt_ad_tc_close_ind(p_tbl, 0);
|
||||
}
|
||||
@ -625,8 +575,7 @@ void avdt_ad_close_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb)
|
||||
p_tbl = avdt_ad_tc_tbl_by_type(type, p_ccb, p_scb);
|
||||
AVDT_TRACE_DEBUG("avdt_ad_close_req state: %d\n", p_tbl->state);
|
||||
|
||||
switch(p_tbl->state)
|
||||
{
|
||||
switch (p_tbl->state) {
|
||||
case AVDT_AD_ST_UNUSED:
|
||||
/* probably for reporting */
|
||||
break;
|
||||
|
295
components/bt/bluedroid/stack/avdt/avdt_api.c
Executable file → Normal file
295
components/bt/bluedroid/stack/avdt/avdt_api.c
Executable file → Normal file
@ -59,8 +59,7 @@ void avdt_process_timeout(TIMER_LIST_ENT *p_tle)
|
||||
UINT8 event = 0;
|
||||
UINT8 err_code = AVDT_ERR_TIMEOUT;
|
||||
|
||||
switch (p_tle->event)
|
||||
{
|
||||
switch (p_tle->event) {
|
||||
case BTU_TTYPE_AVDT_CCB_RET:
|
||||
event = AVDT_CCB_RET_TOUT_EVT + AVDT_CCB_MKR;
|
||||
break;
|
||||
@ -81,13 +80,10 @@ void avdt_process_timeout(TIMER_LIST_ENT *p_tle)
|
||||
break;
|
||||
}
|
||||
|
||||
if (event & AVDT_CCB_MKR)
|
||||
{
|
||||
if (event & AVDT_CCB_MKR) {
|
||||
avdt_ccb_event((tAVDT_CCB *) p_tle->param, (UINT8) (event & ~AVDT_CCB_MKR),
|
||||
(tAVDT_CCB_EVT *) &err_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
avdt_scb_event((tAVDT_SCB *) p_tle->param, event, NULL);
|
||||
}
|
||||
}
|
||||
@ -178,10 +174,8 @@ void AVDT_SINK_Activate()
|
||||
int i;
|
||||
AVDT_TRACE_DEBUG("AVDT_SINK_Activate");
|
||||
/* for all allocated scbs */
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++)
|
||||
{
|
||||
if ((p_scb->allocated) && (p_scb->cs.tsep == AVDT_TSEP_SNK))
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++) {
|
||||
if ((p_scb->allocated) && (p_scb->cs.tsep == AVDT_TSEP_SNK)) {
|
||||
AVDT_TRACE_DEBUG("AVDT_SINK_Activate found scb");
|
||||
p_scb->sink_activated = TRUE;
|
||||
/* update in_use */
|
||||
@ -209,10 +203,8 @@ void AVDT_SINK_Deactivate()
|
||||
int i;
|
||||
AVDT_TRACE_DEBUG("AVDT_SINK_Deactivate");
|
||||
/* for all allocated scbs */
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++)
|
||||
{
|
||||
if ((p_scb->allocated) && (p_scb->cs.tsep == AVDT_TSEP_SNK))
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++) {
|
||||
if ((p_scb->allocated) && (p_scb->cs.tsep == AVDT_TSEP_SNK)) {
|
||||
AVDT_TRACE_DEBUG("AVDT_SINK_Deactivate, found scb");
|
||||
p_scb->sink_activated = FALSE;
|
||||
/* update in_use */
|
||||
@ -227,8 +219,7 @@ void AVDT_AbortReq(UINT8 handle)
|
||||
AVDT_TRACE_ERROR("%s\n", __func__);
|
||||
|
||||
tAVDT_SCB *p_scb = avdt_scb_by_hdl(handle);
|
||||
if (p_scb != NULL)
|
||||
{
|
||||
if (p_scb != NULL) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_API_ABORT_REQ_EVT, NULL);
|
||||
} else {
|
||||
AVDT_TRACE_ERROR("%s Improper SCB, can not abort the stream\n", __func__);
|
||||
@ -255,17 +246,13 @@ UINT16 AVDT_CreateStream(UINT8 *p_handle, tAVDT_CS *p_cs)
|
||||
tAVDT_SCB *p_scb;
|
||||
|
||||
/* Verify parameters; if invalid, return failure */
|
||||
if (((p_cs->cfg.psc_mask & (~AVDT_PSC)) != 0) || (p_cs->p_ctrl_cback == NULL))
|
||||
{
|
||||
if (((p_cs->cfg.psc_mask & (~AVDT_PSC)) != 0) || (p_cs->p_ctrl_cback == NULL)) {
|
||||
result = AVDT_BAD_PARAMS;
|
||||
}
|
||||
/* Allocate scb; if no scbs, return failure */
|
||||
else if ((p_scb = avdt_scb_alloc(p_cs)) == NULL)
|
||||
{
|
||||
else if ((p_scb = avdt_scb_alloc(p_cs)) == NULL) {
|
||||
result = AVDT_NO_RESOURCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
*p_handle = avdt_scb_to_hdl(p_scb);
|
||||
}
|
||||
return result;
|
||||
@ -291,12 +278,9 @@ UINT16 AVDT_RemoveStream(UINT8 handle)
|
||||
tAVDT_SCB *p_scb;
|
||||
|
||||
/* look up scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* send remove event to scb */
|
||||
avdt_scb_event(p_scb, AVDT_SCB_API_REMOVE_EVT, NULL);
|
||||
}
|
||||
@ -337,25 +321,20 @@ UINT16 AVDT_DiscoverReq(BD_ADDR bd_addr, tAVDT_SEP_INFO *p_sep_info,
|
||||
tAVDT_CCB_EVT evt;
|
||||
|
||||
/* find channel control block for this bd addr; if none, allocate one */
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL) {
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL) {
|
||||
/* could not allocate channel control block */
|
||||
result = AVDT_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == AVDT_SUCCESS)
|
||||
{
|
||||
if (result == AVDT_SUCCESS) {
|
||||
/* make sure no discovery or get capabilities req already in progress */
|
||||
if (p_ccb->proc_busy)
|
||||
{
|
||||
if (p_ccb->proc_busy) {
|
||||
result = AVDT_BUSY;
|
||||
}
|
||||
/* send event to ccb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
evt.discover.p_sep_info = p_sep_info;
|
||||
evt.discover.num_seps = max_seps;
|
||||
evt.discover.p_cback = p_cback;
|
||||
@ -381,31 +360,25 @@ static UINT16 avdt_get_cap_req(BD_ADDR bd_addr, tAVDT_CCB_API_GETCAP *p_evt)
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
|
||||
/* verify SEID */
|
||||
if ((p_evt->single.seid < AVDT_SEID_MIN) || (p_evt->single.seid > AVDT_SEID_MAX))
|
||||
{
|
||||
if ((p_evt->single.seid < AVDT_SEID_MIN) || (p_evt->single.seid > AVDT_SEID_MAX)) {
|
||||
AVDT_TRACE_ERROR("seid: %d\n", p_evt->single.seid);
|
||||
result = AVDT_BAD_PARAMS;
|
||||
}
|
||||
/* find channel control block for this bd addr; if none, allocate one */
|
||||
else if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL)
|
||||
{
|
||||
else if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL) {
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL) {
|
||||
/* could not allocate channel control block */
|
||||
result = AVDT_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == AVDT_SUCCESS)
|
||||
{
|
||||
if (result == AVDT_SUCCESS) {
|
||||
/* make sure no discovery or get capabilities req already in progress */
|
||||
if (p_ccb->proc_busy)
|
||||
{
|
||||
if (p_ccb->proc_busy) {
|
||||
result = AVDT_BUSY;
|
||||
}
|
||||
/* send event to ccb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_API_GETCAP_REQ_EVT, (tAVDT_CCB_EVT *)p_evt);
|
||||
}
|
||||
}
|
||||
@ -500,11 +473,9 @@ UINT16 AVDT_DelayReport(UINT8 handle, UINT8 seid, UINT16 delay)
|
||||
tAVDT_SCB_EVT evt;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
} else
|
||||
/* send event to scb */
|
||||
{
|
||||
evt.apidelay.hdr.seid = seid;
|
||||
@ -536,28 +507,23 @@ UINT16 AVDT_OpenReq(UINT8 handle, BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg)
|
||||
tAVDT_SCB_EVT evt;
|
||||
|
||||
/* verify SEID */
|
||||
if ((seid < AVDT_SEID_MIN) || (seid > AVDT_SEID_MAX))
|
||||
{
|
||||
if ((seid < AVDT_SEID_MIN) || (seid > AVDT_SEID_MAX)) {
|
||||
result = AVDT_BAD_PARAMS;
|
||||
}
|
||||
/* map handle to scb */
|
||||
else if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
else if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
/* find channel control block for this bd addr; if none, allocate one */
|
||||
else if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL)
|
||||
{
|
||||
else if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL) {
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL) {
|
||||
/* could not allocate channel control block */
|
||||
result = AVDT_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
/* send event to scb */
|
||||
if (result == AVDT_SUCCESS)
|
||||
{
|
||||
if (result == AVDT_SUCCESS) {
|
||||
evt.msg.config_cmd.hdr.seid = seid;
|
||||
evt.msg.config_cmd.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb);
|
||||
evt.msg.config_cmd.int_seid = handle;
|
||||
@ -587,29 +553,23 @@ UINT16 AVDT_ConfigRsp(UINT8 handle, UINT8 label, UINT8 error_code, UINT8 categor
|
||||
UINT8 event_code;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
/* handle special case when this function is called but peer has not send
|
||||
** a configuration cmd; ignore and return error result
|
||||
*/
|
||||
else if (!p_scb->in_use)
|
||||
{
|
||||
else if (!p_scb->in_use) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
/* send event to scb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
evt.msg.hdr.err_code = error_code;
|
||||
evt.msg.hdr.err_param = category;
|
||||
evt.msg.hdr.label = label;
|
||||
if (error_code == 0)
|
||||
{
|
||||
if (error_code == 0) {
|
||||
event_code = AVDT_SCB_API_SETCONFIG_RSP_EVT;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
event_code = AVDT_SCB_API_SETCONFIG_REJ_EVT;
|
||||
}
|
||||
avdt_scb_event(p_scb, event_code, &evt);
|
||||
@ -639,31 +599,22 @@ UINT16 AVDT_StartReq(UINT8 *p_handles, UINT8 num_handles)
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
int i;
|
||||
|
||||
if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS))
|
||||
{
|
||||
if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS)) {
|
||||
result = AVDT_BAD_PARAMS;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* verify handles */
|
||||
for (i = 0; i < num_handles; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p_handles[i])) == NULL)
|
||||
{
|
||||
for (i = 0; i < num_handles; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p_handles[i])) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result == AVDT_SUCCESS)
|
||||
{
|
||||
if (p_scb->p_ccb == NULL)
|
||||
{
|
||||
if (result == AVDT_SUCCESS) {
|
||||
if (p_scb->p_ccb == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* send event to ccb */
|
||||
memcpy(evt.msg.multi.seid_list, p_handles, num_handles);
|
||||
evt.msg.multi.num_seps = num_handles;
|
||||
@ -695,31 +646,22 @@ UINT16 AVDT_SuspendReq(UINT8 *p_handles, UINT8 num_handles)
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
int i;
|
||||
|
||||
if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS))
|
||||
{
|
||||
if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS)) {
|
||||
result = AVDT_BAD_PARAMS;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* verify handles */
|
||||
for (i = 0; i < num_handles; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p_handles[i])) == NULL)
|
||||
{
|
||||
for (i = 0; i < num_handles; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p_handles[i])) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result == AVDT_SUCCESS)
|
||||
{
|
||||
if (p_scb->p_ccb == NULL)
|
||||
{
|
||||
if (result == AVDT_SUCCESS) {
|
||||
if (p_scb->p_ccb == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* send event to ccb */
|
||||
memcpy(evt.msg.multi.seid_list, p_handles, num_handles);
|
||||
evt.msg.multi.num_seps = num_handles;
|
||||
@ -750,11 +692,9 @@ UINT16 AVDT_CloseReq(UINT8 handle)
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
} else
|
||||
/* send event to scb */
|
||||
{
|
||||
avdt_scb_event(p_scb, AVDT_SCB_API_CLOSE_REQ_EVT, NULL);
|
||||
@ -786,13 +726,11 @@ UINT16 AVDT_ReconfigReq(UINT8 handle, tAVDT_CFG *p_cfg)
|
||||
tAVDT_SCB_EVT evt;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
/* send event to scb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* force psc_mask to zero */
|
||||
p_cfg->psc_mask = 0;
|
||||
|
||||
@ -821,13 +759,11 @@ UINT16 AVDT_ReconfigRsp(UINT8 handle, UINT8 label, UINT8 error_code, UINT8 categ
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
/* send event to scb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
evt.msg.hdr.err_code = error_code;
|
||||
evt.msg.hdr.err_param = category;
|
||||
evt.msg.hdr.label = label;
|
||||
@ -858,13 +794,11 @@ UINT16 AVDT_SecurityReq(UINT8 handle, UINT8 *p_data, UINT16 len)
|
||||
tAVDT_SCB_EVT evt;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
/* send event to scb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
evt.msg.security_rsp.p_data = p_data;
|
||||
evt.msg.security_rsp.len = len;
|
||||
avdt_scb_event(p_scb, AVDT_SCB_API_SECURITY_REQ_EVT, &evt);
|
||||
@ -894,13 +828,11 @@ UINT16 AVDT_SecurityRsp(UINT8 handle, UINT8 label, UINT8 error_code,
|
||||
tAVDT_SCB_EVT evt;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
/* send event to scb */
|
||||
else
|
||||
{
|
||||
else {
|
||||
evt.msg.security_rsp.hdr.err_code = error_code;
|
||||
evt.msg.security_rsp.hdr.label = label;
|
||||
evt.msg.security_rsp.p_data = p_data;
|
||||
@ -953,12 +885,9 @@ UINT16 AVDT_WriteReqOpt(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp, UINT8 m_
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
evt.apiwrite.p_buf = p_pkt;
|
||||
evt.apiwrite.time_stamp = time_stamp;
|
||||
evt.apiwrite.m_pt = m_pt;
|
||||
@ -1032,24 +961,19 @@ UINT16 AVDT_ConnectReq(BD_ADDR bd_addr, UINT8 sec_mask, tAVDT_CTRL_CBACK *p_cbac
|
||||
tAVDT_CCB_EVT evt;
|
||||
|
||||
/* find channel control block for this bd addr; if none, allocate one */
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL) {
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL) {
|
||||
/* could not allocate channel control block */
|
||||
result = AVDT_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
else if (p_ccb->ll_opened == FALSE)
|
||||
{
|
||||
} else if (p_ccb->ll_opened == FALSE) {
|
||||
AVDT_TRACE_WARNING("AVDT_ConnectReq: CCB LL is in the middle of opening");
|
||||
|
||||
/* ccb was already allocated for the incoming signalling. */
|
||||
result = AVDT_BUSY;
|
||||
}
|
||||
|
||||
if (result == AVDT_SUCCESS)
|
||||
{
|
||||
if (result == AVDT_SUCCESS) {
|
||||
/* send event to ccb */
|
||||
evt.connect.p_cback = p_cback;
|
||||
evt.connect.sec_mask = sec_mask;
|
||||
@ -1077,13 +1001,11 @@ UINT16 AVDT_DisconnectReq(BD_ADDR bd_addr, tAVDT_CTRL_CBACK *p_cback)
|
||||
tAVDT_CCB_EVT evt;
|
||||
|
||||
/* find channel control block for this bd addr; if none, error */
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL) {
|
||||
result = AVDT_BAD_PARAMS;
|
||||
}
|
||||
|
||||
if (result == AVDT_SUCCESS)
|
||||
{
|
||||
if (result == AVDT_SUCCESS) {
|
||||
/* send event to ccb */
|
||||
evt.disconnect.p_cback = p_cback;
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_API_DISCONNECT_REQ_EVT, &evt);
|
||||
@ -1109,8 +1031,7 @@ UINT16 AVDT_GetL2CapChannel(UINT8 handle)
|
||||
|
||||
/* map handle to scb */
|
||||
if (((p_scb = avdt_scb_by_hdl(handle)) != NULL)
|
||||
&& ((p_ccb = p_scb->p_ccb) != NULL))
|
||||
{
|
||||
&& ((p_ccb = p_scb->p_ccb) != NULL)) {
|
||||
/* get tcid from type, scb */
|
||||
tcid = avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb);
|
||||
|
||||
@ -1138,12 +1059,9 @@ UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr)
|
||||
|
||||
/* map handle to scb */
|
||||
if (((p_scb = avdt_scb_by_hdl(handle)) != NULL)
|
||||
&& ((p_ccb = p_scb->p_ccb) != NULL))
|
||||
{
|
||||
&& ((p_ccb = p_scb->p_ccb) != NULL)) {
|
||||
lcid = avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][tcid].lcid;
|
||||
}
|
||||
else if ((p_ccb = avdt_ccb_by_bd(bd_addr)) != NULL)
|
||||
{
|
||||
} else if ((p_ccb = avdt_ccb_by_bd(bd_addr)) != NULL) {
|
||||
lcid = avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][tcid].lcid;
|
||||
}
|
||||
|
||||
@ -1180,17 +1098,14 @@ extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
||||
tAVDT_SCB_EVT evt;
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
/* check length of media frame */
|
||||
if(data_len > AVDT_MAX_MEDIA_SIZE)
|
||||
{
|
||||
if (data_len > AVDT_MAX_MEDIA_SIZE) {
|
||||
result = AVDT_BAD_PARAMS;
|
||||
break;
|
||||
}
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
break;
|
||||
}
|
||||
@ -1200,8 +1115,7 @@ extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
||||
|| p_scb->p_ccb == NULL
|
||||
|| !GKI_queue_is_empty(&p_scb->frag_q)
|
||||
|| p_scb->frag_off != 0
|
||||
|| p_scb->curr_cfg.mux_tsid_media == 0)
|
||||
{
|
||||
|| p_scb->curr_cfg.mux_tsid_media == 0) {
|
||||
result = AVDT_ERR_BAD_STATE;
|
||||
AVDT_TRACE_WARNING("p_scb->p_pkt=%p, p_scb->p_ccb=%p, IsQueueEmpty=%x, p_scb->frag_off=%x\n",
|
||||
p_scb->p_pkt, p_scb->p_ccb, GKI_queue_is_empty(&p_scb->frag_q), p_scb->frag_off);
|
||||
@ -1214,8 +1128,7 @@ extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
||||
/* compose fragments from media payload and put fragments into gueue */
|
||||
avdt_scb_queue_frags(p_scb, &p_data, &data_len, &evt.apiwrite.frag_q);
|
||||
|
||||
if(GKI_queue_is_empty(&evt.apiwrite.frag_q))
|
||||
{
|
||||
if (GKI_queue_is_empty(&evt.apiwrite.frag_q)) {
|
||||
AVDT_TRACE_WARNING("AVDT_WriteDataReq out of GKI buffers");
|
||||
result = AVDT_ERR_RESOURCE;
|
||||
break;
|
||||
@ -1225,14 +1138,13 @@ extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
||||
|
||||
/* process the fragments queue */
|
||||
evt.apiwrite.time_stamp = time_stamp;
|
||||
evt.apiwrite.m_pt = m_pt | (marker<<7);
|
||||
evt.apiwrite.m_pt = m_pt | (marker << 7);
|
||||
avdt_scb_event(p_scb, AVDT_SCB_API_WRITE_REQ_EVT, &evt);
|
||||
} while (0);
|
||||
|
||||
#if (BT_USE_TRACES == TRUE)
|
||||
if(result != AVDT_SUCCESS)
|
||||
{
|
||||
AVDT_TRACE_WARNING("*** AVDT_WriteDataReq failed result=%d\n",result);
|
||||
if (result != AVDT_SUCCESS) {
|
||||
AVDT_TRACE_WARNING("*** AVDT_WriteDataReq failed result=%d\n", result);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
@ -1264,16 +1176,12 @@ extern UINT16 AVDT_SetMediaBuf(UINT8 handle, UINT8 *p_buf, UINT32 buf_len)
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
|
||||
/* map handle to scb */
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(handle)) == NULL) {
|
||||
result = AVDT_BAD_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(p_buf && p_scb->cs.p_media_cback == NULL)
|
||||
} else {
|
||||
if (p_buf && p_scb->cs.p_media_cback == NULL) {
|
||||
result = AVDT_NO_RESOURCES;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_scb->p_media_buf = p_buf;
|
||||
p_scb->media_buf_len = buf_len;
|
||||
}
|
||||
@ -1304,7 +1212,7 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
tAVDT_TC_TBL *p_tbl;
|
||||
UINT8 *p, *plen, *pm1, *p_end;
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
UINT8 *p_al=NULL, u;
|
||||
UINT8 *p_al = NULL, u;
|
||||
#endif
|
||||
UINT32 ssrc;
|
||||
UINT16 len;
|
||||
@ -1314,20 +1222,17 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
&& (p_scb->p_ccb != NULL)
|
||||
&& (((type == AVDT_RTCP_PT_SR) && (p_scb->cs.tsep == AVDT_TSEP_SRC)) ||
|
||||
((type == AVDT_RTCP_PT_RR) && (p_scb->cs.tsep == AVDT_TSEP_SNK)) ||
|
||||
(type == AVDT_RTCP_PT_SDES)) )
|
||||
{
|
||||
(type == AVDT_RTCP_PT_SDES)) ) {
|
||||
result = AVDT_NO_RESOURCES;
|
||||
|
||||
/* build SR - assume fit in one packet */
|
||||
p_tbl = avdt_ad_tc_tbl_by_type(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb);
|
||||
if((p_tbl->state == AVDT_AD_ST_OPEN) &&
|
||||
(p_pkt = (BT_HDR *)GKI_getbuf(p_tbl->peer_mtu)) != NULL)
|
||||
{
|
||||
if ((p_tbl->state == AVDT_AD_ST_OPEN) &&
|
||||
(p_pkt = (BT_HDR *)GKI_getbuf(p_tbl->peer_mtu)) != NULL) {
|
||||
p_pkt->offset = L2CAP_MIN_OFFSET;
|
||||
p = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
if(p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX)
|
||||
{
|
||||
if (p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX) {
|
||||
/* Adaptation Layer header later */
|
||||
p_al = p;
|
||||
p += 2;
|
||||
@ -1338,12 +1243,11 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
*p++ = type;
|
||||
/* save the location for length */
|
||||
plen = p;
|
||||
p+= 2;
|
||||
p += 2;
|
||||
ssrc = avdt_scb_gen_ssrc(p_scb);
|
||||
UINT32_TO_BE_STREAM(p, ssrc);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
switch (type) {
|
||||
case AVDT_RTCP_PT_SR: /* Sender Report */
|
||||
*pm1 = AVDT_MEDIA_OCTET1;
|
||||
UINT32_TO_BE_STREAM(p, p_data->sr.ntp_sec);
|
||||
@ -1368,10 +1272,11 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
case AVDT_RTCP_PT_SDES: /* Source Description */
|
||||
*p++ = AVDT_RTCP_SDES_CNAME;
|
||||
len = strlen((char *)p_data->cname);
|
||||
if(len > AVDT_MAX_CNAME_SIZE)
|
||||
if (len > AVDT_MAX_CNAME_SIZE) {
|
||||
len = AVDT_MAX_CNAME_SIZE;
|
||||
}
|
||||
*p++ = (UINT8)len;
|
||||
BCM_STRNCPY_S((char *)p, len+1, (char *)p_data->cname, len+1);
|
||||
BCM_STRNCPY_S((char *)p, len + 1, (char *)p_data->cname, len + 1);
|
||||
p += len;
|
||||
break;
|
||||
}
|
||||
@ -1380,27 +1285,28 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
UINT16_TO_BE_STREAM(plen, len);
|
||||
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
if(p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX)
|
||||
{
|
||||
if (p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX) {
|
||||
/* Adaptation Layer header */
|
||||
p = p_al;
|
||||
len++;
|
||||
UINT16_TO_BE_STREAM(p_al, len );
|
||||
/* TSID, no-fragment bit and coding of length(9-bit length field) */
|
||||
u = *p;
|
||||
*p = (p_scb->curr_cfg.mux_tsid_report<<3) | AVDT_ALH_LCODE_9BITM0;
|
||||
if(u)
|
||||
*p = (p_scb->curr_cfg.mux_tsid_report << 3) | AVDT_ALH_LCODE_9BITM0;
|
||||
if (u) {
|
||||
*p |= AVDT_ALH_LCODE_9BITM1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* set the actual payload length */
|
||||
p_pkt->len = p_end - p;
|
||||
/* send the packet */
|
||||
if(L2CAP_DW_FAILED != avdt_ad_write_req(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb, p_pkt))
|
||||
if (L2CAP_DW_FAILED != avdt_ad_write_req(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb, p_pkt)) {
|
||||
result = AVDT_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1429,8 +1335,9 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
******************************************************************************/
|
||||
UINT8 AVDT_SetTraceLevel (UINT8 new_level)
|
||||
{
|
||||
if (new_level != 0xFF)
|
||||
if (new_level != 0xFF) {
|
||||
avdt_cb.trace_level = new_level;
|
||||
}
|
||||
|
||||
return (avdt_cb.trace_level);
|
||||
}
|
||||
|
271
components/bt/bluedroid/stack/avdt/avdt_ccb.c
Executable file → Normal file
271
components/bt/bluedroid/stack/avdt/avdt_ccb.c
Executable file → Normal file
@ -41,7 +41,7 @@
|
||||
#if AVDT_DEBUG == TRUE
|
||||
|
||||
/* verbose state strings for trace */
|
||||
const char * const avdt_ccb_st_str[] = {
|
||||
const char *const avdt_ccb_st_str[] = {
|
||||
"CCB_IDLE_ST",
|
||||
"CCB_OPENING_ST",
|
||||
"CCB_OPEN_ST",
|
||||
@ -49,7 +49,7 @@ const char * const avdt_ccb_st_str[] = {
|
||||
};
|
||||
|
||||
/* verbose event strings for trace */
|
||||
const char * const avdt_ccb_evt_str[] = {
|
||||
const char *const avdt_ccb_evt_str[] = {
|
||||
"API_DISCOVER_REQ_EVT",
|
||||
"API_GETCAP_REQ_EVT",
|
||||
"API_START_REQ_EVT",
|
||||
@ -130,134 +130,134 @@ const tAVDT_CCB_ACTION avdt_ccb_action[] = {
|
||||
|
||||
/* state table for idle state */
|
||||
const UINT8 avdt_ccb_st_idle[][AVDT_CCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_CHAN_OPEN, AVDT_CCB_OPENING_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_CHAN_OPEN, AVDT_CCB_OPENING_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_CONN, AVDT_CCB_CHAN_OPEN, AVDT_CCB_OPENING_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_HDL_DISCOVER_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_HDL_GETCAP_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_HDL_START_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_HDL_SUSPEND_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_CHAN_OPEN, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_LL_OPENED, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_LL_CLOSED, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_CHAN_OPEN, AVDT_CCB_OPENING_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_CHAN_OPEN, AVDT_CCB_OPENING_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_CONN, AVDT_CCB_CHAN_OPEN, AVDT_CCB_OPENING_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_HDL_DISCOVER_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_HDL_GETCAP_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_HDL_START_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_HDL_SUSPEND_RSP, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_CHAN_OPEN, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_LL_OPENED, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_LL_CLOSED, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST}
|
||||
};
|
||||
|
||||
/* state table for opening state */
|
||||
const UINT8 avdt_ccb_st_opening[][AVDT_CCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_CONN, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_SET_DISCONN, AVDT_CCB_DO_DISCONN, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_CLEAR_CMDS, AVDT_CCB_CHAN_CLOSE, AVDT_CCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_SND_CMD, AVDT_CCB_LL_OPENED, AVDT_CCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_LL_CLOSED, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_CONG_STATE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_CONN, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_SET_DISCONN, AVDT_CCB_DO_DISCONN, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_CLEAR_CMDS, AVDT_CCB_CHAN_CLOSE, AVDT_CCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_SND_CMD, AVDT_CCB_LL_OPENED, AVDT_CCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_LL_CLOSED, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_CONG_STATE, AVDT_CCB_IGNORE, AVDT_CCB_OPENING_ST}
|
||||
};
|
||||
|
||||
/* state table for open state */
|
||||
const UINT8 avdt_ccb_st_open[][AVDT_CCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_SND_START_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_SND_SUSPEND_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_SND_DISCOVER_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_SND_GETCAP_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_SND_START_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_SND_SUSPEND_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_CONN, AVDT_CCB_LL_OPENED, AVDT_CCB_OPEN_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_SET_DISCONN, AVDT_CCB_DO_DISCONN, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_HDL_DISCOVER_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_HDL_GETCAP_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_HDL_START_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_HDL_SUSPEND_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_CHK_CLOSE, AVDT_CCB_HDL_DISCOVER_RSP, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_CHK_CLOSE, AVDT_CCB_HDL_GETCAP_RSP, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_HDL_START_RSP, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_HDL_SUSPEND_RSP, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_FREE_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_SND_MSG, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_RET_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_CMD_FAIL, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_CLEAR_CMDS, AVDT_CCB_CHAN_CLOSE, AVDT_CCB_CLOSING_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_CHK_TIMER, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_CHK_CLOSE, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_LL_CLOSED, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_CONG_STATE, AVDT_CCB_SND_MSG, AVDT_CCB_OPEN_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_SND_START_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_SND_SUSPEND_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_SND_DISCOVER_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_SND_GETCAP_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_SND_START_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_SND_SUSPEND_RSP, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_CONN, AVDT_CCB_LL_OPENED, AVDT_CCB_OPEN_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_SET_DISCONN, AVDT_CCB_DO_DISCONN, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_HDL_DISCOVER_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_HDL_GETCAP_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_HDL_START_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_HDL_SUSPEND_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_CHK_CLOSE, AVDT_CCB_HDL_DISCOVER_RSP, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_CHK_CLOSE, AVDT_CCB_HDL_GETCAP_RSP, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_HDL_START_RSP, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_HDL_SUSPEND_RSP, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_FREE_CMD, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_SND_MSG, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_RET_CMD, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_CMD_FAIL, AVDT_CCB_SND_CMD, AVDT_CCB_OPEN_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_CLEAR_CMDS, AVDT_CCB_CHAN_CLOSE, AVDT_CCB_CLOSING_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_CHK_TIMER, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_CHK_CLOSE, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_OPEN_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_LL_CLOSED, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_CONG_STATE, AVDT_CCB_SND_MSG, AVDT_CCB_OPEN_ST}
|
||||
};
|
||||
|
||||
/* state table for closing state */
|
||||
const UINT8 avdt_ccb_st_closing[][AVDT_CCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_CLOSING_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_CLOSING_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_SET_CONN, AVDT_CCB_CLOSING_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_CLR_RECONN, AVDT_CCB_SET_DISCONN, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_HDL_DISCOVER_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_HDL_GETCAP_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_HDL_START_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_HDL_SUSPEND_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_CLR_RECONN, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_CHK_RECONN, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_DISCOVER_REQ_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_SND_DISCOVER_CMD, AVDT_CCB_CLOSING_ST},
|
||||
/* API_GETCAP_REQ_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_SND_GETCAP_CMD, AVDT_CCB_CLOSING_ST},
|
||||
/* API_START_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_SUSPEND_REQ_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_DISCOVER_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_GETCAP_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_START_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_SUSPEND_RSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* API_CONNECT_REQ_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_SET_CONN, AVDT_CCB_CLOSING_ST},
|
||||
/* API_DISCONNECT_REQ_EVT */ {AVDT_CCB_CLR_RECONN, AVDT_CCB_SET_DISCONN, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_GETCAP_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_DISCOVER_RSP_EVT */ {AVDT_CCB_HDL_DISCOVER_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_GETCAP_RSP_EVT */ {AVDT_CCB_HDL_GETCAP_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_CCB_HDL_START_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_CCB_HDL_SUSPEND_RSP, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* RCVRSP_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* SENDMSG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* RET_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* RSP_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* IDLE_TOUT_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* UL_OPEN_EVT */ {AVDT_CCB_SET_RECONN, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* UL_CLOSE_EVT */ {AVDT_CCB_CLR_RECONN, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* LL_OPEN_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST},
|
||||
/* LL_CLOSE_EVT */ {AVDT_CCB_CHK_RECONN, AVDT_CCB_IGNORE, AVDT_CCB_IDLE_ST},
|
||||
/* LL_CONG_EVT */ {AVDT_CCB_IGNORE, AVDT_CCB_IGNORE, AVDT_CCB_CLOSING_ST}
|
||||
};
|
||||
|
||||
/* type for state table */
|
||||
@ -316,14 +316,10 @@ void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data)
|
||||
}
|
||||
|
||||
/* execute action functions */
|
||||
for (i = 0; i < AVDT_CCB_ACTIONS; i++)
|
||||
{
|
||||
if ((action = state_table[event][i]) != AVDT_CCB_IGNORE)
|
||||
{
|
||||
for (i = 0; i < AVDT_CCB_ACTIONS; i++) {
|
||||
if ((action = state_table[event][i]) != AVDT_CCB_IGNORE) {
|
||||
(*avdt_cb.p_ccb_act[action])(p_ccb, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -345,17 +341,14 @@ tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr)
|
||||
tAVDT_CCB *p_ccb = &avdt_cb.ccb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVDT_NUM_LINKS; i++, p_ccb++)
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_LINKS; i++, p_ccb++) {
|
||||
/* if allocated ccb has matching ccb */
|
||||
if (p_ccb->allocated && (!memcmp(p_ccb->peer_addr, bd_addr, BD_ADDR_LEN)))
|
||||
{
|
||||
if (p_ccb->allocated && (!memcmp(p_ccb->peer_addr, bd_addr, BD_ADDR_LEN))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == AVDT_NUM_LINKS)
|
||||
{
|
||||
if (i == AVDT_NUM_LINKS) {
|
||||
/* if no ccb found */
|
||||
p_ccb = NULL;
|
||||
|
||||
@ -380,10 +373,8 @@ tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr)
|
||||
tAVDT_CCB *p_ccb = &avdt_cb.ccb[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AVDT_NUM_LINKS; i++, p_ccb++)
|
||||
{
|
||||
if (!p_ccb->allocated)
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_LINKS; i++, p_ccb++) {
|
||||
if (!p_ccb->allocated) {
|
||||
p_ccb->allocated = TRUE;
|
||||
memcpy(p_ccb->peer_addr, bd_addr, BD_ADDR_LEN);
|
||||
GKI_init_q(&p_ccb->cmd_q);
|
||||
@ -394,8 +385,7 @@ tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr)
|
||||
}
|
||||
}
|
||||
|
||||
if (i == AVDT_NUM_LINKS)
|
||||
{
|
||||
if (i == AVDT_NUM_LINKS) {
|
||||
/* out of ccbs */
|
||||
p_ccb = NULL;
|
||||
AVDT_TRACE_WARNING("Out of ccbs");
|
||||
@ -453,12 +443,9 @@ tAVDT_CCB *avdt_ccb_by_idx(UINT8 idx)
|
||||
tAVDT_CCB *p_ccb;
|
||||
|
||||
/* verify index */
|
||||
if (idx < AVDT_NUM_LINKS)
|
||||
{
|
||||
if (idx < AVDT_NUM_LINKS) {
|
||||
p_ccb = &avdt_cb.ccb[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_ccb = NULL;
|
||||
AVDT_TRACE_WARNING("No ccb for idx %d\n", idx);
|
||||
}
|
||||
|
177
components/bt/bluedroid/stack/avdt/avdt_ccb_act.c
Executable file → Normal file
177
components/bt/bluedroid/stack/avdt/avdt_ccb_act.c
Executable file → Normal file
@ -56,22 +56,19 @@ static void avdt_ccb_clear_ccb(tAVDT_CCB *p_ccb)
|
||||
p_ccb->ret_count = 0;
|
||||
|
||||
/* free message being fragmented */
|
||||
if (p_ccb->p_curr_msg != NULL)
|
||||
{
|
||||
if (p_ccb->p_curr_msg != NULL) {
|
||||
GKI_freebuf(p_ccb->p_curr_msg);
|
||||
p_ccb->p_curr_msg = NULL;
|
||||
}
|
||||
|
||||
/* free message being reassembled */
|
||||
if (p_ccb->p_rx_msg != NULL)
|
||||
{
|
||||
if (p_ccb->p_rx_msg != NULL) {
|
||||
GKI_freebuf(p_ccb->p_rx_msg);
|
||||
p_ccb->p_rx_msg = NULL;
|
||||
}
|
||||
|
||||
/* clear out response queue */
|
||||
while ((p_buf = (BT_HDR *) GKI_dequeue(&p_ccb->rsp_q)) != NULL)
|
||||
{
|
||||
while ((p_buf = (BT_HDR *) GKI_dequeue(&p_ccb->rsp_q)) != NULL) {
|
||||
GKI_freebuf(p_buf);
|
||||
}
|
||||
}
|
||||
@ -132,17 +129,14 @@ void avdt_ccb_chk_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
UNUSED(p_data);
|
||||
|
||||
/* see if there are any active scbs associated with this ccb */
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++)
|
||||
{
|
||||
if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb))
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++) {
|
||||
if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if no active scbs start idle timer */
|
||||
if (i == AVDT_NUM_SEPS)
|
||||
{
|
||||
if (i == AVDT_NUM_SEPS) {
|
||||
btu_start_timer(&p_ccb->timer_entry, BTU_TTYPE_AVDT_CCB_IDLE, avdt_cb.rcb.idle_tout);
|
||||
}
|
||||
}
|
||||
@ -170,10 +164,8 @@ void avdt_ccb_hdl_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
p_data->msg.discover_rsp.num_seps = 0;
|
||||
|
||||
/* for all allocated scbs */
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++)
|
||||
{
|
||||
if (p_scb->allocated)
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++) {
|
||||
if (p_scb->allocated) {
|
||||
/* copy sep info */
|
||||
sep_info[p_data->msg.discover_rsp.num_seps].in_use = p_scb->in_use;
|
||||
sep_info[p_data->msg.discover_rsp.num_seps].seid = i + 1;
|
||||
@ -277,8 +269,7 @@ void avdt_ccb_hdl_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
/* verify all streams in the right state */
|
||||
UINT8 seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_START, p_data->msg.multi.seid_list,
|
||||
p_data->msg.multi.num_seps, &err_code);
|
||||
if (seid == 0 && err_code == 0)
|
||||
{
|
||||
if (seid == 0 && err_code == 0) {
|
||||
/* we're ok, send response */
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_API_START_RSP_EVT, p_data);
|
||||
} else {
|
||||
@ -317,10 +308,8 @@ void avdt_ccb_hdl_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
p = (UINT8 *)(p_ccb->p_curr_cmd + 1);
|
||||
|
||||
/* little trick here; length of current command equals number of streams */
|
||||
for (i = 0; i < p_ccb->p_curr_cmd->len; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p[i])) != NULL)
|
||||
{
|
||||
for (i = 0; i < p_ccb->p_curr_cmd->len; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p[i])) != NULL) {
|
||||
avdt_scb_event(p_scb, event, (tAVDT_SCB_EVT *) &p_data->msg);
|
||||
}
|
||||
}
|
||||
@ -348,13 +337,10 @@ void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
/* verify all streams in the right state */
|
||||
if ((seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_SUSPEND, p_data->msg.multi.seid_list,
|
||||
p_data->msg.multi.num_seps, &err_code)) == 0 &&
|
||||
err_code == 0)
|
||||
{
|
||||
err_code == 0) {
|
||||
/* we're ok, send response */
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_API_SUSPEND_RSP_EVT, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* not ok, send reject */
|
||||
p_data->msg.hdr.err_code = err_code;
|
||||
p_data->msg.hdr.err_param = seid;
|
||||
@ -391,10 +377,8 @@ void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
p = (UINT8 *)(p_ccb->p_curr_cmd + 1);
|
||||
|
||||
/* little trick here; length of current command equals number of streams */
|
||||
for (i = 0; i < p_ccb->p_curr_cmd->len; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p[i])) != NULL)
|
||||
{
|
||||
for (i = 0; i < p_ccb->p_curr_cmd->len; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p[i])) != NULL) {
|
||||
avdt_scb_event(p_scb, event, (tAVDT_SCB_EVT *) &p_data->msg);
|
||||
}
|
||||
}
|
||||
@ -470,8 +454,9 @@ void avdt_ccb_snd_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
p_ccb->proc_busy = TRUE;
|
||||
|
||||
/* build and queue discover req */
|
||||
if (p_data->msg.hdr.sig_id == AVDT_SIG_GET_ALLCAP)
|
||||
if (p_data->msg.hdr.sig_id == AVDT_SIG_GET_ALLCAP) {
|
||||
sig_id = AVDT_SIG_GET_ALLCAP;
|
||||
}
|
||||
|
||||
avdt_msg_send_cmd(p_ccb, NULL, sig_id, (tAVDT_MSG *) &p_data->getcap.single);
|
||||
}
|
||||
@ -492,8 +477,9 @@ void avdt_ccb_snd_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
{
|
||||
UINT8 sig_id = AVDT_SIG_GETCAP;
|
||||
|
||||
if (p_data->msg.hdr.sig_id == AVDT_SIG_GET_ALLCAP)
|
||||
if (p_data->msg.hdr.sig_id == AVDT_SIG_GET_ALLCAP) {
|
||||
sig_id = AVDT_SIG_GET_ALLCAP;
|
||||
}
|
||||
|
||||
/* send response */
|
||||
avdt_msg_send_rsp(p_ccb, sig_id, &p_data->msg);
|
||||
@ -524,21 +510,16 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
|
||||
/* verify all streams in the right state */
|
||||
if ((avdt_msg.hdr.err_param = avdt_scb_verify(p_ccb, AVDT_VERIFY_OPEN, p_data->msg.multi.seid_list,
|
||||
p_data->msg.multi.num_seps, &avdt_msg.hdr.err_code)) == 0)
|
||||
{
|
||||
p_data->msg.multi.num_seps, &avdt_msg.hdr.err_code)) == 0) {
|
||||
/* set peer seid list in messsage */
|
||||
avdt_scb_peer_seid_list(&p_data->msg.multi);
|
||||
|
||||
/* send command */
|
||||
avdt_msg_send_cmd(p_ccb, seid_list, AVDT_SIG_START, &p_data->msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* failed; send ourselves a reject for each stream */
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(seid_list[i])) != NULL)
|
||||
{
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(seid_list[i])) != NULL) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_MSG_START_REJ_EVT, (tAVDT_SCB_EVT *) &avdt_msg.hdr);
|
||||
}
|
||||
}
|
||||
@ -567,10 +548,8 @@ void avdt_ccb_snd_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
avdt_msg_send_rsp(p_ccb, AVDT_SIG_START, &p_data->msg);
|
||||
|
||||
/* send start event to each scb */
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p_data->msg.multi.seid_list[i])) != NULL)
|
||||
{
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p_data->msg.multi.seid_list[i])) != NULL) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_MSG_START_CMD_EVT, NULL);
|
||||
}
|
||||
}
|
||||
@ -602,21 +581,16 @@ void avdt_ccb_snd_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
|
||||
/* verify all streams in the right state */
|
||||
if ((avdt_msg.hdr.err_param = avdt_scb_verify(p_ccb, AVDT_VERIFY_STREAMING, p_data->msg.multi.seid_list,
|
||||
p_data->msg.multi.num_seps, &avdt_msg.hdr.err_code)) == 0)
|
||||
{
|
||||
p_data->msg.multi.num_seps, &avdt_msg.hdr.err_code)) == 0) {
|
||||
/* set peer seid list in messsage */
|
||||
avdt_scb_peer_seid_list(&p_data->msg.multi);
|
||||
|
||||
/* send command */
|
||||
avdt_msg_send_cmd(p_ccb, seid_list, AVDT_SIG_SUSPEND, &p_data->msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* failed; send ourselves a reject for each stream */
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(seid_list[i])) != NULL)
|
||||
{
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(seid_list[i])) != NULL) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_MSG_SUSPEND_REJ_EVT, (tAVDT_SCB_EVT *) &avdt_msg.hdr);
|
||||
}
|
||||
}
|
||||
@ -645,10 +619,8 @@ void avdt_ccb_snd_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
avdt_msg_send_rsp(p_ccb, AVDT_SIG_SUSPEND, &p_data->msg);
|
||||
|
||||
/* send start event to each scb */
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p_data->msg.multi.seid_list[i])) != NULL)
|
||||
{
|
||||
for (i = 0; i < p_data->msg.multi.num_seps; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p_data->msg.multi.seid_list[i])) != NULL) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_MSG_SUSPEND_CMD_EVT, NULL);
|
||||
}
|
||||
}
|
||||
@ -682,8 +654,7 @@ void avdt_ccb_clear_cmds(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
** to handle the case where there is a command on deck in p_curr_cmd,
|
||||
** plus we need to clear out the queue
|
||||
*/
|
||||
do
|
||||
{
|
||||
do {
|
||||
/* we know p_curr_cmd = NULL after this */
|
||||
avdt_ccb_cmd_fail(p_ccb, (tAVDT_CCB_EVT *) &err_code);
|
||||
|
||||
@ -693,10 +664,8 @@ void avdt_ccb_clear_cmds(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
} while (p_ccb->p_curr_cmd != NULL);
|
||||
|
||||
/* send a CC_CLOSE_EVT any active scbs associated with this ccb */
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++)
|
||||
{
|
||||
if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb))
|
||||
{
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++) {
|
||||
if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb)) {
|
||||
avdt_scb_event(p_scb, AVDT_SCB_CC_CLOSE_EVT, NULL);
|
||||
}
|
||||
}
|
||||
@ -720,8 +689,7 @@ void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
UINT8 evt;
|
||||
tAVDT_SCB *p_scb;
|
||||
|
||||
if (p_ccb->p_curr_cmd != NULL)
|
||||
{
|
||||
if (p_ccb->p_curr_cmd != NULL) {
|
||||
/* set up data */
|
||||
msg.hdr.err_code = p_data->err_code;
|
||||
msg.hdr.err_param = 0;
|
||||
@ -730,16 +698,12 @@ void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
/* pretend that we received a rej message */
|
||||
evt = avdt_msg_rej_2_evt[p_ccb->p_curr_cmd->event - 1];
|
||||
|
||||
if (evt & AVDT_CCB_MKR)
|
||||
{
|
||||
if (evt & AVDT_CCB_MKR) {
|
||||
avdt_ccb_event(p_ccb, (UINT8) (evt & ~AVDT_CCB_MKR), (tAVDT_CCB_EVT *) &msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* we get the scb out of the current cmd */
|
||||
p_scb = avdt_scb_by_hdl(*((UINT8 *)(p_ccb->p_curr_cmd + 1)));
|
||||
if (p_scb != NULL)
|
||||
{
|
||||
if (p_scb != NULL) {
|
||||
avdt_scb_event(p_scb, evt, (tAVDT_SCB_EVT *) &msg);
|
||||
}
|
||||
}
|
||||
@ -764,8 +728,7 @@ void avdt_ccb_free_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
{
|
||||
UNUSED(p_data);
|
||||
|
||||
if (p_ccb->p_curr_cmd != NULL)
|
||||
{
|
||||
if (p_ccb->p_curr_cmd != NULL) {
|
||||
GKI_freebuf(p_ccb->p_curr_cmd);
|
||||
p_ccb->p_curr_cmd = NULL;
|
||||
}
|
||||
@ -806,23 +769,18 @@ void avdt_ccb_ret_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
BT_HDR *p_msg;
|
||||
|
||||
p_ccb->ret_count++;
|
||||
if (p_ccb->ret_count == AVDT_RET_MAX)
|
||||
{
|
||||
if (p_ccb->ret_count == AVDT_RET_MAX) {
|
||||
/* command failed */
|
||||
p_ccb->ret_count = 0;
|
||||
avdt_ccb_cmd_fail(p_ccb, (tAVDT_CCB_EVT *) &err_code);
|
||||
|
||||
/* go to next queued command */
|
||||
avdt_ccb_snd_cmd(p_ccb, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* if command pending and we're not congested and not sending a fragment */
|
||||
if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && (p_ccb->p_curr_cmd != NULL))
|
||||
{
|
||||
if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && (p_ccb->p_curr_cmd != NULL)) {
|
||||
/* make copy of message in p_curr_cmd and send it */
|
||||
if ((p_msg = (BT_HDR *) GKI_getpoolbuf(AVDT_CMD_POOL_ID)) != NULL)
|
||||
{
|
||||
if ((p_msg = (BT_HDR *) GKI_getpoolbuf(AVDT_CMD_POOL_ID)) != NULL) {
|
||||
memcpy(p_msg, p_ccb->p_curr_cmd,
|
||||
(sizeof(BT_HDR) + p_ccb->p_curr_cmd->offset + p_ccb->p_curr_cmd->len));
|
||||
avdt_msg_send(p_ccb, p_msg);
|
||||
@ -853,13 +811,10 @@ void avdt_ccb_snd_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
/* do we have commands to send? send next command; make sure we're clear;
|
||||
** not congested, not sending fragment, not waiting for response
|
||||
*/
|
||||
if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && (p_ccb->p_curr_cmd == NULL))
|
||||
{
|
||||
if ((p_msg = (BT_HDR *) GKI_dequeue(&p_ccb->cmd_q)) != NULL)
|
||||
{
|
||||
if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && (p_ccb->p_curr_cmd == NULL)) {
|
||||
if ((p_msg = (BT_HDR *) GKI_dequeue(&p_ccb->cmd_q)) != NULL) {
|
||||
/* make a copy of buffer in p_curr_cmd */
|
||||
if ((p_ccb->p_curr_cmd = (BT_HDR *) GKI_getpoolbuf(AVDT_CMD_POOL_ID)) != NULL)
|
||||
{
|
||||
if ((p_ccb->p_curr_cmd = (BT_HDR *) GKI_getpoolbuf(AVDT_CMD_POOL_ID)) != NULL) {
|
||||
memcpy(p_ccb->p_curr_cmd, p_msg, (sizeof(BT_HDR) + p_msg->offset + p_msg->len));
|
||||
|
||||
avdt_msg_send(p_ccb, p_msg);
|
||||
@ -884,20 +839,15 @@ void avdt_ccb_snd_msg(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
UNUSED(p_data);
|
||||
|
||||
/* if not congested */
|
||||
if (!p_ccb->cong)
|
||||
{
|
||||
if (!p_ccb->cong) {
|
||||
/* are we sending a fragmented message? continue sending fragment */
|
||||
if (p_ccb->p_curr_msg != NULL)
|
||||
{
|
||||
if (p_ccb->p_curr_msg != NULL) {
|
||||
avdt_msg_send(p_ccb, NULL);
|
||||
}
|
||||
/* do we have responses to send? send them */
|
||||
else if (!GKI_queue_is_empty(&p_ccb->rsp_q))
|
||||
{
|
||||
while ((p_msg = (BT_HDR *) GKI_dequeue(&p_ccb->rsp_q)) != NULL)
|
||||
{
|
||||
if (avdt_msg_send(p_ccb, p_msg) == TRUE)
|
||||
{
|
||||
else if (!GKI_queue_is_empty(&p_ccb->rsp_q)) {
|
||||
while ((p_msg = (BT_HDR *) GKI_dequeue(&p_ccb->rsp_q)) != NULL) {
|
||||
if (avdt_msg_send(p_ccb, p_msg) == TRUE) {
|
||||
/* break out if congested */
|
||||
break;
|
||||
}
|
||||
@ -962,8 +912,7 @@ void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
UINT8 err_code = AVDT_ERR_CONNECT;
|
||||
UNUSED(p_data);
|
||||
|
||||
if (p_ccb->reconn)
|
||||
{
|
||||
if (p_ccb->reconn) {
|
||||
p_ccb->reconn = FALSE;
|
||||
|
||||
/* clear out ccb */
|
||||
@ -974,9 +923,7 @@ void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
|
||||
/* reopen the signaling channel */
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_UL_OPEN_EVT, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
avdt_ccb_ll_closed(p_ccb, NULL);
|
||||
}
|
||||
}
|
||||
@ -996,8 +943,7 @@ void avdt_ccb_chk_timer(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
{
|
||||
UNUSED(p_data);
|
||||
|
||||
if (p_ccb->timer_entry.event == BTU_TTYPE_AVDT_CCB_IDLE)
|
||||
{
|
||||
if (p_ccb->timer_entry.event == BTU_TTYPE_AVDT_CCB_IDLE) {
|
||||
btu_stop_timer(&p_ccb->timer_entry);
|
||||
}
|
||||
}
|
||||
@ -1039,8 +985,9 @@ void avdt_ccb_set_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
p_ccb->p_conn_cback, p_data->disconnect.p_cback);
|
||||
*/
|
||||
/* save callback */
|
||||
if (p_data->disconnect.p_cback)
|
||||
if (p_data->disconnect.p_cback) {
|
||||
p_ccb->p_conn_cback = p_data->disconnect.p_cback;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1087,8 +1034,9 @@ void avdt_ccb_ll_closed(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
|
||||
/* save callback pointer, bd addr */
|
||||
p_cback = p_ccb->p_conn_cback;
|
||||
if (!p_cback)
|
||||
if (!p_cback) {
|
||||
p_cback = avdt_cb.p_conn_cback;
|
||||
}
|
||||
memcpy(bd_addr, p_ccb->peer_addr, BD_ADDR_LEN);
|
||||
|
||||
disc_rsn = p_ccb->disc_rsn;
|
||||
@ -1097,8 +1045,7 @@ void avdt_ccb_ll_closed(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
avdt_ccb_dealloc(p_ccb, NULL);
|
||||
|
||||
/* call callback */
|
||||
if (p_cback)
|
||||
{
|
||||
if (p_cback) {
|
||||
avdt_ctrl.hdr.err_code = 0;
|
||||
avdt_ctrl.hdr.err_param = disc_rsn;
|
||||
|
||||
@ -1122,12 +1069,12 @@ void avdt_ccb_ll_opened(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
|
||||
|
||||
p_ccb->ll_opened = TRUE;
|
||||
|
||||
if (!p_ccb->p_conn_cback)
|
||||
if (!p_ccb->p_conn_cback) {
|
||||
p_ccb->p_conn_cback = avdt_cb.p_conn_cback;
|
||||
}
|
||||
|
||||
/* call callback */
|
||||
if (p_ccb->p_conn_cback)
|
||||
{
|
||||
if (p_ccb->p_conn_cback) {
|
||||
avdt_ctrl.hdr.err_code = 0;
|
||||
avdt_ctrl.hdr.err_param = p_data->msg.hdr.err_param;
|
||||
(*p_ccb->p_conn_cback)(0, p_ccb->peer_addr, AVDT_CONNECT_IND_EVT, &avdt_ctrl);
|
||||
|
132
components/bt/bluedroid/stack/avdt/avdt_l2c.c
Executable file → Normal file
132
components/bt/bluedroid/stack/avdt/avdt_l2c.c
Executable file → Normal file
@ -80,8 +80,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transpo
|
||||
UNUSED(p_ref_data);
|
||||
|
||||
AVDT_TRACE_DEBUG("avdt_sec_check_complete_term res: %d\n", res);
|
||||
if (!bd_addr)
|
||||
{
|
||||
if (!bd_addr) {
|
||||
AVDT_TRACE_WARNING("avdt_sec_check_complete_term: NULL BD_ADDR");
|
||||
return;
|
||||
|
||||
@ -89,11 +88,11 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transpo
|
||||
p_ccb = avdt_ccb_by_bd(bd_addr);
|
||||
|
||||
p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_SIG, p_ccb, AVDT_AD_ST_SEC_ACP);
|
||||
if (p_tbl == NULL)
|
||||
if (p_tbl == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (res == BTM_SUCCESS)
|
||||
{
|
||||
if (res == BTM_SUCCESS) {
|
||||
/* Send response to the L2CAP layer. */
|
||||
L2CA_ConnectRsp (bd_addr, p_tbl->id, p_tbl->lcid, L2CAP_CONN_OK, L2CAP_CONN_OK);
|
||||
|
||||
@ -111,9 +110,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transpo
|
||||
cfg.flush_to_present = TRUE;
|
||||
cfg.flush_to = p_tbl->my_flush_to;
|
||||
L2CA_ConfigReq(p_tbl->lcid, &cfg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
L2CA_ConnectRsp (bd_addr, p_tbl->id, p_tbl->lcid, L2CAP_CONN_SECURITY_BLOCK, L2CAP_CONN_OK);
|
||||
avdt_ad_tc_close_ind(p_tbl, L2CAP_CONN_SECURITY_BLOCK);
|
||||
}
|
||||
@ -138,14 +135,15 @@ static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT trasnpo
|
||||
UNUSED(p_ref_data);
|
||||
|
||||
AVDT_TRACE_DEBUG("avdt_sec_check_complete_orig res: %d\n", res);
|
||||
if (bd_addr)
|
||||
if (bd_addr) {
|
||||
p_ccb = avdt_ccb_by_bd(bd_addr);
|
||||
}
|
||||
p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_SIG, p_ccb, AVDT_AD_ST_SEC_INT);
|
||||
if(p_tbl == NULL)
|
||||
if (p_tbl == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( res == BTM_SUCCESS )
|
||||
{
|
||||
if ( res == BTM_SUCCESS ) {
|
||||
/* set channel state */
|
||||
p_tbl->state = AVDT_AD_ST_CFG;
|
||||
|
||||
@ -156,9 +154,7 @@ static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT trasnpo
|
||||
cfg.flush_to_present = TRUE;
|
||||
cfg.flush_to = p_tbl->my_flush_to;
|
||||
L2CA_ConfigReq(p_tbl->lcid, &cfg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
L2CA_DisconnectReq (p_tbl->lcid);
|
||||
avdt_ad_tc_close_ind(p_tbl, L2CAP_CONN_SECURITY_BLOCK);
|
||||
}
|
||||
@ -183,16 +179,12 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
|
||||
UNUSED(psm);
|
||||
|
||||
/* do we already have a control channel for this peer? */
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_by_bd(bd_addr)) == NULL) {
|
||||
/* no, allocate ccb */
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL)
|
||||
{
|
||||
if ((p_ccb = avdt_ccb_alloc(bd_addr)) == NULL) {
|
||||
/* no ccb available, reject L2CAP connection */
|
||||
result = L2CAP_CONN_NO_RESOURCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* allocate and set up entry; first channel is always signaling */
|
||||
p_tbl = avdt_ad_tc_tbl_alloc(p_ccb);
|
||||
p_tbl->my_mtu = avdt_cb.rcb.ctrl_mtu;
|
||||
@ -208,24 +200,21 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
|
||||
FALSE, BTM_SEC_PROTO_AVDT,
|
||||
AVDT_CHAN_SIG,
|
||||
&avdt_sec_check_complete_term, NULL);
|
||||
if(rc == BTM_CMD_STARTED)
|
||||
{
|
||||
if (rc == BTM_CMD_STARTED) {
|
||||
L2CA_ConnectRsp (p_ccb->peer_addr, p_tbl->id, lcid, L2CAP_CONN_PENDING, L2CAP_CONN_OK);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* deal with simultaneous control channel connect case */
|
||||
else if ((p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_SIG, p_ccb, AVDT_AD_ST_CONN)) != NULL)
|
||||
{
|
||||
else if ((p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_SIG, p_ccb, AVDT_AD_ST_CONN)) != NULL) {
|
||||
/* reject their connection */
|
||||
result = L2CAP_CONN_NO_RESOURCES;
|
||||
}
|
||||
/* this must be a traffic channel; are we accepting a traffic channel
|
||||
** for this ccb?
|
||||
*/
|
||||
else if ((p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_MEDIA, p_ccb, AVDT_AD_ST_ACP)) != NULL)
|
||||
{
|
||||
else if ((p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_MEDIA, p_ccb, AVDT_AD_ST_ACP)) != NULL) {
|
||||
/* yes; proceed with connection */
|
||||
result = L2CAP_CONN_OK;
|
||||
}
|
||||
@ -233,15 +222,13 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
|
||||
/* this must be a reporting channel; are we accepting a reporting channel
|
||||
** for this ccb?
|
||||
*/
|
||||
else if ((p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_REPORT, p_ccb, AVDT_AD_ST_ACP)) != NULL)
|
||||
{
|
||||
else if ((p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_REPORT, p_ccb, AVDT_AD_ST_ACP)) != NULL) {
|
||||
/* yes; proceed with connection */
|
||||
result = L2CAP_CONN_OK;
|
||||
}
|
||||
#endif
|
||||
/* else we're not listening for traffic channel; reject */
|
||||
else
|
||||
{
|
||||
else {
|
||||
result = L2CAP_CONN_NO_PSM;
|
||||
}
|
||||
|
||||
@ -249,8 +236,7 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
|
||||
L2CA_ConnectRsp(bd_addr, id, lcid, result, 0);
|
||||
|
||||
/* if result ok, proceed with connection */
|
||||
if (result == L2CAP_CONN_OK)
|
||||
{
|
||||
if (result == L2CAP_CONN_OK) {
|
||||
/* store idx in LCID table, store LCID in routing table */
|
||||
avdt_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl);
|
||||
avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].lcid = lcid;
|
||||
@ -287,16 +273,12 @@ void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
|
||||
AVDT_TRACE_DEBUG("avdt_l2c_connect_cfm_cback lcid: %d, result: %d\n",
|
||||
lcid, result);
|
||||
/* look up info for this channel */
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL) {
|
||||
/* if in correct state */
|
||||
if (p_tbl->state == AVDT_AD_ST_CONN)
|
||||
{
|
||||
if (p_tbl->state == AVDT_AD_ST_CONN) {
|
||||
/* if result successful */
|
||||
if (result == L2CAP_CONN_OK)
|
||||
{
|
||||
if(p_tbl->tcid != AVDT_CHAN_SIG)
|
||||
{
|
||||
if (result == L2CAP_CONN_OK) {
|
||||
if (p_tbl->tcid != AVDT_CHAN_SIG) {
|
||||
/* set channel state */
|
||||
p_tbl->state = AVDT_AD_ST_CFG;
|
||||
|
||||
@ -307,16 +289,11 @@ void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
|
||||
cfg.flush_to_present = TRUE;
|
||||
cfg.flush_to = p_tbl->my_flush_to;
|
||||
L2CA_ConfigReq(lcid, &cfg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_ccb = avdt_ccb_by_idx(p_tbl->ccb_idx);
|
||||
if(p_ccb == NULL)
|
||||
{
|
||||
if (p_ccb == NULL) {
|
||||
result = L2CAP_CONN_NO_RESOURCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* set channel state */
|
||||
p_tbl->state = AVDT_AD_ST_SEC_INT;
|
||||
p_tbl->lcid = lcid;
|
||||
@ -332,8 +309,7 @@ void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
|
||||
}
|
||||
|
||||
/* failure; notify adaption that channel closed */
|
||||
if (result != L2CAP_CONN_OK)
|
||||
{
|
||||
if (result != L2CAP_CONN_OK) {
|
||||
avdt_ad_tc_close_ind(p_tbl, result);
|
||||
}
|
||||
}
|
||||
@ -355,28 +331,23 @@ void avdt_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
|
||||
tAVDT_TC_TBL *p_tbl;
|
||||
|
||||
/* look up info for this channel */
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL) {
|
||||
p_tbl->lcid = lcid;
|
||||
|
||||
/* if in correct state */
|
||||
if (p_tbl->state == AVDT_AD_ST_CFG)
|
||||
{
|
||||
if (p_tbl->state == AVDT_AD_ST_CFG) {
|
||||
/* if result successful */
|
||||
if (p_cfg->result == L2CAP_CONN_OK)
|
||||
{
|
||||
if (p_cfg->result == L2CAP_CONN_OK) {
|
||||
/* update cfg_flags */
|
||||
p_tbl->cfg_flags |= AVDT_L2C_CFG_CFM_DONE;
|
||||
|
||||
/* if configuration complete */
|
||||
if (p_tbl->cfg_flags & AVDT_L2C_CFG_IND_DONE)
|
||||
{
|
||||
if (p_tbl->cfg_flags & AVDT_L2C_CFG_IND_DONE) {
|
||||
avdt_ad_tc_open_ind(p_tbl);
|
||||
}
|
||||
}
|
||||
/* else failure */
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* Send L2CAP disconnect req */
|
||||
L2CA_DisconnectReq(lcid);
|
||||
}
|
||||
@ -399,18 +370,14 @@ void avdt_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
|
||||
tAVDT_TC_TBL *p_tbl;
|
||||
|
||||
/* look up info for this channel */
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL) {
|
||||
/* store the mtu in tbl */
|
||||
if (p_cfg->mtu_present)
|
||||
{
|
||||
if (p_cfg->mtu_present) {
|
||||
p_tbl->peer_mtu = p_cfg->mtu;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_tbl->peer_mtu = L2CAP_DEFAULT_MTU;
|
||||
}
|
||||
AVDT_TRACE_DEBUG("peer_mtu: %d, lcid: x%x\n",p_tbl->peer_mtu, lcid);
|
||||
AVDT_TRACE_DEBUG("peer_mtu: %d, lcid: x%x\n", p_tbl->peer_mtu, lcid);
|
||||
|
||||
/* send L2CAP configure response */
|
||||
memset(p_cfg, 0, sizeof(tL2CAP_CFG_INFO));
|
||||
@ -418,14 +385,12 @@ void avdt_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
|
||||
L2CA_ConfigRsp(lcid, p_cfg);
|
||||
|
||||
/* if first config ind */
|
||||
if ((p_tbl->cfg_flags & AVDT_L2C_CFG_IND_DONE) == 0)
|
||||
{
|
||||
if ((p_tbl->cfg_flags & AVDT_L2C_CFG_IND_DONE) == 0) {
|
||||
/* update cfg_flags */
|
||||
p_tbl->cfg_flags |= AVDT_L2C_CFG_IND_DONE;
|
||||
|
||||
/* if configuration complete */
|
||||
if (p_tbl->cfg_flags & AVDT_L2C_CFG_CFM_DONE)
|
||||
{
|
||||
if (p_tbl->cfg_flags & AVDT_L2C_CFG_CFM_DONE) {
|
||||
avdt_ad_tc_open_ind(p_tbl);
|
||||
}
|
||||
}
|
||||
@ -449,10 +414,8 @@ void avdt_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
|
||||
AVDT_TRACE_DEBUG("avdt_l2c_disconnect_ind_cback lcid: %d, ack_needed: %d\n",
|
||||
lcid, ack_needed);
|
||||
/* look up info for this channel */
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if (ack_needed)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL) {
|
||||
if (ack_needed) {
|
||||
/* send L2CAP disconnect response */
|
||||
L2CA_DisconnectRsp(lcid);
|
||||
} else {
|
||||
@ -480,8 +443,7 @@ void avdt_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
|
||||
AVDT_TRACE_DEBUG("avdt_l2c_disconnect_cfm_cback lcid: %d, result: %d\n",
|
||||
lcid, result);
|
||||
/* look up info for this channel */
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL) {
|
||||
avdt_ad_tc_close_ind(p_tbl, result);
|
||||
}
|
||||
}
|
||||
@ -501,8 +463,7 @@ void avdt_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested)
|
||||
tAVDT_TC_TBL *p_tbl;
|
||||
|
||||
/* look up info for this channel */
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL) {
|
||||
avdt_ad_tc_cong_ind(p_tbl, is_congested);
|
||||
}
|
||||
}
|
||||
@ -522,12 +483,11 @@ void avdt_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf)
|
||||
tAVDT_TC_TBL *p_tbl;
|
||||
|
||||
/* look up info for this channel */
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
|
||||
{
|
||||
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL) {
|
||||
avdt_ad_tc_data_ind(p_tbl, p_buf);
|
||||
}
|
||||
else /* prevent buffer leak */
|
||||
} else { /* prevent buffer leak */
|
||||
GKI_freebuf(p_buf);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* #if (defined(AVDT_INCLUDED) && AVDT_INCLUDED == TRUE) */
|
||||
|
493
components/bt/bluedroid/stack/avdt/avdt_msg.c
Executable file → Normal file
493
components/bt/bluedroid/stack/avdt/avdt_msg.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
669
components/bt/bluedroid/stack/avdt/avdt_scb.c
Executable file → Normal file
669
components/bt/bluedroid/stack/avdt/avdt_scb.c
Executable file → Normal file
@ -41,7 +41,7 @@
|
||||
#if AVDT_DEBUG == TRUE
|
||||
|
||||
/* verbose state strings for trace */
|
||||
const char * const avdt_scb_st_str[] = {
|
||||
const char *const avdt_scb_st_str[] = {
|
||||
"SCB_IDLE_ST",
|
||||
"SCB_CONF_ST",
|
||||
"SCB_OPENING_ST",
|
||||
@ -51,7 +51,7 @@ const char * const avdt_scb_st_str[] = {
|
||||
};
|
||||
|
||||
/* verbose event strings for trace */
|
||||
const char * const avdt_scb_evt_str[] = {
|
||||
const char *const avdt_scb_evt_str[] = {
|
||||
"API_REMOVE_EVT",
|
||||
"API_WRITE_REQ_EVT",
|
||||
"API_GETCONFIG_REQ_EVT",
|
||||
@ -179,325 +179,325 @@ const tAVDT_SCB_ACTION avdt_scb_action[] = {
|
||||
|
||||
/* state table for idle state */
|
||||
const UINT8 avdt_scb_st_idle[][AVDT_SCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_DEALLOC, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_SND_SETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_SND_SETCONFIG_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_SETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_NOT_IN_USE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_SETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_HDL_SETCONFIG_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_CLR_VARS, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_DEALLOC, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_SND_SETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_SND_SETCONFIG_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_SETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_NOT_IN_USE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_SETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_HDL_SETCONFIG_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_CLR_VARS, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}
|
||||
};
|
||||
|
||||
/* state table for configured state */
|
||||
const UINT8 avdt_scb_st_conf[][AVDT_SCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_SET_REMOVE, AVDT_SCB_CONF_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_SND_OPEN_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_SND_OPEN_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_IN_USE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_HDL_OPEN_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_HDL_OPEN_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_HDL_ABORT_RSP, AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_HDL_OPEN_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_SET_REMOVE, AVDT_SCB_CONF_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_SND_OPEN_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_SND_OPEN_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_IN_USE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_HDL_OPEN_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_HDL_OPEN_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_HDL_ABORT_RSP, AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_HDL_OPEN_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}
|
||||
};
|
||||
|
||||
/* state table for opening state */
|
||||
const UINT8 avdt_scb_st_opening[][AVDT_SCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_SET_REMOVE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_SND_CLOSE_RSP, AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_HDL_CLOSE_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_HDL_ABORT_RSP, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_HDL_TC_OPEN, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_CONG_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_SET_REMOVE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_SND_CLOSE_RSP, AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_HDL_CLOSE_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_HDL_ABORT_RSP, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_HDL_TC_OPEN, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_CONG_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPENING_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
};
|
||||
|
||||
/* state table for open state */
|
||||
const UINT8 avdt_scb_st_open[][AVDT_SCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_SET_REMOVE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_SND_RECONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_SND_CLOSE_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_SND_RECONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_HDL_START_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_HDL_CLOSE_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_HDL_RECONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_HDL_RECONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_SET_REMOVE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_CLOSE_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_SND_RECONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_SND_CLOSE_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_SND_RECONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_HDL_START_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_HDL_CLOSE_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_HDL_RECONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_HDL_RECONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
#if AVDT_REPORTING == TRUE
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_HDL_TC_OPEN_STO, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE_STO, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_HDL_TC_OPEN_STO, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE_STO, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
#else
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
#endif
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_CONG_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_CONG_STATE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
};
|
||||
|
||||
/* state table for streaming state */
|
||||
const UINT8 avdt_scb_st_stream[][AVDT_SCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_STREAM_CLOSE, AVDT_SCB_SET_REMOVE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_HDL_WRITE_REQ, AVDT_SCB_CHK_SND_PKT, AVDT_SCB_STREAM_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_STREAM_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_CLR_PKT, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_SND_CLOSE_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_HDL_SUSPEND_CMD, AVDT_SCB_CLR_PKT, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_HDL_CLOSE_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_CLR_PKT, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_CLR_PKT, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_HDL_RECONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_CONG_STATE, AVDT_SCB_CHK_SND_PKT, AVDT_SCB_STREAM_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_HDL_PKT, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SND_STREAM_CLOSE, AVDT_SCB_SET_REMOVE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_HDL_WRITE_REQ, AVDT_SCB_CHK_SND_PKT, AVDT_SCB_STREAM_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_SND_GETCONFIG_REQ, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_SND_DELAY_RPT_REQ, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_SND_STREAM_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_SND_SECURITY_REQ, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_SND_ABORT_REQ, AVDT_SCB_CLR_PKT, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_SND_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_SND_CLOSE_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_SND_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_TC_TIMER, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_HDL_GETCONFIG_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_HDL_SUSPEND_CMD, AVDT_SCB_CLR_PKT, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_HDL_CLOSE_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_CLR_PKT, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_HDL_SECURITY_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_HDL_DELAY_RPT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_CLR_PKT, AVDT_SCB_OPEN_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_HDL_RECONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_HDL_SECURITY_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_CONG_STATE, AVDT_SCB_CHK_SND_PKT, AVDT_SCB_STREAM_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_HDL_PKT, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
};
|
||||
|
||||
/* state table for closing state */
|
||||
const UINT8 avdt_scb_st_closing[][AVDT_SCB_NUM_COLS] = {
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SET_REMOVE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_HDL_CLOSE_RSP, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_HDL_ABORT_RSP, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
/* Event Action 1 Action 2 Next state */
|
||||
/* API_REMOVE_EVT */ {AVDT_SCB_SET_REMOVE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_WRITE_REQ_EVT */ {AVDT_SCB_FREE_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_DELAY_RPT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SETCONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_OPEN_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_CLOSE_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SECURITY_REQ_EVT */ {AVDT_SCB_CB_ERR, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_ABORT_REQ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* API_ABORT_RSP_EVT */ {AVDT_SCB_SND_ABORT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_GETCONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_OPEN_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_START_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_CMD_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_CLOSE_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_ABORT_CMD_EVT */ {AVDT_SCB_HDL_ABORT_CMD, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_RECONFIG_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SECURITY_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_DELAY_RPT_CMD_EVT */ {AVDT_SCB_REJ_STATE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_DELAY_RPT_RSP_EVT */ {AVDT_SCB_HDL_DELAY_RPT_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_START_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_HDL_CLOSE_RSP, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_ABORT_RSP_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_HDL_ABORT_RSP, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SECURITY_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SETCONFIG_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_OPEN_REJ_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_START_REJ_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* MSG_SUSPEND_REJ_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_TOUT_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_OPEN_EVT */ {AVDT_SCB_SND_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_CLOSE_EVT */ {AVDT_SCB_HDL_TC_CLOSE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
|
||||
/* TC_CONG_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* TC_DATA_EVT */ {AVDT_SCB_DROP_PKT, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST},
|
||||
/* CC_CLOSE_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_CLOSING_ST}
|
||||
};
|
||||
|
||||
/* type for state table */
|
||||
@ -545,14 +545,10 @@ void avdt_scb_event(tAVDT_SCB *p_scb, UINT8 event, tAVDT_SCB_EVT *p_data)
|
||||
}
|
||||
|
||||
/* execute action functions */
|
||||
for (i = 0; i < AVDT_SCB_ACTIONS; i++)
|
||||
{
|
||||
if ((action = state_table[event][i]) != AVDT_SCB_IGNORE)
|
||||
{
|
||||
for (i = 0; i < AVDT_SCB_ACTIONS; i++) {
|
||||
if ((action = state_table[event][i]) != AVDT_SCB_IGNORE) {
|
||||
(*avdt_cb.p_scb_act[action])(p_scb, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -592,17 +588,14 @@ tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs)
|
||||
int i;
|
||||
|
||||
/* find available scb */
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++)
|
||||
{
|
||||
if (!p_scb->allocated)
|
||||
{
|
||||
memset(p_scb,0,sizeof(tAVDT_SCB));
|
||||
for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++) {
|
||||
if (!p_scb->allocated) {
|
||||
memset(p_scb, 0, sizeof(tAVDT_SCB));
|
||||
p_scb->allocated = TRUE;
|
||||
p_scb->p_ccb = NULL;
|
||||
|
||||
/* initialize sink as activated */
|
||||
if (p_cs->tsep == AVDT_TSEP_SNK)
|
||||
{
|
||||
if (p_cs->tsep == AVDT_TSEP_SNK) {
|
||||
p_scb->sink_activated = TRUE;
|
||||
}
|
||||
|
||||
@ -611,25 +604,22 @@ tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs)
|
||||
/* initialize fragments gueue */
|
||||
GKI_init_q(&p_scb->frag_q);
|
||||
|
||||
if(p_cs->cfg.psc_mask & AVDT_PSC_MUX)
|
||||
{
|
||||
if (p_cs->cfg.psc_mask & AVDT_PSC_MUX) {
|
||||
p_scb->cs.cfg.mux_tcid_media = avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb);
|
||||
#if AVDT_REPORTING == TRUE
|
||||
if(p_cs->cfg.psc_mask & AVDT_PSC_REPORT)
|
||||
{
|
||||
if (p_cs->cfg.psc_mask & AVDT_PSC_REPORT) {
|
||||
p_scb->cs.cfg.mux_tcid_report = avdt_ad_type_to_tcid(AVDT_CHAN_REPORT, p_scb);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
p_scb->timer_entry.param = (UINT32) p_scb;
|
||||
AVDT_TRACE_DEBUG("avdt_scb_alloc hdl=%d, psc_mask:0x%x\n", i+1, p_cs->cfg.psc_mask);
|
||||
AVDT_TRACE_DEBUG("avdt_scb_alloc hdl=%d, psc_mask:0x%x\n", i + 1, p_cs->cfg.psc_mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == AVDT_NUM_SEPS)
|
||||
{
|
||||
if (i == AVDT_NUM_SEPS) {
|
||||
/* out of ccbs */
|
||||
p_scb = NULL;
|
||||
AVDT_TRACE_WARNING("Out of scbs");
|
||||
@ -660,8 +650,9 @@ void avdt_scb_dealloc(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
/* free fragments we're holding, if any; it shouldn't happen */
|
||||
while ((p_buf = GKI_dequeue (&p_scb->frag_q)) != NULL)
|
||||
while ((p_buf = GKI_dequeue (&p_scb->frag_q)) != NULL) {
|
||||
GKI_freebuf(p_buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(p_scb, 0, sizeof(tAVDT_SCB));
|
||||
@ -698,19 +689,15 @@ tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl)
|
||||
tAVDT_SCB *p_scb;
|
||||
|
||||
/* verify index */
|
||||
if ((hdl > 0) && (hdl <= AVDT_NUM_SEPS))
|
||||
{
|
||||
if ((hdl > 0) && (hdl <= AVDT_NUM_SEPS)) {
|
||||
p_scb = &avdt_cb.scb[hdl - 1];
|
||||
|
||||
/* verify scb is allocated */
|
||||
if (!p_scb->allocated)
|
||||
{
|
||||
if (!p_scb->allocated) {
|
||||
p_scb = NULL;
|
||||
AVDT_TRACE_WARNING("scb hdl %d not allocated\n", hdl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_scb = NULL;
|
||||
AVDT_TRACE_WARNING("scb hdl %d out of range\n", hdl);
|
||||
}
|
||||
@ -738,36 +725,38 @@ UINT8 avdt_scb_verify(tAVDT_CCB *p_ccb, UINT8 state, UINT8 *p_seid, UINT16 num_s
|
||||
/* set nonsupported command mask */
|
||||
/* translate public state into private state */
|
||||
nsc_mask = 0;
|
||||
if (state == AVDT_VERIFY_SUSPEND)
|
||||
if (state == AVDT_VERIFY_SUSPEND) {
|
||||
nsc_mask = AVDT_NSC_SUSPEND;
|
||||
}
|
||||
|
||||
/* verify every scb */
|
||||
for (i = 0, *p_err_code = 0; (i < num_seid) && (*p_err_code == 0) && (i < AVDT_NUM_SEPS); i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p_seid[i])) == NULL)
|
||||
for (i = 0, *p_err_code = 0; (i < num_seid) && (*p_err_code == 0) && (i < AVDT_NUM_SEPS); i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p_seid[i])) == NULL) {
|
||||
*p_err_code = AVDT_ERR_BAD_STATE;
|
||||
else if (p_scb->p_ccb != p_ccb)
|
||||
} else if (p_scb->p_ccb != p_ccb) {
|
||||
*p_err_code = AVDT_ERR_BAD_STATE;
|
||||
else if (p_scb->cs.nsc_mask & nsc_mask)
|
||||
} else if (p_scb->cs.nsc_mask & nsc_mask) {
|
||||
*p_err_code = AVDT_ERR_NSC;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case AVDT_VERIFY_OPEN:
|
||||
case AVDT_VERIFY_START:
|
||||
if (p_scb->state != AVDT_SCB_OPEN_ST && p_scb->state != AVDT_SCB_STREAM_ST)
|
||||
if (p_scb->state != AVDT_SCB_OPEN_ST && p_scb->state != AVDT_SCB_STREAM_ST) {
|
||||
*p_err_code = AVDT_ERR_BAD_STATE;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVDT_VERIFY_SUSPEND:
|
||||
case AVDT_VERIFY_STREAMING:
|
||||
if (p_scb->state != AVDT_SCB_STREAM_ST)
|
||||
if (p_scb->state != AVDT_SCB_STREAM_ST) {
|
||||
*p_err_code = AVDT_ERR_BAD_STATE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i != num_seid) && (i < AVDT_NUM_SEPS))
|
||||
{
|
||||
if ((i != num_seid) && (i < AVDT_NUM_SEPS)) {
|
||||
ret = p_seid[i];
|
||||
}
|
||||
|
||||
@ -790,10 +779,8 @@ void avdt_scb_peer_seid_list(tAVDT_MULTI *p_multi)
|
||||
int i;
|
||||
tAVDT_SCB *p_scb;
|
||||
|
||||
for (i = 0; i < p_multi->num_seps; i++)
|
||||
{
|
||||
if ((p_scb = avdt_scb_by_hdl(p_multi->seid_list[i])) != NULL)
|
||||
{
|
||||
for (i = 0; i < p_multi->num_seps; i++) {
|
||||
if ((p_scb = avdt_scb_by_hdl(p_multi->seid_list[i])) != NULL) {
|
||||
p_multi->seid_list[i] = p_scb->peer_seid;
|
||||
}
|
||||
}
|
||||
|
386
components/bt/bluedroid/stack/avdt/avdt_scb_act.c
Executable file → Normal file
386
components/bt/bluedroid/stack/avdt/avdt_scb_act.c
Executable file → Normal file
@ -153,7 +153,7 @@ void avdt_scb_hdl_close_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
** Returns Nothing.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void avdt_scb_hdl_getconfig_cmd(tAVDT_SCB *p_scb,tAVDT_SCB_EVT *p_data)
|
||||
void avdt_scb_hdl_getconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
p_data->msg.svccap.p_cfg = &p_scb->curr_cfg;
|
||||
|
||||
@ -268,8 +268,7 @@ void avdt_scb_hdl_pkt_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
p += o_cc * 4;
|
||||
|
||||
/* check for and skip over extension header */
|
||||
if (o_x)
|
||||
{
|
||||
if (o_x) {
|
||||
p += 2;
|
||||
BE_STREAM_TO_UINT16(ex_len, p);
|
||||
p += ex_len * 4;
|
||||
@ -279,43 +278,36 @@ void avdt_scb_hdl_pkt_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
offset = (UINT16) (p - p_start);
|
||||
|
||||
/* adjust length for any padding at end of packet */
|
||||
if (o_p)
|
||||
{
|
||||
if (o_p) {
|
||||
/* padding length in last byte of packet */
|
||||
pad_len = *(p_start + p_data->p_pkt->len);
|
||||
}
|
||||
|
||||
/* do sanity check */
|
||||
if ((offset > p_data->p_pkt->len) || ((pad_len + offset) > p_data->p_pkt->len))
|
||||
{
|
||||
if ((offset > p_data->p_pkt->len) || ((pad_len + offset) > p_data->p_pkt->len)) {
|
||||
AVDT_TRACE_WARNING("Got bad media packet");
|
||||
GKI_freebuf(p_data->p_pkt);
|
||||
}
|
||||
/* adjust offset and length and send it up */
|
||||
else
|
||||
{
|
||||
else {
|
||||
p_data->p_pkt->len -= (offset + pad_len);
|
||||
p_data->p_pkt->offset += offset;
|
||||
|
||||
if (p_scb->cs.p_data_cback != NULL)
|
||||
{
|
||||
if (p_scb->cs.p_data_cback != NULL) {
|
||||
/* report sequence number */
|
||||
p_data->p_pkt->layer_specific = seq;
|
||||
(*p_scb->cs.p_data_cback)(avdt_scb_to_hdl(p_scb), p_data->p_pkt,
|
||||
time_stamp, (UINT8)(m_pt | (marker<<7)));
|
||||
}
|
||||
else
|
||||
{
|
||||
time_stamp, (UINT8)(m_pt | (marker << 7)));
|
||||
} else {
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
if ((p_scb->cs.p_media_cback != NULL)
|
||||
&& (p_scb->p_media_buf != NULL)
|
||||
&& (p_scb->media_buf_len > p_data->p_pkt->len))
|
||||
{
|
||||
&& (p_scb->media_buf_len > p_data->p_pkt->len)) {
|
||||
/* media buffer enough length is assigned by application. Lets use it*/
|
||||
memcpy(p_scb->p_media_buf,(UINT8*)(p_data->p_pkt + 1) + p_data->p_pkt->offset,
|
||||
memcpy(p_scb->p_media_buf, (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset,
|
||||
p_data->p_pkt->len);
|
||||
(*p_scb->cs.p_media_cback)(avdt_scb_to_hdl(p_scb),p_scb->p_media_buf,
|
||||
p_scb->media_buf_len,time_stamp,seq,m_pt,marker);
|
||||
(*p_scb->cs.p_media_cback)(avdt_scb_to_hdl(p_scb), p_scb->p_media_buf,
|
||||
p_scb->media_buf_len, time_stamp, seq, m_pt, marker);
|
||||
}
|
||||
#endif
|
||||
GKI_freebuf(p_data->p_pkt);
|
||||
@ -333,7 +325,7 @@ void avdt_scb_hdl_pkt_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
** Returns Nothing.
|
||||
**
|
||||
*******************************************************************************/
|
||||
UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
||||
UINT8 *avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
||||
{
|
||||
UINT16 result = AVDT_SUCCESS;
|
||||
UINT8 *p_start = p;
|
||||
@ -343,8 +335,7 @@ UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
||||
tAVDT_REPORT_DATA report, *p_rpt;
|
||||
|
||||
AVDT_TRACE_DEBUG( "avdt_scb_hdl_report");
|
||||
if(p_scb->cs.p_report_cback)
|
||||
{
|
||||
if (p_scb->cs.p_report_cback) {
|
||||
p_rpt = &report;
|
||||
/* parse report packet header */
|
||||
AVDT_MSG_PRS_RPT_OCTET1(p, o_v, o_p, o_cc);
|
||||
@ -355,8 +346,7 @@ UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
||||
UNUSED(o_p);
|
||||
UNUSED(o_v);
|
||||
|
||||
switch(pt)
|
||||
{
|
||||
switch (pt) {
|
||||
case AVDT_RTCP_PT_SR: /* the packet type - SR (Sender Report) */
|
||||
BE_STREAM_TO_UINT32(report.sr.ntp_sec, p);
|
||||
BE_STREAM_TO_UINT32(report.sr.ntp_frac, p);
|
||||
@ -376,14 +366,11 @@ UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
||||
break;
|
||||
|
||||
case AVDT_RTCP_PT_SDES: /* the packet type - SDES (Source Description) */
|
||||
if(*p == AVDT_RTCP_SDES_CNAME)
|
||||
{
|
||||
p_rpt = (tAVDT_REPORT_DATA *)(p+2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*p == AVDT_RTCP_SDES_CNAME) {
|
||||
p_rpt = (tAVDT_REPORT_DATA *)(p + 2);
|
||||
} else {
|
||||
AVDT_TRACE_WARNING( " - SDES SSRC=0x%08x sc=%d %d len=%d %s\n",
|
||||
ssrc, o_cc, *p, *(p+1), p+2);
|
||||
ssrc, o_cc, *p, *(p + 1), p + 2);
|
||||
result = AVDT_BUSY;
|
||||
}
|
||||
break;
|
||||
@ -393,8 +380,9 @@ UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
||||
result = AVDT_BAD_PARAMS;
|
||||
}
|
||||
|
||||
if(result == AVDT_SUCCESS)
|
||||
if (result == AVDT_SUCCESS) {
|
||||
(*p_scb->cs.p_report_cback)(avdt_scb_to_hdl(p_scb), pt, p_rpt);
|
||||
}
|
||||
|
||||
}
|
||||
p_start += len;
|
||||
@ -415,7 +403,7 @@ UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
||||
void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
/* Fields of Adaptation Layer Header */
|
||||
UINT8 al_tsid,al_frag,al_lcode;
|
||||
UINT8 al_tsid, al_frag, al_lcode;
|
||||
UINT16 al_len;
|
||||
/* media header fields */
|
||||
UINT8 o_v, o_p, o_x, o_cc;
|
||||
@ -436,27 +424,25 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
|
||||
p_end = p + p_data->p_pkt->len;
|
||||
/* parse all fragments */
|
||||
while(p < p_end)
|
||||
{
|
||||
if (p_end - p < 4) /* length check. maximum length of AL header = 4 */
|
||||
{
|
||||
while (p < p_end) {
|
||||
if (p_end - p < 4) { /* length check. maximum length of AL header = 4 */
|
||||
AVDT_TRACE_WARNING("p_end: %p - p:%p < 4\n", p_end, p);
|
||||
break;
|
||||
}
|
||||
|
||||
/* parse first byte */
|
||||
al_tsid = (*p)>>3;
|
||||
al_tsid = (*p) >> 3;
|
||||
al_frag = ( (*p) >> 2 ) & 0x01;
|
||||
al_lcode = (*p++) & AVDT_ALH_LCODE_MASK;
|
||||
|
||||
/* in case of TSID=00000, a second AL header byte, before the length field,
|
||||
** is expected and contains the actual TSID, aligned with MSB */
|
||||
if(al_tsid == 0)
|
||||
if (al_tsid == 0) {
|
||||
al_tsid = *p++;
|
||||
}
|
||||
|
||||
/* get remaining media length on base of lcode */
|
||||
switch(al_lcode)
|
||||
{
|
||||
switch (al_lcode) {
|
||||
case AVDT_ALH_LCODE_NONE: /* No length field present. Take length from l2cap */
|
||||
al_len = (UINT16)(p_end - p);
|
||||
break;
|
||||
@ -467,27 +453,25 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
al_len = *p++;
|
||||
break;
|
||||
default: /* 9 bit length field, MSB = 1, 8 LSBs in 1 octet following */
|
||||
al_len =(UINT16)*p++ + 0x100;
|
||||
al_len = (UINT16) * p++ + 0x100;
|
||||
}
|
||||
|
||||
/* max fragment length */
|
||||
frag_len = (UINT16)(p_end - p);
|
||||
/* if it isn't last fragment */
|
||||
if(frag_len >= al_len)
|
||||
if (frag_len >= al_len) {
|
||||
frag_len = al_len;
|
||||
}
|
||||
|
||||
/* check TSID corresponds to config */
|
||||
if (al_tsid != p_scb->curr_cfg.mux_tsid_media)
|
||||
{
|
||||
if (al_tsid != p_scb->curr_cfg.mux_tsid_media) {
|
||||
#if AVDT_REPORTING == TRUE
|
||||
if((p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT) &&
|
||||
(al_tsid == p_scb->curr_cfg.mux_tsid_report))
|
||||
{
|
||||
if ((p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT) &&
|
||||
(al_tsid == p_scb->curr_cfg.mux_tsid_report)) {
|
||||
/* parse reporting packet */
|
||||
p = avdt_scb_hdl_report(p_scb, p, frag_len);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
AVDT_TRACE_WARNING("bad tsid: %d, mux_tsid_media:%d\n", al_tsid, p_scb->curr_cfg.mux_tsid_media);
|
||||
@ -495,64 +479,54 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
}
|
||||
}
|
||||
/* check are buffer for assembling and related callback set */
|
||||
else if ((p_scb->p_media_buf == NULL) || (p_scb->cs.p_media_cback == NULL))
|
||||
{
|
||||
else if ((p_scb->p_media_buf == NULL) || (p_scb->cs.p_media_cback == NULL)) {
|
||||
AVDT_TRACE_WARNING("NULL p_media_buf or p_media_cback");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* it is media fragment beginning */
|
||||
if(!al_frag) /* is it first fragment of original media packet */
|
||||
{
|
||||
if (!al_frag) { /* is it first fragment of original media packet */
|
||||
AVDT_TRACE_DEBUG("al:%d media:%d\n",
|
||||
al_len, p_scb->media_buf_len);
|
||||
|
||||
p_scb->frag_off = 0;
|
||||
p_scb->frag_org_len = al_len; /* total length of original media packet */
|
||||
/* length check: minimum length of media header is 12 */
|
||||
if (p_scb->frag_org_len < 12)
|
||||
{
|
||||
if (p_scb->frag_org_len < 12) {
|
||||
AVDT_TRACE_WARNING("bad al_len: %d(<12)\n", al_len);
|
||||
break;
|
||||
}
|
||||
/* check that data fit into buffer */
|
||||
if (al_len > p_scb->media_buf_len)
|
||||
{
|
||||
if (al_len > p_scb->media_buf_len) {
|
||||
AVDT_TRACE_WARNING("bad al_len: %d(>%d)\n", al_len, p_scb->media_buf_len);
|
||||
break;
|
||||
}
|
||||
/* make sure it is the last fragment in l2cap packet */
|
||||
if (p + al_len < p_end)
|
||||
{
|
||||
if (p + al_len < p_end) {
|
||||
AVDT_TRACE_WARNING("bad al_len: %d(>%d)\n", al_len, p_scb->media_buf_len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVDT_TRACE_DEBUG("al:%d media:%d frag_org_len:%d frag_off:%d\n",
|
||||
al_len, p_scb->media_buf_len, p_scb->frag_org_len, p_scb->frag_off);
|
||||
|
||||
/* check that remaining length from AL header equals to original len - length of already received fragments */
|
||||
if(al_len != p_scb->frag_org_len - p_scb->frag_off)
|
||||
{
|
||||
if (al_len != p_scb->frag_org_len - p_scb->frag_off) {
|
||||
AVDT_TRACE_WARNING("al_len:%d != (frag_org_len:%d - frag_off:%d) %d\n",
|
||||
al_len, p_scb->frag_org_len, p_scb->frag_off,
|
||||
(p_scb->frag_org_len- p_scb->frag_off));
|
||||
(p_scb->frag_org_len - p_scb->frag_off));
|
||||
break;
|
||||
}
|
||||
|
||||
/* do sanity check */
|
||||
if (p_scb->frag_off == 0)
|
||||
{
|
||||
if (p_scb->frag_off == 0) {
|
||||
AVDT_TRACE_WARNING("frag_off=0");
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* do common sanity check */
|
||||
if((p_scb->frag_org_len <= p_scb->frag_off) || (p_scb->frag_org_len >= p_scb->media_buf_len))
|
||||
{
|
||||
if ((p_scb->frag_org_len <= p_scb->frag_off) || (p_scb->frag_org_len >= p_scb->media_buf_len)) {
|
||||
AVDT_TRACE_WARNING("common sanity frag_off:%d frag_org_len:%d media_buf_len:%d\n",
|
||||
p_scb->frag_off, p_scb->frag_org_len, p_scb->media_buf_len);
|
||||
break;
|
||||
@ -567,8 +541,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
/* move to the next fragment */
|
||||
p += frag_len;
|
||||
/* if it is last fragment in original media packet then process total media pocket */
|
||||
if(p_scb->frag_off == p_scb->frag_org_len)
|
||||
{
|
||||
if (p_scb->frag_off == p_scb->frag_org_len) {
|
||||
p_payload = p_scb->p_media_buf;
|
||||
|
||||
/* media header */
|
||||
@ -585,10 +558,8 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
p_payload += o_cc * 4;
|
||||
|
||||
/* check for and skip over extension header */
|
||||
if (o_x)
|
||||
{
|
||||
if(p_scb->p_media_buf + p_scb->frag_off - p_payload < 4)
|
||||
{
|
||||
if (o_x) {
|
||||
if (p_scb->p_media_buf + p_scb->frag_off - p_payload < 4) {
|
||||
AVDT_TRACE_WARNING("length check frag_off:%d p_media_buf:%p p_payload:%p\n",
|
||||
p_scb->frag_off, p_scb->p_media_buf, p_payload);
|
||||
break;/* length check */
|
||||
@ -598,38 +569,34 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
p_payload += ex_len * 4;
|
||||
}
|
||||
|
||||
if(p_payload >= p_scb->p_media_buf + p_scb->frag_off)
|
||||
{
|
||||
if (p_payload >= p_scb->p_media_buf + p_scb->frag_off) {
|
||||
AVDT_TRACE_WARNING("length check2 frag_off:%d p_media_buf:%p p_payload:%p\n",
|
||||
p_scb->frag_off, p_scb->p_media_buf, p_payload);
|
||||
break;/* length check */
|
||||
}
|
||||
|
||||
/* adjust length for any padding at end of packet */
|
||||
if (o_p)
|
||||
{
|
||||
if (o_p) {
|
||||
/* padding length in last byte of packet */
|
||||
pad_len = *(p_scb->p_media_buf + p_scb->frag_off - 1);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
pad_len = 0;
|
||||
}
|
||||
/* payload length */
|
||||
payload_len = (UINT32)(p_scb->p_media_buf + p_scb->frag_off - pad_len - p_payload);
|
||||
|
||||
AVDT_TRACE_DEBUG("Received last fragment header=%d len=%d\n",
|
||||
p_payload - p_scb->p_media_buf,payload_len);
|
||||
p_payload - p_scb->p_media_buf, payload_len);
|
||||
|
||||
/* send total media packet up */
|
||||
if (p_scb->cs.p_media_cback != NULL)
|
||||
{
|
||||
if (p_scb->cs.p_media_cback != NULL) {
|
||||
(*p_scb->cs.p_media_cback)(avdt_scb_to_hdl(p_scb), p_payload,
|
||||
payload_len, time_stamp, seq, m_pt, marker);
|
||||
}
|
||||
}
|
||||
} /* while(p < p_end) */
|
||||
|
||||
if(p < p_end)
|
||||
{
|
||||
if (p < p_end) {
|
||||
AVDT_TRACE_WARNING("*** Got bad media packet");
|
||||
}
|
||||
GKI_freebuf(p_data->p_pkt);
|
||||
@ -653,20 +620,16 @@ void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
/* select right function in dependance of is fragmentation supported or not */
|
||||
if( 0 != (p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX))
|
||||
{
|
||||
if ( 0 != (p_scb->curr_cfg.psc_mask & AVDT_PSC_MUX)) {
|
||||
avdt_scb_hdl_pkt_frag(p_scb, p_data);
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
#if AVDT_REPORTING == TRUE
|
||||
if(p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT)
|
||||
{
|
||||
if (p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT) {
|
||||
p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
|
||||
avdt_scb_hdl_report(p_scb, p, p_data->p_pkt->len);
|
||||
GKI_freebuf(p_data->p_pkt);
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
avdt_scb_hdl_pkt_no_frag(p_scb, p_data);
|
||||
}
|
||||
@ -702,15 +665,12 @@ void avdt_scb_drop_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
void avdt_scb_hdl_reconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
/* if command not supported */
|
||||
if (p_scb->cs.nsc_mask & AVDT_NSC_RECONFIG)
|
||||
{
|
||||
if (p_scb->cs.nsc_mask & AVDT_NSC_RECONFIG) {
|
||||
/* send reject */
|
||||
p_data->msg.hdr.err_code = AVDT_ERR_NSC;
|
||||
p_data->msg.hdr.err_param = 0;
|
||||
avdt_scb_event(p_scb, AVDT_SCB_API_RECONFIG_RSP_EVT, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* store requested configuration */
|
||||
memcpy(&p_scb->req_cfg, p_data->msg.reconfig_cmd.p_cfg, sizeof(tAVDT_CFG));
|
||||
|
||||
@ -734,16 +694,13 @@ void avdt_scb_hdl_reconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
*******************************************************************************/
|
||||
void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
if (p_data->msg.hdr.err_code == 0)
|
||||
{
|
||||
if (p_data->msg.hdr.err_code == 0) {
|
||||
/* store new configuration */
|
||||
if (p_scb->req_cfg.num_codec > 0)
|
||||
{
|
||||
if (p_scb->req_cfg.num_codec > 0) {
|
||||
p_scb->curr_cfg.num_codec = p_scb->req_cfg.num_codec;
|
||||
memcpy(p_scb->curr_cfg.codec_info, p_scb->req_cfg.codec_info, AVDT_CODEC_SIZE);
|
||||
}
|
||||
if (p_scb->req_cfg.num_protect > 0)
|
||||
{
|
||||
if (p_scb->req_cfg.num_protect > 0) {
|
||||
p_scb->curr_cfg.num_protect = p_scb->req_cfg.num_protect;
|
||||
memcpy(p_scb->curr_cfg.protect_info, p_scb->req_cfg.protect_info, AVDT_PROTECT_SIZE);
|
||||
}
|
||||
@ -771,14 +728,11 @@ void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
void avdt_scb_hdl_security_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
/* if command not supported */
|
||||
if (p_scb->cs.nsc_mask & AVDT_NSC_SECURITY)
|
||||
{
|
||||
if (p_scb->cs.nsc_mask & AVDT_NSC_SECURITY) {
|
||||
/* send reject */
|
||||
p_data->msg.hdr.err_code = AVDT_ERR_NSC;
|
||||
avdt_scb_event(p_scb, AVDT_SCB_API_SECURITY_RSP_EVT, p_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* call application callback */
|
||||
(*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb),
|
||||
NULL,
|
||||
@ -821,11 +775,9 @@ void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
tAVDT_CFG *p_cfg;
|
||||
|
||||
if (!p_scb->in_use)
|
||||
{
|
||||
if (!p_scb->in_use) {
|
||||
p_cfg = p_data->msg.config_cmd.p_cfg;
|
||||
if(p_scb->cs.cfg.codec_info[AVDT_CODEC_TYPE_INDEX] == p_cfg->codec_info[AVDT_CODEC_TYPE_INDEX])
|
||||
{
|
||||
if (p_scb->cs.cfg.codec_info[AVDT_CODEC_TYPE_INDEX] == p_cfg->codec_info[AVDT_CODEC_TYPE_INDEX]) {
|
||||
/* set sep as in use */
|
||||
p_scb->in_use = TRUE;
|
||||
|
||||
@ -838,17 +790,13 @@ void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
p_scb->p_ccb ? p_scb->p_ccb->peer_addr : NULL,
|
||||
AVDT_CONFIG_IND_EVT,
|
||||
(tAVDT_CTRL *) &p_data->msg.config_cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data->msg.hdr.err_code = AVDT_ERR_UNSUP_CFG;
|
||||
p_data->msg.hdr.err_param = 0;
|
||||
avdt_msg_send_rej(avdt_ccb_by_idx(p_data->msg.hdr.ccb_idx),
|
||||
p_data->msg.hdr.sig_id, &p_data->msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
avdt_scb_rej_in_use(p_scb, p_data);
|
||||
}
|
||||
}
|
||||
@ -893,8 +841,7 @@ void avdt_scb_hdl_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
tAVDT_EVT_HDR single;
|
||||
UNUSED(p_data);
|
||||
|
||||
if (p_scb->p_ccb != NULL)
|
||||
{
|
||||
if (p_scb->p_ccb != NULL) {
|
||||
/* save configuration */
|
||||
memcpy(&p_scb->curr_cfg, &p_scb->req_cfg, sizeof(tAVDT_CFG));
|
||||
|
||||
@ -1017,8 +964,7 @@ void avdt_scb_hdl_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
p_scb->cong = FALSE;
|
||||
|
||||
/* free pkt we're holding, if any */
|
||||
if (p_scb->p_pkt != NULL)
|
||||
{
|
||||
if (p_scb->p_pkt != NULL) {
|
||||
GKI_freebuf(p_scb->p_pkt);
|
||||
p_scb->p_pkt = NULL;
|
||||
}
|
||||
@ -1026,16 +972,14 @@ void avdt_scb_hdl_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
/* stop transport channel timer */
|
||||
btu_stop_timer(&p_scb->timer_entry);
|
||||
|
||||
if ((p_scb->role == AVDT_CLOSE_INT) || (p_scb->role == AVDT_OPEN_INT))
|
||||
{
|
||||
if ((p_scb->role == AVDT_CLOSE_INT) || (p_scb->role == AVDT_OPEN_INT)) {
|
||||
/* tell ccb we're done with signaling channel */
|
||||
avdt_ccb_event(p_ccb, AVDT_CCB_UL_CLOSE_EVT, NULL);
|
||||
}
|
||||
event = (p_scb->role == AVDT_CLOSE_INT) ? AVDT_CLOSE_CFM_EVT : AVDT_CLOSE_IND_EVT;
|
||||
p_scb->role = AVDT_CLOSE_ACP;
|
||||
|
||||
if (p_scb->remove)
|
||||
{
|
||||
if (p_scb->remove) {
|
||||
avdt_scb_dealloc(p_scb, NULL);
|
||||
}
|
||||
|
||||
@ -1075,10 +1019,11 @@ void avdt_scb_hdl_delay_rpt_cmd (tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
AVDT_DELAY_REPORT_EVT,
|
||||
(tAVDT_CTRL *) &p_data->msg.hdr);
|
||||
|
||||
if (p_scb->p_ccb)
|
||||
if (p_scb->p_ccb) {
|
||||
avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_DELAY_RPT, &p_data->msg);
|
||||
else
|
||||
} else {
|
||||
avdt_scb_rej_not_in_use(p_scb, p_data);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1114,12 +1059,10 @@ void avdt_scb_hdl_tc_close_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
tAVDT_CTRL avdt_ctrl;
|
||||
/* AVDT_CHAN_SIG does not visit this action */
|
||||
if(p_data && p_data->close.type != AVDT_CHAN_MEDIA)
|
||||
{
|
||||
if (p_data && p_data->close.type != AVDT_CHAN_MEDIA) {
|
||||
/* it's reporting or recovery channel,
|
||||
* the channel close in open state means the peer does not support it */
|
||||
if(p_data->close.old_tc_state == AVDT_AD_ST_OPEN)
|
||||
{
|
||||
if (p_data->close.old_tc_state == AVDT_AD_ST_OPEN) {
|
||||
avdt_ctrl.hdr.err_code = 0;
|
||||
avdt_ctrl.hdr.err_param = 0;
|
||||
/* call app callback */
|
||||
@ -1127,9 +1070,7 @@ void avdt_scb_hdl_tc_close_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
p_scb->p_ccb ? p_scb->p_ccb->peer_addr : NULL,
|
||||
AVDT_REPORT_DISCONN_EVT, &avdt_ctrl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* must be in OPEN state. need to go back to idle */
|
||||
avdt_scb_event(p_scb, AVDT_SCB_MSG_ABORT_RSP_EVT, NULL);
|
||||
avdt_scb_hdl_tc_close(p_scb, p_data);
|
||||
@ -1165,8 +1106,7 @@ void avdt_scb_hdl_tc_open(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
AVDT_TRACE_DEBUG("psc_mask: cfg: 0x%x, req:0x%x, cur: 0x%x\n",
|
||||
p_scb->cs.cfg.psc_mask, p_scb->req_cfg.psc_mask, p_scb->curr_cfg.psc_mask);
|
||||
#if AVDT_REPORTING == TRUE
|
||||
if(p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT)
|
||||
{
|
||||
if (p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT) {
|
||||
/* open the reporting channel, if both devices support it */
|
||||
role = (p_scb->role == AVDT_OPEN_INT) ? AVDT_INT : AVDT_ACP;
|
||||
avdt_ad_open_req(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb, role);
|
||||
@ -1199,8 +1139,7 @@ void avdt_scb_hdl_tc_open_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
/* open reporting channel here, when it is implemented */
|
||||
|
||||
/* call app callback */
|
||||
if(p_data->open.hdr.err_code == AVDT_CHAN_REPORT)
|
||||
{
|
||||
if (p_data->open.hdr.err_code == AVDT_CHAN_REPORT) {
|
||||
avdt_ctrl.hdr.err_code = 0;
|
||||
avdt_ctrl.hdr.err_param = 1;
|
||||
(*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb),
|
||||
@ -1227,8 +1166,7 @@ void avdt_scb_hdl_write_req_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
UINT32 ssrc;
|
||||
|
||||
/* free packet we're holding, if any; to be replaced with new */
|
||||
if (p_scb->p_pkt != NULL)
|
||||
{
|
||||
if (p_scb->p_pkt != NULL) {
|
||||
GKI_freebuf(p_scb->p_pkt);
|
||||
|
||||
/* this shouldn't be happening */
|
||||
@ -1237,8 +1175,7 @@ void avdt_scb_hdl_write_req_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
|
||||
/* build a media packet */
|
||||
/* Add RTP header if required */
|
||||
if ( !(p_data->apiwrite.opt & AVDT_DATA_OPT_NO_RTP) )
|
||||
{
|
||||
if ( !(p_data->apiwrite.opt & AVDT_DATA_OPT_NO_RTP) ) {
|
||||
ssrc = avdt_scb_gen_ssrc(p_scb);
|
||||
|
||||
p_data->apiwrite.p_buf->len += AVDT_MEDIA_HDR_SIZE;
|
||||
@ -1275,10 +1212,10 @@ void avdt_scb_hdl_write_req_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
BT_HDR *p_frag;
|
||||
|
||||
/* free fragments we're holding, if any; it shouldn't happen */
|
||||
if (!GKI_queue_is_empty(&p_scb->frag_q))
|
||||
{
|
||||
while((p_frag = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
||||
if (!GKI_queue_is_empty(&p_scb->frag_q)) {
|
||||
while ((p_frag = (BT_HDR *)GKI_dequeue (&p_scb->frag_q)) != NULL) {
|
||||
GKI_freebuf(p_frag);
|
||||
}
|
||||
|
||||
/* this shouldn't be happening */
|
||||
AVDT_TRACE_WARNING("*** Dropped media packet; congested");
|
||||
@ -1291,7 +1228,7 @@ void avdt_scb_hdl_write_req_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
ssrc = avdt_scb_gen_ssrc(p_scb);
|
||||
|
||||
/* get first packet */
|
||||
p_frag = (BT_HDR*)GKI_getfirst (&p_data->apiwrite.frag_q);
|
||||
p_frag = (BT_HDR *)GKI_getfirst (&p_data->apiwrite.frag_q);
|
||||
/* posit on Adaptation Layer header */
|
||||
p_frag->len += AVDT_AL_HDR_SIZE + AVDT_MEDIA_HDR_SIZE;
|
||||
p_frag->offset -= AVDT_AL_HDR_SIZE + AVDT_MEDIA_HDR_SIZE;
|
||||
@ -1299,10 +1236,10 @@ void avdt_scb_hdl_write_req_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
|
||||
/* Adaptation Layer header */
|
||||
/* TSID, no-fragment bit and coding of length(in 2 length octets following) */
|
||||
*p++ = (p_scb->curr_cfg.mux_tsid_media<<3) | AVDT_ALH_LCODE_16BIT;
|
||||
*p++ = (p_scb->curr_cfg.mux_tsid_media << 3) | AVDT_ALH_LCODE_16BIT;
|
||||
|
||||
/* length of all remaining transport packet */
|
||||
UINT16_TO_BE_STREAM(p, p_frag->layer_specific+AVDT_MEDIA_HDR_SIZE );
|
||||
UINT16_TO_BE_STREAM(p, p_frag->layer_specific + AVDT_MEDIA_HDR_SIZE );
|
||||
/* media header */
|
||||
UINT8_TO_BE_STREAM(p, AVDT_MEDIA_OCTET1);
|
||||
UINT8_TO_BE_STREAM(p, p_data->apiwrite.m_pt);
|
||||
@ -1311,15 +1248,14 @@ void avdt_scb_hdl_write_req_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
UINT32_TO_BE_STREAM(p, ssrc);
|
||||
p_scb->media_seq++;
|
||||
|
||||
while((p_frag = (BT_HDR*)GKI_getnext (p_frag)) != NULL)
|
||||
{
|
||||
while ((p_frag = (BT_HDR *)GKI_getnext (p_frag)) != NULL) {
|
||||
/* posit on Adaptation Layer header */
|
||||
p_frag->len += AVDT_AL_HDR_SIZE;
|
||||
p_frag->offset -= AVDT_AL_HDR_SIZE;
|
||||
p = (UINT8 *)(p_frag + 1) + p_frag->offset;
|
||||
/* Adaptation Layer header */
|
||||
/* TSID, fragment bit and coding of length(in 2 length octets following) */
|
||||
*p++ = (p_scb->curr_cfg.mux_tsid_media<<3) | (AVDT_ALH_FRAG_MASK|AVDT_ALH_LCODE_16BIT);
|
||||
*p++ = (p_scb->curr_cfg.mux_tsid_media << 3) | (AVDT_ALH_FRAG_MASK | AVDT_ALH_LCODE_16BIT);
|
||||
|
||||
/* length of all remaining transport packet */
|
||||
UINT16_TO_BE_STREAM(p, p_frag->layer_specific );
|
||||
@ -1348,8 +1284,9 @@ void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
#endif
|
||||
avdt_scb_hdl_write_req_no_frag(p_scb, p_data);
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
else
|
||||
else {
|
||||
avdt_scb_hdl_write_req_frag(p_scb, p_data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1367,8 +1304,7 @@ void avdt_scb_snd_abort_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
tAVDT_EVT_HDR hdr;
|
||||
UNUSED(p_data);
|
||||
|
||||
if (p_scb->p_ccb != NULL)
|
||||
{
|
||||
if (p_scb->p_ccb != NULL) {
|
||||
p_scb->role = AVDT_CLOSE_INT;
|
||||
|
||||
hdr.seid = p_scb->peer_seid;
|
||||
@ -1432,19 +1368,20 @@ void avdt_scb_snd_stream_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
AVDT_TRACE_WARNING("avdt_scb_snd_stream_close c:%d, off:%d\n",
|
||||
GKI_queue_length(&p_scb->frag_q), p_scb->frag_off);
|
||||
/* clean fragments queue */
|
||||
while((p_frag = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
||||
while ((p_frag = (BT_HDR *)GKI_dequeue (&p_scb->frag_q)) != NULL) {
|
||||
GKI_freebuf(p_frag);
|
||||
}
|
||||
p_scb->frag_off = 0;
|
||||
#endif
|
||||
if (p_scb->p_pkt)
|
||||
{
|
||||
if (p_scb->p_pkt) {
|
||||
GKI_freebuf(p_scb->p_pkt);
|
||||
p_scb->p_pkt = NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(p_scb->cong)
|
||||
if (p_scb->cong) {
|
||||
p_scb->cong = FALSE;
|
||||
}
|
||||
|
||||
/* p_scb->curr_cfg.mux_tsid_media == 0 */
|
||||
#endif
|
||||
@ -1570,25 +1507,20 @@ void avdt_scb_snd_reconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
*******************************************************************************/
|
||||
void avdt_scb_snd_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
if (p_data->msg.hdr.err_code == 0)
|
||||
{
|
||||
if (p_data->msg.hdr.err_code == 0) {
|
||||
/* store new configuration */
|
||||
if (p_scb->req_cfg.num_codec > 0)
|
||||
{
|
||||
if (p_scb->req_cfg.num_codec > 0) {
|
||||
p_scb->curr_cfg.num_codec = p_scb->req_cfg.num_codec;
|
||||
memcpy(p_scb->curr_cfg.codec_info, p_scb->req_cfg.codec_info, AVDT_CODEC_SIZE);
|
||||
}
|
||||
if (p_scb->req_cfg.num_protect > 0)
|
||||
{
|
||||
if (p_scb->req_cfg.num_protect > 0) {
|
||||
p_scb->curr_cfg.num_protect = p_scb->req_cfg.num_protect;
|
||||
memcpy(p_scb->curr_cfg.protect_info, p_scb->req_cfg.protect_info, AVDT_PROTECT_SIZE);
|
||||
}
|
||||
|
||||
/* send response */
|
||||
avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_RECONFIG, &p_data->msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* send reject */
|
||||
avdt_msg_send_rej(p_scb->p_ccb, AVDT_SIG_RECONFIG, &p_data->msg);
|
||||
}
|
||||
@ -1620,12 +1552,9 @@ void avdt_scb_snd_security_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
*******************************************************************************/
|
||||
void avdt_scb_snd_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
if (p_data->msg.hdr.err_code == 0)
|
||||
{
|
||||
if (p_data->msg.hdr.err_code == 0) {
|
||||
avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_SECURITY, &p_data->msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
avdt_msg_send_rej(p_scb->p_ccb, AVDT_SIG_SECURITY, &p_data->msg);
|
||||
}
|
||||
}
|
||||
@ -1642,8 +1571,7 @@ void avdt_scb_snd_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
*******************************************************************************/
|
||||
void avdt_scb_snd_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
if (p_scb->p_ccb != NULL)
|
||||
{
|
||||
if (p_scb->p_ccb != NULL) {
|
||||
avdt_msg_send_rej(p_scb->p_ccb, AVDT_SIG_SETCONFIG, &p_data->msg);
|
||||
|
||||
/* clear scb variables */
|
||||
@ -1676,8 +1604,7 @@ void avdt_scb_snd_setconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
p_req->mux_tsid_media = p_cfg->mux_tsid_media;
|
||||
p_req->mux_tcid_media = p_cfg->mux_tcid_media;
|
||||
if(p_req->psc_mask & AVDT_PSC_REPORT)
|
||||
{
|
||||
if (p_req->psc_mask & AVDT_PSC_REPORT) {
|
||||
p_req->mux_tsid_report = p_cfg->mux_tsid_report;
|
||||
p_req->mux_tcid_report = p_cfg->mux_tcid_report;
|
||||
}
|
||||
@ -1703,8 +1630,7 @@ void avdt_scb_snd_setconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
*******************************************************************************/
|
||||
void avdt_scb_snd_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
if (p_scb->p_ccb != NULL)
|
||||
{
|
||||
if (p_scb->p_ccb != NULL) {
|
||||
memcpy(&p_scb->curr_cfg, &p_scb->req_cfg, sizeof(tAVDT_CFG));
|
||||
|
||||
avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_SETCONFIG, &p_data->msg);
|
||||
@ -1726,8 +1652,9 @@ void avdt_scb_snd_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
UNUSED(p_data);
|
||||
|
||||
#if AVDT_REPORTING == TRUE
|
||||
if(p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT)
|
||||
if (p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT) {
|
||||
avdt_ad_close_req(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb);
|
||||
}
|
||||
#endif
|
||||
avdt_ad_close_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb);
|
||||
}
|
||||
@ -1870,13 +1797,15 @@ void avdt_scb_free_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
avdt_ctrl.hdr.err_param = 0;
|
||||
|
||||
/* p_buf can be NULL in case using of fragments queue frag_q */
|
||||
if(p_data->apiwrite.p_buf)
|
||||
if (p_data->apiwrite.p_buf) {
|
||||
GKI_freebuf(p_data->apiwrite.p_buf);
|
||||
}
|
||||
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
/* clean fragments queue */
|
||||
while((p_frag = (BT_HDR*)GKI_dequeue (&p_data->apiwrite.frag_q)) != NULL)
|
||||
while ((p_frag = (BT_HDR *)GKI_dequeue (&p_data->apiwrite.frag_q)) != NULL) {
|
||||
GKI_freebuf(p_frag);
|
||||
}
|
||||
#endif
|
||||
|
||||
AVDT_TRACE_WARNING("Dropped media packet");
|
||||
@ -1910,8 +1839,7 @@ void avdt_scb_clr_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
avdt_ctrl.hdr.err_code = AVDT_ERR_BAD_STATE;
|
||||
avdt_ctrl.hdr.err_param = 0;
|
||||
/* flush the media data queued at L2CAP */
|
||||
if((p_ccb = p_scb->p_ccb) != NULL)
|
||||
{
|
||||
if ((p_ccb = p_scb->p_ccb) != NULL) {
|
||||
/* get tcid from type, scb */
|
||||
tcid = avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb);
|
||||
|
||||
@ -1919,8 +1847,7 @@ void avdt_scb_clr_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
L2CA_FlushChannel (lcid, L2CAP_FLUSH_CHANS_ALL);
|
||||
}
|
||||
|
||||
if (p_scb->p_pkt != NULL)
|
||||
{
|
||||
if (p_scb->p_pkt != NULL) {
|
||||
GKI_freebuf(p_scb->p_pkt);
|
||||
p_scb->p_pkt = NULL;
|
||||
|
||||
@ -1931,12 +1858,12 @@ void avdt_scb_clr_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
&avdt_ctrl);
|
||||
}
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
else if(!GKI_queue_is_empty (&p_scb->frag_q))
|
||||
{
|
||||
else if (!GKI_queue_is_empty (&p_scb->frag_q)) {
|
||||
AVDT_TRACE_DEBUG("Dropped fragments queue");
|
||||
/* clean fragments queue */
|
||||
while((p_frag = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
||||
while ((p_frag = (BT_HDR *)GKI_dequeue (&p_scb->frag_q)) != NULL) {
|
||||
GKI_freebuf(p_frag);
|
||||
}
|
||||
|
||||
p_scb->frag_off = 0;
|
||||
|
||||
@ -1973,10 +1900,8 @@ void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
|
||||
avdt_ctrl.hdr.err_code = 0;
|
||||
|
||||
if (!p_scb->cong)
|
||||
{
|
||||
if (p_scb->p_pkt != NULL)
|
||||
{
|
||||
if (!p_scb->cong) {
|
||||
if (p_scb->p_pkt != NULL) {
|
||||
p_pkt = p_scb->p_pkt;
|
||||
p_scb->p_pkt = NULL;
|
||||
avdt_ad_write_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, p_pkt);
|
||||
@ -1984,36 +1909,30 @@ void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
(*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb), NULL, AVDT_WRITE_CFM_EVT, &avdt_ctrl);
|
||||
}
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
else
|
||||
{
|
||||
else {
|
||||
#if 0
|
||||
AVDT_TRACE_DEBUG("num_q=%d\n",
|
||||
L2CA_FlushChannel(avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_scb->p_ccb)][avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb)].lcid),
|
||||
L2CAP_FLUSH_CHANS_GET);
|
||||
#endif
|
||||
while((p_pkt = (BT_HDR*)GKI_dequeue (&p_scb->frag_q)) != NULL)
|
||||
{
|
||||
while ((p_pkt = (BT_HDR *)GKI_dequeue (&p_scb->frag_q)) != NULL) {
|
||||
sent = TRUE;
|
||||
AVDT_TRACE_DEBUG("Send fragment len=%d\n",p_pkt->len);
|
||||
AVDT_TRACE_DEBUG("Send fragment len=%d\n", p_pkt->len);
|
||||
/* fragments queue contains fragment to send */
|
||||
res = avdt_ad_write_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, p_pkt);
|
||||
if(AVDT_AD_CONGESTED == res)
|
||||
{
|
||||
if (AVDT_AD_CONGESTED == res) {
|
||||
p_scb->cong = TRUE;
|
||||
AVDT_TRACE_DEBUG("avdt/l2c congested!!");
|
||||
break;/* exit loop if channel became congested */
|
||||
}
|
||||
}
|
||||
AVDT_TRACE_DEBUG("res=%d left=%d\n",res, p_scb->frag_off);
|
||||
AVDT_TRACE_DEBUG("res=%d left=%d\n", res, p_scb->frag_off);
|
||||
|
||||
if(p_scb->frag_off)
|
||||
{
|
||||
if(AVDT_AD_SUCCESS == res || GKI_queue_is_empty (&p_scb->frag_q))
|
||||
{
|
||||
if (p_scb->frag_off) {
|
||||
if (AVDT_AD_SUCCESS == res || GKI_queue_is_empty (&p_scb->frag_q)) {
|
||||
/* all buffers were sent to L2CAP, compose more to queue */
|
||||
avdt_scb_queue_frags(p_scb, &p_scb->p_next_frag, &p_scb->frag_off, &p_scb->frag_q);
|
||||
if(!GKI_queue_is_empty (&p_scb->frag_q))
|
||||
{
|
||||
if (!GKI_queue_is_empty (&p_scb->frag_q)) {
|
||||
data.llcong = p_scb->cong;
|
||||
avdt_scb_event(p_scb, AVDT_SCB_TC_CONG_EVT, &data);
|
||||
}
|
||||
@ -2021,8 +1940,7 @@ void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
}
|
||||
|
||||
/* Send event AVDT_WRITE_CFM_EVT if it was last fragment */
|
||||
else if (sent && GKI_queue_is_empty (&p_scb->frag_q))
|
||||
{
|
||||
else if (sent && GKI_queue_is_empty (&p_scb->frag_q)) {
|
||||
(*p_scb->cs.p_ctrl_cback)(avdt_scb_to_hdl(p_scb), NULL, AVDT_WRITE_CFM_EVT, &avdt_ctrl);
|
||||
}
|
||||
}
|
||||
@ -2061,12 +1979,9 @@ void avdt_scb_clr_vars(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||
{
|
||||
UNUSED(p_data);
|
||||
|
||||
if ((p_scb->cs.tsep == AVDT_TSEP_SNK) && (!p_scb->sink_activated))
|
||||
{
|
||||
if ((p_scb->cs.tsep == AVDT_TSEP_SNK) && (!p_scb->sink_activated)) {
|
||||
p_scb->in_use = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_scb->in_use = FALSE;
|
||||
}
|
||||
p_scb->p_ccb = NULL;
|
||||
@ -2101,25 +2016,19 @@ void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len,
|
||||
tcid = avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb);
|
||||
lcid = avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_scb->p_ccb)][tcid].lcid;
|
||||
|
||||
if( p_scb->frag_off != 0)
|
||||
{
|
||||
if ( p_scb->frag_off != 0) {
|
||||
/* continuing process is usually triggered by un-congest event.
|
||||
* the number of buffers at L2CAP is very small (if not 0).
|
||||
* we do not need to L2CA_FlushChannel() */
|
||||
offset = cont_offset;
|
||||
al_hdr = TRUE;
|
||||
num_frag = AVDT_MAX_FRAG_COUNT;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
num_frag = L2CA_FlushChannel(lcid, L2CAP_FLUSH_CHANS_GET);
|
||||
AVDT_TRACE_DEBUG("num_q=%d lcid=%d\n", num_frag, lcid);
|
||||
if(num_frag >= AVDT_MAX_FRAG_COUNT)
|
||||
{
|
||||
if (num_frag >= AVDT_MAX_FRAG_COUNT) {
|
||||
num_frag = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
num_frag = AVDT_MAX_FRAG_COUNT - num_frag;
|
||||
}
|
||||
}
|
||||
@ -2130,17 +2039,16 @@ void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len,
|
||||
AVDT_TRACE_DEBUG("peer_mtu: %d, buf_size: %d num_frag=%d\n",
|
||||
p_tbl->peer_mtu, buf_size, num_frag);
|
||||
|
||||
if(buf_size > AVDT_DATA_POOL_SIZE)
|
||||
if (buf_size > AVDT_DATA_POOL_SIZE) {
|
||||
buf_size = AVDT_DATA_POOL_SIZE;
|
||||
}
|
||||
|
||||
mtu_used = buf_size - BT_HDR_SIZE;
|
||||
|
||||
while(*p_data_len && num_frag)
|
||||
{
|
||||
while (*p_data_len && num_frag) {
|
||||
/* allocate buffer for fragment */
|
||||
if(NULL == (p_frag = (BT_HDR*)GKI_getbuf(buf_size)))
|
||||
{
|
||||
AVDT_TRACE_WARNING("avdt_scb_queue_frags len=%d(out of GKI buffers)\n",*p_data_len);
|
||||
if (NULL == (p_frag = (BT_HDR *)GKI_getbuf(buf_size))) {
|
||||
AVDT_TRACE_WARNING("avdt_scb_queue_frags len=%d(out of GKI buffers)\n", *p_data_len);
|
||||
break;
|
||||
}
|
||||
/* fill fragment by chunk of media payload */
|
||||
@ -2150,21 +2058,21 @@ void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len,
|
||||
offset = cont_offset;
|
||||
|
||||
p_frag->len = mtu_used - p_frag->offset;
|
||||
if(p_frag->len > *p_data_len)
|
||||
if (p_frag->len > *p_data_len) {
|
||||
p_frag->len = *p_data_len;
|
||||
memcpy((UINT8*)(p_frag+1) + p_frag->offset, *pp_data, p_frag->len);
|
||||
}
|
||||
memcpy((UINT8 *)(p_frag + 1) + p_frag->offset, *pp_data, p_frag->len);
|
||||
*pp_data += p_frag->len;
|
||||
*p_data_len -= p_frag->len;
|
||||
AVDT_TRACE_DEBUG("Prepared fragment len=%d\n", p_frag->len);
|
||||
|
||||
if(al_hdr)
|
||||
{
|
||||
if (al_hdr) {
|
||||
/* Adaptation Layer header */
|
||||
p_frag->len += AVDT_AL_HDR_SIZE;
|
||||
p_frag->offset -= AVDT_AL_HDR_SIZE;
|
||||
p = (UINT8 *)(p_frag + 1) + p_frag->offset;
|
||||
/* TSID, fragment bit and coding of length(in 2 length octets following) */
|
||||
*p++ = (p_scb->curr_cfg.mux_tsid_media<<3) | (AVDT_ALH_FRAG_MASK|AVDT_ALH_LCODE_16BIT);
|
||||
*p++ = (p_scb->curr_cfg.mux_tsid_media << 3) | (AVDT_ALH_FRAG_MASK | AVDT_ALH_LCODE_16BIT);
|
||||
|
||||
/* length of all remaining transport packet */
|
||||
UINT16_TO_BE_STREAM(p, p_frag->layer_specific );
|
||||
|
333
components/bt/bluedroid/stack/avrc/avrc_api.c
Executable file → Normal file
333
components/bt/bluedroid/stack/avrc/avrc_api.c
Executable file → Normal file
@ -42,8 +42,7 @@
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static const UINT8 avrc_ctrl_event_map[] =
|
||||
{
|
||||
static const UINT8 avrc_ctrl_event_map[] = {
|
||||
AVRC_OPEN_IND_EVT, /* AVCT_CONNECT_CFM_EVT */
|
||||
AVRC_OPEN_IND_EVT, /* AVCT_CONNECT_IND_EVT */
|
||||
AVRC_CLOSE_IND_EVT, /* AVCT_DISCONNECT_CFM_EVT */
|
||||
@ -80,14 +79,13 @@ static void avrc_ctrl_cback(UINT8 handle, UINT8 event, UINT16 result,
|
||||
{
|
||||
UINT8 avrc_event;
|
||||
|
||||
if (event <= AVRC_MAX_RCV_CTRL_EVT && avrc_cb.ccb[handle].p_ctrl_cback)
|
||||
{
|
||||
if (event <= AVRC_MAX_RCV_CTRL_EVT && avrc_cb.ccb[handle].p_ctrl_cback) {
|
||||
avrc_event = avrc_ctrl_event_map[event];
|
||||
if (event == AVCT_CONNECT_CFM_EVT)
|
||||
{
|
||||
if (result != 0) /* failed */
|
||||
if (event == AVCT_CONNECT_CFM_EVT) {
|
||||
if (result != 0) { /* failed */
|
||||
avrc_event = AVRC_CLOSE_IND_EVT;
|
||||
}
|
||||
}
|
||||
(*avrc_cb.ccb[handle].p_ctrl_cback)(handle, avrc_event, result, peer_addr);
|
||||
}
|
||||
/* else drop the unknown event*/
|
||||
@ -102,7 +100,7 @@ static void avrc_ctrl_cback(UINT8 handle, UINT8 event, UINT16 result,
|
||||
** Returns A pointer to the data payload.
|
||||
**
|
||||
******************************************************************************/
|
||||
static UINT8 * avrc_get_data_ptr(BT_HDR *p_pkt)
|
||||
static UINT8 *avrc_get_data_ptr(BT_HDR *p_pkt)
|
||||
{
|
||||
return (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
}
|
||||
@ -117,7 +115,7 @@ static UINT8 * avrc_get_data_ptr(BT_HDR *p_pkt)
|
||||
** Returns The buffer with the copied data.
|
||||
**
|
||||
******************************************************************************/
|
||||
static BT_HDR * avrc_copy_packet(BT_HDR *p_pkt, int rsp_pkt_len)
|
||||
static BT_HDR *avrc_copy_packet(BT_HDR *p_pkt, int rsp_pkt_len)
|
||||
{
|
||||
const int offset = MAX(AVCT_MSG_OFFSET, p_pkt->offset);
|
||||
const int pkt_len = MAX(rsp_pkt_len, p_pkt->len);
|
||||
@ -165,7 +163,7 @@ static void avrc_prep_end_frag(UINT8 handle)
|
||||
p_pkt_new = p_fcb->p_fmsg;
|
||||
p_pkt_new->len -= (AVRC_MAX_CTRL_DATA_LEN - AVRC_VENDOR_HDR_SIZE - AVRC_MIN_META_HDR_SIZE);
|
||||
p_pkt_new->offset += (AVRC_MAX_CTRL_DATA_LEN - AVRC_VENDOR_HDR_SIZE - AVRC_MIN_META_HDR_SIZE);
|
||||
p_data = (UINT8 *)(p_pkt_new+1) + p_pkt_new->offset;
|
||||
p_data = (UINT8 *)(p_pkt_new + 1) + p_pkt_new->offset;
|
||||
*p_data++ = rsp_type;
|
||||
*p_data++ = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT);
|
||||
*p_data++ = AVRC_OP_VENDOR;
|
||||
@ -199,19 +197,17 @@ static void avrc_send_continue_frag(UINT8 handle, UINT8 label)
|
||||
|
||||
AVRC_TRACE_DEBUG("%s handle = %u label = %u len = %d",
|
||||
__func__, handle, label, p_pkt->len);
|
||||
if (p_pkt->len > AVRC_MAX_CTRL_DATA_LEN)
|
||||
{
|
||||
if (p_pkt->len > AVRC_MAX_CTRL_DATA_LEN) {
|
||||
int offset_len = MAX(AVCT_MSG_OFFSET, p_pkt->offset);
|
||||
p_pkt_old = p_fcb->p_fmsg;
|
||||
p_pkt = (BT_HDR *)GKI_getbuf((UINT16)(AVRC_PACKET_LEN + offset_len + BT_HDR_SIZE));
|
||||
if (p_pkt)
|
||||
{
|
||||
if (p_pkt) {
|
||||
p_pkt->len = AVRC_MAX_CTRL_DATA_LEN;
|
||||
p_pkt->offset = AVCT_MSG_OFFSET;
|
||||
p_pkt->layer_specific = p_pkt_old->layer_specific;
|
||||
p_pkt->event = p_pkt_old->event;
|
||||
p_old = (UINT8 *)(p_pkt_old+1) + p_pkt_old->offset;
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_old = (UINT8 *)(p_pkt_old + 1) + p_pkt_old->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
memcpy (p_data, p_old, AVRC_MAX_CTRL_DATA_LEN);
|
||||
/* use AVRC continue packet type */
|
||||
p_data += AVRC_VENDOR_HDR_SIZE;
|
||||
@ -222,15 +218,13 @@ static void avrc_send_continue_frag(UINT8 handle, UINT8 label)
|
||||
|
||||
/* prepare the left over for as an end fragment */
|
||||
avrc_prep_end_frag (handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* use the current GKI buffer to send Internal error status */
|
||||
p_pkt = p_fcb->p_fmsg;
|
||||
p_fcb->p_fmsg = NULL;
|
||||
p_fcb->frag_enabled = FALSE;
|
||||
AVRC_TRACE_ERROR ("AVRC_MsgReq no buffers for fragmentation - send internal error" );
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
*p_data++ = AVRC_PDU_REQUEST_CONTINUATION_RSP;
|
||||
*p_data++ = 0;
|
||||
UINT16_TO_BE_STREAM(p_data, 0);
|
||||
@ -240,9 +234,7 @@ static void avrc_send_continue_frag(UINT8 handle, UINT8 label)
|
||||
AVRC_BldResponse( handle, (tAVRC_RESPONSE *)&rej_rsp, &p_pkt);
|
||||
cr = AVCT_RSP;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* end fragment. clean the control block */
|
||||
p_fcb->frag_enabled = FALSE;
|
||||
p_fcb->p_fmsg = NULL;
|
||||
@ -259,7 +251,7 @@ static void avrc_send_continue_frag(UINT8 handle, UINT8 label)
|
||||
** Returns if not NULL, the response to send right away.
|
||||
**
|
||||
******************************************************************************/
|
||||
static BT_HDR * avrc_proc_vendor_command(UINT8 handle, UINT8 label,
|
||||
static BT_HDR *avrc_proc_vendor_command(UINT8 handle, UINT8 label,
|
||||
BT_HDR *p_pkt, tAVRC_MSG_VENDOR *p_msg)
|
||||
{
|
||||
BT_HDR *p_rsp = NULL;
|
||||
@ -270,37 +262,30 @@ static BT_HDR * avrc_proc_vendor_command(UINT8 handle, UINT8 label,
|
||||
tAVRC_STS status = AVRC_STS_NO_ERROR;
|
||||
tAVRC_FRAG_CB *p_fcb;
|
||||
|
||||
p_begin = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_begin = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
p_data = p_begin + AVRC_VENDOR_HDR_SIZE;
|
||||
pkt_type = *(p_data + 1) & AVRC_PKT_TYPE_MASK;
|
||||
|
||||
if (pkt_type != AVRC_PKT_SINGLE)
|
||||
{
|
||||
if (pkt_type != AVRC_PKT_SINGLE) {
|
||||
/* reject - commands can only be in single packets at AVRCP level */
|
||||
AVRC_TRACE_ERROR ("commands must be in single packet pdu:0x%x", *p_data );
|
||||
/* use the current GKI buffer to send the reject */
|
||||
status = AVRC_STS_BAD_CMD;
|
||||
}
|
||||
/* check if there are fragments waiting to be sent */
|
||||
else if (avrc_cb.fcb[handle].frag_enabled)
|
||||
{
|
||||
else if (avrc_cb.fcb[handle].frag_enabled) {
|
||||
p_fcb = &avrc_cb.fcb[handle];
|
||||
if (p_msg->company_id == AVRC_CO_METADATA)
|
||||
{
|
||||
switch (*p_data)
|
||||
{
|
||||
if (p_msg->company_id == AVRC_CO_METADATA) {
|
||||
switch (*p_data) {
|
||||
case AVRC_PDU_ABORT_CONTINUATION_RSP:
|
||||
/* aborted by CT - send accept response */
|
||||
abort_frag = TRUE;
|
||||
p_begin = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_begin = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
*p_begin = (AVRC_RSP_ACCEPT & AVRC_CTYPE_MASK);
|
||||
if (*(p_data + 4) != p_fcb->frag_pdu)
|
||||
{
|
||||
if (*(p_data + 4) != p_fcb->frag_pdu) {
|
||||
*p_begin = (AVRC_RSP_REJ & AVRC_CTYPE_MASK);
|
||||
*(p_data + 4) = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data = (p_begin + AVRC_VENDOR_HDR_SIZE + 2);
|
||||
UINT16_TO_BE_STREAM(p_data, 0);
|
||||
p_pkt->len = (p_data - p_begin);
|
||||
@ -310,13 +295,10 @@ static BT_HDR * avrc_proc_vendor_command(UINT8 handle, UINT8 label,
|
||||
break;
|
||||
|
||||
case AVRC_PDU_REQUEST_CONTINUATION_RSP:
|
||||
if (*(p_data + 4) == p_fcb->frag_pdu)
|
||||
{
|
||||
if (*(p_data + 4) == p_fcb->frag_pdu) {
|
||||
avrc_send_continue_frag(handle, label);
|
||||
p_msg->hdr.opcode = AVRC_OP_DROP_N_FREE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* the pdu id does not match - reject the command using the current GKI buffer */
|
||||
AVRC_TRACE_ERROR("avrc_proc_vendor_command continue pdu: 0x%x does not match \
|
||||
current re-assembly pdu: 0x%x",
|
||||
@ -330,26 +312,23 @@ static BT_HDR * avrc_proc_vendor_command(UINT8 handle, UINT8 label,
|
||||
/* implicit abort */
|
||||
abort_frag = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
abort_frag = TRUE;
|
||||
/* implicit abort */
|
||||
}
|
||||
|
||||
if (abort_frag)
|
||||
{
|
||||
if (p_fcb->p_fmsg)
|
||||
if (abort_frag) {
|
||||
if (p_fcb->p_fmsg) {
|
||||
GKI_freebuf(p_fcb->p_fmsg);
|
||||
}
|
||||
p_fcb->p_fmsg = NULL;
|
||||
p_fcb->frag_enabled = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (status != AVRC_STS_NO_ERROR)
|
||||
{
|
||||
if (status != AVRC_STS_NO_ERROR) {
|
||||
/* use the current GKI buffer to build/send the reject message */
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
*p_data++ = AVRC_RSP_REJ;
|
||||
p_data += AVRC_VENDOR_HDR_SIZE; /* pdu */
|
||||
*p_data++ = 0; /* pkt_type */
|
||||
@ -387,7 +366,7 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
tAVRC_RASM_CB *p_rcb;
|
||||
tAVRC_NEXT_CMD avrc_cmd;
|
||||
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
|
||||
/* Skip over vendor header (ctype, subunit*, opcode, CO_ID) */
|
||||
p_data += AVRC_VENDOR_HDR_SIZE;
|
||||
@ -395,35 +374,29 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
pkt_type = *(p_data + 1) & AVRC_PKT_TYPE_MASK;
|
||||
AVRC_TRACE_DEBUG ("pkt_type %d", pkt_type );
|
||||
p_rcb = &avrc_cb.rcb[handle];
|
||||
if (p_msg->company_id == AVRC_CO_METADATA)
|
||||
{
|
||||
if (p_msg->company_id == AVRC_CO_METADATA) {
|
||||
/* check if the message needs to be re-assembled */
|
||||
if (pkt_type == AVRC_PKT_SINGLE || pkt_type == AVRC_PKT_START)
|
||||
{
|
||||
if (pkt_type == AVRC_PKT_SINGLE || pkt_type == AVRC_PKT_START) {
|
||||
/* previous fragments need to be dropped, when received another new message */
|
||||
p_rcb->rasm_offset = 0;
|
||||
if (p_rcb->p_rmsg)
|
||||
{
|
||||
if (p_rcb->p_rmsg) {
|
||||
GKI_freebuf(p_rcb->p_rmsg);
|
||||
p_rcb->p_rmsg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (pkt_type != AVRC_PKT_SINGLE && cr == AVCT_RSP)
|
||||
{
|
||||
if (pkt_type != AVRC_PKT_SINGLE && cr == AVCT_RSP) {
|
||||
/* not a single response packet - need to re-assemble metadata messages */
|
||||
if (pkt_type == AVRC_PKT_START)
|
||||
{
|
||||
if (pkt_type == AVRC_PKT_START) {
|
||||
/* Allocate buffer for re-assembly */
|
||||
p_rcb->rasm_pdu = *p_data;
|
||||
if ((p_rcb->p_rmsg = (BT_HDR *)GKI_getbuf(GKI_MAX_BUF_SIZE)) != NULL)
|
||||
{
|
||||
if ((p_rcb->p_rmsg = (BT_HDR *)GKI_getbuf(GKI_MAX_BUF_SIZE)) != NULL) {
|
||||
/* Copy START packet to buffer for re-assembling fragments*/
|
||||
memcpy(p_rcb->p_rmsg, p_pkt, sizeof(BT_HDR)); /* Copy bt hdr */
|
||||
|
||||
/* Copy metadata message */
|
||||
memcpy((UINT8 *)(p_rcb->p_rmsg + 1),
|
||||
(UINT8 *)(p_pkt+1) + p_pkt->offset, p_pkt->len);
|
||||
(UINT8 *)(p_pkt + 1) + p_pkt->offset, p_pkt->len);
|
||||
|
||||
/* offset of start of metadata response in reassembly buffer */
|
||||
p_rcb->p_rmsg->offset = p_rcb->rasm_offset = 0;
|
||||
@ -431,9 +404,7 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
/* Free original START packet, replace with pointer to reassembly buffer */
|
||||
GKI_freebuf(p_pkt);
|
||||
*pp_pkt = p_rcb->p_rmsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* Unable to allocate buffer for fragmented avrc message. Reuse START
|
||||
buffer for reassembly (re-assembled message may fit into ACL buf) */
|
||||
AVRC_TRACE_DEBUG ("Unable to allocate buffer for fragmented avrc message, \
|
||||
@ -445,9 +416,7 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
/* set offset to point to where to copy next - use the same re-asm logic as AVCT */
|
||||
p_rcb->p_rmsg->offset += p_rcb->p_rmsg->len;
|
||||
req_continue = TRUE;
|
||||
}
|
||||
else if (p_rcb->p_rmsg == NULL)
|
||||
{
|
||||
} else if (p_rcb->p_rmsg == NULL) {
|
||||
/* Received a CONTINUE/END, but no corresponding START
|
||||
(or previous fragmented response was dropped) */
|
||||
AVRC_TRACE_DEBUG ("Received a CONTINUE/END without no corresponding START \
|
||||
@ -455,17 +424,14 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
drop_code = 5;
|
||||
GKI_freebuf(p_pkt);
|
||||
*pp_pkt = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* get size of buffer holding assembled message */
|
||||
buf_len = GKI_get_buf_size (p_rcb->p_rmsg) - sizeof(BT_HDR);
|
||||
/* adjust offset and len of fragment for header byte */
|
||||
p_pkt->offset += (AVRC_VENDOR_HDR_SIZE + AVRC_MIN_META_HDR_SIZE);
|
||||
p_pkt->len -= (AVRC_VENDOR_HDR_SIZE + AVRC_MIN_META_HDR_SIZE);
|
||||
/* verify length */
|
||||
if ((p_rcb->p_rmsg->offset + p_pkt->len) > buf_len)
|
||||
{
|
||||
if ((p_rcb->p_rmsg->offset + p_pkt->len) > buf_len) {
|
||||
AVRC_TRACE_WARNING("Fragmented message too big! - report the partial message");
|
||||
p_pkt->len = buf_len - p_rcb->p_rmsg->offset;
|
||||
pkt_type = AVRC_PKT_END;
|
||||
@ -475,14 +441,13 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
memcpy((UINT8 *)(p_rcb->p_rmsg + 1) + p_rcb->p_rmsg->offset,
|
||||
(UINT8 *)(p_pkt + 1) + p_pkt->offset, p_pkt->len);
|
||||
|
||||
if (pkt_type == AVRC_PKT_END)
|
||||
{
|
||||
if (pkt_type == AVRC_PKT_END) {
|
||||
p_rcb->p_rmsg->offset = p_rcb->rasm_offset;
|
||||
p_rcb->p_rmsg->len += p_pkt->len;
|
||||
p_pkt_new = p_rcb->p_rmsg;
|
||||
p_rcb->rasm_offset = 0;
|
||||
p_rcb->p_rmsg = NULL;
|
||||
p_msg->p_vendor_data = (UINT8 *)(p_pkt_new+1) + p_pkt_new->offset;
|
||||
p_msg->p_vendor_data = (UINT8 *)(p_pkt_new + 1) + p_pkt_new->offset;
|
||||
p_msg->hdr.ctype = p_msg->p_vendor_data[0] & AVRC_CTYPE_MASK;
|
||||
/* 6 = ctype, subunit*, opcode & CO_ID */
|
||||
p_msg->p_vendor_data += AVRC_VENDOR_HDR_SIZE;
|
||||
@ -492,9 +457,7 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
UINT16_TO_BE_STREAM(p_data, (p_msg->vendor_len - AVRC_MIN_META_HDR_SIZE));
|
||||
AVRC_TRACE_DEBUG("end frag:%d, total len:%d, offset:%d", p_pkt->len,
|
||||
p_pkt_new->len, p_pkt_new->offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_rcb->p_rmsg->offset += p_pkt->len;
|
||||
p_rcb->p_rmsg->len += p_pkt->len;
|
||||
p_pkt_new = NULL;
|
||||
@ -505,29 +468,22 @@ static UINT8 avrc_proc_far_msg(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR **pp_
|
||||
}
|
||||
}
|
||||
|
||||
if (cr == AVCT_CMD)
|
||||
{
|
||||
if (cr == AVCT_CMD) {
|
||||
p_rsp = avrc_proc_vendor_command(handle, label, *pp_pkt, p_msg);
|
||||
if (p_rsp)
|
||||
{
|
||||
if (p_rsp) {
|
||||
AVCT_MsgReq( handle, label, AVCT_RSP, p_rsp);
|
||||
drop_code = 3;
|
||||
}
|
||||
else if (p_msg->hdr.opcode == AVRC_OP_DROP)
|
||||
{
|
||||
} else if (p_msg->hdr.opcode == AVRC_OP_DROP) {
|
||||
drop_code = 1;
|
||||
}
|
||||
else if (p_msg->hdr.opcode == AVRC_OP_DROP_N_FREE)
|
||||
} else if (p_msg->hdr.opcode == AVRC_OP_DROP_N_FREE) {
|
||||
drop_code = 4;
|
||||
|
||||
}
|
||||
else if (cr == AVCT_RSP && req_continue == TRUE)
|
||||
{
|
||||
|
||||
} else if (cr == AVCT_RSP && req_continue == TRUE) {
|
||||
avrc_cmd.pdu = AVRC_PDU_REQUEST_CONTINUATION_RSP;
|
||||
avrc_cmd.status = AVRC_STS_NO_ERROR;
|
||||
avrc_cmd.target_pdu = p_rcb->rasm_pdu;
|
||||
if (AVRC_BldCommand ((tAVRC_COMMAND *)&avrc_cmd, &p_cmd) == AVRC_STS_NO_ERROR)
|
||||
{
|
||||
if (AVRC_BldCommand ((tAVRC_COMMAND *)&avrc_cmd, &p_cmd) == AVRC_STS_NO_ERROR) {
|
||||
drop_code = 2;
|
||||
AVRC_MsgReq (handle, (UINT8)(label), AVRC_CMD_CTRL, p_cmd);
|
||||
}
|
||||
@ -567,8 +523,7 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
tAVRC_MSG_VENDOR *p_msg = &msg.vendor;
|
||||
|
||||
if (cr == AVCT_CMD &&
|
||||
(p_pkt->layer_specific & AVCT_DATA_CTRL && AVRC_PACKET_LEN < sizeof(p_pkt->len)))
|
||||
{
|
||||
(p_pkt->layer_specific & AVCT_DATA_CTRL && AVRC_PACKET_LEN < sizeof(p_pkt->len))) {
|
||||
/* Ignore the invalid AV/C command frame */
|
||||
#if (BT_USE_TRACES == TRUE)
|
||||
p_drop_msg = "dropped - too long AV/C cmd frame size";
|
||||
@ -577,8 +532,7 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
return;
|
||||
}
|
||||
|
||||
if (cr == AVCT_REJ)
|
||||
{
|
||||
if (cr == AVCT_REJ) {
|
||||
/* The peer thinks that this PID is no longer open - remove this handle */
|
||||
/* */
|
||||
GKI_freebuf(p_pkt);
|
||||
@ -586,7 +540,7 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
return;
|
||||
}
|
||||
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
memset(&msg, 0, sizeof(tAVRC_MSG) );
|
||||
{
|
||||
msg.hdr.ctype = p_data[0] & AVRC_CTYPE_MASK;
|
||||
@ -598,14 +552,11 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
}
|
||||
|
||||
if ( ((avrc_cb.ccb[handle].control & AVRC_CT_TARGET) && (cr == AVCT_CMD)) ||
|
||||
((avrc_cb.ccb[handle].control & AVRC_CT_CONTROL) && (cr == AVCT_RSP)) )
|
||||
{
|
||||
((avrc_cb.ccb[handle].control & AVRC_CT_CONTROL) && (cr == AVCT_RSP)) ) {
|
||||
|
||||
switch(opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case AVRC_OP_UNIT_INFO:
|
||||
if (cr == AVCT_CMD)
|
||||
{
|
||||
if (cr == AVCT_CMD) {
|
||||
/* send the response to the peer */
|
||||
p_rsp = avrc_copy_packet(p_pkt, AVRC_OP_UNIT_INFO_RSP_LEN);
|
||||
p_rsp_data = avrc_get_data_ptr(p_rsp);
|
||||
@ -623,9 +574,7 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
#if (BT_USE_TRACES == TRUE)
|
||||
p_drop_msg = "auto respond";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* parse response */
|
||||
p_data += 4; /* 3 bytes: ctype, subunit*, opcode + octet 3 (is 7)*/
|
||||
msg.unit.unit_type = (*p_data & AVRC_SUBTYPE_MASK) >> AVRC_SUBTYPE_SHIFT;
|
||||
@ -636,8 +585,7 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
break;
|
||||
|
||||
case AVRC_OP_SUB_INFO:
|
||||
if (cr == AVCT_CMD)
|
||||
{
|
||||
if (cr == AVCT_CMD) {
|
||||
/* send the response to the peer */
|
||||
p_rsp = avrc_copy_packet(p_pkt, AVRC_OP_SUB_UNIT_INFO_RSP_LEN);
|
||||
p_rsp_data = avrc_get_data_ptr(p_rsp);
|
||||
@ -654,32 +602,30 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
#if (BT_USE_TRACES == TRUE)
|
||||
p_drop_msg = "auto responded";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* parse response */
|
||||
p_data += AVRC_AVC_HDR_SIZE; /* 3 bytes: ctype, subunit*, opcode */
|
||||
msg.sub.page = (*p_data++ >> AVRC_SUB_PAGE_SHIFT) & AVRC_SUB_PAGE_MASK;
|
||||
xx = 0;
|
||||
while (*p_data != AVRC_CMD_OPRND_PAD && xx<AVRC_SUB_TYPE_LEN)
|
||||
{
|
||||
while (*p_data != AVRC_CMD_OPRND_PAD && xx < AVRC_SUB_TYPE_LEN) {
|
||||
msg.sub.subunit_type[xx] = *p_data++ >> AVRC_SUBTYPE_SHIFT;
|
||||
if (msg.sub.subunit_type[xx] == AVRC_SUB_PANEL)
|
||||
if (msg.sub.subunit_type[xx] == AVRC_SUB_PANEL) {
|
||||
msg.sub.panel = TRUE;
|
||||
}
|
||||
xx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_OP_VENDOR:
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
p_begin = p_data;
|
||||
if (p_pkt->len < AVRC_VENDOR_HDR_SIZE) /* 6 = ctype, subunit*, opcode & CO_ID */
|
||||
{
|
||||
if (cr == AVCT_CMD)
|
||||
if (p_pkt->len < AVRC_VENDOR_HDR_SIZE) { /* 6 = ctype, subunit*, opcode & CO_ID */
|
||||
if (cr == AVCT_CMD) {
|
||||
reject = TRUE;
|
||||
else
|
||||
} else {
|
||||
drop = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
p_data += AVRC_AVC_HDR_SIZE; /* skip the first 3 bytes: ctype, subunit*, opcode */
|
||||
@ -689,30 +635,29 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
|
||||
#if (AVRC_METADATA_INCLUDED == TRUE)
|
||||
UINT8 drop_code = 0;
|
||||
if (p_msg->company_id == AVRC_CO_METADATA)
|
||||
{
|
||||
if (p_msg->company_id == AVRC_CO_METADATA) {
|
||||
/* Validate length for metadata message */
|
||||
if (p_pkt->len < (AVRC_VENDOR_HDR_SIZE + AVRC_MIN_META_HDR_SIZE))
|
||||
{
|
||||
if (cr == AVCT_CMD)
|
||||
if (p_pkt->len < (AVRC_VENDOR_HDR_SIZE + AVRC_MIN_META_HDR_SIZE)) {
|
||||
if (cr == AVCT_CMD) {
|
||||
reject = TRUE;
|
||||
else
|
||||
} else {
|
||||
drop = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check+handle fragmented messages */
|
||||
drop_code = avrc_proc_far_msg(handle, label, cr, &p_pkt, p_msg);
|
||||
if (drop_code > 0)
|
||||
if (drop_code > 0) {
|
||||
drop = TRUE;
|
||||
}
|
||||
if (drop_code > 0)
|
||||
{
|
||||
if (drop_code != 4)
|
||||
}
|
||||
if (drop_code > 0) {
|
||||
if (drop_code != 4) {
|
||||
do_free = FALSE;
|
||||
}
|
||||
#if (BT_USE_TRACES == TRUE)
|
||||
switch (drop_code)
|
||||
{
|
||||
switch (drop_code) {
|
||||
case 1:
|
||||
p_drop_msg = "sent_frag";
|
||||
break;
|
||||
@ -734,48 +679,47 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
break;
|
||||
|
||||
case AVRC_OP_PASS_THRU:
|
||||
if (p_pkt->len < 5) /* 3 bytes: ctype, subunit*, opcode & op_id & len */
|
||||
{
|
||||
if (cr == AVCT_CMD)
|
||||
if (p_pkt->len < 5) { /* 3 bytes: ctype, subunit*, opcode & op_id & len */
|
||||
if (cr == AVCT_CMD) {
|
||||
reject = TRUE;
|
||||
else
|
||||
} else {
|
||||
drop = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
p_data += AVRC_AVC_HDR_SIZE; /* skip the first 3 bytes: ctype, subunit*, opcode */
|
||||
msg.pass.op_id = (AVRC_PASS_OP_ID_MASK & *p_data);
|
||||
if (AVRC_PASS_STATE_MASK & *p_data)
|
||||
if (AVRC_PASS_STATE_MASK & *p_data) {
|
||||
msg.pass.state = TRUE;
|
||||
else
|
||||
} else {
|
||||
msg.pass.state = FALSE;
|
||||
}
|
||||
p_data++;
|
||||
msg.pass.pass_len = *p_data++;
|
||||
if (msg.pass.pass_len != p_pkt->len - 5)
|
||||
if (msg.pass.pass_len != p_pkt->len - 5) {
|
||||
msg.pass.pass_len = p_pkt->len - 5;
|
||||
if (msg.pass.pass_len)
|
||||
}
|
||||
if (msg.pass.pass_len) {
|
||||
msg.pass.p_pass_data = p_data;
|
||||
else
|
||||
} else {
|
||||
msg.pass.p_pass_data = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if ((avrc_cb.ccb[handle].control & AVRC_CT_TARGET) && (cr == AVCT_CMD))
|
||||
{
|
||||
if ((avrc_cb.ccb[handle].control & AVRC_CT_TARGET) && (cr == AVCT_CMD)) {
|
||||
/* reject unsupported opcode */
|
||||
reject = TRUE;
|
||||
}
|
||||
drop = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else /* drop the event */
|
||||
{
|
||||
} else { /* drop the event */
|
||||
drop = TRUE;
|
||||
}
|
||||
|
||||
if (reject)
|
||||
{
|
||||
if (reject) {
|
||||
/* reject unsupported opcode */
|
||||
p_rsp = avrc_copy_packet(p_pkt, AVRC_OP_REJ_MSG_LEN);
|
||||
p_rsp_data = avrc_get_data_ptr(p_rsp);
|
||||
@ -787,21 +731,18 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
drop = TRUE;
|
||||
}
|
||||
|
||||
if (p_rsp)
|
||||
{
|
||||
if (p_rsp) {
|
||||
/* set to send response right away */
|
||||
AVCT_MsgReq( handle, label, cr, p_rsp);
|
||||
drop = TRUE;
|
||||
}
|
||||
|
||||
if (drop == FALSE)
|
||||
{
|
||||
if (drop == FALSE) {
|
||||
msg.hdr.opcode = opcode;
|
||||
(*avrc_cb.ccb[handle].p_msg_cback)(handle, label, opcode, &msg);
|
||||
}
|
||||
#if (BT_USE_TRACES == TRUE)
|
||||
else
|
||||
{
|
||||
else {
|
||||
AVRC_TRACE_WARNING("avrc_msg_cback %s msg handle:%d, control:%d, cr:%d, opcode:x%x",
|
||||
p_drop_msg,
|
||||
handle, avrc_cb.ccb[handle].control, cr, opcode);
|
||||
@ -809,8 +750,9 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
#endif
|
||||
|
||||
|
||||
if (do_free)
|
||||
if (do_free) {
|
||||
GKI_freebuf(p_pkt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -832,38 +774,34 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
** NULL if p_msg is NULL.
|
||||
**
|
||||
******************************************************************************/
|
||||
static BT_HDR * avrc_pass_msg(tAVRC_MSG_PASS *p_msg)
|
||||
static BT_HDR *avrc_pass_msg(tAVRC_MSG_PASS *p_msg)
|
||||
{
|
||||
BT_HDR *p_cmd = NULL;
|
||||
UINT8 *p_data;
|
||||
|
||||
assert(p_msg != NULL);
|
||||
assert(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->pass_len));
|
||||
assert(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN + p_msg->pass_len));
|
||||
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL)
|
||||
{
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL) {
|
||||
p_cmd->offset = AVCT_MSG_OFFSET;
|
||||
p_cmd->layer_specific = AVCT_DATA_CTRL;
|
||||
p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset;
|
||||
*p_data++ = (p_msg->hdr.ctype & AVRC_CTYPE_MASK);
|
||||
*p_data++ = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT); /* Panel subunit & id=0 */
|
||||
*p_data++ = AVRC_OP_PASS_THRU;
|
||||
*p_data = (AVRC_PASS_OP_ID_MASK&p_msg->op_id);
|
||||
if (p_msg->state)
|
||||
*p_data = (AVRC_PASS_OP_ID_MASK & p_msg->op_id);
|
||||
if (p_msg->state) {
|
||||
*p_data |= AVRC_PASS_STATE_MASK;
|
||||
}
|
||||
p_data++;
|
||||
|
||||
if (p_msg->op_id == AVRC_ID_VENDOR)
|
||||
{
|
||||
if (p_msg->op_id == AVRC_ID_VENDOR) {
|
||||
*p_data++ = p_msg->pass_len;
|
||||
if (p_msg->pass_len && p_msg->p_pass_data)
|
||||
{
|
||||
if (p_msg->pass_len && p_msg->p_pass_data) {
|
||||
memcpy(p_data, p_msg->p_pass_data, p_msg->pass_len);
|
||||
p_data += p_msg->pass_len;
|
||||
}
|
||||
}
|
||||
else /* set msg len to 0 for other op_id */
|
||||
{
|
||||
} else { /* set msg len to 0 for other op_id */
|
||||
/* set msg len to 0 for other op_id */
|
||||
*p_data++ = 0;
|
||||
}
|
||||
@ -929,8 +867,7 @@ UINT16 AVRC_Open(UINT8 *p_handle, tAVRC_CONN_CB *p_ccb, BD_ADDR_PTR peer_addr)
|
||||
cc.control = p_ccb->control; /* Control role (Control/Target) */
|
||||
|
||||
status = AVCT_CreateConn(p_handle, &cc, peer_addr);
|
||||
if (status == AVCT_SUCCESS)
|
||||
{
|
||||
if (status == AVCT_SUCCESS) {
|
||||
memcpy(&avrc_cb.ccb[*p_handle], p_ccb, sizeof(tAVRC_CONN_CB));
|
||||
#if (AVRC_METADATA_INCLUDED == TRUE)
|
||||
memset(&avrc_cb.fcb[*p_handle], 0, sizeof(tAVRC_FRAG_CB));
|
||||
@ -995,17 +932,18 @@ UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt)
|
||||
UINT16 len;
|
||||
BT_HDR *p_pkt_new;
|
||||
|
||||
if (!p_pkt)
|
||||
if (!p_pkt) {
|
||||
return AVRC_BAD_PARAM;
|
||||
}
|
||||
|
||||
AVRC_TRACE_DEBUG("%s handle = %u label = %u ctype = %u len = %d",
|
||||
__func__, handle, label, ctype, p_pkt->len);
|
||||
|
||||
if (ctype >= AVRC_RSP_NOT_IMPL)
|
||||
if (ctype >= AVRC_RSP_NOT_IMPL) {
|
||||
cr = AVCT_RSP;
|
||||
}
|
||||
|
||||
if (p_pkt->event == AVRC_OP_VENDOR)
|
||||
{
|
||||
if (p_pkt->event == AVRC_OP_VENDOR) {
|
||||
/* add AVRCP Vendor Dependent headers */
|
||||
p_start = ((UINT8 *)(p_pkt + 1) + p_pkt->offset);
|
||||
p_pkt->offset -= AVRC_VENDOR_HDR_SIZE;
|
||||
@ -1015,9 +953,7 @@ UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt)
|
||||
*p_data++ = (AVRC_SUB_PANEL << AVRC_SUBTYPE_SHIFT);
|
||||
*p_data++ = AVRC_OP_VENDOR;
|
||||
AVRC_CO_ID_TO_BE_STREAM(p_data, AVRC_CO_METADATA);
|
||||
}
|
||||
else if (p_pkt->event == AVRC_OP_PASS_THRU)
|
||||
{
|
||||
} else if (p_pkt->event == AVRC_OP_PASS_THRU) {
|
||||
/* add AVRCP Pass Through headers */
|
||||
p_start = ((UINT8 *)(p_pkt + 1) + p_pkt->offset);
|
||||
p_pkt->offset -= AVRC_PASS_THRU_SIZE;
|
||||
@ -1033,26 +969,23 @@ UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt)
|
||||
|
||||
/* abandon previous fragments */
|
||||
p_fcb = &avrc_cb.fcb[handle];
|
||||
if (p_fcb->frag_enabled)
|
||||
if (p_fcb->frag_enabled) {
|
||||
p_fcb->frag_enabled = FALSE;
|
||||
}
|
||||
|
||||
if (p_fcb->p_fmsg)
|
||||
{
|
||||
if (p_fcb->p_fmsg) {
|
||||
GKI_freebuf(p_fcb->p_fmsg);
|
||||
p_fcb->p_fmsg = NULL;
|
||||
}
|
||||
|
||||
/* AVRCP spec has not defined any control channel commands that needs fragmentation at this level
|
||||
* check for fragmentation only on the response */
|
||||
if ((cr == AVCT_RSP) && (chk_frag == TRUE))
|
||||
{
|
||||
if (p_pkt->len > AVRC_MAX_CTRL_DATA_LEN)
|
||||
{
|
||||
if ((cr == AVCT_RSP) && (chk_frag == TRUE)) {
|
||||
if (p_pkt->len > AVRC_MAX_CTRL_DATA_LEN) {
|
||||
int offset_len = MAX(AVCT_MSG_OFFSET, p_pkt->offset);
|
||||
p_pkt_new = (BT_HDR *)GKI_getbuf((UINT16)(AVRC_PACKET_LEN + offset_len
|
||||
+ BT_HDR_SIZE));
|
||||
if (p_pkt_new && (p_start != NULL))
|
||||
{
|
||||
if (p_pkt_new && (p_start != NULL)) {
|
||||
p_fcb->frag_enabled = TRUE;
|
||||
p_fcb->p_fmsg = p_pkt;
|
||||
p_fcb->frag_pdu = *p_start;
|
||||
@ -1062,7 +995,7 @@ UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt)
|
||||
p_pkt->offset = p_pkt_new->offset;
|
||||
p_pkt->layer_specific = p_pkt_new->layer_specific;
|
||||
p_pkt->event = p_pkt_new->event;
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
p_start -= AVRC_VENDOR_HDR_SIZE;
|
||||
memcpy (p_data, p_start, AVRC_MAX_CTRL_DATA_LEN);
|
||||
/* use AVRC start packet type */
|
||||
@ -1077,9 +1010,7 @@ UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt)
|
||||
avrc_prep_end_frag (handle);
|
||||
AVRC_TRACE_DEBUG ("%s p_pkt len:%d/%d, next len:%d", __func__,
|
||||
p_pkt->len, len, p_fcb->p_fmsg->len );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVRC_TRACE_ERROR ("AVRC_MsgReq no buffers for fragmentation" );
|
||||
GKI_freebuf(p_pkt);
|
||||
return AVRC_NO_RESOURCES;
|
||||
@ -1121,13 +1052,13 @@ UINT16 AVRC_PassCmd(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
assert(p_msg != NULL);
|
||||
if (p_msg)
|
||||
{
|
||||
if (p_msg) {
|
||||
p_msg->hdr.ctype = AVRC_CMD_CTRL;
|
||||
p_buf = avrc_pass_msg(p_msg);
|
||||
if (p_buf)
|
||||
if (p_buf) {
|
||||
return AVCT_MsgReq( handle, label, AVCT_CMD, p_buf);
|
||||
}
|
||||
}
|
||||
return AVRC_NO_RESOURCES;
|
||||
}
|
||||
|
||||
@ -1160,12 +1091,12 @@ UINT16 AVRC_PassRsp(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
assert(p_msg != NULL);
|
||||
if (p_msg)
|
||||
{
|
||||
if (p_msg) {
|
||||
p_buf = avrc_pass_msg(p_msg);
|
||||
if (p_buf)
|
||||
if (p_buf) {
|
||||
return AVCT_MsgReq( handle, label, AVCT_RSP, p_buf);
|
||||
}
|
||||
}
|
||||
return AVRC_NO_RESOURCES;
|
||||
}
|
||||
|
||||
|
40
components/bt/bluedroid/stack/avrc/avrc_bld_ct.c
Executable file → Normal file
40
components/bt/bluedroid/stack/avrc/avrc_bld_ct.c
Executable file → Normal file
@ -98,7 +98,7 @@ static tAVRC_STS avrc_bld_set_abs_volume_cmd (tAVRC_SET_VOLUME_CMD *p_cmd, BT_HD
|
||||
** Otherwise, the error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
static tAVRC_STS avrc_bld_vol_change_notfn(BT_HDR * p_pkt)
|
||||
static tAVRC_STS avrc_bld_vol_change_notfn(BT_HDR *p_pkt)
|
||||
{
|
||||
UINT8 *p_data, *p_start;
|
||||
|
||||
@ -109,7 +109,7 @@ static tAVRC_STS avrc_bld_vol_change_notfn(BT_HDR * p_pkt)
|
||||
p_data = p_start + 2; /* pdu + rsvd */
|
||||
/* add fixed length 5 -*/
|
||||
UINT16_TO_BE_STREAM(p_data, 5);
|
||||
UINT8_TO_BE_STREAM(p_data,AVRC_EVT_VOLUME_CHANGE);
|
||||
UINT8_TO_BE_STREAM(p_data, AVRC_EVT_VOLUME_CHANGE);
|
||||
UINT32_TO_BE_STREAM(p_data, 0);
|
||||
p_pkt->len = (p_data - p_start);
|
||||
return AVRC_STS_NO_ERROR;
|
||||
@ -128,15 +128,14 @@ static tAVRC_STS avrc_bld_vol_change_notfn(BT_HDR * p_pkt)
|
||||
*******************************************************************************/
|
||||
static BT_HDR *avrc_bld_init_cmd_buffer(tAVRC_COMMAND *p_cmd)
|
||||
{
|
||||
UINT16 offset = 0, chnl = AVCT_DATA_CTRL, len=AVRC_META_CMD_POOL_SIZE;
|
||||
BT_HDR *p_pkt=NULL;
|
||||
UINT16 offset = 0, chnl = AVCT_DATA_CTRL, len = AVRC_META_CMD_POOL_SIZE;
|
||||
BT_HDR *p_pkt = NULL;
|
||||
UINT8 opcode;
|
||||
|
||||
opcode = avrc_opcode_from_pdu(p_cmd->pdu);
|
||||
AVRC_TRACE_API("avrc_bld_init_cmd_buffer: pdu=%x, opcode=%x", p_cmd->pdu, opcode);
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case AVRC_OP_PASS_THRU:
|
||||
offset = AVRC_MSG_PASS_THRU_OFFSET;
|
||||
break;
|
||||
@ -148,8 +147,7 @@ static BT_HDR *avrc_bld_init_cmd_buffer(tAVRC_COMMAND *p_cmd)
|
||||
|
||||
/* allocate and initialize the buffer */
|
||||
p_pkt = (BT_HDR *)GKI_getbuf(len);
|
||||
if (p_pkt)
|
||||
{
|
||||
if (p_pkt) {
|
||||
UINT8 *p_data, *p_start;
|
||||
|
||||
p_pkt->layer_specific = chnl;
|
||||
@ -159,11 +157,11 @@ static BT_HDR *avrc_bld_init_cmd_buffer(tAVRC_COMMAND *p_cmd)
|
||||
p_start = p_data;
|
||||
|
||||
/* pass thru - group navigation - has a two byte op_id, so dont do it here */
|
||||
if (opcode != AVRC_OP_PASS_THRU)
|
||||
if (opcode != AVRC_OP_PASS_THRU) {
|
||||
*p_data++ = p_cmd->pdu;
|
||||
}
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case AVRC_OP_VENDOR:
|
||||
/* reserved 0, packet_type 0 */
|
||||
UINT8_TO_BE_STREAM(p_data, 0);
|
||||
@ -197,17 +195,14 @@ tAVRC_STS AVRC_BldCommand( tAVRC_COMMAND *p_cmd, BT_HDR **pp_pkt)
|
||||
BOOLEAN alloc = FALSE;
|
||||
|
||||
AVRC_TRACE_API("AVRC_BldCommand: pdu=%x status=%x", p_cmd->cmd.pdu, p_cmd->cmd.status);
|
||||
if (!p_cmd || !pp_pkt)
|
||||
{
|
||||
if (!p_cmd || !pp_pkt) {
|
||||
AVRC_TRACE_API("AVRC_BldCommand. Invalid parameters passed. p_cmd=%p, pp_pkt=%p",
|
||||
p_cmd, pp_pkt);
|
||||
return AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
|
||||
if (*pp_pkt == NULL)
|
||||
{
|
||||
if ((*pp_pkt = avrc_bld_init_cmd_buffer(p_cmd)) == NULL)
|
||||
{
|
||||
if (*pp_pkt == NULL) {
|
||||
if ((*pp_pkt = avrc_bld_init_cmd_buffer(p_cmd)) == NULL) {
|
||||
AVRC_TRACE_API("AVRC_BldCommand: Failed to initialize command buffer");
|
||||
return AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
@ -216,8 +211,7 @@ tAVRC_STS AVRC_BldCommand( tAVRC_COMMAND *p_cmd, BT_HDR **pp_pkt)
|
||||
status = AVRC_STS_NO_ERROR;
|
||||
p_pkt = *pp_pkt;
|
||||
|
||||
switch (p_cmd->pdu)
|
||||
{
|
||||
switch (p_cmd->pdu) {
|
||||
case AVRC_PDU_REQUEST_CONTINUATION_RSP: /* 0x40 */
|
||||
status = avrc_bld_next_cmd(&p_cmd->continu, p_pkt);
|
||||
break;
|
||||
@ -233,15 +227,15 @@ tAVRC_STS AVRC_BldCommand( tAVRC_COMMAND *p_cmd, BT_HDR **pp_pkt)
|
||||
|
||||
case AVRC_PDU_REGISTER_NOTIFICATION: /* 0x31 */
|
||||
#if (AVRC_ADV_CTRL_INCLUDED == TRUE)
|
||||
if(AVRC_EVT_VOLUME_CHANGE==p_cmd->reg_notif.event_id)
|
||||
status=avrc_bld_vol_change_notfn(p_pkt);
|
||||
if (AVRC_EVT_VOLUME_CHANGE == p_cmd->reg_notif.event_id) {
|
||||
status = avrc_bld_vol_change_notfn(p_pkt);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (alloc && (status != AVRC_STS_NO_ERROR) )
|
||||
{
|
||||
if (alloc && (status != AVRC_STS_NO_ERROR) ) {
|
||||
GKI_freebuf(p_pkt);
|
||||
*pp_pkt = NULL;
|
||||
}
|
||||
|
194
components/bt/bluedroid/stack/avrc/avrc_bld_tg.c
Executable file → Normal file
194
components/bt/bluedroid/stack/avrc/avrc_bld_tg.c
Executable file → Normal file
@ -49,8 +49,7 @@ static tAVRC_STS avrc_bld_get_capability_rsp (tAVRC_GET_CAPS_RSP *p_rsp, BT_HDR
|
||||
UINT8 *p_event_id;
|
||||
tAVRC_STS status = AVRC_STS_NO_ERROR;
|
||||
|
||||
if (!(AVRC_IS_VALID_CAP_ID(p_rsp->capability_id)))
|
||||
{
|
||||
if (!(AVRC_IS_VALID_CAP_ID(p_rsp->capability_id))) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_get_capability_rsp bad parameter. p_rsp: %x", (int)p_rsp);
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
return status;
|
||||
@ -65,35 +64,26 @@ static tAVRC_STS avrc_bld_get_capability_rsp (tAVRC_GET_CAPS_RSP *p_rsp, BT_HDR
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->capability_id);
|
||||
p_count = p_data;
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
if (len == 0) {
|
||||
*p_count = p_rsp->count;
|
||||
p_data++;
|
||||
len = 2; /* move past the capability_id and count */
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data = p_start + p_pkt->len;
|
||||
*p_count += p_rsp->count;
|
||||
}
|
||||
|
||||
if (p_rsp->capability_id == AVRC_CAP_COMPANY_ID)
|
||||
{
|
||||
if (p_rsp->capability_id == AVRC_CAP_COMPANY_ID) {
|
||||
p_company_id = p_rsp->param.company_id;
|
||||
for (xx=0; xx< p_rsp->count; xx++)
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->count; xx++) {
|
||||
UINT24_TO_BE_STREAM(p_data, p_company_id[xx]);
|
||||
}
|
||||
len += p_rsp->count * 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_event_id = p_rsp->param.event_id;
|
||||
*p_count = 0;
|
||||
for (xx=0; xx< p_rsp->count; xx++)
|
||||
{
|
||||
if (AVRC_IS_VALID_EVENT_ID(p_event_id[xx]))
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->count; xx++) {
|
||||
if (AVRC_IS_VALID_EVENT_ID(p_event_id[xx])) {
|
||||
(*p_count)++;
|
||||
UINT8_TO_BE_STREAM(p_data, p_event_id[xx]);
|
||||
}
|
||||
@ -131,21 +121,16 @@ static tAVRC_STS avrc_bld_list_app_settings_attr_rsp (tAVRC_LIST_APP_ATTR_RSP *p
|
||||
|
||||
BE_STREAM_TO_UINT16(len, p_data);
|
||||
p_num = p_data;
|
||||
if (len == 0)
|
||||
{
|
||||
if (len == 0) {
|
||||
/* first time initialize the attribute count */
|
||||
*p_num = 0;
|
||||
p_data++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data = p_start + p_pkt->len;
|
||||
}
|
||||
|
||||
for (xx=0; xx<p_rsp->num_attr; xx++)
|
||||
{
|
||||
if(AVRC_IsValidPlayerAttr(p_rsp->attrs[xx]))
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->num_attr; xx++) {
|
||||
if (AVRC_IsValidPlayerAttr(p_rsp->attrs[xx])) {
|
||||
(*p_num)++;
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->attrs[xx]);
|
||||
}
|
||||
@ -185,20 +170,16 @@ static tAVRC_STS avrc_bld_list_app_settings_values_rsp (tAVRC_LIST_APP_VALUES_RS
|
||||
BE_STREAM_TO_UINT16(len, p_data);
|
||||
p_num = p_data;
|
||||
/* first time initialize the attribute count */
|
||||
if (len == 0)
|
||||
{
|
||||
if (len == 0) {
|
||||
*p_num = p_rsp->num_val;
|
||||
p_data++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data = p_start + p_pkt->len;
|
||||
*p_num += p_rsp->num_val;
|
||||
}
|
||||
|
||||
|
||||
for (xx=0; xx<p_rsp->num_val; xx++)
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->num_val; xx++) {
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->vals[xx]);
|
||||
}
|
||||
|
||||
@ -226,8 +207,7 @@ static tAVRC_STS avrc_bld_get_cur_app_setting_value_rsp (tAVRC_GET_CUR_APP_VALUE
|
||||
UINT16 len;
|
||||
UINT8 xx;
|
||||
|
||||
if (!p_rsp->p_vals)
|
||||
{
|
||||
if (!p_rsp->p_vals) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_get_cur_app_setting_value_rsp NULL parameter");
|
||||
return AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
@ -239,21 +219,16 @@ static tAVRC_STS avrc_bld_get_cur_app_setting_value_rsp (tAVRC_GET_CUR_APP_VALUE
|
||||
|
||||
BE_STREAM_TO_UINT16(len, p_data);
|
||||
p_count = p_data;
|
||||
if (len == 0)
|
||||
{
|
||||
if (len == 0) {
|
||||
/* first time initialize the attribute count */
|
||||
*p_count = 0;
|
||||
p_data++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data = p_start + p_pkt->len;
|
||||
}
|
||||
|
||||
for (xx=0; xx<p_rsp->num_val; xx++)
|
||||
{
|
||||
if (avrc_is_valid_player_attrib_value(p_rsp->p_vals[xx].attr_id, p_rsp->p_vals[xx].attr_val))
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->num_val; xx++) {
|
||||
if (avrc_is_valid_player_attrib_value(p_rsp->p_vals[xx].attr_id, p_rsp->p_vals[xx].attr_val)) {
|
||||
(*p_count)++;
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->p_vals[xx].attr_id);
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->p_vals[xx].attr_val);
|
||||
@ -306,8 +281,7 @@ static tAVRC_STS avrc_bld_app_setting_text_rsp (tAVRC_GET_APP_ATTR_TXT_RSP *p_rs
|
||||
tAVRC_STS sts = AVRC_STS_NO_ERROR;
|
||||
UINT8 num_added = 0;
|
||||
|
||||
if (!p_rsp->p_attrs)
|
||||
{
|
||||
if (!p_rsp->p_attrs) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_app_setting_text_rsp NULL parameter");
|
||||
return AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
@ -319,28 +293,22 @@ static tAVRC_STS avrc_bld_app_setting_text_rsp (tAVRC_GET_APP_ATTR_TXT_RSP *p_rs
|
||||
BE_STREAM_TO_UINT16(len, p_data);
|
||||
p_count = p_data;
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
if (len == 0) {
|
||||
*p_count = 0;
|
||||
p_data++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data = p_start + p_pkt->len;
|
||||
}
|
||||
|
||||
for (xx=0; xx<p_rsp->num_attr; xx++)
|
||||
{
|
||||
if (len_left < (p_rsp->p_attrs[xx].str_len + 4))
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->num_attr; xx++) {
|
||||
if (len_left < (p_rsp->p_attrs[xx].str_len + 4)) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_app_setting_text_rsp out of room %d(str_len:%d, left:%d)",
|
||||
xx, p_rsp->p_attrs[xx].str_len, len_left);
|
||||
p_rsp->num_attr = num_added;
|
||||
sts = AVRC_STS_INTERNAL_ERR;
|
||||
break;
|
||||
}
|
||||
if ( !p_rsp->p_attrs[xx].str_len || !p_rsp->p_attrs[xx].p_str )
|
||||
{
|
||||
if ( !p_rsp->p_attrs[xx].str_len || !p_rsp->p_attrs[xx].p_str ) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_app_setting_text_rsp NULL attr text[%d]", xx);
|
||||
continue;
|
||||
}
|
||||
@ -454,8 +422,7 @@ static tAVRC_STS avrc_bld_get_elem_attrs_rsp (tAVRC_GET_ELEM_ATTRS_RSP *p_rsp, B
|
||||
UINT8 xx;
|
||||
|
||||
AVRC_TRACE_API("avrc_bld_get_elem_attrs_rsp");
|
||||
if (!p_rsp->p_attrs)
|
||||
{
|
||||
if (!p_rsp->p_attrs) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_get_elem_attrs_rsp NULL parameter");
|
||||
return AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
@ -467,25 +434,19 @@ static tAVRC_STS avrc_bld_get_elem_attrs_rsp (tAVRC_GET_ELEM_ATTRS_RSP *p_rsp, B
|
||||
BE_STREAM_TO_UINT16(len, p_data);
|
||||
p_count = p_data;
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
if (len == 0) {
|
||||
*p_count = 0;
|
||||
p_data++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_data = p_start + p_pkt->len;
|
||||
}
|
||||
|
||||
for (xx=0; xx<p_rsp->num_attr; xx++)
|
||||
{
|
||||
if (!AVRC_IS_VALID_MEDIA_ATTRIBUTE(p_rsp->p_attrs[xx].attr_id))
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->num_attr; xx++) {
|
||||
if (!AVRC_IS_VALID_MEDIA_ATTRIBUTE(p_rsp->p_attrs[xx].attr_id)) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_get_elem_attrs_rsp invalid attr id[%d]: %d", xx, p_rsp->p_attrs[xx].attr_id);
|
||||
continue;
|
||||
}
|
||||
if ( !p_rsp->p_attrs[xx].name.p_str )
|
||||
{
|
||||
if ( !p_rsp->p_attrs[xx].name.p_str ) {
|
||||
p_rsp->p_attrs[xx].name.str_len = 0;
|
||||
}
|
||||
UINT32_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].attr_id);
|
||||
@ -554,18 +515,14 @@ static tAVRC_STS avrc_bld_notify_rsp (tAVRC_REG_NOTIF_RSP *p_rsp, BT_HDR *p_pkt)
|
||||
p_data += 2;
|
||||
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->event_id);
|
||||
switch (p_rsp->event_id)
|
||||
{
|
||||
switch (p_rsp->event_id) {
|
||||
case AVRC_EVT_PLAY_STATUS_CHANGE: /* 0x01 */
|
||||
/* p_rsp->param.play_status >= AVRC_PLAYSTATE_STOPPED is always TRUE */
|
||||
if ((p_rsp->param.play_status <= AVRC_PLAYSTATE_REV_SEEK) ||
|
||||
(p_rsp->param.play_status == AVRC_PLAYSTATE_ERROR) )
|
||||
{
|
||||
(p_rsp->param.play_status == AVRC_PLAYSTATE_ERROR) ) {
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->param.play_status);
|
||||
len = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVRC_TRACE_ERROR("bad play state");
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
@ -587,58 +544,48 @@ static tAVRC_STS avrc_bld_notify_rsp (tAVRC_REG_NOTIF_RSP *p_rsp, BT_HDR *p_pkt)
|
||||
break;
|
||||
|
||||
case AVRC_EVT_BATTERY_STATUS_CHANGE: /* 0x06 */
|
||||
if (AVRC_IS_VALID_BATTERY_STATUS(p_rsp->param.battery_status))
|
||||
{
|
||||
if (AVRC_IS_VALID_BATTERY_STATUS(p_rsp->param.battery_status)) {
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->param.battery_status);
|
||||
len = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVRC_TRACE_ERROR("bad battery status");
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_EVT_SYSTEM_STATUS_CHANGE: /* 0x07 */
|
||||
if (AVRC_IS_VALID_SYSTEM_STATUS(p_rsp->param.system_status))
|
||||
{
|
||||
if (AVRC_IS_VALID_SYSTEM_STATUS(p_rsp->param.system_status)) {
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->param.system_status);
|
||||
len = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVRC_TRACE_ERROR("bad system status");
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_EVT_APP_SETTING_CHANGE: /* 0x08 */
|
||||
if (p_rsp->param.player_setting.num_attr > AVRC_MAX_APP_SETTINGS)
|
||||
if (p_rsp->param.player_setting.num_attr > AVRC_MAX_APP_SETTINGS) {
|
||||
p_rsp->param.player_setting.num_attr = AVRC_MAX_APP_SETTINGS;
|
||||
}
|
||||
|
||||
if (p_rsp->param.player_setting.num_attr > 0)
|
||||
{
|
||||
if (p_rsp->param.player_setting.num_attr > 0) {
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->param.player_setting.num_attr);
|
||||
len = 2;
|
||||
for (xx=0; xx<p_rsp->param.player_setting.num_attr; xx++)
|
||||
{
|
||||
for (xx = 0; xx < p_rsp->param.player_setting.num_attr; xx++) {
|
||||
if (avrc_is_valid_player_attrib_value(p_rsp->param.player_setting.attr_id[xx],
|
||||
p_rsp->param.player_setting.attr_value[xx]))
|
||||
{
|
||||
p_rsp->param.player_setting.attr_value[xx])) {
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->param.player_setting.attr_id[xx]);
|
||||
UINT8_TO_BE_STREAM(p_data, p_rsp->param.player_setting.attr_value[xx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVRC_TRACE_ERROR("bad player app seeting attribute or value");
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
break;
|
||||
}
|
||||
len += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -688,14 +635,13 @@ tAVRC_STS avrc_bld_group_navigation_rsp (UINT16 navi_id, BT_HDR *p_pkt)
|
||||
{
|
||||
UINT8 *p_data;
|
||||
|
||||
if (!AVRC_IS_VALID_GROUP(navi_id))
|
||||
{
|
||||
if (!AVRC_IS_VALID_GROUP(navi_id)) {
|
||||
AVRC_TRACE_ERROR("avrc_bld_group_navigation_rsp bad navigation op id: %d", navi_id);
|
||||
return AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
|
||||
AVRC_TRACE_API("avrc_bld_group_navigation_rsp");
|
||||
p_data = (UINT8 *)(p_pkt+1) + p_pkt->offset;
|
||||
p_data = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
|
||||
UINT16_TO_BE_STREAM(p_data, navi_id);
|
||||
p_pkt->len = 2;
|
||||
return AVRC_STS_NO_ERROR;
|
||||
@ -740,36 +686,34 @@ static tAVRC_STS avrc_bld_rejected_rsp( tAVRC_RSP *p_rsp, BT_HDR *p_pkt )
|
||||
*******************************************************************************/
|
||||
static BT_HDR *avrc_bld_init_rsp_buffer(tAVRC_RESPONSE *p_rsp)
|
||||
{
|
||||
UINT16 offset = AVRC_MSG_PASS_THRU_OFFSET, chnl = AVCT_DATA_CTRL, len=AVRC_META_CMD_POOL_SIZE;
|
||||
BT_HDR *p_pkt=NULL;
|
||||
UINT16 offset = AVRC_MSG_PASS_THRU_OFFSET, chnl = AVCT_DATA_CTRL, len = AVRC_META_CMD_POOL_SIZE;
|
||||
BT_HDR *p_pkt = NULL;
|
||||
UINT8 opcode = avrc_opcode_from_pdu(p_rsp->pdu);
|
||||
|
||||
AVRC_TRACE_API("avrc_bld_init_rsp_buffer: pdu=%x, opcode=%x/%x", p_rsp->pdu, opcode,
|
||||
p_rsp->rsp.opcode);
|
||||
if (opcode != p_rsp->rsp.opcode && p_rsp->rsp.status != AVRC_STS_NO_ERROR &&
|
||||
avrc_is_valid_opcode(p_rsp->rsp.opcode))
|
||||
{
|
||||
avrc_is_valid_opcode(p_rsp->rsp.opcode)) {
|
||||
opcode = p_rsp->rsp.opcode;
|
||||
AVRC_TRACE_API("opcode=%x", opcode);
|
||||
}
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case AVRC_OP_PASS_THRU:
|
||||
offset = AVRC_MSG_PASS_THRU_OFFSET;
|
||||
break;
|
||||
|
||||
case AVRC_OP_VENDOR:
|
||||
offset = AVRC_MSG_VENDOR_OFFSET;
|
||||
if (p_rsp->pdu == AVRC_PDU_GET_ELEMENT_ATTR)
|
||||
if (p_rsp->pdu == AVRC_PDU_GET_ELEMENT_ATTR) {
|
||||
len = AVRC_BROWSE_POOL_SIZE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* allocate and initialize the buffer */
|
||||
p_pkt = (BT_HDR *)GKI_getbuf(len);
|
||||
if (p_pkt)
|
||||
{
|
||||
if (p_pkt) {
|
||||
UINT8 *p_data, *p_start;
|
||||
|
||||
p_pkt->layer_specific = chnl;
|
||||
@ -779,11 +723,11 @@ static BT_HDR *avrc_bld_init_rsp_buffer(tAVRC_RESPONSE *p_rsp)
|
||||
p_start = p_data;
|
||||
|
||||
/* pass thru - group navigation - has a two byte op_id, so dont do it here */
|
||||
if (opcode != AVRC_OP_PASS_THRU)
|
||||
if (opcode != AVRC_OP_PASS_THRU) {
|
||||
*p_data++ = p_rsp->pdu;
|
||||
}
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case AVRC_OP_VENDOR:
|
||||
/* reserved 0, packet_type 0 */
|
||||
UINT8_TO_BE_STREAM(p_data, 0);
|
||||
@ -817,17 +761,14 @@ tAVRC_STS AVRC_BldResponse( UINT8 handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt
|
||||
BOOLEAN alloc = FALSE;
|
||||
UNUSED(handle);
|
||||
|
||||
if (!p_rsp || !pp_pkt)
|
||||
{
|
||||
if (!p_rsp || !pp_pkt) {
|
||||
AVRC_TRACE_API("AVRC_BldResponse. Invalid parameters passed. p_rsp=%p, pp_pkt=%p",
|
||||
p_rsp, pp_pkt);
|
||||
return AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
|
||||
if (*pp_pkt == NULL)
|
||||
{
|
||||
if ((*pp_pkt = avrc_bld_init_rsp_buffer(p_rsp)) == NULL)
|
||||
{
|
||||
if (*pp_pkt == NULL) {
|
||||
if ((*pp_pkt = avrc_bld_init_rsp_buffer(p_rsp)) == NULL) {
|
||||
AVRC_TRACE_API("AVRC_BldResponse: Failed to initialize response buffer");
|
||||
return AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
@ -837,13 +778,11 @@ tAVRC_STS AVRC_BldResponse( UINT8 handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt
|
||||
p_pkt = *pp_pkt;
|
||||
|
||||
AVRC_TRACE_API("AVRC_BldResponse: pdu=%x status=%x", p_rsp->rsp.pdu, p_rsp->rsp.status);
|
||||
if (p_rsp->rsp.status != AVRC_STS_NO_ERROR)
|
||||
{
|
||||
return( avrc_bld_rejected_rsp(&p_rsp->rsp, p_pkt) );
|
||||
if (p_rsp->rsp.status != AVRC_STS_NO_ERROR) {
|
||||
return ( avrc_bld_rejected_rsp(&p_rsp->rsp, p_pkt) );
|
||||
}
|
||||
|
||||
switch (p_rsp->pdu)
|
||||
{
|
||||
switch (p_rsp->pdu) {
|
||||
case AVRC_PDU_NEXT_GROUP:
|
||||
case AVRC_PDU_PREV_GROUP:
|
||||
status = avrc_bld_group_navigation_rsp(p_rsp->pdu, p_pkt);
|
||||
@ -906,8 +845,7 @@ tAVRC_STS AVRC_BldResponse( UINT8 handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt
|
||||
break;
|
||||
}
|
||||
|
||||
if (alloc && (status != AVRC_STS_NO_ERROR) )
|
||||
{
|
||||
if (alloc && (status != AVRC_STS_NO_ERROR) ) {
|
||||
GKI_freebuf(p_pkt);
|
||||
*pp_pkt = NULL;
|
||||
}
|
||||
|
27
components/bt/bluedroid/stack/avrc/avrc_opt.c
Executable file → Normal file
27
components/bt/bluedroid/stack/avrc/avrc_opt.c
Executable file → Normal file
@ -46,7 +46,7 @@
|
||||
** NULL if p_msg is NULL.
|
||||
**
|
||||
******************************************************************************/
|
||||
static BT_HDR * avrc_vendor_msg(tAVRC_MSG_VENDOR *p_msg)
|
||||
static BT_HDR *avrc_vendor_msg(tAVRC_MSG_VENDOR *p_msg)
|
||||
{
|
||||
BT_HDR *p_cmd;
|
||||
UINT8 *p_data;
|
||||
@ -54,10 +54,10 @@ static BT_HDR * avrc_vendor_msg(tAVRC_MSG_VENDOR *p_msg)
|
||||
assert(p_msg != NULL);
|
||||
|
||||
#if AVRC_METADATA_INCLUDED == TRUE
|
||||
assert(AVRC_META_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->vendor_len));
|
||||
assert(AVRC_META_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN + p_msg->vendor_len));
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_META_CMD_POOL_ID)) != NULL)
|
||||
#else
|
||||
assert(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->vendor_len));
|
||||
assert(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN + p_msg->vendor_len));
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL)
|
||||
#endif
|
||||
{
|
||||
@ -67,8 +67,7 @@ static BT_HDR * avrc_vendor_msg(tAVRC_MSG_VENDOR *p_msg)
|
||||
*p_data++ = (p_msg->hdr.subunit_type << AVRC_SUBTYPE_SHIFT) | p_msg->hdr.subunit_id;
|
||||
*p_data++ = AVRC_OP_VENDOR;
|
||||
AVRC_CO_ID_TO_BE_STREAM(p_data, p_msg->company_id);
|
||||
if(p_msg->vendor_len && p_msg->p_vendor_data)
|
||||
{
|
||||
if (p_msg->vendor_len && p_msg->p_vendor_data) {
|
||||
memcpy(p_data, p_msg->p_vendor_data, p_msg->vendor_len);
|
||||
}
|
||||
p_cmd->len = (UINT16) (p_data + p_msg->vendor_len - (UINT8 *)(p_cmd + 1) - p_cmd->offset);
|
||||
@ -103,8 +102,7 @@ UINT16 AVRC_UnitCmd(UINT8 handle, UINT8 label)
|
||||
BT_HDR *p_cmd;
|
||||
UINT8 *p_data;
|
||||
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL)
|
||||
{
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL) {
|
||||
p_cmd->offset = AVCT_MSG_OFFSET;
|
||||
p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset;
|
||||
*p_data++ = AVRC_CMD_STATUS;
|
||||
@ -148,15 +146,14 @@ UINT16 AVRC_SubCmd(UINT8 handle, UINT8 label, UINT8 page)
|
||||
BT_HDR *p_cmd;
|
||||
UINT8 *p_data;
|
||||
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL)
|
||||
{
|
||||
if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL) {
|
||||
p_cmd->offset = AVCT_MSG_OFFSET;
|
||||
p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset;
|
||||
*p_data++ = AVRC_CMD_STATUS;
|
||||
/* unit & id ignore */
|
||||
*p_data++ = (AVRC_SUB_UNIT << AVRC_SUBTYPE_SHIFT) | AVRC_SUBID_IGNORE;
|
||||
*p_data++ = AVRC_OP_SUB_INFO;
|
||||
*p_data++ = ((page&AVRC_SUB_PAGE_MASK) << AVRC_SUB_PAGE_SHIFT) | AVRC_SUB_EXT_CODE;
|
||||
*p_data++ = ((page & AVRC_SUB_PAGE_MASK) << AVRC_SUB_PAGE_SHIFT) | AVRC_SUB_EXT_CODE;
|
||||
memset(p_data, AVRC_CMD_OPRND_PAD, AVRC_SUB_OPRND_BYTES);
|
||||
p_cmd->len = p_data + AVRC_SUB_OPRND_BYTES - (UINT8 *)(p_cmd + 1) - p_cmd->offset;
|
||||
p_cmd->layer_specific = AVCT_DATA_CTRL;
|
||||
@ -190,10 +187,11 @@ UINT16 AVRC_SubCmd(UINT8 handle, UINT8 label, UINT8 page)
|
||||
UINT16 AVRC_VendorCmd(UINT8 handle, UINT8 label, tAVRC_MSG_VENDOR *p_msg)
|
||||
{
|
||||
BT_HDR *p_buf = avrc_vendor_msg(p_msg);
|
||||
if (p_buf)
|
||||
if (p_buf) {
|
||||
return AVCT_MsgReq( handle, label, AVCT_CMD, p_buf);
|
||||
else
|
||||
} else {
|
||||
return AVCT_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -225,10 +223,11 @@ UINT16 AVRC_VendorCmd(UINT8 handle, UINT8 label, tAVRC_MSG_VENDOR *p_msg)
|
||||
UINT16 AVRC_VendorRsp(UINT8 handle, UINT8 label, tAVRC_MSG_VENDOR *p_msg)
|
||||
{
|
||||
BT_HDR *p_buf = avrc_vendor_msg(p_msg);
|
||||
if (p_buf)
|
||||
if (p_buf) {
|
||||
return AVCT_MsgReq( handle, label, AVCT_RSP, p_buf);
|
||||
else
|
||||
} else {
|
||||
return AVCT_NO_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* #if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE) */
|
||||
|
41
components/bt/bluedroid/stack/avrc/avrc_pars_ct.c
Executable file → Normal file
41
components/bt/bluedroid/stack/avrc/avrc_pars_ct.c
Executable file → Normal file
@ -47,36 +47,35 @@ static tAVRC_STS avrc_pars_vendor_rsp(tAVRC_MSG_VENDOR *p_msg, tAVRC_RESPONSE *p
|
||||
tAVRC_STS status = AVRC_STS_NO_ERROR;
|
||||
UINT8 *p;
|
||||
UINT16 len;
|
||||
UINT8 eventid=0;
|
||||
UINT8 eventid = 0;
|
||||
|
||||
/* Check the vendor data */
|
||||
if (p_msg->vendor_len == 0)
|
||||
if (p_msg->vendor_len == 0) {
|
||||
return AVRC_STS_NO_ERROR;
|
||||
if (p_msg->p_vendor_data == NULL)
|
||||
}
|
||||
if (p_msg->p_vendor_data == NULL) {
|
||||
return AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
p = p_msg->p_vendor_data;
|
||||
BE_STREAM_TO_UINT8 (p_result->pdu, p);
|
||||
p++; /* skip the reserved/packe_type byte */
|
||||
BE_STREAM_TO_UINT16 (len, p);
|
||||
AVRC_TRACE_DEBUG("avrc_pars_vendor_rsp() ctype:0x%x pdu:0x%x, len:%d/0x%x", p_msg->hdr.ctype, p_result->pdu, len, len);
|
||||
if (p_msg->hdr.ctype == AVRC_RSP_REJ)
|
||||
{
|
||||
if (p_msg->hdr.ctype == AVRC_RSP_REJ) {
|
||||
p_result->rsp.status = *p;
|
||||
return p_result->rsp.status;
|
||||
}
|
||||
|
||||
switch (p_result->pdu)
|
||||
{
|
||||
switch (p_result->pdu) {
|
||||
/* case AVRC_PDU_REQUEST_CONTINUATION_RSP: 0x40 */
|
||||
/* case AVRC_PDU_ABORT_CONTINUATION_RSP: 0x41 */
|
||||
|
||||
#if (AVRC_ADV_CTRL_INCLUDED == TRUE)
|
||||
case AVRC_PDU_SET_ABSOLUTE_VOLUME: /* 0x50 */
|
||||
if (len != 1)
|
||||
if (len != 1) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
BE_STREAM_TO_UINT8 (p_result->volume.volume, p);
|
||||
}
|
||||
break;
|
||||
@ -85,15 +84,14 @@ static tAVRC_STS avrc_pars_vendor_rsp(tAVRC_MSG_VENDOR *p_msg, tAVRC_RESPONSE *p
|
||||
case AVRC_PDU_REGISTER_NOTIFICATION: /* 0x31 */
|
||||
#if (AVRC_ADV_CTRL_INCLUDED == TRUE)
|
||||
BE_STREAM_TO_UINT8 (eventid, p);
|
||||
if(AVRC_EVT_VOLUME_CHANGE==eventid
|
||||
&& (AVRC_RSP_CHANGED==p_msg->hdr.ctype || AVRC_RSP_INTERIM==p_msg->hdr.ctype
|
||||
|| AVRC_RSP_REJ==p_msg->hdr.ctype || AVRC_RSP_NOT_IMPL==p_msg->hdr.ctype))
|
||||
{
|
||||
p_result->reg_notif.status=p_msg->hdr.ctype;
|
||||
p_result->reg_notif.event_id=eventid;
|
||||
if (AVRC_EVT_VOLUME_CHANGE == eventid
|
||||
&& (AVRC_RSP_CHANGED == p_msg->hdr.ctype || AVRC_RSP_INTERIM == p_msg->hdr.ctype
|
||||
|| AVRC_RSP_REJ == p_msg->hdr.ctype || AVRC_RSP_NOT_IMPL == p_msg->hdr.ctype)) {
|
||||
p_result->reg_notif.status = p_msg->hdr.ctype;
|
||||
p_result->reg_notif.event_id = eventid;
|
||||
BE_STREAM_TO_UINT8 (p_result->reg_notif.param.volume, p);
|
||||
}
|
||||
AVRC_TRACE_DEBUG("avrc_pars_vendor_rsp PDU reg notif response:event %x, volume %x",eventid,
|
||||
AVRC_TRACE_DEBUG("avrc_pars_vendor_rsp PDU reg notif response:event %x, volume %x", eventid,
|
||||
p_result->reg_notif.param.volume);
|
||||
#endif /* (AVRC_ADV_CTRL_INCLUDED == TRUE) */
|
||||
break;
|
||||
@ -122,18 +120,15 @@ tAVRC_STS AVRC_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result, UINT8 *
|
||||
UNUSED(p_buf);
|
||||
UNUSED(buf_len);
|
||||
|
||||
if (p_msg && p_result)
|
||||
{
|
||||
switch (p_msg->hdr.opcode)
|
||||
{
|
||||
if (p_msg && p_result) {
|
||||
switch (p_msg->hdr.opcode) {
|
||||
case AVRC_OP_VENDOR: /* 0x00 Vendor-dependent commands */
|
||||
status = avrc_pars_vendor_rsp(&p_msg->vendor, p_result);
|
||||
break;
|
||||
|
||||
case AVRC_OP_PASS_THRU: /* 0x7C panel subunit opcode */
|
||||
status = avrc_pars_pass_thru(&p_msg->pass, &id);
|
||||
if (status == AVRC_STS_NO_ERROR)
|
||||
{
|
||||
if (status == AVRC_STS_NO_ERROR) {
|
||||
p_result->pdu = (UINT8)id;
|
||||
}
|
||||
break;
|
||||
|
150
components/bt/bluedroid/stack/avrc/avrc_pars_tg.c
Executable file → Normal file
150
components/bt/bluedroid/stack/avrc/avrc_pars_tg.c
Executable file → Normal file
@ -54,73 +54,74 @@ static tAVRC_STS avrc_pars_vendor_cmd(tAVRC_MSG_VENDOR *p_msg, tAVRC_COMMAND *p_
|
||||
UINT16 size_needed;
|
||||
|
||||
/* Check the vendor data */
|
||||
if (p_msg->vendor_len == 0)
|
||||
if (p_msg->vendor_len == 0) {
|
||||
return AVRC_STS_NO_ERROR;
|
||||
if (p_msg->p_vendor_data == NULL)
|
||||
}
|
||||
if (p_msg->p_vendor_data == NULL) {
|
||||
return AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
p = p_msg->p_vendor_data;
|
||||
p_result->pdu = *p++;
|
||||
AVRC_TRACE_DEBUG("avrc_pars_vendor_cmd() pdu:0x%x", p_result->pdu);
|
||||
if (!AVRC_IsValidAvcType (p_result->pdu, p_msg->hdr.ctype))
|
||||
{
|
||||
if (!AVRC_IsValidAvcType (p_result->pdu, p_msg->hdr.ctype)) {
|
||||
AVRC_TRACE_DEBUG("avrc_pars_vendor_cmd() detects wrong AV/C type!");
|
||||
status = AVRC_STS_BAD_CMD;
|
||||
}
|
||||
|
||||
p++; /* skip the reserved byte */
|
||||
BE_STREAM_TO_UINT16 (len, p);
|
||||
if ((len+4) != (p_msg->vendor_len))
|
||||
{
|
||||
if ((len + 4) != (p_msg->vendor_len)) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
if (status != AVRC_STS_NO_ERROR)
|
||||
if (status != AVRC_STS_NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
|
||||
switch (p_result->pdu)
|
||||
{
|
||||
switch (p_result->pdu) {
|
||||
case AVRC_PDU_GET_CAPABILITIES: /* 0x10 */
|
||||
p_result->get_caps.capability_id = *p++;
|
||||
if (!AVRC_IS_VALID_CAP_ID(p_result->get_caps.capability_id))
|
||||
if (!AVRC_IS_VALID_CAP_ID(p_result->get_caps.capability_id)) {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
else if (len != 1)
|
||||
} else if (len != 1) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_LIST_PLAYER_APP_ATTR: /* 0x11 */
|
||||
/* no additional parameters */
|
||||
if (len != 0)
|
||||
if (len != 0) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_LIST_PLAYER_APP_VALUES: /* 0x12 */
|
||||
p_result->list_app_values.attr_id = *p++;
|
||||
if (!AVRC_IS_VALID_ATTRIBUTE(p_result->list_app_values.attr_id))
|
||||
if (!AVRC_IS_VALID_ATTRIBUTE(p_result->list_app_values.attr_id)) {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
else if (len != 1)
|
||||
} else if (len != 1) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_GET_CUR_PLAYER_APP_VALUE: /* 0x13 */
|
||||
case AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT: /* 0x15 */
|
||||
BE_STREAM_TO_UINT8 (p_result->get_cur_app_val.num_attr, p);
|
||||
if (len != (p_result->get_cur_app_val.num_attr+1))
|
||||
{
|
||||
if (len != (p_result->get_cur_app_val.num_attr + 1)) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
break;
|
||||
}
|
||||
p_u8 = p_result->get_cur_app_val.attrs;
|
||||
for (xx=0, yy=0; xx< p_result->get_cur_app_val.num_attr; xx++)
|
||||
{
|
||||
for (xx = 0, yy = 0; xx < p_result->get_cur_app_val.num_attr; xx++) {
|
||||
/* only report the valid player app attributes */
|
||||
if (AVRC_IsValidPlayerAttr(*p))
|
||||
if (AVRC_IsValidPlayerAttr(*p)) {
|
||||
p_u8[yy++] = *p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
p_result->get_cur_app_val.num_attr = yy;
|
||||
if (yy == 0)
|
||||
{
|
||||
if (yy == 0) {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
break;
|
||||
@ -128,53 +129,44 @@ static tAVRC_STS avrc_pars_vendor_cmd(tAVRC_MSG_VENDOR *p_msg, tAVRC_COMMAND *p_
|
||||
case AVRC_PDU_SET_PLAYER_APP_VALUE: /* 0x14 */
|
||||
BE_STREAM_TO_UINT8 (p_result->set_app_val.num_val, p);
|
||||
size_needed = sizeof(tAVRC_APP_SETTING);
|
||||
if (p_buf && (len == ((p_result->set_app_val.num_val<<1) + 1)))
|
||||
{
|
||||
if (p_buf && (len == ((p_result->set_app_val.num_val << 1) + 1))) {
|
||||
p_result->set_app_val.p_vals = (tAVRC_APP_SETTING *)p_buf;
|
||||
p_app_set = p_result->set_app_val.p_vals;
|
||||
for (xx=0; ((xx< p_result->set_app_val.num_val) && (buf_len > size_needed)); xx++)
|
||||
{
|
||||
for (xx = 0; ((xx < p_result->set_app_val.num_val) && (buf_len > size_needed)); xx++) {
|
||||
p_app_set[xx].attr_id = *p++;
|
||||
p_app_set[xx].attr_val = *p++;
|
||||
if (!avrc_is_valid_player_attrib_value(p_app_set[xx].attr_id, p_app_set[xx].attr_val))
|
||||
if (!avrc_is_valid_player_attrib_value(p_app_set[xx].attr_id, p_app_set[xx].attr_val)) {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
if (xx != p_result->set_app_val.num_val)
|
||||
{
|
||||
}
|
||||
if (xx != p_result->set_app_val.num_val) {
|
||||
AVRC_TRACE_ERROR("AVRC_PDU_SET_PLAYER_APP_VALUE not enough room:%d orig num_val:%d",
|
||||
xx, p_result->set_app_val.num_val);
|
||||
p_result->set_app_val.num_val = xx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AVRC_TRACE_ERROR("AVRC_PDU_SET_PLAYER_APP_VALUE NULL decode buffer or bad len");
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT:/* 0x16 */
|
||||
if (len < 3)
|
||||
if (len < 3) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
BE_STREAM_TO_UINT8 (p_result->get_app_val_txt.attr_id, p);
|
||||
if (!AVRC_IS_VALID_ATTRIBUTE(p_result->get_app_val_txt.attr_id))
|
||||
if (!AVRC_IS_VALID_ATTRIBUTE(p_result->get_app_val_txt.attr_id)) {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
BE_STREAM_TO_UINT8 (p_result->get_app_val_txt.num_val, p);
|
||||
if ( (len - 2/* attr_id & num_val */) != p_result->get_app_val_txt.num_val)
|
||||
if ( (len - 2/* attr_id & num_val */) != p_result->get_app_val_txt.num_val) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_u8 = p_result->get_app_val_txt.vals;
|
||||
for (xx=0; xx< p_result->get_app_val_txt.num_val; xx++)
|
||||
{
|
||||
for (xx = 0; xx < p_result->get_app_val_txt.num_val; xx++) {
|
||||
p_u8[xx] = *p++;
|
||||
if (!avrc_is_valid_player_attrib_value(p_result->get_app_val_txt.attr_id,
|
||||
p_u8[xx]))
|
||||
{
|
||||
p_u8[xx])) {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
break;
|
||||
}
|
||||
@ -185,20 +177,18 @@ static tAVRC_STS avrc_pars_vendor_cmd(tAVRC_MSG_VENDOR *p_msg, tAVRC_COMMAND *p_
|
||||
break;
|
||||
|
||||
case AVRC_PDU_INFORM_DISPLAY_CHARSET: /* 0x17 */
|
||||
if (len < 3)
|
||||
if (len < 3) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
BE_STREAM_TO_UINT8 (p_result->inform_charset.num_id, p);
|
||||
if ( (len - 1/* num_id */) != p_result->inform_charset.num_id * 2)
|
||||
if ( (len - 1/* num_id */) != p_result->inform_charset.num_id * 2) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_u16 = p_result->inform_charset.charsets;
|
||||
if (p_result->inform_charset.num_id > AVRC_MAX_CHARSET_SIZE)
|
||||
if (p_result->inform_charset.num_id > AVRC_MAX_CHARSET_SIZE) {
|
||||
p_result->inform_charset.num_id = AVRC_MAX_CHARSET_SIZE;
|
||||
for (xx=0; xx< p_result->inform_charset.num_id; xx++)
|
||||
{
|
||||
}
|
||||
for (xx = 0; xx < p_result->inform_charset.num_id; xx++) {
|
||||
BE_STREAM_TO_UINT16 (p_u16[xx], p);
|
||||
}
|
||||
}
|
||||
@ -206,64 +196,61 @@ static tAVRC_STS avrc_pars_vendor_cmd(tAVRC_MSG_VENDOR *p_msg, tAVRC_COMMAND *p_
|
||||
break;
|
||||
|
||||
case AVRC_PDU_INFORM_BATTERY_STAT_OF_CT:/* 0x18 */
|
||||
if (len != 1)
|
||||
if (len != 1) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_result->inform_battery_status.battery_status = *p++;
|
||||
if (!AVRC_IS_VALID_BATTERY_STATUS(p_result->inform_battery_status.battery_status))
|
||||
if (!AVRC_IS_VALID_BATTERY_STATUS(p_result->inform_battery_status.battery_status)) {
|
||||
status = AVRC_STS_BAD_PARAM;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_GET_ELEMENT_ATTR: /* 0x20 */
|
||||
if (len < 9) /* UID/8 and num_attr/1 */
|
||||
if (len < 9) { /* UID/8 and num_attr/1 */
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
BE_STREAM_TO_UINT32 (u32, p);
|
||||
BE_STREAM_TO_UINT32 (u32_2, p);
|
||||
if (u32== 0 && u32_2 == 0)
|
||||
{
|
||||
if (u32 == 0 && u32_2 == 0) {
|
||||
BE_STREAM_TO_UINT8 (p_result->get_elem_attrs.num_attr, p);
|
||||
if ( (len - 9/* UID/8 and num_attr/1 */) != (p_result->get_elem_attrs.num_attr * 4))
|
||||
if ( (len - 9/* UID/8 and num_attr/1 */) != (p_result->get_elem_attrs.num_attr * 4)) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_u32 = p_result->get_elem_attrs.attrs;
|
||||
if (p_result->get_elem_attrs.num_attr > AVRC_MAX_ELEM_ATTR_SIZE)
|
||||
if (p_result->get_elem_attrs.num_attr > AVRC_MAX_ELEM_ATTR_SIZE) {
|
||||
p_result->get_elem_attrs.num_attr = AVRC_MAX_ELEM_ATTR_SIZE;
|
||||
for (xx=0; xx< p_result->get_elem_attrs.num_attr; xx++)
|
||||
{
|
||||
}
|
||||
for (xx = 0; xx < p_result->get_elem_attrs.num_attr; xx++) {
|
||||
BE_STREAM_TO_UINT32 (p_u32[xx], p);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
status = AVRC_STS_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_GET_PLAY_STATUS: /* 0x30 */
|
||||
/* no additional parameters */
|
||||
if (len != 0)
|
||||
if (len != 0) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_REGISTER_NOTIFICATION: /* 0x31 */
|
||||
if (len != 5)
|
||||
if (len != 5) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
BE_STREAM_TO_UINT8 (p_result->reg_notif.event_id, p);
|
||||
BE_STREAM_TO_UINT32 (p_result->reg_notif.param, p);
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_SET_ABSOLUTE_VOLUME:
|
||||
{
|
||||
if(len!=1)
|
||||
case AVRC_PDU_SET_ABSOLUTE_VOLUME: {
|
||||
if (len != 1) {
|
||||
status = AVRC_STS_INTERNAL_ERR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -293,18 +280,15 @@ tAVRC_STS AVRC_ParsCommand (tAVRC_MSG *p_msg, tAVRC_COMMAND *p_result, UINT8 *p_
|
||||
tAVRC_STS status = AVRC_STS_INTERNAL_ERR;
|
||||
UINT16 id;
|
||||
|
||||
if (p_msg && p_result)
|
||||
{
|
||||
switch (p_msg->hdr.opcode)
|
||||
{
|
||||
if (p_msg && p_result) {
|
||||
switch (p_msg->hdr.opcode) {
|
||||
case AVRC_OP_VENDOR: /* 0x00 Vendor-dependent commands */
|
||||
status = avrc_pars_vendor_cmd(&p_msg->vendor, p_result, p_buf, buf_len);
|
||||
break;
|
||||
|
||||
case AVRC_OP_PASS_THRU: /* 0x7C panel subunit opcode */
|
||||
status = avrc_pars_pass_thru(&p_msg->pass, &id);
|
||||
if (status == AVRC_STS_NO_ERROR)
|
||||
{
|
||||
if (status == AVRC_STS_NO_ERROR) {
|
||||
p_result->pdu = (UINT8)id;
|
||||
}
|
||||
break;
|
||||
|
56
components/bt/bluedroid/stack/avrc/avrc_sdp.c
Executable file → Normal file
56
components/bt/bluedroid/stack/avrc/avrc_sdp.c
Executable file → Normal file
@ -45,8 +45,7 @@ tAVRC_CB avrc_cb;
|
||||
#endif
|
||||
|
||||
/* update AVRC_NUM_PROTO_ELEMS if this constant is changed */
|
||||
const tSDP_PROTOCOL_ELEM avrc_proto_list [] =
|
||||
{
|
||||
const tSDP_PROTOCOL_ELEM avrc_proto_list [] = {
|
||||
{UUID_PROTOCOL_L2CAP, 1, {AVCT_PSM, 0} },
|
||||
#if SDP_AVCTP_1_4 == TRUE
|
||||
{UUID_PROTOCOL_AVCTP, 1, {AVCT_REV_1_4, 0} }
|
||||
@ -64,12 +63,14 @@ const tSDP_PROTOCOL_ELEM avrc_proto_list [] =
|
||||
};
|
||||
|
||||
#if SDP_AVRCP_1_4 == TRUE
|
||||
const tSDP_PROTO_LIST_ELEM avrc_add_proto_list [] =
|
||||
{
|
||||
{AVRC_NUM_PROTO_ELEMS,
|
||||
const tSDP_PROTO_LIST_ELEM avrc_add_proto_list [] = {
|
||||
{
|
||||
AVRC_NUM_PROTO_ELEMS,
|
||||
{
|
||||
{UUID_PROTOCOL_L2CAP, 1, {AVCT_BR_PSM, 0} },
|
||||
{UUID_PROTOCOL_AVCTP, 1, {AVCT_REV_1_3, 0} }}}
|
||||
{UUID_PROTOCOL_AVCTP, 1, {AVCT_REV_1_3, 0} }
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -149,24 +150,26 @@ UINT16 AVRC_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
ATTR_ID_BT_PROFILE_DESC_LIST,
|
||||
ATTR_ID_SERVICE_NAME,
|
||||
ATTR_ID_SUPPORTED_FEATURES,
|
||||
ATTR_ID_PROVIDER_NAME};
|
||||
ATTR_ID_PROVIDER_NAME
|
||||
};
|
||||
|
||||
AVRC_TRACE_API("AVRC_FindService uuid: %x", service_uuid);
|
||||
if( (service_uuid != UUID_SERVCLASS_AV_REM_CTRL_TARGET && service_uuid != UUID_SERVCLASS_AV_REMOTE_CONTROL) ||
|
||||
p_db == NULL || p_db->p_db == NULL || p_cback == NULL)
|
||||
if ( (service_uuid != UUID_SERVCLASS_AV_REM_CTRL_TARGET && service_uuid != UUID_SERVCLASS_AV_REMOTE_CONTROL) ||
|
||||
p_db == NULL || p_db->p_db == NULL || p_cback == NULL) {
|
||||
return AVRC_BAD_PARAM;
|
||||
}
|
||||
|
||||
/* check if it is busy */
|
||||
if( avrc_cb.service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET ||
|
||||
avrc_cb.service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL)
|
||||
if ( avrc_cb.service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET ||
|
||||
avrc_cb.service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL) {
|
||||
return AVRC_NO_RESOURCES;
|
||||
}
|
||||
|
||||
/* set up discovery database */
|
||||
uuid_list.len = LEN_UUID_16;
|
||||
uuid_list.uu.uuid16 = service_uuid;
|
||||
|
||||
if(p_db->p_attrs == NULL || p_db->num_attr == 0)
|
||||
{
|
||||
if (p_db->p_attrs == NULL || p_db->num_attr == 0) {
|
||||
p_db->p_attrs = a2d_attr_list;
|
||||
p_db->num_attr = AVRC_NUM_ATTR;
|
||||
}
|
||||
@ -174,8 +177,7 @@ UINT16 AVRC_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
result = SDP_InitDiscoveryDb(p_db->p_db, p_db->db_len, 1, &uuid_list, p_db->num_attr,
|
||||
p_db->p_attrs);
|
||||
|
||||
if (result == TRUE)
|
||||
{
|
||||
if (result == TRUE) {
|
||||
/* store service_uuid and discovery db pointer */
|
||||
avrc_cb.p_db = p_db->p_db;
|
||||
avrc_cb.service_uuid = service_uuid;
|
||||
@ -232,21 +234,20 @@ UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
|
||||
AVRC_TRACE_API("AVRC_AddRecord uuid: %x", service_uuid);
|
||||
|
||||
if( service_uuid != UUID_SERVCLASS_AV_REM_CTRL_TARGET && service_uuid != UUID_SERVCLASS_AV_REMOTE_CONTROL )
|
||||
if ( service_uuid != UUID_SERVCLASS_AV_REM_CTRL_TARGET && service_uuid != UUID_SERVCLASS_AV_REMOTE_CONTROL ) {
|
||||
return AVRC_BAD_PARAM;
|
||||
}
|
||||
|
||||
/* add service class id list */
|
||||
class_list[0] = service_uuid;
|
||||
#if SDP_AVCTP_1_4 == TRUE
|
||||
if( service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL )
|
||||
{
|
||||
if ( service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL ) {
|
||||
class_list[1] = UUID_SERVCLASS_AV_REM_CTRL_CONTROL;
|
||||
count = 2;
|
||||
}
|
||||
#else
|
||||
#if SDP_AVRCP_1_4 == TRUE
|
||||
if( service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL )
|
||||
{
|
||||
if ( service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL ) {
|
||||
class_list[1] = UUID_SERVCLASS_AV_REM_CTRL_CONTROL;
|
||||
count = 2;
|
||||
}
|
||||
@ -275,20 +276,18 @@ UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
p = temp;
|
||||
UINT16_TO_BE_STREAM(p, categories);
|
||||
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
|
||||
(UINT32)2, (UINT8*)temp);
|
||||
(UINT32)2, (UINT8 *)temp);
|
||||
|
||||
/* add provider name */
|
||||
if (p_provider_name != NULL)
|
||||
{
|
||||
if (p_provider_name != NULL) {
|
||||
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_PROVIDER_NAME, TEXT_STR_DESC_TYPE,
|
||||
(UINT32)(strlen(p_provider_name)+1), (UINT8 *) p_provider_name);
|
||||
(UINT32)(strlen(p_provider_name) + 1), (UINT8 *) p_provider_name);
|
||||
}
|
||||
|
||||
/* add service name */
|
||||
if (p_service_name != NULL)
|
||||
{
|
||||
if (p_service_name != NULL) {
|
||||
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SERVICE_NAME, TEXT_STR_DESC_TYPE,
|
||||
(UINT32)(strlen(p_service_name)+1), (UINT8 *) p_service_name);
|
||||
(UINT32)(strlen(p_service_name) + 1), (UINT8 *) p_service_name);
|
||||
}
|
||||
|
||||
/* add browse group list */
|
||||
@ -324,8 +323,9 @@ UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
******************************************************************************/
|
||||
UINT8 AVRC_SetTraceLevel (UINT8 new_level)
|
||||
{
|
||||
if (new_level != 0xFF)
|
||||
if (new_level != 0xFF) {
|
||||
avrc_cb.trace_level = new_level;
|
||||
}
|
||||
|
||||
return (avrc_cb.trace_level);
|
||||
}
|
||||
|
75
components/bt/bluedroid/stack/avrc/avrc_utils.c
Executable file → Normal file
75
components/bt/bluedroid/stack/avrc/avrc_utils.c
Executable file → Normal file
@ -37,12 +37,10 @@
|
||||
*******************************************************************************/
|
||||
BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type)
|
||||
{
|
||||
BOOLEAN result=FALSE;
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
if (avc_type < AVRC_RSP_NOT_IMPL) /* command msg */
|
||||
{
|
||||
switch (pdu_id)
|
||||
{
|
||||
if (avc_type < AVRC_RSP_NOT_IMPL) { /* command msg */
|
||||
switch (pdu_id) {
|
||||
case AVRC_PDU_GET_CAPABILITIES: /* 0x10 */
|
||||
case AVRC_PDU_LIST_PLAYER_APP_ATTR: /* 0x11 */
|
||||
case AVRC_PDU_LIST_PLAYER_APP_VALUES: /* 0x12 */
|
||||
@ -51,8 +49,9 @@ BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type)
|
||||
case AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT: /* 0x16 */
|
||||
case AVRC_PDU_GET_ELEMENT_ATTR: /* 0x20 */
|
||||
case AVRC_PDU_GET_PLAY_STATUS: /* 0x30 */
|
||||
if (avc_type == AVRC_CMD_STATUS)
|
||||
result=TRUE;
|
||||
if (avc_type == AVRC_CMD_STATUS) {
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_SET_PLAYER_APP_VALUE: /* 0x14 */
|
||||
@ -60,21 +59,22 @@ BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type)
|
||||
case AVRC_PDU_INFORM_BATTERY_STAT_OF_CT: /* 0x18 */
|
||||
case AVRC_PDU_REQUEST_CONTINUATION_RSP: /* 0x40 */
|
||||
case AVRC_PDU_ABORT_CONTINUATION_RSP: /* 0x41 */
|
||||
if (avc_type == AVRC_CMD_CTRL)
|
||||
result=TRUE;
|
||||
if (avc_type == AVRC_CMD_CTRL) {
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PDU_REGISTER_NOTIFICATION: /* 0x31 */
|
||||
if (avc_type == AVRC_CMD_NOTIF)
|
||||
result=TRUE;
|
||||
if (avc_type == AVRC_CMD_NOTIF) {
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else /* response msg */
|
||||
{
|
||||
} else { /* response msg */
|
||||
if (avc_type >= AVRC_RSP_NOT_IMPL &&
|
||||
avc_type <= AVRC_RSP_INTERIM )
|
||||
result=TRUE;
|
||||
avc_type <= AVRC_RSP_INTERIM ) {
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -91,32 +91,35 @@ BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type)
|
||||
*******************************************************************************/
|
||||
BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value)
|
||||
{
|
||||
BOOLEAN result=FALSE;
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
switch(attrib)
|
||||
{
|
||||
switch (attrib) {
|
||||
case AVRC_PLAYER_SETTING_EQUALIZER:
|
||||
if ((value > 0) &&
|
||||
(value <= AVRC_PLAYER_VAL_ON))
|
||||
result=TRUE;
|
||||
(value <= AVRC_PLAYER_VAL_ON)) {
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PLAYER_SETTING_REPEAT:
|
||||
if ((value > 0) &&
|
||||
(value <= AVRC_PLAYER_VAL_GROUP_REPEAT))
|
||||
result=TRUE;
|
||||
(value <= AVRC_PLAYER_VAL_GROUP_REPEAT)) {
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVRC_PLAYER_SETTING_SHUFFLE:
|
||||
case AVRC_PLAYER_SETTING_SCAN:
|
||||
if ((value > 0) &&
|
||||
(value <= AVRC_PLAYER_VAL_GROUP_SHUFFLE))
|
||||
result=TRUE;
|
||||
(value <= AVRC_PLAYER_VAL_GROUP_SHUFFLE)) {
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (attrib >= AVRC_PLAYER_SETTING_LOW_MENU_EXT)
|
||||
if (attrib >= AVRC_PLAYER_SETTING_LOW_MENU_EXT) {
|
||||
result = TRUE;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
AVRC_TRACE_ERROR(
|
||||
@ -137,11 +140,10 @@ BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value)
|
||||
*******************************************************************************/
|
||||
BOOLEAN AVRC_IsValidPlayerAttr(UINT8 attr)
|
||||
{
|
||||
BOOLEAN result=FALSE;
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
if ( (attr >= AVRC_PLAYER_SETTING_EQUALIZER && attr <= AVRC_PLAYER_SETTING_SCAN) ||
|
||||
(attr >= AVRC_PLAYER_SETTING_LOW_MENU_EXT) )
|
||||
{
|
||||
(attr >= AVRC_PLAYER_SETTING_LOW_MENU_EXT) ) {
|
||||
result = TRUE;
|
||||
}
|
||||
|
||||
@ -168,15 +170,12 @@ tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, UINT16 *p_vendor_unique_id)
|
||||
UINT16 id;
|
||||
tAVRC_STS status = AVRC_STS_BAD_CMD;
|
||||
|
||||
if (p_msg->op_id == AVRC_ID_VENDOR && p_msg->pass_len == AVRC_PASS_THRU_GROUP_LEN)
|
||||
{
|
||||
if (p_msg->op_id == AVRC_ID_VENDOR && p_msg->pass_len == AVRC_PASS_THRU_GROUP_LEN) {
|
||||
p_data = p_msg->p_pass_data;
|
||||
AVRC_BE_STREAM_TO_CO_ID (co_id, p_data);
|
||||
if (co_id == AVRC_CO_METADATA)
|
||||
{
|
||||
if (co_id == AVRC_CO_METADATA) {
|
||||
BE_STREAM_TO_UINT16 (id, p_data);
|
||||
if (AVRC_IS_VALID_GROUP(id))
|
||||
{
|
||||
if (AVRC_IS_VALID_GROUP(id)) {
|
||||
*p_vendor_unique_id = id;
|
||||
status = AVRC_STS_NO_ERROR;
|
||||
}
|
||||
@ -198,8 +197,7 @@ UINT8 avrc_opcode_from_pdu(UINT8 pdu)
|
||||
{
|
||||
UINT8 opcode = 0;
|
||||
|
||||
switch (pdu)
|
||||
{
|
||||
switch (pdu) {
|
||||
case AVRC_PDU_NEXT_GROUP:
|
||||
case AVRC_PDU_PREV_GROUP: /* pass thru */
|
||||
opcode = AVRC_OP_PASS_THRU;
|
||||
@ -225,8 +223,7 @@ UINT8 avrc_opcode_from_pdu(UINT8 pdu)
|
||||
BOOLEAN avrc_is_valid_opcode(UINT8 opcode)
|
||||
{
|
||||
BOOLEAN is_valid = FALSE;
|
||||
switch (opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case AVRC_OP_BROWSE:
|
||||
case AVRC_OP_PASS_THRU:
|
||||
case AVRC_OP_VENDOR:
|
||||
|
11
components/bt/bluedroid/stack/avrc/include/avrc_int.h
Executable file → Normal file
11
components/bt/bluedroid/stack/avrc/include/avrc_int.h
Executable file → Normal file
@ -98,24 +98,21 @@
|
||||
|
||||
#if (AVRC_METADATA_INCLUDED == TRUE)
|
||||
/* type for Metadata fragmentation control block */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR *p_fmsg; /* the fragmented message */
|
||||
UINT8 frag_pdu; /* the PDU ID for fragmentation */
|
||||
BOOLEAN frag_enabled; /* fragmentation flag */
|
||||
} tAVRC_FRAG_CB;
|
||||
|
||||
/* type for Metadata re-assembly control block */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BT_HDR *p_rmsg; /* the received message */
|
||||
UINT16 rasm_offset; /* re-assembly flag, the offset of the start fragment */
|
||||
UINT8 rasm_pdu; /* the PDU ID for re-assembly */
|
||||
} tAVRC_RASM_CB;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_CONN_CB ccb[AVCT_NUM_CONN];
|
||||
#if (AVRC_METADATA_INCLUDED == TRUE)
|
||||
tAVRC_FRAG_CB fcb[AVCT_NUM_CONN];
|
||||
@ -146,7 +143,7 @@ extern tAVRC_CB *avrc_cb_ptr;
|
||||
|
||||
extern BOOLEAN avrc_is_valid_pdu_id(UINT8 pdu_id);
|
||||
extern BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value);
|
||||
extern BT_HDR * avrc_alloc_ctrl_pkt (UINT8 pdu);
|
||||
extern BT_HDR *avrc_alloc_ctrl_pkt (UINT8 pdu);
|
||||
extern tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, UINT16 *p_vendor_unique_id);
|
||||
extern UINT8 avrc_opcode_from_pdu(UINT8 pdu);
|
||||
extern BOOLEAN avrc_is_valid_opcode(UINT8 opcode);
|
||||
|
12
components/bt/bluedroid/stack/include/a2d_api.h
Executable file → Normal file
12
components/bt/bluedroid/stack/include/a2d_api.h
Executable file → Normal file
@ -98,8 +98,7 @@ typedef UINT8 tA2D_STATUS;
|
||||
|
||||
/* This data type is used in A2D_FindService() to initialize the SDP database
|
||||
* to hold the result service search. */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT32 db_len; /* Length, in bytes, of the discovery database */
|
||||
UINT16 num_attr;/* The number of attributes in p_attrs */
|
||||
tSDP_DISCOVERY_DB *p_db; /* Pointer to the discovery database */
|
||||
@ -110,20 +109,19 @@ typedef struct
|
||||
} tA2D_SDP_DB_PARAMS;
|
||||
|
||||
/* This data type is used in tA2D_FIND_CBACK to report the result of the SDP discovery process. */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT16 service_len; /* Length, in bytes, of the service name */
|
||||
UINT16 provider_len; /* Length, in bytes, of the provider name */
|
||||
char * p_service_name; /* Pointer the service name. This character string may not be null terminated.
|
||||
char *p_service_name; /* Pointer the service name. This character string may not be null terminated.
|
||||
* Use the service_len parameter to safely copy this string */
|
||||
char * p_provider_name;/* Pointer the provider name. This character string may not be null terminated.
|
||||
char *p_provider_name;/* Pointer the provider name. This character string may not be null terminated.
|
||||
* Use the provider_len parameter to safely copy this string */
|
||||
UINT16 features; /* Profile supported features */
|
||||
UINT16 avdt_version; /* AVDTP protocol version */
|
||||
} tA2D_Service;
|
||||
|
||||
/* This is the callback to notify the result of the SDP discovery process. */
|
||||
typedef void (tA2D_FIND_CBACK)(BOOLEAN found, tA2D_Service * p_service);
|
||||
typedef void (tA2D_FIND_CBACK)(BOOLEAN found, tA2D_Service *p_service);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
3
components/bt/bluedroid/stack/include/a2d_sbc.h
Executable file → Normal file
3
components/bt/bluedroid/stack/include/a2d_sbc.h
Executable file → Normal file
@ -74,8 +74,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/* data type for the SBC Codec Information Element*/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 samp_freq; /* Sampling frequency */
|
||||
UINT8 ch_mode; /* Channel mode */
|
||||
UINT8 block_len; /* Block length */
|
||||
|
9
components/bt/bluedroid/stack/include/avdt_api.h
Executable file → Normal file
9
components/bt/bluedroid/stack/include/avdt_api.h
Executable file → Normal file
@ -210,8 +210,7 @@ typedef UINT8 AVDT_REPORT_TYPE;
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT32 ntp_sec; /* NTP time: seconds relative to 0h UTC on 1 January 1900 */
|
||||
UINT32 ntp_frac; /* NTP time: the fractional part */
|
||||
UINT32 rtp_time; /* timestamp in RTP header */
|
||||
@ -220,8 +219,7 @@ typedef struct
|
||||
UINT32 octet_count; /* sender's octet count: same comment */
|
||||
} tAVDT_SENDER_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 frag_lost; /* fraction lost since last RR */
|
||||
UINT32 packet_lost; /* cumulative number of packets lost since the beginning */
|
||||
UINT32 seq_num_rcvd; /* extended highest sequence number received */
|
||||
@ -230,8 +228,7 @@ typedef struct
|
||||
UINT32 dlsr; /* delay since last SR */
|
||||
} tAVDT_REPORT_BLK;
|
||||
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
tAVDT_SENDER_INFO sr;
|
||||
tAVDT_REPORT_BLK rr;
|
||||
UINT8 cname[AVDT_MAX_CNAME_SIZE + 1];
|
||||
|
10
components/bt/bluedroid/stack/include/avrc_api.h
Executable file → Normal file
10
components/bt/bluedroid/stack/include/avrc_api.h
Executable file → Normal file
@ -71,8 +71,8 @@
|
||||
* send messages. */
|
||||
#define AVRC_UNCONG_IND_EVT 3
|
||||
|
||||
/* AVRC_BROWSE_OPEN_IND_EVT event is sent when the browse channel is successfully opened.
|
||||
* This eventis sent in response to an AVRC_Open() or AVRC_OpenBrowse() . */
|
||||
/* AVRC_BROWSE_OPEN_IND_EVT event is sent when the browse channel is successfully opened.
|
||||
* This eventis sent in response to an AVRC_Open() or AVRC_OpenBrowse() . */
|
||||
#define AVRC_BROWSE_OPEN_IND_EVT 4
|
||||
|
||||
/* AVRC_BROWSE_CLOSE_IND_EVT event is sent when a browse channel is closed.
|
||||
@ -121,8 +121,7 @@
|
||||
|
||||
/* This data type is used in AVRC_FindService() to initialize the SDP database
|
||||
* to hold the result service search. */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT32 db_len; /* Length, in bytes, of the discovery database */
|
||||
tSDP_DISCOVERY_DB *p_db; /* Pointer to the discovery database */
|
||||
UINT16 num_attr;/* The number of attributes in p_attrs */
|
||||
@ -153,8 +152,7 @@ typedef void (tAVRC_CTRL_CBACK) (UINT8 handle, UINT8 event, UINT16 result,
|
||||
typedef void (tAVRC_MSG_CBACK) (UINT8 handle, UINT8 label, UINT8 opcode,
|
||||
tAVRC_MSG *p_msg);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_CTRL_CBACK *p_ctrl_cback; /* pointer to application control callback */
|
||||
tAVRC_MSG_CBACK *p_msg_cback; /* pointer to application message callback */
|
||||
UINT32 company_id; /* the company ID */
|
||||
|
173
components/bt/bluedroid/stack/include/avrc_defs.h
Executable file → Normal file
173
components/bt/bluedroid/stack/include/avrc_defs.h
Executable file → Normal file
@ -754,8 +754,7 @@ typedef UINT8 tAVRC_UID[AVRC_UID_SIZE];
|
||||
/*
|
||||
This structure contains the header parameters of an AV/C message.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 ctype; /* Command type. */
|
||||
UINT8 subunit_type; /* Subunit type. */
|
||||
UINT8 subunit_id; /* Subunit ID. This value is typically ignored in AVRCP,
|
||||
@ -765,8 +764,7 @@ typedef struct
|
||||
} tAVRC_HDR;
|
||||
|
||||
/* This structure contains a UNIT INFO message. */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_HDR hdr; /* Message header. */
|
||||
UINT32 company_id; /* Company identifier. */
|
||||
UINT8 unit_type; /* Unit type. Uses the same values as subunit type. */
|
||||
@ -774,8 +772,7 @@ typedef struct
|
||||
} tAVRC_MSG_UNIT;
|
||||
|
||||
/* This structure contains a SUBUNIT INFO message. */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_HDR hdr; /* Message header. */
|
||||
UINT8 subunit_type[AVRC_SUB_TYPE_LEN];
|
||||
/* Array containing subunit type values. */
|
||||
@ -787,8 +784,7 @@ typedef struct
|
||||
} tAVRC_MSG_SUB;
|
||||
|
||||
/* This structure contains a VENDOR DEPENDENT message. */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_HDR hdr; /* Message header. */
|
||||
UINT32 company_id; /* Company identifier. */
|
||||
UINT8 *p_vendor_data;/* Pointer to vendor dependent data. */
|
||||
@ -796,8 +792,7 @@ typedef struct
|
||||
} tAVRC_MSG_VENDOR;
|
||||
|
||||
/* PASS THROUGH message structure */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_HDR hdr; /* hdr.ctype Unused.
|
||||
* hdr.subunit_type Unused.
|
||||
* hdr.subunit_id Unused. */
|
||||
@ -814,8 +809,7 @@ typedef struct
|
||||
#define AVRC_RSP AVCT_RSP /* Response message */
|
||||
|
||||
/* Browsing channel message structure */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_HDR hdr; /* hdr.ctype AVRC_CMD or AVRC_RSP.
|
||||
* hdr.subunit_type Unused.
|
||||
* hdr.subunit_id Unused. */
|
||||
@ -825,8 +819,7 @@ typedef struct
|
||||
} tAVRC_MSG_BROWSE;
|
||||
|
||||
/* This is a union of all message type structures. */
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
tAVRC_HDR hdr; /* Message header. */
|
||||
tAVRC_MSG_UNIT unit; /* UNIT INFO message. */
|
||||
tAVRC_MSG_SUB sub; /* SUBUNIT INFO message. */
|
||||
@ -889,20 +882,17 @@ typedef struct {
|
||||
#define AVRC_CAP_MAX_NUM_EVT_ID 16
|
||||
#endif
|
||||
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
UINT32 company_id[AVRC_CAP_MAX_NUM_COMP_ID];
|
||||
UINT8 event_id[AVRC_CAP_MAX_NUM_EVT_ID];
|
||||
} tAVRC_CAPS_PARAM;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 attr_id;
|
||||
UINT8 attr_val;
|
||||
} tAVRC_APP_SETTING;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 attr_id;
|
||||
UINT16 charset_id;
|
||||
UINT8 str_len;
|
||||
@ -911,8 +901,7 @@ typedef struct
|
||||
|
||||
typedef UINT8 tAVRC_FEATURE_MASK[AVRC_FEATURE_MASK_SIZE];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT16 player_id; /* A unique identifier for this media player.*/
|
||||
UINT8 major_type; /* Use AVRC_MJ_TYPE_AUDIO, AVRC_MJ_TYPE_VIDEO, AVRC_MJ_TYPE_BC_AUDIO, or AVRC_MJ_TYPE_BC_VIDEO.*/
|
||||
UINT32 sub_type; /* Use AVRC_SUB_TYPE_NONE, AVRC_SUB_TYPE_AUDIO_BOOK, or AVRC_SUB_TYPE_PODCAST*/
|
||||
@ -922,8 +911,7 @@ typedef struct
|
||||
tAVRC_FULL_NAME name; /* The player name, name length and character set id.*/
|
||||
} tAVRC_ITEM_PLAYER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_UID uid; /* The uid of this folder */
|
||||
UINT8 type; /* Use AVRC_FOLDER_TYPE_MIXED, AVRC_FOLDER_TYPE_TITLES,
|
||||
AVRC_FOLDER_TYPE_ALNUMS, AVRC_FOLDER_TYPE_ARTISTS, AVRC_FOLDER_TYPE_GENRES,
|
||||
@ -932,28 +920,24 @@ typedef struct
|
||||
tAVRC_FULL_NAME name; /* The folder name, name length and character set id. */
|
||||
} tAVRC_ITEM_FOLDER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT32 attr_id; /* Use AVRC_MEDIA_ATTR_ID_TITLE, AVRC_MEDIA_ATTR_ID_ARTIST, AVRC_MEDIA_ATTR_ID_ALBUM,
|
||||
AVRC_MEDIA_ATTR_ID_TRACK_NUM, AVRC_MEDIA_ATTR_ID_NUM_TRACKS,
|
||||
AVRC_MEDIA_ATTR_ID_GENRE, AVRC_MEDIA_ATTR_ID_PLAYING_TIME */
|
||||
tAVRC_FULL_NAME name; /* The attribute value, value length and character set id. */
|
||||
} tAVRC_ATTR_ENTRY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
tAVRC_UID uid; /* The uid of this media element item */
|
||||
UINT8 type; /* Use AVRC_MEDIA_TYPE_AUDIO or AVRC_MEDIA_TYPE_VIDEO. */
|
||||
tAVRC_FULL_NAME name; /* The media name, name length and character set id. */
|
||||
UINT8 attr_count; /* The number of attributes in p_attr_list */
|
||||
tAVRC_ATTR_ENTRY* p_attr_list; /* Attribute entry list. */
|
||||
tAVRC_ATTR_ENTRY *p_attr_list; /* Attribute entry list. */
|
||||
} tAVRC_ITEM_MEDIA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 item_type; /* AVRC_ITEM_PLAYER, AVRC_ITEM_FOLDER, or AVRC_ITEM_MEDIA */
|
||||
union
|
||||
{
|
||||
union {
|
||||
tAVRC_ITEM_PLAYER player; /* The properties of a media player item.*/
|
||||
tAVRC_ITEM_FOLDER folder; /* The properties of a folder item.*/
|
||||
tAVRC_ITEM_MEDIA media; /* The properties of a media item.*/
|
||||
@ -961,8 +945,7 @@ typedef struct
|
||||
} tAVRC_ITEM;
|
||||
|
||||
/* GetCapability */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -970,8 +953,7 @@ typedef struct
|
||||
} tAVRC_GET_CAPS_CMD;
|
||||
|
||||
/* ListPlayerAppValues */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -979,8 +961,7 @@ typedef struct
|
||||
} tAVRC_LIST_APP_VALUES_CMD;
|
||||
|
||||
/* GetCurAppValue */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -989,8 +970,7 @@ typedef struct
|
||||
} tAVRC_GET_CUR_APP_VALUE_CMD;
|
||||
|
||||
/* SetAppValue */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -999,8 +979,7 @@ typedef struct
|
||||
} tAVRC_SET_APP_VALUE_CMD;
|
||||
|
||||
/* GetAppAttrTxt */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1009,8 +988,7 @@ typedef struct
|
||||
} tAVRC_GET_APP_ATTR_TXT_CMD;
|
||||
|
||||
/* GetAppValueTxt */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1020,8 +998,7 @@ typedef struct
|
||||
} tAVRC_GET_APP_VAL_TXT_CMD;
|
||||
|
||||
/* InformCharset */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1030,8 +1007,7 @@ typedef struct
|
||||
} tAVRC_INFORM_CHARSET_CMD;
|
||||
|
||||
/* InformBatteryStatus */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1039,8 +1015,7 @@ typedef struct
|
||||
} tAVRC_BATTERY_STATUS_CMD;
|
||||
|
||||
/* GetElemAttrs */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1049,8 +1024,7 @@ typedef struct
|
||||
} tAVRC_GET_ELEM_ATTRS_CMD;
|
||||
|
||||
/* RegNotify */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1059,8 +1033,7 @@ typedef struct
|
||||
} tAVRC_REG_NOTIF_CMD;
|
||||
|
||||
/* SetAddrPlayer */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1068,8 +1041,7 @@ typedef struct
|
||||
} tAVRC_SET_ADDR_PLAYER_CMD;
|
||||
|
||||
/* SetBrowsedPlayer */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1077,8 +1049,7 @@ typedef struct
|
||||
} tAVRC_SET_BR_PLAYER_CMD;
|
||||
|
||||
/* SetAbsVolume */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1086,8 +1057,7 @@ typedef struct
|
||||
} tAVRC_SET_VOLUME_CMD;
|
||||
|
||||
/* GetFolderItems */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1099,8 +1069,7 @@ typedef struct
|
||||
} tAVRC_GET_ITEMS_CMD;
|
||||
|
||||
/* ChangePath */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1110,8 +1079,7 @@ typedef struct
|
||||
} tAVRC_CHG_PATH_CMD;
|
||||
|
||||
/* GetItemAttrs */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1123,8 +1091,7 @@ typedef struct
|
||||
} tAVRC_GET_ATTRS_CMD;
|
||||
|
||||
/* Search */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1132,8 +1099,7 @@ typedef struct
|
||||
} tAVRC_SEARCH_CMD;
|
||||
|
||||
/* PlayItem */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1143,8 +1109,7 @@ typedef struct
|
||||
} tAVRC_PLAY_ITEM_CMD;
|
||||
|
||||
/* AddToNowPlaying */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
@ -1153,24 +1118,21 @@ typedef struct
|
||||
UINT16 uid_counter;
|
||||
} tAVRC_ADD_TO_PLAY_CMD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
} tAVRC_CMD;
|
||||
|
||||
/* Continue and Abort */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
|
||||
UINT8 target_pdu;
|
||||
} tAVRC_NEXT_CMD;
|
||||
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
UINT8 pdu;
|
||||
tAVRC_CMD cmd;
|
||||
tAVRC_GET_CAPS_CMD get_caps; /* GetCapability */
|
||||
@ -1200,8 +1162,7 @@ typedef union
|
||||
} tAVRC_COMMAND;
|
||||
|
||||
/* GetCapability */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1211,8 +1172,7 @@ typedef struct
|
||||
} tAVRC_GET_CAPS_RSP;
|
||||
|
||||
/* ListPlayerAppAttr */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1221,8 +1181,7 @@ typedef struct
|
||||
} tAVRC_LIST_APP_ATTR_RSP;
|
||||
|
||||
/* ListPlayerAppValues */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1231,8 +1190,7 @@ typedef struct
|
||||
} tAVRC_LIST_APP_VALUES_RSP;
|
||||
|
||||
/* GetCurAppValue */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1241,8 +1199,7 @@ typedef struct
|
||||
} tAVRC_GET_CUR_APP_VALUE_RSP;
|
||||
|
||||
/* GetAppAttrTxt */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1251,8 +1208,7 @@ typedef struct
|
||||
} tAVRC_GET_APP_ATTR_TXT_RSP;
|
||||
|
||||
/* GetElemAttrs */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1261,8 +1217,7 @@ typedef struct
|
||||
} tAVRC_GET_ELEM_ATTRS_RSP;
|
||||
|
||||
/* GetPlayStatus */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1272,8 +1227,7 @@ typedef struct
|
||||
} tAVRC_GET_PLAY_STATUS_RSP;
|
||||
|
||||
/* notification event parameter for AddressedPlayer change */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT16 player_id;
|
||||
UINT16 uid_counter;
|
||||
} tAVRC_ADDR_PLAYER_PARAM;
|
||||
@ -1283,15 +1237,13 @@ typedef struct
|
||||
#endif
|
||||
|
||||
/* notification event parameter for Player Application setting change */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 num_attr;
|
||||
UINT8 attr_id[AVRC_MAX_APP_SETTINGS];
|
||||
UINT8 attr_value[AVRC_MAX_APP_SETTINGS];
|
||||
} tAVRC_PLAYER_APP_PARAM;
|
||||
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
tAVRC_PLAYSTATE play_status;
|
||||
tAVRC_UID track;
|
||||
UINT32 play_pos;
|
||||
@ -1304,8 +1256,7 @@ typedef union
|
||||
} tAVRC_NOTIF_RSP_PARAM;
|
||||
|
||||
/* RegNotify */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1314,8 +1265,7 @@ typedef struct
|
||||
} tAVRC_REG_NOTIF_RSP;
|
||||
|
||||
/* SetAbsVolume */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1323,8 +1273,7 @@ typedef struct
|
||||
} tAVRC_SET_VOLUME_RSP;
|
||||
|
||||
/* SetBrowsedPlayer */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1336,8 +1285,7 @@ typedef struct
|
||||
} tAVRC_SET_BR_PLAYER_RSP;
|
||||
|
||||
/* GetFolderItems */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1347,8 +1295,7 @@ typedef struct
|
||||
} tAVRC_GET_ITEMS_RSP;
|
||||
|
||||
/* ChangePath */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1356,8 +1303,7 @@ typedef struct
|
||||
} tAVRC_CHG_PATH_RSP;
|
||||
|
||||
/* GetItemAttrs */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1366,8 +1312,7 @@ typedef struct
|
||||
} tAVRC_GET_ATTRS_RSP;
|
||||
|
||||
/* Search */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
@ -1376,15 +1321,13 @@ typedef struct
|
||||
} tAVRC_SEARCH_RSP;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UINT8 pdu;
|
||||
tAVRC_STS status;
|
||||
UINT8 opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse user. invalid one to generate according to pdu) */
|
||||
} tAVRC_RSP;
|
||||
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
UINT8 pdu;
|
||||
tAVRC_RSP rsp;
|
||||
tAVRC_GET_CAPS_RSP get_caps; /* GetCapability */
|
||||
|
Loading…
Reference in New Issue
Block a user