📄 ansphoneengine.h
字号:
#ifndef ANSPHONEENGINE_H_
#define ANSPHONEENGINE_H_
#include <MdaAudioSampleEditor.h>
#include <mda\common\base.h>
#include "AnsPhoneTimer.h"
#include "AnsPhoneCallWatcher.h"
#include "AnsPhoneCallMaker.h"
#include "AnsPhoneCallLog.h"
#include "AnsPhonePhone.h"
class CAnsPhoneMessageHolder;
_LIT(KAnsPhoneEngine, "CAnsPhoneEngine");
const TInt KNumberMaxLength = 20;
class MAnsPhoneEngineObserver
{
public:
virtual void HandlePlayMessageOverL() = 0;
virtual void HandleCallChangeL(const RCall::TStatus& aStatus) = 0;
virtual void HandleNewMessageL() = 0;
};
class CAnsPhoneEngine : public CBase,
public MMdaObjectStateChangeObserver,
public MAnsPhoneTimerObserver,
public MAnsPhoneCallWatcherObserver,
public MAnsPhoneCallMakerObserver,
public MAnsPhoneCallLogObserver
{
public:
enum TState { ENoState, ERecordInit, ERecord, EPlayInit, EPlay };
public:
class TMessage
{
public:
TMessage() { iNumber.Zero(); }
public:
TBuf<KNumberMaxLength> iNumber; // this includes index, e.g. "07779238045 5"
TTime iTime;
};
public:
static CAnsPhoneEngine* NewL(MAnsPhoneEngineObserver& aObserver);
~CAnsPhoneEngine();
public: // MMdaObjectStateChangeObserver
virtual void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
public: // MAnsPhoneTimerObserver
virtual void TimerCompleteL();
public: // MAnsPhoneCallWatcherObserver
virtual void HandleCallInChangeL(const RCall::TStatus& aStatus);
public: // MAnsPhoneCallMakerObserver
virtual void HandleCallHungUpL();
public: // MAnsPhoneCallLogObserver
virtual void HandlePhoneNumberL(const TDesC& aNumber);
public:
void PlayMessageL(TBool aIsLocal, TInt aIndex, TBool aIsUsers);
void RecordMessageL(TBool aIsLocal);
void Stop();
void DeleteMessage(TInt aIndex);
void AnsweringStartL();
void AnsweringStop();
void DialNumberL(TInt aIndex);
public:
void TrimIndex(const TDesC& aBuffer, TDes& aNumber, TInt& aIndex);
public:
inline const TState& State() const;
inline const CArrayFixSeg<TMessage>& MessageList() const;
private:
CAnsPhoneEngine(MAnsPhoneEngineObserver& aObserver);
void ConstructL();
private:
void MoscoStateChangeEventL(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
void TelStartL();
void SoundCleanup();
void TelephonyCleanup();
void GetNextMessageFileName(TDes& aFileName, const TDesC& aNumber);
private:
enum TPanicCode { EWrongState, ERecordInitError, EPlayInitError, EPlayError };
inline void Panic(TPanicCode aReason) const;
private:
MAnsPhoneEngineObserver& iObserver;
CMdaAudioRecorderUtility* iSound;
TState iState;
TBool iIsLocal;
// recording message settings
TMdaFileClipLocation iMessageLocation;
TMdaAudioDataSettings iMessageSettings;
TMdaWavClipFormat iMessageFormat;
TMdaPcmWavCodec iMessageCodec;
CAnsPhoneTimer* iTimer;
// telephony
RTelServer iSession;
RLine iLine;
RAnsPhonePhone iPhone;
CAnsPhoneCallWatcher* iCallWatcher;
CAnsPhoneCallMaker* iCallMaker;
CAnsPhoneCallLog* iCallLog;
CArrayFixSeg<TMessage>* iMessageList;
RFs iFs;
};
// inline functions
const CAnsPhoneEngine::TState& CAnsPhoneEngine::State() const { return iState; }
const CArrayFixSeg<CAnsPhoneEngine::TMessage>& CAnsPhoneEngine::MessageList() const { return *iMessageList; }
void CAnsPhoneEngine::Panic(TPanicCode aReason) const { User::Panic(KAnsPhoneEngine, aReason); };
#endif /*ANSPHONEENGINE_H_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -