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

📄 hostag_send.c

📁 bluetooth audio gateway
💻 C
字号:
#include "hostag_private.h"
#include "ag.h"


/* Function used to pass data to the AG engine */


/*
    hostAgStartReq

    Start request received over host comms so call 
    the appropriate engine function.
*/
void hostAgStartReq(const AG_START_REQ_T *req, uint16 len)
{
    /* Length passed in is at least 2 words (type and length of host comms pkt) */
    uint16 data_len = len - 2;

    if (data_len)
    {
        /* Extra data defined that needs to be passed to the engine */
        startReqAction(req->hfSupportedFeatures, req->supportedProfiles);
    }
    else
    {
        /* No extra data - default to headset profile */
        startReqAction(0, agHeadsetProfile);
    }
}


/*
    hostAgInquiryReq

    Inquiry request received from host comms.
*/
void hostAgInquiryReq(const AG_INQUIRY_REQ_T *req)
{
    inquiryReqAction(req->num_responses, req->timeout, 
        req->CoD_filter, req->remote_name_request_enabled);
}


/*
    hostAgPairReq

    Pair request received over host comms
*/
void hostAgPairReq(const AG_PAIR_REQ_T *req)
{
    pairReqAction(req->dev_address, req->use_authentication, req->timeout);
}


/*
    hostAgPinRes

    Pin code received over host comms 
*/
void hostAgPinRes(const AG_PIN_CODE_RES_T *res)
{    
    pinResAction(res->dev_address, res->PIN_length, (uint8 *) &(res->PIN));
}


/*
    hostAgLinkKeyRes

    Link key response received over host comms
*/
void hostAgLinkKeyRes(const AG_LINK_KEY_RES_T *res)
{
    linkKeyResAction(res->accept, res->handle, (uint8 *) &(res->link_key));
}


/*
    hostAgSmAddDeviceReq

    Request to register a device with the security manager
*/
void hostAgSmAddDeviceReq(const AG_SM_ADD_DEVICE_REQ_T *req)
{
    agSmAddDeviceReqAction(req->dev_address, req->trust_flag, (uint8 *) &(req->link_key));
}


/*
    hostAgConnectAsMasterReq

    Initiate the creation of a connection
*/
void hostAgConnectAsMasterReq(const AG_CONNECT_AS_MASTER_REQ_T *req)
{
    agConnectAsMasterReqAction(req->dev_address, (ag_auth_config_t *) &(req->use), (ag_park_config_t *) &(req->park), (ag_sniff_config_t *) &(req->sniff), req->target, req->timeout);
}


/*
    hostAgConnectAsSlaveReq

    Become connectable
*/
void hostAgConnectAsSlaveReq(const AG_CONNECT_AS_SLAVE_REQ_T *req)
{
    agConnectAsSlaveReqAction(req->dev_address, (ag_auth_config_t *) &(req->use), (ag_park_config_t *) &(req->park), (ag_sniff_config_t *) &(req->sniff), req->timeout, req->page_scan_interval, req->page_scan_window);
}



/*
    hostAgCreateScoReq

    Attempt to create a SCO connection
*/
void hostAgCreateScoReq(const AG_CREATE_SCO_REQ_T *req)
{
    agScoConnectReqAction(req->handle, req->type);
}


/*
    hostAgRfcommDisconnectReq
    
    Request to disconnect a RFCOMM connection
*/
void hostAgRfcommDisconnectReq(const AG_RFCOMM_DISCONNECT_REQ_T *req)
{
    agRfcommDisconnectReqAction(req->handle);
}


/*
    hostAgScoDisconnectReq

    Request to disconnect a SCO connection
*/
void hostAgScoDisconnectReq(const AG_SCO_DISCONNECT_REQ_T *req)
{
    agScoDisconnectReqAction(req->handle);
}


/*
    hostAgRingReq

    Request to send RING AT commands
*/
void hostAgRingReq(const AG_RING_REQ_T *req)
{
    agRingReqAction(req->repetition_rate, req->number_rings);
}


/*
    hostAgVolumeGainReq

    Request to send a volume command
*/
void hostAgVolumeGainReq(const AG_VOLUME_CHANGE_REQ_T *req)
{    
    agVolumeChangeReqAction(req->increment, req->gain);
}


/*
    hostAgMicrophoneChangeReq

    Request to send a microphone gain command
*/
void hostAgMicrophoneChangeReq(const AG_MIC_CHANGE_REQ_T *req)
{
    agMicChangeReqAction(req->gain);
}


/*
    hostAgDataReq

    Request to send custom data
*/
void hostAgDataReq(const AG_DATA_REQ_T *req)
{
    agDataReqAction(req->length, (uint8 *) &(req->data));
}


/*
    hostAgCallStatusReq

    Request to send a call status indicator
*/
void hostAgCallStatusReq(const AG_SEND_CALL_STATUS_REQ_T *req)
{
    agCallStatusReqAction(req->call_ind_status);
}


void hostAgCallSetupReq(const AG_SEND_CALL_SETUP_REQ_T *req)
{
	agCallSetupReqAction(req->call_setup);
}


void hostAgServiceReqAction(const AG_SEND_SERVICE_STATUS_REQ_T *req)
{
	agServiceStatusReqAction(req->service_ind_status);
}


/*
    hostAgCancelReq

    Cancel the current state
*/
void hostAgCancelReq(void)
{
    agCancelReqAction();
}

⌨️ 快捷键说明

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