📄 ring.c
字号:
#include "handsfree_private.h"
#include "handsfree.h"
#include <audio.h>
#include <stdlib.h>
#include <vm.h>
/* This is the ring tone played */
static const audio_note twilight[] =
{
AUDIO_TEMPO(180), AUDIO_VOLUME(64), AUDIO_TIMBRE(sine),
AUDIO_NOTE(E7, QUAVER),
AUDIO_NOTE(F7, QUAVER),
AUDIO_NOTE(E7, QUAVER),
AUDIO_NOTE(C7, QUAVER),
AUDIO_NOTE(E7, QUAVER),
AUDIO_NOTE(F7, QUAVER),
AUDIO_NOTE(E7, QUAVER),
AUDIO_NOTE(C7, QUAVER),
AUDIO_END
};
/*
hfRingInd
Called by the headset framework to tell us that a RING command has
been received over RFCOMM (state = 1) or that the ring duration
has expired (state = 0).
*/
void hfRingInd(const HS_RING_IND_T *ind)
{
/* set the rinigng flag */
if(ind->state)
{
HFstate.ringing = 1;
}
/* Make sure the AG isn't sending in-band ring tones */
if(ind->state && !HFstate.inBandRingEnabled)
{
/* If a new ring indication received, play the ring tone */
HFstate.AudioRingHandle = AudioPlay(twilight);
}
else
{
/* Indication that the ring tone has stopped playing */
HFstate.AudioRingHandle = 0;
}
/* Inform the interface. */
handleRingInd(ind->state);
}
/*
hfInBandRingEnable
AG sends an indication whether it currently has the in-band ring tone
enabled or disabled. Handle this indication here.
*/
void hfInBandRingEnable(const HANDSFREE_IN_BAND_RING_IND_T *ind)
{
/* Set the local state to reflect the change in in-band ring setting */
HFstate.inBandRingEnabled = ind->enable;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -