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

📄 ag_dial.c

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

#include <message.h>
#include <string.h>


/*
    agCallAnswered

    The remote end has accpeted the call. Set up the call and stop ringing.
*/
void agCallAnswered(BD_ADDR_T addr)
{
    /* 
        TODO: a SCO must be set up for now we rely on the GUI to do
        this as it knows the parameters that the user wants but could
        do this here instead in order to have the EAG fully comply
        with the HF spec independent of the GUI.
    */
    /* stop sending ring alerts */
    agStopRings();
    
    /* Send a call active indication */
    agSendCallInd(1);

    handleCallAnsweredInd(agGetConnectionHandle(&addr), 1);
}


/*
    agCallRejected

    The remote end has rejected the call. So drop it.
*/
void agCallRejected(BD_ADDR_T addr)
{    
    /* Sent call ind to HF but it has rejected the call */
    if (AGState.currentState == AgConnected)
    {        
        /* stop sending ring alerts */
        agStopRings();        

        /* Inform the interface that the call has been rejected */
        handleCallAnsweredInd(agGetConnectionHandle(&addr), 0);

		/* Send a call_setup indicator to show call has been rejected */
		agSendCallSetupInd(call_setup_no_call);
    }
    else if (agScoConnectedQuery())
    {		
        /* Call to HF exists and the HF has just hung up so close the SCO */
		agScoDisconnectReqAction(agGetConnectionHandle(&addr));

        /* Send a no call indication to indicate call has been terminated */
        agSendCallInd(0);        
    }    
}


/*
    agReceivedDialNumber

    Request from the hands free device to dial a given number
*/
void agReceivedDialNumber(BD_ADDR_T addr, const uint8 *num_data, uint16 length)
{                        
    /* Send a call seuup indicator */
	agSendCallSetupInd(call_setup_outgoing_call);

    /* Tell the interface about this */
    handleRemoteDialReq(agGetConnectionHandle(&addr), dial_number, length, num_data);
}


/*
    agReceivedLastNumberRedial

    Send a last number redial request to the AG. This function alerts
    the EAG driver that the AT command has been received and it is up
    to that to implement the actual dialling. A SCO will be set up
    though.
*/
void agReceivedLastNumberRedial(BD_ADDR_T addr)
{              
    /* Send a call seuup indicator */
	agSendCallSetupInd(call_setup_outgoing_call);

    /* Tell the interface about this */
    handleRemoteDialReq(agGetConnectionHandle(&addr), last_numer_redial, 0, 0);
}


/*
    agReceivedMemoryDial

    Send a memory dial request to the driver. 
*/
void agReceivedMemoryDial(BD_ADDR_T addr, const uint8 *mem_data, uint16 length)
{    
    /* Send a call seuup indicator */
	agSendCallSetupInd(call_setup_outgoing_call);

    /* Tell the interface about this */
    handleRemoteDialReq(agGetConnectionHandle(&addr), dial_memory_location, length, mem_data);
}

⌨️ 快捷键说明

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