⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 av_headset_remote_control.c

📁 csr 蓝牙芯片 无线蓝牙耳机的嵌入式程序
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004

FILE NAME
    av_headset_remote_control.c        

DESCRIPTION
    Deals with AVRCP connection

NOTES

*/

/****************************************************************************
    Header files
*/
#include "av_headset_private.h"
#include "av_headset_remote_control.h"

/* Send response to the AVRCP lib */
static void sendRcpConnectResponse(AVRCP *avrcp, const AVRCP_CONNECT_IND_T *ind, bool accept)
{
    /* Send the connect response */
    AvrcpConnectResponse(avrcp, ind->connection_id, accept);
}

/*************************************************************************
NAME    
     avHeadsetHandleAvrcpConnectCfm
    
DESCRIPTION
     This function is called on receipt of an AVRCP_CONNECT_CFM message

RETURNS
     
*/
void avHeadsetHandleAvrcpConnectCfm(avTaskData *theAvApp, const AVRCP_CONNECT_CFM_T *cfm)
{
    if(cfm->status == avrcp_success)
    {
        /* Change to Connected state */
        theAvApp->avrcp_sink = cfm->sink;
        avHeadsetSetAvrcpState(avHeadsetAvrcpConnected);
    }
    else
    {
        DEBUG(("AVRCP Connect failed\n"));
        theAvApp->avrcp_sink = 0;

        /* Change to Ready state */
        avHeadsetSetAvrcpState(avHeadsetAvrcpReady);
    }
}

/*************************************************************************
NAME    
     avHeadsetHandleAvrcpConnectInd
    
DESCRIPTION
     This function is called on receipt of an AVRCP_CONNECT_IND message

RETURNS
     
*/
void avHeadsetHandleAvrcpConnectInd(const avTaskData *app, const AVRCP_CONNECT_IND_T *ind)
{
    bdaddr avrcp_bdaddr;
    
    (void) SinkGetBdAddr(app->avrcp_sink, &avrcp_bdaddr);

    if (avrcp_bdaddr.nap == ind->bd_addr.nap &&
        avrcp_bdaddr.uap == ind->bd_addr.uap &&
        avrcp_bdaddr.lap == ind->bd_addr.lap)
        sendRcpConnectResponse(app->avrcp, ind, 1); 
    else
        sendRcpConnectResponse(app->avrcp, ind, 0); 
}

/*************************************************************************
NAME    
     avHeadsetHandleAvrcpConnectIndReject
    
DESCRIPTION
     This function is called on receipt of an AVRCP_CONNECT_IND message

RETURNS
     
*/
void avHeadsetHandleAvrcpConnectIndReject(AVRCP *avrcp, const AVRCP_CONNECT_IND_T *ind)
{
    sendRcpConnectResponse(avrcp, ind, 0);
}


/*************************************************************************
NAME    
     avHeadsetHandleAvrcpDisconnectInd
    
DESCRIPTION
     This function is called on receipt of an AVRCP_DISCONNECT_IND message

RETURNS
     
*/
void avHeadsetHandleAvrcpDisconnectInd(void)
{
    /* Change to Ready state */
    avHeadsetSetAvrcpState(avHeadsetAvrcpReady);    
}


/*************************************************************************
NAME    
     avHeadsetHandleAvrcpPassthroughInd
    
DESCRIPTION
     This function is called on receipt of an AVRCP_PASSTHROUGH_IND message

RETURNS
     
*/
void avHeadsetHandleAvrcpPassthroughInd(const AVRCP_PASSTHROUGH_IND_T *ind)
{
    /* Acknowledge the request */
    AvrcpPassthroughResponse(ind->avrcp, avctp_response_not_implemented);
}

/*************************************************************************
NAME    
     avHeadetHandleAvrcpUnitInfo
    
DESCRIPTION
     This function is called on receipt of an AVRCP_UNITINFO_IND message

RETURNS
     
*/
void avHeadetHandleAvrcpUnitInfo(const AVRCP_UNITINFO_IND_T *ind)
{
    /*
        We are not a target so reject UnitInfo requests
    */
    AvrcpUnitInfoResponse(ind->avrcp, FALSE, subunit_monitor, 0, (uint32) 0);
}

/*************************************************************************
NAME    
     avHeadetHandleAvrcpSubUnitInfo
    
DESCRIPTION
     This function is called on receipt of an AVRCP_SUBUNITINFO_IND message

RETURNS
     
*/
void avHeadetHandleAvrcpSubUnitInfo(const AVRCP_SUBUNITINFO_IND_T *ind)
{
    /*
        We are not a target so reject SubUnitInfo requests
    */
    AvrcpSubUnitInfoResponse(ind->avrcp, FALSE, 0);
}


/*************************************************************************
NAME    
     avHeadetHandleAvrcpVendorDependent
    
DESCRIPTION
     This function is called on receipt of an AVRCP_VENDORDEPENDENT_INDD message

RETURNS
     
*/
void avHeadetHandleAvrcpVendorDependent(const AVRCP_VENDORDEPENDENT_IND_T *ind)
{
    /*
        We are not a target so reject vendor requests
    */
	AvrcpVendorDependentResponse(ind->avrcp, avctp_response_not_implemented);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -