?? headset_private.h
字號:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.6.2-release
FILE NAME
headset_private.h
DESCRIPTION
*/
#ifndef _HEADSET_PRIVATE_H_
#define _HEADSET_PRIVATE_H_
#include "headset_battery.h"
#include "headset_debug.h"
#include "stereo_headset_buttons.h"
#include <a2dp.h>
#include <avrcp.h>
#include <hfp.h>
#include <connection.h>
#include <message.h>
#include <app/message/system_message.h>
/* Local application messages base value */
#define HEADSET_MSG_BASE (0x0)
/* 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
/* PIO definititions */
#ifdef DEV_1442
#define LED_RED (1<<1)
#define LED_BLUE (1<<2)
#define SOFT_POWER
#define POWER_HOLD (1<<9)
#ifdef WOLFSON_CODEC_WM8731
#define AUDIO_AMP_LINE 0 /*wolfson uses PIO11 as clock*/
#else
#define AUDIO_AMP_LINE (1<<11) /*for passthrough board*/
#endif /* WOLFSON_CODEC_WM8731 */
#endif /* DEV_1442 */
#ifdef DEV_1508
#define LED_RED (1<<2)
#define LED_BLUE (1<<11)
#define MFB_BUTTON (1<<3)
#define AUDIO_AMP_LINE (1<<4)
#define SOFT_POWER
#define POWER_HOLD (1<<9)
#endif
#ifdef DEV_1645
#define LED_RED (1<<15)
#define LED_BLUE (1<<14)
#define SPECIAL_LED_PINS
#define AUDIO_AMP_LINE (1<<3)
#endif
#ifdef DEV_1645
#define SET_AMP(v) {PioSetDir(AUDIO_AMP_LINE,AUDIO_AMP_LINE); PioSet(AUDIO_AMP_LINE, v); PioSetMicBiasHwEnabled(v);}
#else
#define SET_AMP(v) {PioSetDir(AUDIO_AMP_LINE,AUDIO_AMP_LINE); PioSet(AUDIO_AMP_LINE, v);}
#endif
#define PIO_AIO1 (1<<13)
#define PIO_AIO3 (1<<15)
/* PS keys used by the app */
#define LAST_USED_AG (0)
#define LAST_USED_AV_SOURCE (1)
#define VOLUME_LEVEL (2)
#define AUTO_RECONNECT (3)
#define HEADSET_SECURITY (4)
#define RING_TONE_SELECT (5)
#define AUTO_SWITCH_OFF_ENABLED (6)
#define AUTO_SWITCH_OFF_TIMEOUT (7)
#define LAST_PAIRED_DEVICE (8)
#define MP3_ENABLED (9)
#define LAST_USED_AV_SOURCE_SEP (12)
/* Time to wait after audio has ended before switching off the audio amp */
#define AMP_IDLE_TIMER 6000
/* How long to wait before restarting audio. Used to avoid conficts in signalling */
#define MUSIC_RESTART_DELAY 500
/* If SLC connection not created after this has expired then abort the connect attempt. */
#define SLC_CONNECT_TIMEOUT (10000)
/* Remain in pairing mode only for this length of time */
#define PAIRING_TIMEOUT (300000)
typedef uint16 ledState;
/* Local App messages */
enum
{
APP_AMP_IDLE_IND = HEADSET_MSG_BASE,
APP_BATTERY_DEAD_IND,
APP_BATTERY_FULL_IND,
APP_BATTERY_LOW_IND,
APP_CHARGER_CONNECTED_IND,
APP_CHARGER_DISCONNECTED_IND,
APP_DISCONNECT_HFP_SLC_IND,
APP_HEADSET_INIT_CFM,
APP_HFP_SLC_REQ,
APP_HFP_SLC_TIMEOUT_IND,
APP_MUSIC_RESTART_IND,
APP_MUTE_REMINDER,
APP_PAIR_MODE_END_IND,
APP_POWER_OFF_IND,
APP_RING_TIMEOUT_IND,
APP_POWER_ON_EVENT_SEEN,
APP_PREVENT_POWER_ON,
APP_TONE_TO_PLAY_IND,
APP_UNMUTE_MIC,
APP_VOICE_DIAL,
APP_PLAY_PAUSE_SHORT,
APP_BACKWARD_SHORT,
APP_AVRCP_CONNECT_REQ,
APP_AUTO_SWITCH_OFF_IND
};
#define HEADSET_MSG_TOP APP_AVRCP_CONNECT_REQ
typedef struct
{
uint16 id;
} APP_TONE_TO_PLAY_IND_T;
typedef struct
{
uint16 voice_recog_enabled;
} APP_VOICE_DIAL_T;
typedef struct
{
bdaddr addr;
} APP_AVRCP_CONNECT_REQ_T;
typedef enum
{
headsetInitialising,
headsetReady,
headsetConnecting,
headsetConnected,
headsetOutgoingCallEstablish,
headsetIncomingCallEstablish,
headsetActiveCall
} headsetHfpState;
typedef enum
{
avHeadsetA2dpInitialising,
avHeadsetA2dpReady,
avHeadsetA2dpInitiating,
avHeadsetA2dpSignallingActive,
avHeadsetA2dpConnected,
avHeadsetA2dpStreaming
} headsetA2dpState;
typedef enum
{
avHeadsetAvrcpInitialising,
avHeadsetAvrcpReady,
avHeadsetAvrcpConnecting,
avHeadsetAvrcpConnected
} headsetAvrcpState;
typedef enum
{
none_active,
hfp_active,
av_active
} activeProfileState;
typedef enum
{
power_state_off,
power_state_off_charging,
power_state_on,
power_state_on_charging
} power_state;
typedef struct
{
unsigned auto_switch_off_timeout:16;
unsigned dummy:10;
unsigned auto_switch_off_enabled:1;
unsigned auto_reconnect:1;
unsigned ring_tone_select:4;
} features_type;
typedef struct
{
unsigned hfp_volume:8;
unsigned av_volume:8;
} volume_type;
typedef struct
{
TaskData task;
Task codec_task;
TaskData controls_task;
PioState pio_state;
/* Common states */
volume_type speaker_volume;
activeProfileState active_profile;
power_state headset_power_state;
power_source_type power_source;
features_type features;
/* AV states */
A2DP* a2dp;
AVRCP* avrcp;
headsetA2dpState a2dp_state;
headsetAvrcpState avrcp_state;
Sink sig_sink;
Sink media_sink;
a2dp_channel_mode channel_mode;
uint32 rate;
bool avrcp_pending;
/* HFP states */
headsetHfpState hfp_state;
uint16 headset_connecting_hfp;
Sink slc_sink;
Sink sco_sink;
uint16 supp_features_0;
hfp_profile profile_connected;
HFP *hfp;
HFP *hsp;
uint16 mic_volume;
/* Boolean variables */
unsigned mic_mute_on:1;
unsigned using_wbs:1;
unsigned charger_connected:1;
unsigned battery_full:1;
unsigned voice_recognition_enabled:1;
unsigned in_band_ring_enabled:1;
unsigned pairing_enabled:1;
unsigned sent_suspend:1;
unsigned connect_av:1;
unsigned av_stream_stopped:1;
unsigned stored_av_stream_stopped:1;
unsigned headset_connecting_av:1;
unsigned play_state:1;
unsigned av_stream_connected:1;
unsigned dummy:2;
} headsetTaskData;
/****************************************************************************
NAME
avGetAppTask
DESCRIPTION
Returns the AV headset application main task.
RETURNS
Task
*/
Task getAppTask(void);
/****************************************************************************
NAME
avGetApp
DESCRIPTION
Returns the AV headset application state
RETURNS
headsetTaskData
*/
headsetTaskData *getApp(void);
#endif /* _HEADSET_PRIVATE_H_ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -