www.pudn.com > headset.rar > demohs.h
#ifndef _DEMOHS_H #define _DEMOHS_H #include "config.h" #include#include #include #define HEADSET_FRAMEWORK_TASK 1 #define HEADSET_TASK 2 /* Increment value for one press of the volume UP button */ #define VG_VOLUME_UP 1 /* Increment value for one press of the volume DOWN button */ #define VG_VOLUME_DOWN -1 /* The volume change coomand sets either the gain i.e. absolute speaker volume, OR the increment by which to increase/ decrease the speaker volume. */ #define VG_ZERO_GAIN 0 #define VG_ZERO_INCREMENT 0 /* Enumerations defining the current state of the headset device. idle - the headset is awaiting user input or an incoming call connectingAsMaster - the headset is initiating an RFCOMM connection to the audio gateway connectingAsSlave - the headset is awaiting the audio gateway to initiate the RFCOMM connection connected - the headset is connected to another device pairing - the headset is engaged in the pairing procedure with a remote device */ typedef enum { idle, connectingAsMaster, connectingAsSlave, connected, pairing } hs_conn_state_t; typedef struct { uint16 connectState : 4; /* the current state of the headset, see HS_STATE_T */ uint16 buttonPressPending :1; /* set to 1 if true, 0 if false */ uint16 connectAsMasterPending :1; /* set to 1 if true, 0 if false */ uint16 isMuted : 1; uint16 pairingPending:1; uint16 scoConnected:1; #ifdef DEV_BOARD_HS uint16 turnOffHs:1; uint16 connectLEDstate:1; uint16 pairLEDstate:1; #endif uint16 AudioRingHandle; } HeadsetState; /* need a global variable to gain access to this information */ extern HeadsetState hsState; /* cmd.c - called when the Audio Gateway has sent us an unrecognized AT command */ void cmdInd(const HS_CMD_IND_T * ind); /* connect.c - called when the user presses the talk button */ void talkButton(void); /* connect.c - called when the connect operation has completed */ void connectCfm(const HS_CONNECT_CFM_T * cfm); /* connect.c - Ideally called whenever there is a change in status of the connection. However, right now this function is only called when the RFCOMM channel is disconnected. */ void connectStatusInd(HS_CONNECT_STATUS_IND_T * ind); /* connect.c - cancel the current state */ void cancelOperation(void); /* hsState.c - update the current state */ void updateHsConnectState(hs_conn_state_t new_state); /* main.c - puts a headset message in the sceduler queue */ void putMsg(void*); /* microphone.c - send initial mic gain settings */ void sendInitialMicGain(void); /* microphone.c - send request to increment the mic gain */ void onMicGainUp(void); /* microphone.c - send request to decrement the mic gain */ void onMicGainDown(void); /* microphone.c - handle the received mic gain indication */ void microphoneGainInd(const HS_MIC_IND_T * ind); /* mute.c - handle microphone muting */ void muteRequest(void); /* open.c - called when the headset powers up and sets the default ring duration */ void openReq(void); /* open.c - called when the openReq() operation has completed */ void openCfm(const HS_OPEN_CFM_T* cfm); /* pair.c - when the user presses the pair button, this function is called */ void pairButton(void); /* pair.c - called when the pairing operation has completed */ void pairCfm(const HS_PAIR_CFM_T * cfm); /* reset.c - processes user request to reset the pairing status of the headset */ void resetReq(void); /* reset.c - reset completed */ void resetCfm(void); /* reset.c - indicates that an error has ocurred and includes a reason code to indicate what*/ void errorInd(const HS_ERROR_IND_T *ind); /* ring.c - called when there is an incoming ring indication */ void ringInd(const HS_RING_IND_T * ind); /* sco.c - called when there is a change in status of a SCO connection. This function is called both when the SCO is created and destroyed. */ void scoStatusInd(const HS_SCO_STATUS_IND_T * ind); /* volume.c - called by handleButtonChange() when the user presses the volume UP button */ void onVolumeUp(void); /* volume.c - called by handleButtonChange() when the user presses the volume DOWN button */ void onVolumeDown(void); /* volume.c - called when a connection is initially established to set up the default volume level */ void sendInitialVolume(void); /* volume.c - called when the user presses a volume button and sets the volume */ void vgsInd(const HS_VGS_IND_T * ind); #ifdef DEV_BOARD_HS enum { led_off, led_on } ; /* flash.c - start off the flashing LEDs routine */ void flashInit(void); /* flash.c - turns led_id on or off dependning on the value of state */ void setLEDstate(uint8 led_id, uint8 state); /* flash.c - change the flashing LED pattern */ void changeFlash(void); /* on_off.c - cancel everything so headset can go into deep sleep */ void enterDeepSleepAsap(void); /* on_off.c - start up the headset after everything has been disabled */ void enterActiveStateAsap(void); #endif #endif