|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================ 00003 * Name : IsvTelCallAppTelephony.h 00004 * Part of : IsvTelCallApp 00005 * Interface : 00006 * Description : A class that wraps the CTelephony class. 00007 * Version : 00008 * 00009 * Copyright (c) 2005-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 #ifndef ISVTELCALLAPP_TELEPHONY_H 00017 #define ISVTELCALLAPP_TELEPHONY_H 00018 00019 // INCLUDES 00020 #include <e32base.h> 00021 #include <e32std.h> 00022 #include <etel3rdparty.h> 00023 #include <charconv.h> 00024 00025 // CONSTANTS 00026 const TInt KMaxCmdSize = 100; 00027 const TInt KMaxTelNumSize = 100; 00028 const TInt KMaxErrMsgSize = 100; 00029 const TInt KMaxDTMFLength = 80; 00030 00031 // FORWARD DECLARATIONS 00032 class MIsvTelCallAppTelephonyNotify; 00033 class CTelephony; 00034 00035 // CLASS DEFINITIONS 00036 /** 00037 * CIsvTelCallAppTelephony: This class derives from CActive and wraps the 00038 * CTelephony class. Provides a command table based execution for 00039 * telephony commands with command specific parsing capabilities. 00040 */ 00041 class CIsvTelCallAppTelephony : public CActive 00042 { 00043 public: 00044 /** 00045 * Two-phased constructor. 00046 * @param aNotify Reference to an object implementing the 00047 * MIsvTelCallAppTelephonyNotify interface 00048 */ 00049 static CIsvTelCallAppTelephony* NewL( MIsvTelCallAppTelephonyNotify& 00050 aNotify ); 00051 00052 /** 00053 * Destructor. 00054 */ 00055 ~CIsvTelCallAppTelephony(); 00056 00057 /** 00058 * Set the pointer to CTelephony class object 00059 * @param aTel Pointer to CTelephony class object 00060 */ 00061 void SetTelephonyPtr( CTelephony* aTel ); 00062 00063 /** 00064 * Get the pointer to CTelephony class object 00065 */ 00066 CTelephony* GetTelephonyPtr(); 00067 /** 00068 * Create a CTelephony class object 00069 */ 00070 void CreateTelephonyPtrL(); 00071 00072 protected: 00073 00074 /** 00075 * From CActive, RunL. 00076 * Handles the active object’s request completion event 00077 */ 00078 void RunL(); 00079 00080 /** 00081 * From CActive, DoCancel. 00082 * Implements cancellation of an outstanding request. 00083 */ 00084 void DoCancel(); 00085 00086 public: 00087 00088 /** 00089 * Default constructor. 00090 * @param aNotify reference to the object that implements the 00091 * MIsvTelCallAppTelephonyNotify interface. 00092 */ 00093 CIsvTelCallAppTelephony( MIsvTelCallAppTelephonyNotify& aNotify ); 00094 00095 /** 00096 * Second-phase constructor. 00097 */ 00098 void ConstructL(); 00099 00100 /** 00101 * Register for notification change 00102 */ 00103 void RegisterForAsyncNotification( TInt ); 00104 00105 //Wrapper functions for individual commands 00106 /** 00107 * Wrapper function that calls DialNewCall of CTelephony class. 00108 * @param CTelephony::TCallId aCallId either Call1 or Call2. 00109 * @param aTelNumber Called party's mobile number. 00110 */ 00111 void TelApiWrapperMakeNewCallL( CTelephony::TCallId aCallId, 00112 TBuf<CTelephony::KMaxTelNumberSize> aTelNumber ); 00113 00114 /** 00115 * Wrapper function that calls GetCallStatus of CTelephony class. 00116 * @param CTelephony::TCallId aCallId either Call1 or Call2. 00117 */ 00118 void TelApiWrapperGetCallStatusL( CTelephony::TCallId aCallId ); 00119 00120 /** 00121 * Wrapper function that calls Hangup of CTelephony class. 00122 * @param CTelephony::TCallId aCallId either Call1 or Call2. 00123 */ 00124 void TelApiWrapperHangupL( CTelephony::TCallId aCallId ); 00125 00126 /** 00127 * Wrapper function that calls Hold of CTelephony class. 00128 * @param CTelephony::TCallId aCallId either Call1 or Call2. 00129 */ 00130 void TelApiWrapperHoldL( CTelephony::TCallId aCallId ); 00131 /** 00132 * Wrapper function that calls Resume of CTelephony class. 00133 * @param CTelephony::TCallId aCallId either Call1 or Call2. 00134 */ 00135 void TelApiWrapperResumeL( CTelephony::TCallId aCallId ); 00136 00137 /** 00138 * Wrapper function that calls Swap of CTelephony class. 00139 */ 00140 void TelApiWrapperSwapL( ); 00141 00142 /** 00143 * Wrapper function that calls GetLineStatus of CTelephony class 00144 */ 00145 void TelApiWrapperGetVoiceLineStatusL(); 00146 00147 /** 00148 * Wrapper function that calls GetLineStatus of CTelephony class 00149 */ 00150 void TelApiWrapperGetDataLineStatusL(); 00151 00152 /** 00153 * Wrapper function that calls GetLineStatus of CTelephony class 00154 */ 00155 void TelApiWrapperGetFaxLineStatusL(); 00156 00157 /** 00158 * Wrapper function that calls SendDTMFTones of CTelephony class. 00159 * @param CTelephony::TCallId aCallId either Call1 or Call2. 00160 * @param aDtmfSeq DTMF sequence to be sent. 00161 */ 00162 void TelApiWrapperSendDTMFL(CTelephony::TCallId aCallId, 00163 TBuf<KMaxDTMFLength> aDtmfSeq); 00164 00165 /** 00166 * Answers Incoming Call 00167 */ 00168 void TelApiWrapperAnswerInCallL(); 00169 00170 /** 00171 * Loads error strings from resource files 00172 */ 00173 void LoadErrorStringsFromResource( ); 00174 00175 public: 00176 /** 00177 * Finds the system wide error. 00178 * @param aStatus The system wide error. 00179 * @param aErrMsgBuffer The buffer containing the error message. 00180 */ 00181 void GeneralErrorMessage( 00182 TInt aStatus, 00183 TBuf16<KMaxErrMsgSize>* aErrMsgBuffer); 00184 00185 /** 00186 * Starts the active scheduler wait after testing if it is already 00187 * started 00188 */ 00189 void StartWait( ); 00190 00191 private: 00192 00193 /** 00194 * Command Table. 00195 */ 00196 enum TETelApiCmd 00197 { 00198 /** 00199 Dial new call. 00200 */ 00201 EMakeNewCall = 0, 00202 /** 00203 Terminate call. 00204 */ 00205 EHangup, 00206 /** 00207 Place call on hold. 00208 */ 00209 EHold, 00210 /** 00211 Moves call from Hold to Active state. 00212 */ 00213 EResume, 00214 /** 00215 Moves the call under to hold to active and 00216 * the call that is active to hold. 00217 */ 00218 ESwap, 00219 /** 00220 Get Call Status. 00221 */ 00222 EGetCallStatus, 00223 /** 00224 Get Voice line status. 00225 */ 00226 EGetVoiceLineStatus, 00227 /** 00228 Get Data line status. 00229 */ 00230 EGetDataLineStatus, 00231 /** 00232 Get Fax line status. 00233 */ 00234 EGetFaxLineStatus, 00235 /** 00236 Send DTMF. 00237 */ 00238 ESendDTMF, 00239 /** 00240 Answer Incoming Call. 00241 */ 00242 EAnswerIncomingCall, 00243 /** 00244 Async commands. 00245 */ 00246 EAsyncEvent, 00247 /** 00248 Maximum number of commands. 00249 */ 00250 EMaxCommands, 00251 /** 00252 Command None 00253 */ 00254 ECommandNone 00255 }; 00256 00257 private: 00258 00259 //Instance of command table. 00260 TETelApiCmd iTelApiCmd; 00261 00262 //Call identifier. 00263 CTelephony::TCallId iCallId; 00264 00265 //Instance of scheduler wait class 00266 CActiveSchedulerWait iWait; 00267 00268 //Notification event 00269 CTelephony::TNotificationEvent iEvent; 00270 00271 //Reference to a class implementing MIsvTelCallAppTelephonyNotify 00272 //interface. 00273 MIsvTelCallAppTelephonyNotify& iNotify; 00274 00275 //Contains telephone number 00276 TBuf<CTelephony::KMaxTelNumberSize> iTelNum; 00277 00278 //Contains command languauge arguments 00279 TBuf8<KMaxCmdSize> iCallId1Str; 00280 TBuf8<KMaxCmdSize> iCallId2Str; 00281 00282 //Contains error strings loaded from resource 00283 TBuf16<KMaxErrMsgSize> iErrStrNotFound; 00284 TBuf16<KMaxErrMsgSize> iErrStrGeneral; 00285 TBuf16<KMaxErrMsgSize> iErrStrCancel; 00286 TBuf16<KMaxErrMsgSize> iErrStrNoMemory; 00287 TBuf16<KMaxErrMsgSize> iErrStrNotSupported; 00288 TBuf16<KMaxErrMsgSize> iErrStrArgument; 00289 TBuf16<KMaxErrMsgSize> iErrStrTotalLossOfPrecision; 00290 TBuf16<KMaxErrMsgSize> iErrStrBadHandle; 00291 TBuf16<KMaxErrMsgSize> iErrStrOverflow; 00292 TBuf16<KMaxErrMsgSize> iErrStrUnderflow; 00293 TBuf16<KMaxErrMsgSize> iErrStrAlreadyExists; 00294 TBuf16<KMaxErrMsgSize> iErrStrInUse; 00295 TBuf16<KMaxErrMsgSize> iErrStrServerTerminated; 00296 TBuf16<KMaxErrMsgSize> iErrStrServerBusy; 00297 TBuf16<KMaxErrMsgSize> iErrStrUnknown; 00298 TBuf16<KMaxErrMsgSize> iErrStrCorrupt; 00299 TBuf16<KMaxErrMsgSize> iErrStrAccessDenied; 00300 TBuf16<KMaxErrMsgSize> iErrStrCommsLineFail; 00301 TBuf16<KMaxErrMsgSize> iErrStrTimedOut; 00302 TBuf16<KMaxErrMsgSize> iErrStrCouldNotConnect; 00303 TBuf16<KMaxErrMsgSize> iErrStrCouldNotDisconnect; 00304 TBuf16<KMaxErrMsgSize> iErrStrHardwareNotAvailable; 00305 TBuf16<KMaxErrMsgSize> iErrStrSessionClosed; 00306 TBuf16<KMaxErrMsgSize> iErrStrPermissionDenied; 00307 TBuf16<KMaxErrMsgSize> iErrStrDefault; 00308 TBuf16<KMaxErrMsgSize> iEmuApiNotSupported; 00309 00310 //Contains mobile phone identity. 00311 CTelephony::TPhoneIdV1 iPhoneId; 00312 00313 public: 00314 00315 //Pointer to CTelephony class 00316 //which contains the ETel ISV 3rd party APIs 00317 CTelephony* iTel; 00318 00319 //A typedef'd packaged TPhoneIdV1 for passing 00320 //through a generic API method 00321 CTelephony::TCallStatusV1 iCallStatus; 00322 CTelephony::TCallStatusV1Pckg iCallStatusPckg; 00323 }; 00324 00325 #endif // ISVTELCALLAPP_TELEPHONY_H
|
© Nokia 2006 |