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

📄 handsfree_private.h

📁 蓝牙HANDFREE软件源代码
💻 H
字号:
#ifndef _HF_PRIVATE_H
#define _HF_PRIVATE_H

#include <csrtypes.h>

#include "handsfree_types.h"
#include <cm_rfcomm.h>
#include <hshf_lib.h>
#include <timer.h>


/* Used to send messages to the headset framework and get messages from it */
#define HEADSET_FRAMEWORK_TASK 1
#define HANDSFREE_TASK 2

/* Timeout values */
#define MASTER_CONNECT_TIMEOUT  D_SEC(300) 
#define SLAVE_CONNECT_TIMEOUT   D_NEVER

#define MUTE_BEEP_DELAY        D_SEC(3)


/* Increment value for one press of the volume UP button */
#define VGS_VOLUME_UP 1

/* Increment value for one press of the volume DOWN button */
#define VGS_VOLUME_DOWN -1

/* 
    The volume change comand sets either the gain i.e. absolute speaker 
    volume, OR the increment by which to increase/ decrease the speaker volume
*/

#define VGS_ZERO_GAIN       0
#define VGS_ZERO_INCREMENT  0


/*
    Enumeration defining the current state of the handsfree device.
    idle - awaiting user input or an incoming call
    connectingAsMaster - initiating an RFCOMM connection to the audio gateway
    connectingAsSlave - awaiting the audio gateway to initiate the RFCOMM connection
    connected - connected to another device
    pairing - engaged in the pairing procedure with a remote device
*/

enum
{
    idle,
    connectingAsMaster,
    connectingAsSlave,
    connected,
    pairing,
    scoConnected
};


/* store the necessary pairing data in this */
typedef struct 
{
    Delay pairing_timeout;
    framework_role_t pairing_role;
} hf_pair_data_t;


typedef struct
{
    uint16 connectState: 4; /* the current state of the handsfree */
    framework_role_t applicationRole:3;
    uint16 connectAsMasterPending:1;
    uint16 dialNumberPending:1;
    uint16 dialMemoryPending:1;
    uint16 dialLastNumberPending:1;
    uint16 audioTransferPending:1;
    uint16 voiceDialPending:1;
    uint16 ringing:1;
    uint16 inBandRingEnabled:1;
    uint16 microphoneMute:1;            
    uint16 hfCallActive:1;
    uint16 hfCallSetup:2;
    uint16 SCOpktType;
    hf_pair_data_t *pair_data;
    uint16 numberLength;
    uint8  *numberToDial;
    uint16 AudioRingHandle;
} HandsFreeState ;



/* call.c - called when there is an incoming caller id indication */
void hfCallerIdInd(const HANDSFREE_CALLER_ID_IND_T *ind);

/* cmd.c - called when the Audio Gateway has sent us an unrecognized AT command */
void hfCmdInd(const HS_CMD_IND_T *ind);

/* connect.c - called when the connect operation has completed */
void hfConnectCfm(const HS_CONNECT_CFM_T * cfm);

/* connect.c - called when the RFCOMM channel is disconnected. */
void hfConnectStatusInd(HS_CONNECT_STATUS_IND_T * ind);

/* connect.c - send a disconnect message to the libs */
void hfSendDisconnectMessage(hf_link_type_t link);

/* dial.c - called once a connection is established to send any penidng dial cmds */
void hfCheckDialPendingFlags(void);

/* error.c - indicates that an error has ocurred and includes a reason code to indicate what*/
void hfErrorInd(const HS_ERROR_IND_T *ind);

/* hal.c - set the speaker gain */
void hfHalSetSpeakerGain(uint8  vol);

/* hal.c - set the microphone gain */
void hfHalSetMicrophoneGain(uint8 gain);

/* hfalloc.c - allocate some memory and Panic if null returned */
void *hfAlloc(uint16 sz);

/* indicators.c - message from core framework containing the status of the indicators */
void hfIndicatorStatusInd(const HANDSFREE_INDICATOR_STATUS_IND_T *ind);

/* localState.c - use this function to update the current state of the hands free */
void setLocalState(uint16 new_state);

/* microphone.c - handle a mic gain ind message */
void hfMicrophoneInd(const HS_MIC_IND_T *ind);

/* open.c - called when the open request operation has completed */
void hfOpenCfm(const HS_OPEN_CFM_T* cfm);

/* pair.c - called when the pairing operation has completed */
void hfPairCfm(const HS_PAIR_CFM_T * cfm);

/* reset.c - confirmation reset has completed */
void hfResetCfm(const HS_RESET_CFM_T *req);

/* reset.c - reset all flags to do with an SLC */
void hfResetConnectionState(void);

/* ring.c - called when there is an incoming ring indication */
void hfRingInd(const HS_RING_IND_T *ind);

/* ring.c - in band ring tone enable/ disable indication */
void hfInBandRingEnable(const HANDSFREE_IN_BAND_RING_IND_T *ind);

/* sco.c - send the create SCO message */
void createSCO(uint16 pkt_type);

/* sco.c - called when there is a change in status of a SCO connection. */
void hfScoStatusInd(const HS_SCO_STATUS_IND_T * ind);

/* voice.c - handle the voice dial enabled/disabled indicator from the lib */
void hfVoiceDialEnableInd(const HANDSFREE_VOICE_DIAL_ENABLE_IND_T *ind);

/* volume.c - called when the user presses a volume button and sets the volume */
void hfVolumeInd(const HS_VGS_IND_T * ind);

/* volume.c - called when a connection is initially established to set up the default volume level */
void hfSendInitialVolume(void);


#endif

⌨️ 快捷键说明

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