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

📄 headset_private.h

📁 bc5_stereo:bluetooth stereo Headset CODE 支持A2DP HSP 和 HSP 。可作为车载免提。BlueLab 2007环境下编译
💻 H
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2007
Part of Stereo-Headset-SDK Q1-2007.Release

FILE NAME
    headset_private.h
    
DESCRIPTION
    
*/

#ifndef _HEADSET_PRIVATE_H_
#define _HEADSET_PRIVATE_H_


#include "headset_buttonmanager.h"
#include "headset_leddata.h"
#include "headset_powermanager.h"
#include "headset_states.h"

#include <app/message/system_message.h>
#include <a2dp.h>
#include <avrcp.h>
#include <csrtypes.h>
#include <message.h>
#include <hfp.h>
#include <sink.h>

/* Class of device defines */
#define AUDIO_MAJOR_SERV_CLASS  0x200000
#define AV_MAJOR_DEVICE_CLASS   0x000400
#define AV_MINOR_HEADSET        0x000004
#define AV_COD_RENDER           0x040000

/* Restart A2DP Delay Time */
#define A2DP_RESTART_DELAY		(uint32)500

typedef uint16 HeadsetTone_t ;
#define TONE_NOT_DEFINED 0


/* Locally generted message base */
#define HEADSET_MSG_BASE    (0x0)

enum
{
    APP_RESUME_A2DP = HEADSET_MSG_BASE,
	APP_AVRCP_CONTROLS,
    APP_AVRCP_CONNECT_REQ,
	APP_AMP_OFF,
	APP_SEND_PLAY,
	HEADSET_MSG_TOP	
};


typedef enum
{
    AVRCP_CTRL_PAUSE_PRESS,
    AVRCP_CTRL_PAUSE_RELEASE,
    AVRCP_CTRL_PLAY_PRESS,
    AVRCP_CTRL_PLAY_RELEASE,
    AVRCP_CTRL_FORWARD_PRESS,
    AVRCP_CTRL_FORWARD_RELEASE,
    AVRCP_CTRL_BACKWARD_PRESS,
    AVRCP_CTRL_BACKWARD_RELEASE,
    AVRCP_CTRL_STOP_PRESS,
    AVRCP_CTRL_STOP_RELEASE,
    AVRCP_CTRL_FF_PRESS,
    AVRCP_CTRL_FF_RELEASE,
    AVRCP_CTRL_REW_PRESS,
    AVRCP_CTRL_REW_RELEASE
} avrcp_controls;


typedef struct
{
    avrcp_controls control;
} APP_AVRCP_CONTROLS_T;

typedef struct
{
    bdaddr addr;
} APP_AVRCP_CONNECT_REQ_T;


typedef enum
{
	dsp_process_none = 0,
	dsp_process_sco = 1,
	dsp_process_a2dp = 2
} dspProcessType;


/* The audio data - part of the main data structure */
typedef struct audioDataTag
{    
    HeadsetTone_t * gEventTones ;
    unsigned        gMuted:1 ;
    unsigned        gHfpVolumeLevel:7 ; 
    unsigned        gAvVolumeLevel:7 ; 
	unsigned 	    unused:1;
}audioData_t ;


/* AVRCP Specific data */
typedef struct
{
	/* AVRCP Instance */
	AVRCP *avrcp;
	/* AVRCP is pending a command response */
	bool pending;
	/* Should a play be sent */
	uint16 send_play;
} avrcpData;

/* A2DP Specific data */
typedef struct
{
	/* A2DP Instance */
	A2DP *a2dp;
	/* Media Sink */
	Sink sink;
	/* Signalling Sink */
	Sink sig_sink;
	/* A2DP Channel Mode */
    a2dp_channel_mode channel_mode;
    /* A2DP rate */
	uint32 rate;   
	/* Active SEP */
	a2dp_sep_type sep;	
} a2dpData;


