telephonyutils/etel3rdpartyapi/ExampleApps/Shared/CISVAPIBase.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CCISVAPIBase.h
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 #ifndef __CISVAPIBASE_H__
       
    20 #define __CISVAPIBASE_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <etel3rdparty.h>
       
    24 
       
    25 /**
       
    26 Enumeration allocating numbers to different types of classes derived from 
       
    27 CISVBase.
       
    28 */
       
    29 enum TTelISVExampleType
       
    30 	{
       
    31 	KNotType = -1,
       
    32 	KPhoneId,
       
    33 	KSubscriberId,
       
    34 	KBatteryInfo,
       
    35 	KSignalInfo,
       
    36 	KGetIndicator,
       
    37 	KLockInfo,
       
    38 	KNetworkInfo,
       
    39 	KNetworkName,
       
    40 	KOperatorName,
       
    41 	KCallInfo,
       
    42 	KLineStatus,
       
    43 	KCallStatus,
       
    44 	KFlightModeInfo,
       
    45 	KNetworkRegInfo,
       
    46 	KAnswerIncomingCall,
       
    47 	KDialCall,
       
    48 	KDynamicCaps,
       
    49 	KHold,
       
    50 	KResume,
       
    51 	KSwap,
       
    52 	KSendDTMF,
       
    53 	KHangup,
       
    54 	KCallWaitingStatus,
       
    55 	KCallForwardingStatus,
       
    56 	KCallBarringStatus,
       
    57 	KIdentityServiceStatus
       
    58 	};
       
    59 
       
    60 /**
       
    61 Enumerations for the potential states of a CMainMenu class.
       
    62 */
       
    63 enum TState
       
    64 	{
       
    65 	EStart,
       
    66 	EEnd,
       
    67 	EDummyAnswer,
       
    68 
       
    69 	EGetPhoneId,
       
    70 	EGetSubscriberId,
       
    71 	EGetCallInfo,
       
    72 	EGetBatteryInfo,
       
    73 	EGetIndicator,
       
    74 	EGetLockInfo,
       
    75 	EGetSignalInfo,
       
    76 	EGetNetworkInfo,
       
    77 	EGetNetworkName,
       
    78 	EGetOperatorName,
       
    79 
       
    80 	EGetFlightModeInfo,
       
    81 	EGetNetworkRegStatus,
       
    82 
       
    83 	EGetLineStatus,
       
    84 	EGetCallStatus,
       
    85 	EAnswerIncomingCall,
       
    86 	EDialCall,
       
    87 	EGetDynamicCaps,
       
    88 	EHold,
       
    89 	EResume,
       
    90 	ESwap,
       
    91 	ESendDTMF,
       
    92 	EHangup,
       
    93 
       
    94 	ECallForwarding,
       
    95 	ECallWaiting,
       
    96 	ECallBarring,
       
    97 	EIdentityService,
       
    98 
       
    99 	EWaitingForKeyPress,
       
   100 
       
   101 	ESetNotifier
       
   102 	};
       
   103 
       
   104 /**
       
   105 Base interface providing functionality for a member active object to interact
       
   106 with its owning class.
       
   107 */
       
   108 class MExecController
       
   109 	{
       
   110 public:
       
   111 	/**
       
   112 	End execution of the program, stop the active scheduler making sure all 
       
   113 	outstanding requests have been cancelled.
       
   114 	*/
       
   115 	virtual void Terminate() = 0;
       
   116 
       
   117 	/**
       
   118 	Returns a pointer to the CTelephony Instance so member objects can make
       
   119 	calls to the Etel 3rd Party API through the same object.
       
   120 	
       
   121 	@return CTelephony pointer
       
   122 	*/
       
   123 	virtual CTelephony* GetTelObj() const = 0;
       
   124 
       
   125 	/**
       
   126 	Returns a pointer to the console instance so
       
   127 	member objects can print to the console as required.
       
   128 	
       
   129 	@return CConsoleBase pointer
       
   130 	*/
       
   131 	virtual CConsoleBase* GConsole() const = 0;
       
   132 
       
   133 	};
       
   134 
       
   135 /**
       
   136 Base class providing functionality for objects to make Etel 3rd party function
       
   137 calls and interact with their owning class.
       
   138 */
       
   139 class CISVAPIBase : public CActive
       
   140 	{
       
   141 
       
   142 public:
       
   143 	CISVAPIBase(MExecController* aController,
       
   144 			    TTelISVExampleType aExampleType);
       
   145 
       
   146 	void StartRequestL();
       
   147 	void StartRequestL(CTelephony::TCallId aCallId);
       
   148 	void StartRequestL(CTelephony::TCallId aCallId1,
       
   149 	                   CTelephony::TCallId aCallId2);
       
   150 	void StartRequestL(const TDesC& aTones);
       
   151 	void RequestNotificationL();
       
   152 	void AppTerminate();
       
   153 
       
   154 	inline void RetrieveTelephonyObject();
       
   155 	inline void RetrieveConsole();
       
   156 
       
   157 	inline TTelISVExampleType GetExampleType() const;
       
   158 
       
   159 protected:
       
   160 	virtual void DoStartRequestL();
       
   161 	virtual void DoStartRequestL(CTelephony::TCallId aCallId);
       
   162 	virtual void DoStartRequestL(CTelephony::TCallId aCallId1,
       
   163 	                             CTelephony::TCallId aCallId2);
       
   164 	virtual void DoStartRequestL(const TDesC& aNumber);
       
   165 	virtual void DoRequestNotificationL();
       
   166 
       
   167 protected:
       
   168 	/**
       
   169 	An instance of the MExecController interface allowing objects derived from
       
   170 	this class to make calls back to a class implementing this interface. (In 
       
   171 	this case CMainMenu).
       
   172 	*/
       
   173 	MExecController* iController;
       
   174 	/**
       
   175 	A CTelephony instance allowing derived classes to make Etel 3rd party
       
   176 	calls.
       
   177 	*/
       
   178 	CTelephony* iTelephony;
       
   179 	/**
       
   180 	A CConsoleBase instance allowing derived classes to peform console 
       
   181 	operations such as printing.
       
   182 	*/
       
   183 	CConsoleBase* iConsole;
       
   184 
       
   185 private:
       
   186 	/**
       
   187 	Specifies the type of the derived class that has extended the functionality
       
   188 	of this class.
       
   189 	*/
       
   190 	const TTelISVExampleType iExampleType;
       
   191 
       
   192 	};
       
   193 
       
   194 /**
       
   195 Gives the type of the derived class.
       
   196 
       
   197 @return TTelISVExampleType enumeration value stating the derived type of this
       
   198                            object
       
   199 */
       
   200 inline TTelISVExampleType CISVAPIBase::GetExampleType() const
       
   201 	{
       
   202 	return iExampleType;
       
   203 	};
       
   204 
       
   205 /**
       
   206 Retrieves a CTelephony instance from the MExecController implementing class by
       
   207 calling the GetTelObj() method of the interface. Sets iTelephony to point to this
       
   208 instance. Etel 3rd party calls can be made through this pointer.
       
   209 */
       
   210 inline void CISVAPIBase::RetrieveTelephonyObject()
       
   211 	{
       
   212 	iTelephony = iController->GetTelObj();
       
   213 	}
       
   214 
       
   215 /**
       
   216 Retrieves a CConsoleBase instance from the MExecController implementing class by
       
   217 calling GConsole() method of the interface. Sets iConsole to point to this
       
   218 instance. A console can now be printed to through this pointer.
       
   219 */
       
   220 inline void CISVAPIBase::RetrieveConsole()
       
   221 	{
       
   222 	iConsole = iController->GConsole();
       
   223 	}
       
   224 
       
   225 
       
   226 #endif // __CISVAPIBASE_H__