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

📄 headset_configmanager.h

📁 BlueLab 3.5.2 单声道耳机源码
💻 H
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.6.2-release

FILE NAME
    headset_configmanager.h
    
DESCRIPTION
    Configuration manager for the headset - resoponsible for extracting user information out of the 
    PSKEYs and initialising the configurable nature of the headset components
    
*/
#ifndef HEADSET_CONFIG_MANAGER_H
#define HEADSET_CONFIG_MANAGER_H

#include "headset_private.h"
#include "headset_private.h"

/* Persistent store key allocation */
#define PSKEY_BASE  (0)
enum
{
 	PSKEY_BATTERY_CONFIG     		= PSKEY_BASE,
 	PSKEY_BUTTON_CONFIG     		= 1,
 	PSKEY_BUTTON_PATTERN_CONFIG     = 2,
 	PSKEY_HFP_SUPPORTED_FEATURES	= 3,
 	PSKEY_INPUT_PIO_BLOCK        	= 4,
 	PSKEY_HFP_1_5_SUPPORTED_FEATURES= 5,
 	PSKEY_NETWORK_SERVICE_IND_TIME  = 6,
 	PSKEY_MUTE_REMIND_TIME   		= 7,
 	PSKEY_POWER_ON_TIMEOUT   		= 8,
 	PSKEY_POWER_OFF_DISABLED_TIME   = 9,
 	PSKEY_VOLUME_ORIENTATION  		= 10,
 	PSKEY_PAIRING_TIMEOUT     		= 11,
 	PSKEY_AUTOMATIC_SWITCH_OFF    	= 12,
 	PSKEY_RADIO_CONFIG      		= 13,
 	PSKEY_NIMH_CHARGER_CONFIG    	= 14,
 	PSKEY_FEATURE_BLOCK     		= 15,
 	PSKEY_SPEAKER_GAIN_MAPPING		= 16,
 	PSKEY_NO_LED_FILTERS     		= 17,
 	PSKEY_LED_FILTERS      			= 18,
 	PSKEY_NO_LED_STATES     		= 19,
 	PSKEY_LED_STATES      			= 20,
 	PSKEY_NO_LED_EVENTS     		= 21,
 	PSKEY_LED_EVENTS      			= 22,
 	PSKEY_EVENTS_A      			= 23,
 	PSKEY_EVENTS_B    				= 24,
 	PSKEY_NO_TONES                  = 25,
    PSKEY_TONES                     = 26,
    PSKEY_PIO_BLOCK              	= 27,
 	PSKEY_LINK_LOSS_NUM_RETRIES		= 28,
    PSKEY_LAST_USED_AG           	= 29,
 	PSKEY_DEFAULT_AG				= 30,
 	PSKEY_CONFIGURATION_ID			= 31
};

/* 
   	In order to ensure BC4-Headset has a valid configuration 
   	the following limits and defaults are applied to the configuration
   	settings stored within the persistent store
*/
typedef struct
{
 	uint16  psKey;
 	uint16  def;
 	uint16  min;
 	uint16  max;
}key_config;


/* Persistent store event configuration definition */
typedef struct
{
 	unsigned    event:8;
 	unsigned 	type:8;
 	uint16  	pio_mask;
 	uint16  	state_mask;
}event_config_type;

#define MAX_EVENTS ( EVENTS_MAX_EVENTS )


/* Persistent store LED configuration definition */
typedef struct
{
 	unsigned 	state:8;
 	unsigned 	on_time:8;
 	unsigned 	off_time:8;
 	unsigned  	repeat_time:8;
 	uint16  	timeout;
 	unsigned 	number_flashes:4;
 	unsigned 	led_a:4;
 	unsigned 	led_b:4;
 	unsigned 	colour:4;
}led_config_type;

typedef struct
{
 	unsigned 	event:8;
 	unsigned 	speed:8;
     
    unsigned 	active:1;
    unsigned    dummy:1 ;
 	unsigned 	speed_action:2;
 	unsigned  	colour:4;
    unsigned    filter_to_cancel:4 ;
    unsigned    overide_led:4 ;   
    
    unsigned    overide_led_active:1 ;
    unsigned    dummy2:2;
    unsigned    follower_led_active:1 ;
    unsigned    follower_led_delay_50ms:4;
    unsigned    dummy3:8 ;
    
    
}led_filter_config_type;

#define MAX_STATES (HEADSET_NUM_STATES)
#define MAX_LED_EVENTS (20)
#define MAX_LED_STATES (HEADSET_NUM_STATES)
#define MAX_LED_FILTERS (LM_NUM_FILTER_EVENTS)

/* LED patterns */
typedef enum
{
 	led_state_pattern,
 	led_event_pattern
}configType;


#define SOM_NUM_VOL_SETTINGS 16 


typedef struct  
{
    unsigned       IncVol:4;
    unsigned       DecVol:4;
    unsigned       Mic:4;
    unsigned       Tone:4;
    
    unsigned       VolGain:8;
    unsigned       MicGain:8;
    
}vol_config_type;


typedef struct 
{
    unsigned event:8;
    unsigned tone:8;
}tone_config_type ;


typedef struct
{
    uint16 event;
    uint16 pattern[6];
}button_pattern_config_type ;

/****************************************************************************
NAME 
 	configManagerInit

DESCRIPTION
 	Initialises all subcomponents in order

RETURNS
 	void
    
*/
void configManagerInit (hsTaskData* theHeadset);


/****************************************************************************
NAME 
 	configManagerGetMicBiasPio

DESCRIPTION
    Read the PIO assigned for use as the mic bias
 
RETURNS
 	void
*/ 

uint16 configManagerGetMicBiasPio(void);


/****************************************************************************
NAME 
 	configManagerReset

DESCRIPTION
    Resets the Paired Device List - Reboots if PSKEY says to do so
 
RETURNS
 	void
*/ 
void configManagerReset ( hsTaskData * pApp ) ;
     

/****************************************************************************
NAME 
 	configManagerSupportedFeatures

DESCRIPTION
    Gets the Supported features set from PS - exposed as this needs to be done prior to a HFPInit() 
 
RETURNS
 	void
*/ 
uint16 configManagerSupportedFeatures(hsTaskData * theHeadset) ;



/****************************************************************************
NAME 
 	configManagerHFP_1_5_SupportedFeatures

DESCRIPTION
    Gets the 1.5 Supported features set from PS - exposed as this needs to be done prior to a HFPInit() 
 
RETURNS
 	void
*/ 
void configManagerHFP_1_5_SupportedFeatures(hsTaskData* theHeadset) ;



/****************************************************************************
NAME 
 	configManagerWriteVolumeOrientation

DESCRIPTION
    Set the Volume Orientation Inverted PSKEY to Inverted (true ) or not (false)
 
RETURNS
 	void
*/ 
void configManagerWriteVolumeOrientation( hsTaskData * theHeadset , bool pInverted ) ;

#endif   

⌨️ 快捷键说明

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