/* The application timeouts */
typedef struct TimeoutsTag
{
	uint16 PairModeTimeout_s ;
    uint16 MuteRemindTime_s ;
    uint16 AutoSwitchOffTime_s ;
}Timeouts_t ;


/* The amp control */
typedef struct AmpTag
{
	unsigned ampAutoOff:1;
	unsigned dummy:7;	
	unsigned ampOffDelay:8;
    uint32 ampPio;
}Amp_t ;


/* The features block */
typedef struct FeaturesTag
{
	unsigned autoSendAvrcp:1;
	unsigned cvcEnabled:1;
	unsigned dummy:14;	
}Features_t ;


/* Headset data */
typedef struct
{
    TaskData            task;
    BTaskData           theButtonTask;
    LedTaskData			theLEDTask;
    Task                theCodecTask;
    
    a2dpData			a2dp;
    avrcpData			avrcp;
	
    HFP                 *hfp;
    HFP                 *hsp;   
    
	Sink 				slc_sink;
    Sink                sco_sink;
    
    audioData_t         audioData ;    
    power_type			*power;
    Timeouts_t		    Timeouts ;
    
	/* Determines if the HFP or HSP profile is in use */
    hfp_profile         profile_connected;
    
	/* Local HFP features that are enabled */
    uint16				local_hfp_features;
    
	/* Flag to indicate if voice recognition is enabled */
    unsigned            voice_recognition_enabled:1;
	/* Flag to indicate if inquiry scan is enabled */
    unsigned            inquiry_scan_enabled:1;
	/* Flag to indicate if page scan is enabled */
	unsigned            page_scan_enabled:1 ;
	/* Flag to indicate if the dsp processing SCO, or A2DP, or neither */
	unsigned 			dsp_process:3;
	/* Flag to indicate if headset is connecting HFP due to power on reconnect procedure */
	unsigned 			slcConnectFromPowerOn:1 ;
	/* Flag to indicate if headset is connecting HFP */
    unsigned 			slcConnecting:1 ;	
	/* Flag to indicate if A2DP is ready */
	unsigned 			a2dpReady:1;
	/* Flag to indicate if headset is connecting A2DP */
	unsigned 			a2dpConnecting:1;
	/* Flag to indicate if A2DP supports MP3 decoding */
	unsigned 	 		a2dpMP3Enabled:1;
	/* Flag to indicate if headset successfully suspended A2DP source */
	unsigned 			a2dpSourceSuspended:1;
	/* Flag to indicate if amp should be turned off when there's no audio */
	unsigned 			ampAutoOff:1;
	/* Flag to indicate if the amp is currently switched on */
	unsigned 			ampOn:1;
	/* Flag to indicate if an avrcp_play should be sent once media is connected */
	unsigned 			sendPlayOnConnection:1;
	/* Flag to indicate if the headset should auto send AVRCP commands to try and pause/resume music playing */
    unsigned            autoSendAvrcp:1;
	
	/* Flag to indicate if inband ringtones have been enabled from the AG */
	unsigned    		InBandRingEnabled:1;
	/* Flag to indicate the ringtone used by the headset for out-of-band ringing */
    unsigned    		RingTone:5;
	/* Flag to indicate the suspected status of the playing music. ie. Playing (1) or Paused/Stopped (0).
	   This is used to hold the state when not actually streaming as the source can be suspended but AVRCP
	   commands can still be sent.
	*/
    unsigned    		PlayingState:1;
	/* Flag to indicate if CVC should be used for (e)SCO */
	unsigned			cvcEnabled:1;
	/* Time in secs to wait after there's no audio, before turning audio amp off */
	unsigned			ampOffDelay:8;
	
	/* The PIO that is used to turn the audio amp on and off */
	uint32 				ampPio;
	
} hsTaskData;


/****************************************************************************
NAME    
    getAppTask
    
DESCRIPTION
  Returns the headset application main task.

RETURNS
    Task
*/
Task getAppTask(void);




#endif /* HEADSET_PRIVATE_H_ */

⌨️ 快捷键说明

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