00001 /* 00002 * TermParms.h 00003 * 00004 * Copyright 2003, MobileSpear Inc. (www.mobilespear.com). All rights reserved. 00005 * Copyright 2003, David Resnick. All rights reserved. 00006 * 00007 * See the file doc\license.txt for the terms of usage and distribution. 00008 */ 00009 00010 #ifndef _BOGOTEL_TERMPARMS_H 00011 #define _BOGOTEL_TERMPARMS_H 00012 00013 #include <srltpt.h> 00014 00015 #include <bogotel/observer.h> 00016 #include <bogotel/voicedev.h> 00017 #include <bogotel/timertarget.h> 00018 00019 #include <bogotel/stlhelp.h> 00020 00021 namespace bogotel { 00022 00023 class CIOOp; 00024 00025 class CTermParms : public CObserver { 00026 public: 00027 CTermParms(CVoiceDev* pVD, CIOOp* pIOOp, const DV_TPT* pTPT); 00028 ~CTermParms(); 00029 00030 enum timerType { 00031 MaxSil = 0, // maximum period of silence 00032 MaxTime, // maximum total period for function 00033 IddTime // maximum inter-digit delay period 00034 }; 00035 00036 void timerExpired(int timerType, int stateId); 00037 void start(); 00038 00039 int getNumberDtmfsPressed() { return m_iNumDtmfsPressed; } 00040 00041 private: 00042 00043 void initialCheck(); 00044 virtual void update(CSubject* theChangedCSubject); 00045 void _update(); 00046 void copyTpt(const DV_TPT* pTpt) throw (std::invalid_argument); 00047 00048 bool inDigitMask(unsigned short mask, char digit); 00049 00050 void log(int iLevel, char *szFmt, ...); 00051 00052 CVoiceDev* m_pVD; 00053 CIOOp* m_pIOOp; 00054 DV_TPT* m_pTpt; 00055 00056 int m_iNumDtmfsPressed; 00057 00058 unsigned int m_uiStartingSpeakerStateId; 00059 00060 // DTMFs accumulated since beginning of monitoring 00061 std::string m_strDtmf; 00062 00063 CVoiceDev::speakerState m_currSpeakerState; 00064 }; 00065 00066 } 00067 00068 #endif // ! _BOGOTEL_TERMPARMS_H 00069