ansphonecallwatcher.h

来自「series60 应用程序开发的源代码 series60 应用程序开发的源代码」· C头文件 代码 · 共 72 行

H
72
字号
#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 + =
减小字号Ctrl + -
显示快捷键?