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

📄 ansphonecallwatcher.h

📁 s60 接打电话代码,很有学习价值的,可以移植到不同平台
💻 H
字号:
#ifndef __ANSPHONECALLWATCHER_H__
#define __ANSPHONECALLWATCHER_H__

#include <etel.h>

class MAnsPhoneCallWatcherObserver
	{
	public:
		virtual void HandleCallInChangeL(const RCall::TStatus& aStatus) = 0;
	};

/**
*
* @class	CAnsPhoneCallWatcher AnsPhoneCallWatcher.h
* @brief	This class watches for incoming calls
*
*	An RLine handle is required to watch for incoming calls. This will have been opened before
*	this class is constructed and is passed in as a parameter of the constructor.
*	An RCall handle is required to watch the incoming call. This will be opened when an
*	incoming call comes in and closed when the call is hung up.
*
*	In order to be alerted when an incoming call has arrived, NotifyIncomingCall() is called on
*	the RLine handle. This is called as soon as this object is constructed.
*	When an incoming call has arrived RunL() will be called. This opens an RCall handle for
*	the call that has come in using OpenExistingCall(), and answers it using AnswerIncomingCall().
*	When the call has been answered, RunL() will be called. This asks the RCall handle to alert
*	this object when a change in the status of the call takes place, using NotifyStatusChange().
*	When a change occurs, RunL() is called. If the status is hanging up, the call is closed
*	and the object starts watching for incoming calls again. If the status is anything else,
*	another NotifyStatusChange() is queued.
*
*	The observer is updated when the call has been answered and when it has been hung up
*
* Copyright (c) EMCC Software Ltd 2003
* @version	1.0
*
*/

class CAnsPhoneCallWatcher	:	public CActive
	{
	public:
		static CAnsPhoneCallWatcher* NewL(MAnsPhoneCallWatcherObserver& aObserver, RLine& aLine);
		~CAnsPhoneCallWatcher();

	public:				// CActive
		virtual void RunL();
		virtual void DoCancel();

	private:
		//	the state of this object governs what happens when the
		//	StartL() / Stop() / RunL() / DoCancel() functions are called.
		enum TState	{ EWaiting, EAnswering, EWatching };

	private:
		CAnsPhoneCallWatcher(MAnsPhoneCallWatcherObserver& aObserver, RLine& aLine);
		void ConstructL();

	private:
		void StartL();
		void Stop();

	private:
		MAnsPhoneCallWatcherObserver&	iObserver;
		RLine&					iLine;
		RCall					iCall;
		TName					iCallName;
		RCall::TStatus			iCallStatus;
		TState					iState;
	};

#endif

⌨️ 快捷键说明

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