?? ag_open.c
字號:
#include "ag_private.h"
#include "ag.h"
#include "ag_types.h"
#include <event.h>
#include <message.h>
static void registerService(ag_profile_role_t profile)
{
MAKE_MSG(CM_SERVICE_REGISTER_REQ);
msg->serviceRecord = agCreateServiceRecord(&msg->sizeServiceRecord, profile);
msg->classOfDevice = EAG_COD; /* the cod is the same for either profile */
agPutCmMsg(msg);
}
/*
AGstartReq
Start request from the client app to kick off the whole thing. Currently
only one type of extra data supported so this function only handles that.
*/
void startReqAction(uint16 hfSuppFeatures, ag_profile_role_t profiles)
{
/* Init the supported profiles and current profile */
agSetSupportedProfiles(profiles);
agSetCurrentProfile(agProfileNotSet);
/* Reset the server channels */
AGState.agHsServerChan = 0;
AGState.agHfServerChan = 0;
/* Init the AG state */
agSetCurrentState(AgIdle);
AGState.ringContinuous = 0;
/* Initialise the address to ag_handle map */
createAddressHandleMap();
/* The MSW defines the network type while the LSW defines the supported features */
AGState.hfAgSupportedFeatures = hfSuppFeatures;
/* Init the connection manager library */
{
MAKE_MSG(CM_INIT_REQ);
agPutCmMsg(msg);
}
/* enable the rfc data events */
EventEnable(VM_EVENT_SOURCE, 1);
EventEnable(VM_EVENT_SINK, 1);
}
/*
agInitCfm
Register Audio Gateway service with the Connection Manager.
*/
void agInitCfm(void)
{
if (agIsHeadsetSupported())
registerService(agHeadsetProfile);
else if (agIsHandsFreeSupported())
registerService(agHandsFreeProfile);
}
/*
agServiceRegisterCfm
Confirmation of service register request (can be success or
failure).
*/
void agServiceRegisterCfm(const CM_SERVICE_REGISTER_CFM_T *cfm)
{
/* TODO should check result code in cfm in case something failed */
/* Store the server channel */
if (agIsHeadsetSupported() && !(AGState.agHsServerChan & 0xff))
AGState.agHsServerChan = cfm->server_channel;
else
AGState.agHfServerChan = cfm->server_channel;
if (agIsHandsFreeSupported() && !(AGState.agHfServerChan & 0xff))
{
/* if both profiles are supported then register the second sdp record */
registerService(agHandsFreeProfile);
}
else
{
/* If hands free supported default to that otherwise fall back to headset */
if (agIsHandsFreeSupported())
agSetCurrentProfile(agHandsFreeProfile);
else
agSetCurrentProfile(agHeadsetProfile);
/* Initialization phase complete so let the driver know */
handleStartCfm();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -