?? hosthf_main.c
字號:
#include "hosthf_private.h"
#include "handsfree.h"
#include <host.h>
#include <print.h>
#include <sched.h>
#include <stdlib.h>
/*
hostHfPutGuiMsg
Sends messages to the client using host communications over BCSP
channel 13.
*/
void hostHfPutGuiMsg(void *msg)
{
(void) HostSendMessage((uint16 *)msg);
}
/*
handleHostMessage
Handles messages from the client that arrive over BCSP channel 13.
*/
void handleHostMessage(void)
{
uint16 *data;
while((data = HostGetMessage()) != NULL)
{
switch(data[1])
{
/* Message sent to EAG so driver can check the EAG is up and running */
case START_REQ:
{
START_REQ_T *req = (START_REQ_T *) ((void *)(data+2));
startReqAction(req->supported_features, (uint16) frameworkHandsFree);
}
break;
/* Request to put device into pairing mode */
case PAIR_REQ:
{
PAIR_REQ_T *req = (PAIR_REQ_T *) ((void *)(data+2));
pairReqAction(req->timeout, frameworkHandsFree);
}
break;
/* Cancel the current mode of the hands-free device*/
case CANCEL_REQ:
cancelCurrentStateAction();
break;
/* Disconnect the specified connection to the given address */
case DISCONNECT_REQ:
{
DISCONNECT_REQ_T *req = (DISCONNECT_REQ_T *) ((void *)(data+2));
disconnectReqAction(req->linkType);
}
break;
/* Volume change request from GUI */
case VOLUME_CHANGE_REQ:
{
VOLUME_CHANGE_REQ_T *req = (VOLUME_CHANGE_REQ_T *) ((void *)(data+2));
volumeReqAction(req->increment, req->gain);
}
break;
/* Request to dial specified number to be sent to AG */
case DIAL_NUMBER_REQ:
hostHfDialNumberReq((DIAL_NUMBER_REQ_T *)((void *)(data+2)));
break;
/* Send request to dial number in the specified memory location */
case DIAL_MEMORY_REQ:
hostHfDialMemoryReq((DIAL_MEMORY_REQ_T *)((void *)(data+2)));
break;
/* Last number redial request */
case LAST_NUMBER_REDIAL_REQ:
lastNumberRedialAction();
break;
/* Transfer audio connection from AG to HF but HF sets up SCO */
case AUDIO_TRANSFER_REQ:
{
AUDIO_TRANSFER_REQ_T *req = (AUDIO_TRANSFER_REQ_T *)((void *)(data+2));
callTransferReqAction(req->pktType);
}
break;
/* Accept an incoming call */
case ANSWER_REQ:
callAnswerAction();
break;
/* Reject an incoming call */
case HANG_UP_REQ:
callRejectAction();
break;
/* Enable caller id reporting on the AG */
case CALLER_ID_REQ:
{
CALLER_ID_REQ_T *req = (CALLER_ID_REQ_T *) ((void *)(data+2));
hfCallerIdEnableAction(req->enable);
}
break;
/* Request to toggle the mute setting on the local microphone */
case MUTE_MIC_REQ:
hfToggleMuteMicAction();
break;
/* Enable or disable voice dialling at the AG */
case VOICE_DIAL_REQ:
{
VOICE_DIAL_REQ_T *req = (VOICE_DIAL_REQ_T *) ((void *)(data+2));
startVoiceDialAction(req->enable);
}
break;
/* Disable the NR/ EC functionality of the AG */
case NREC_DISABLE_REQ:
disableNrecAction();
break;
case SEND_DTMF_REQ:
{
SEND_DTMF_REQ_T *req = (SEND_DTMF_REQ_T *)((void *)(data+2));
sendDtmfReqAction(req->dtmf);
}
break;
default:
PRINT(("main: Unrecognised message type 0x%x received from host.\n", data[1]));
handleErrorInd(HfErrorUnknownOrUnhandledState);
break;
}
/* Must free the message otherwise we'll be in all sorts of trouble */
free(data);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -