?? piohshf_receive.c
字號(hào):
#include "piohshf_private.h"
#include "handsfree.h"
#include "handsfree_types.h"
#include <audio.h>
#include <message.h>
#include <print.h>
/*
handleOpenCfm
Libs have been initialized. The status field tells us whether the device
is currently paired or not.
*/
void handleOpenCfm(uint16 status)
{
/* if not paired then go into pairing mode with role set to both profiles */
if (!status)
pioHsHfPairButton();
/* Reset the button press pending flag */
hshfState.hshfButtonPressPending = 0;
}
/*
handleConnectComplete
Indication that a service level connection has been established
*/
void handleConnectComplete(void)
{
if (HFstate.applicationRole == frameworkHandsFree)
{
/*
The button press pending flag was set if the call active
button was pressed i.e. if the HF initiated the SLC
connection. If not set the the AG initiated it so do nothing.
*/
if (hshfState.hshfButtonPressPending)
{
/* Reset the button press pending flag */
hshfState.hshfButtonPressPending = 0;
/*
If there is an active call perform an audio connection
transfer otherwise enable voce dialling
Need to ensure that just slc is connected. Workaround,
in case AG opens SCO before SLC is established
(out of HFP spec but it happens) - see also connect.c.
*/
if (HFstate.connectState == connected)
{
if (HFstate.hfCallActive)
callTransferReqAction(0x80);
else
startVoiceDialAction(1);
}
}
}
else
{
/* If there is a button press pending then send it. */
if (hshfState.hshfButtonPressPending)
{
/* Send a button press message to the framework */
pioHshfSendButtonPress();
}
}
/* Request AG to send us the caller id */
hfCallerIdEnableAction(1);
}
/*
handleCallerIdInd
If the HF supports displaying caller id then this function is
called when the caller id is received. From here the info can
be displayed on an LCD for example but for now just hook in a
print for debugging.
*/
void handleCallerIdInd(uint16 length, const uint8 *caller_id)
{
/* Keeo the compiler happy when debug is disabled */
length = length;
caller_id = caller_id;
/*
Just debug, a this point the caller id should be displayed
on an LCD if using one
*/
{
uint16 i=0;
PRINT(("Caller id: "));
for (i=0; i<length; i++)
{
PRINT(("%c", caller_id[i]));
}
PRINT(("\n"));
}
}
/*
handlePairCfm
Check the outcome of the pairing phase.
*/
void handlePairCfm(pairing_status_t status)
{
/* Reset this flag in case it was set when selecting HS pair mode */
hshfState.hshfButtonPressPending = 0;
/* Check the pairing outcome */
switch (status)
{
case HfPairingComplete:
break;
case HfPairingCancelled:
/* If currently idle go into connectable mode */
if (HFstate.connectState == idle)
connectReqAction();
break;
case HfPairingFailed:
case HfPairingError:
case HfPairingTimedOut:
default:
/* Become connectable */
connectReqAction();
break;
}
}
/*
handleIndicatorUpdate
One or more of the indicators used has changed
*/
void handleIndicatorUpdate(uint16 service_ind, uint16 call_ind, uint16 call_setup_ind)
{
/* keep the compiler happy */
service_ind = service_ind;
call_ind = call_ind;
call_setup_ind = call_setup_ind;
}
/*
handleErrorInd
Error received, play a beep to indicate this
*/
void handleErrorInd(error_code_t this_error)
{
/* Check if we've got a warning or an error */
switch(this_error)
{
case HfErrorPairRequestWhenNotIdle:
case HfErrorConnectRequestWhenNotIdle:
case HfErrorCancelWhenIdle:
case HfErrorDataRequestWhenNotConnected:
case HfErrorInquiryRequestWhenNotIdle:
case HfErrorScoRequestWhenSCOConnected:
case HfErrorDisconnectRequestWhenNotConnected:
case HfErrorSmDeviceDatabaseError:
case HfErrorUnknownOrUnhandledState:
case HfErrorDialRequestPendingAlready:
case HfWarnLocalSniffNotEnabled:
case HfWarnLocalParkNotEnabled:
case HfWarnLocalLowPwrModeNotEnabled:
case HfWarnRemDevDoesNotSupportSniffMode:
case HfWarnRemDevDoesNotSupportParkMode:
case HfWarnRemoteLowPwrModeNotEnabled:
default:
/* do nothing */
break;
}
}
void handleRingInd(uint16 ring_state)
{
/* keep the compiler happy */
ring_state = ring_state;
}
void handleVolInd(uint8 gain)
{
/* keep the compiler happy */
gain = gain;
}
void handleVoiceDialStatusInd(uint16 status)
{
/* keep the compiler happy */
status = status;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -