📄 am_timer_vibrate.cc
字号:
/* (c) Copyright Motorola 1996 - 2005, All rights reserved. Motorola Confidential Proprietary Contains confidential proprietary information of Motorola, Inc. Reverse engineering is prohibited. The copyright notice does not imply publication. DESCRIPTION: This is *************** REVISION HISTORY ********************************************* Date Author Reference ======== ======== ========================= 2005-06-23 w16355 CR - LIBgg36361 Need additional logging capabilities. 2004-04-30 w17860 LIBee01361 FT_HK: no vibration when incoming arrives while mp3 is playing - Use a Wave pattern instead of the AM timer 2004-03-31 w17860 LIBdd89621 E398: Pops during vibrate using MFT especially at start and end. - Use MP3 instead of Wave for MFT vibrate content 2004-02-26 w17860 LIBdd64152 OT: Interrupted audio when call waiting advice is signalled - Added logging for HAPI signals 03-12-16 a18984 CR - LIBdd62286 Need to support MFT/non MFT product in single binary 03-12-16 w17860 CR - LIBdd62227 MFT vib Updates for E398 03-05-29 a18984 CR - LIBdd07377 MFT feature ON/OFF through Flex 03-04-15 w17860 CR - LIBbb91620 MRS 8291: MFT support for E390 03-03-16 a18984 CR - LIBbb76996 Support for MFT on E380 - added function calls for calling OKI library 02-11-25 w16355 CR - LIBbb61204 Difficult to hear some ringtones in loud environ. Need Ring and Vib. 00-11-09 qcf001 CR - CSGce79507 00-08-04 ktang PR - CSGce67917 Update audio Manager to support Synergy Lite tone defs - Reimplement vib ringers, so all 5 of them are supported 00-08-04 ktang PR - CSGce66238 Add Ringer/Vibrate functionality 99-11-10 bchoi CR - CSGce39480 Modify Audio Manager timer functionality to use SUAPI compliant timers.******************************************************************************/#include <ENGINE_AUDIO/am_aud_tone_reply.h>#include <audio/AM_Timer_Vibrate.H>#include <audio/AM_Timer_Container.H>#include <ENGINE_HAPI/hapi_portlist.h>#include <ENGINE_HAPI/hapi.h>#include <SYNERGY_DEVICE_LAYER/dl_audio_auf.h>#if ((MAKE_HDW_MFT == TRUE) && (MAKE_HDW_OKI == TRUE))#include "am_soundlib_wrapper.h"#include "aud_soundlib_interface.h"#include <SYNERGY_DEVICE_LAYER/dl_db_flexing_auf.h>#endif#if (MAKE_FTR_MFT_SUPPORT == TRUE)#include <ENGINE_AUDIO/aud_tone_type.h>#include <MME/mm_auf_avp.h>#include <audio/AM_Tone_Sequence_Handler.H>#endif#include <audio/AM_HW_Primitive_Builder.H>// Below are 5 types of vib ringers. The data indicates the ON / OFF periods// of the vib alerts, starting from an ON and ending at an OFF. The unit of// each period is ms. const UINT8 shrt[] = {5, 15};const UINT8 lng[] = {15, 30};const UINT8 shrtshrt[] = {5, 3, 5, 15};const UINT8 shrtlng[] = {5, 3, 15, 30};const UINT8 shrt4[] = {5, 3, 5, 3, 5, 3, 5, 10};// Point array of 5 types of vib ringersconst UINT8* Vibs[] = {shrt, lng, shrtshrt, shrtlng, shrt4};// on/off timing parameters of the 5 vib ringers, correspoding to the vib alert// sequence in array Vibsconst UINT8 SemiCycles[] = {2, 2, 4, 4, 8, 0};// declaration of the vibrate_timer;Vibrate_Timer vibrate_timer;Vibrate_Timer::Vibrate_Timer() : AM_Timer_Base(){ Vib.type = 0; Repetition = 0; DspSeq = 0;//LIBgg06828: set InitialDelay to 0 InitialDelay = 0;}// Chooses which of the 5 vib ringers is to be playedvoid Vibrate_Timer::SetDelays(TD_AUD_TONE_UNION_T vib, UINT8 repetition, UINT8 dsp_seq){ Vib = vib; Repetition = repetition; DspSeq = dsp_seq;}// Within the number of ringer cycles, go vib on / off; otherwise,// send a message to AM itself so this vib tone gets removed from the queue.void Vibrate_Timer::RunSequence(){ /* We want to index an array of vibrate durations, which requires * that we have a zero-based index. Since we don't want to alter the * original value of Vib.fields.id, we use a temp variable, VibSelect. */ UINT8 VibSelect = Vib.fields.id; /* Make sure the vibrate is in a valid range. */ if ( VibSelect > DL_AUDIO_TONE_TYPE_ALERT_VIBE_PULSE ) { VibSelect = DL_AUDIO_TONE_TYPE_ALERT_VIBE_PULSE; } else if ( VibSelect < DL_AUDIO_TONE_TYPE_ALERT_VIBE_DOT ) { VibSelect = DL_AUDIO_TONE_TYPE_ALERT_VIBE_PULSE; } /* Shift the alert value to be zero based so we can use it as an array index. */ VibSelect -= DL_AUDIO_TONE_TYPE_ALERT_VIBE_DOT; if (Vib.fields.id == DL_AUDIO_TONE_TYPE_ALERT_VIBE_PULSE + 1) {#if ((MAKE_HDW_MFT == TRUE) && (MAKE_HDW_OKI == TRUE)) if (DL_DbGetFeatureAvailability(DL_DB_FEATURE_ID_MFT_AVAILABLE)) { aud_soundlib_vibrate_req(AUD_SOUNDLIB_VIBRATE_STOP); } else { AM_HW_Primitive_Builder::aud_hPortWrite(HAPI_VIBRATOR_EN, HAPI_SIGNAL_DISABLE, AM_HW_VIBRATOR_EN); }#else { AM_HW_Primitive_Builder::aud_hPortWrite(HAPI_VIBRATOR_EN, HAPI_SIGNAL_DISABLE, AM_HW_VIBRATOR_EN); }#endif } // SeqIndex starts from 0 after the initial delay. NOTE that we don't // want to play the last OFF period of a vib alert. else if ((SeqIndex) < (Repetition * SemiCycles[VibSelect] - 1) || Repetition == 0) { // off duration which should be one second ResetTimer(Vibs[VibSelect][SeqIndex % SemiCycles[VibSelect]] * MS_2_TICKS);#if ((MAKE_HDW_MFT == TRUE) && (MAKE_HDW_OKI == TRUE)) if (DL_DbGetFeatureAvailability(DL_DB_FEATURE_ID_MFT_AVAILABLE)) { aud_soundlib_vibrate_req((SeqIndex % 2)? AUD_SOUNDLIB_VIBRATE_STOP : AUD_SOUNDLIB_VIBRATE_START); } else { AM_HW_Primitive_Builder::aud_hPortWrite( HAPI_VIBRATOR_EN, ((SeqIndex % 2) ? HAPI_SIGNAL_DISABLE : HAPI_SIGNAL_ENABLE), AM_HW_VIBRATOR_EN ); } #else { AM_HW_Primitive_Builder::aud_hPortWrite( HAPI_VIBRATOR_EN, ((SeqIndex % 2) ? HAPI_SIGNAL_DISABLE : HAPI_SIGNAL_ENABLE), AM_HW_VIBRATOR_EN ); }#endif } else if (SeqIndex == (Repetition * SemiCycles[VibSelect] - 1)) { aud_am_reply(Vib.type, DspSeq);#if ((MAKE_HDW_MFT == TRUE) && (MAKE_HDW_OKI == TRUE)) if (DL_DbGetFeatureAvailability(DL_DB_FEATURE_ID_MFT_AVAILABLE)) { aud_soundlib_vibrate_req(AUD_SOUNDLIB_VIBRATE_STOP); } else { AM_HW_Primitive_Builder::aud_hPortWrite(HAPI_VIBRATOR_EN, HAPI_SIGNAL_DISABLE, AM_HW_VIBRATOR_EN ); }#else { AM_HW_Primitive_Builder::aud_hPortWrite(HAPI_VIBRATOR_EN, HAPI_SIGNAL_DISABLE, AM_HW_VIBRATOR_EN ); }#endif } SeqIndex++;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -