examples/Telephony/ETel3rdPartyExample/OutgoingCalls/CMainMenu.cpp

00001 /*
00002 Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */
00029 
00030 
00031 #include "CMainMenu.h"
00032 #include <simtsy.h>
00033 
00040 CMainMenu* CMainMenu::NewLC(CConsoleBase& aConsole)
00041         {
00042         CMainMenu* self = new(ELeave) CMainMenu(aConsole);
00043         CleanupStack::PushL(self);
00044         self->ConstructL();
00045         return self;
00046         }
00047 
00053 CMainMenu::CMainMenu(CConsoleBase& aConsole)
00054         : CBaseMenuAsync(aConsole)
00055         {
00056         iCallWaitingOn = EFalse;
00057         iRinging = EFalse;
00058         iThenAnswer = EFalse;
00059         }
00060 
00064 void CMainMenu::ConstructL()
00065         {
00066         CBaseMenuAsync::ConstructL();
00067         iPhoneId = CPhoneId::NewL(this);
00068         iNetworkName = CCurrentNetworkName::NewL(this);
00069         iOperatorName = COperatorName::NewL(this);
00070         iNetworkInfo = CCurrentNetworkInfo::NewL(this);
00071 
00072         iFlightModeInfo = CFlightModeInfo::NewL(this);
00073         iNetworkRegInfo = CNetworkRegInfo::NewL(this);
00074         iDialCall = CDialCall::NewL(this);
00075         iLineStatus = CLineStatus::NewL(this);
00076 
00077         iHangup = CHangup::NewL(this);
00078         iHold = CHold::NewL(this);
00079         iResume = CResume::NewL(this);
00080 
00081         iSwap = CSwap::NewL(this);
00082 
00083         iGetLockInfo = CGetLockInfo::NewL(this);
00084         iCallWaiting = CCallWaitingStatus::NewL(this);
00085         iAnswerIncomingCall = CAnswerIncomingCall::NewL(this);
00086         }
00087 
00091 CMainMenu::~CMainMenu()
00092         {
00093         delete iTelephony;
00094         delete iPhoneId;
00095 
00096         delete iNetworkName;
00097         delete iNetworkInfo;
00098         delete iOperatorName;
00099 
00100         delete iDialCall;
00101         delete iHangup;
00102         delete iHold;
00103         delete iSwap;
00104         delete iResume;
00105 
00106         delete iFlightModeInfo;
00107         delete iNetworkRegInfo;
00108 
00109         delete iGetLockInfo;
00110         delete iCallWaiting;
00111         delete iAnswerIncomingCall;
00112 
00113         delete iLineStatus;
00114         delete iCallStatus;
00115         delete iCallStatus2;
00116         }
00117 
00124 void CMainMenu::ExecComplete(TTelISVExampleType aDerivedType)
00125         {
00126         if (IsActive())
00127                 {
00128                 Cancel();
00129                 }
00130    if ( iState==ESetNotifier
00131                         ||  aDerivedType == KLineStatus
00132                         ||  aDerivedType == KHold)
00133                 {
00134                 switch(aDerivedType)
00135                         {
00136                 case KLineStatus:
00137                         iLastOperation = iLineStatus;
00138                         break;
00139                 case KFlightModeInfo:
00140                         iLastOperation = iFlightModeInfo;
00141                         break;
00142                 case KNetworkRegInfo:
00143                         iLastOperation = iNetworkRegInfo;
00144                         break;
00145                 case KDialCall:
00146                         iLastOperation = iDialCall;
00147                         break;
00148                 case KHold:
00149                         iLastOperation = iHold;
00150                         break;
00151                 case KResume:
00152                         iLastOperation = iResume;
00153                         break;
00154                 case KSwap:
00155                         iLastOperation = iSwap;
00156                         break;
00157                 case KHangup:
00158                         iLastOperation = iHangup;
00159                         break;
00160                 case KNetworkInfo:
00161                         iLastOperation = iNetworkInfo;
00162                         break;
00163                 case KNetworkName:
00164                         iLastOperation = iNetworkName;
00165                         break;
00166                 case KOperatorName:
00167                         iLastOperation = iOperatorName;
00168                         break;
00169                 case KLockInfo:
00170                         iLastOperation = iGetLockInfo;
00171                         break;
00172                 case KCallWaitingStatus:
00173                         iLastOperation = iCallWaiting;
00174                         break;
00175                 case KAnswerIncomingCall:
00176                         iLastOperation = iAnswerIncomingCall;
00177                         break;
00178                 case KNotType:
00179                 case KPhoneId:
00180                 case KSubscriberId:
00181                 case KBatteryInfo:
00182                 case KSignalInfo:
00183                 case KGetIndicator:
00184                 case KCallInfo:
00185                 case KCallStatus:
00186                 case KDynamicCaps:
00187                 case KSendDTMF:
00188                 case KCallForwardingStatus:
00189                 case KCallBarringStatus:
00190                 case KIdentityServiceStatus:
00191                 default:
00192                         break;
00193                         }
00194                 TRAPD(errNotify, iLastOperation->RequestNotificationL());
00195                 if (errNotify != KErrNone)
00196                         {
00197                         iConsole->Printf(_L("Notification Request for TTelISVExampleType"));
00198                         iConsole->Printf(_L("%d left with error code "), aDerivedType);
00199                         iConsole->Printf(_L("%d\n"), errNotify);
00200                         return;
00201                         };
00202                 // Check the type of iLastOperation to see what it has been cast to
00203                 switch(iLastOperation->GetExampleType())
00204                         {
00205                 case KFlightModeInfo:
00206                         iState = EGetNetworkRegStatus;
00207                         iLastOperation = iNetworkRegInfo;
00208                         SetActive();
00209                         CompleteOwnRequest(KErrNone);
00210                         break;
00211                 case KLineStatus:
00212                         iRinging = ETrue;
00213                         PrintCorrectMenu(GetCurrentDynamicCaps());
00214                         GetInput();
00215                         break;
00216                 case KAnswerIncomingCall:
00217                         if (iCallStatus == NULL)
00218                                 {
00219                                 iCallId = reinterpret_cast<CAnswerIncomingCall*>
00220                                                   (iAnswerIncomingCall)->iCallId;
00221                                 TRAPD(err,      iCallStatus = CCallStatus::NewL(this, iCallId));
00222                                 if (err != KErrNone)
00223                                         {
00224                                         iConsole->Printf(_L("CallStatus1 construction left "));
00225                                         iConsole->Printf(_L("with error code %d\n"), err);
00226                                         return;
00227                                         }
00228                                 iLastCallStatus = iCallStatus;
00229                                 }
00230                         else
00231                                 {
00232                                 iCallId2 = reinterpret_cast<CAnswerIncomingCall*>
00233                                            (iAnswerIncomingCall)->iCallId;
00234                                 TRAPD(err,      iCallStatus2 = CCallStatus::NewL(this, iCallId2));
00235                                 if (err != KErrNone)
00236                                         {
00237                                         iConsole->Printf(_L("CallStatus2 construction left "));
00238                                         iConsole->Printf(_L("with error code %d\n"), err);
00239                                         return;
00240                                         }
00241                                 iLastCallStatus =  iCallStatus2;
00242                                 }
00243                         iState = EGetCallStatus;
00244                         iLastOperation = iLastCallStatus;
00245                         SetActive();
00246                         CompleteOwnRequest(KErrNone);
00247                         break;
00248                 case KDialCall:
00249                         if (iCallStatus == NULL)
00250                                 {
00251                                 iCallId = reinterpret_cast<CDialCall*>
00252                                           (iDialCall)->iCallId;
00253                                 TRAPD(err,      iCallStatus = CCallStatus::NewL(this, iCallId));
00254                                 if (err != KErrNone)
00255                                         {
00256                                         iConsole->Printf(_L("CallStatus1 construction left "));
00257                                         iConsole->Printf(_L("with error code %d\n"), err);
00258                                         return;
00259                                         }
00260 
00261                                 iLastCallStatus = iCallStatus;
00262                                 }
00263                         else
00264                                 {
00265                                 iCallId2 = reinterpret_cast<CDialCall*>
00266                                            (iDialCall)->iCallId;
00267                                 TRAPD(err,      iCallStatus2 = CCallStatus::NewL(this, iCallId2));
00268                                 if (err != KErrNone)
00269                                         {
00270                                         iConsole->Printf(_L("CallStatus2 construction left "));
00271                                         iConsole->Printf(_L("with error code %d\n"), err);
00272                                         return;
00273                                         }
00274                                 iLastCallStatus =  iCallStatus2;
00275                                 }
00276                         iState = EGetCallStatus;
00277                         iLastOperation = iLastCallStatus;
00278                         SetActive();
00279                         CompleteOwnRequest(KErrNone);
00280                         break;
00281                 case KCallStatus:
00282                 case KResume:
00283                         PrintCorrectMenu(GetCurrentDynamicCaps());
00284                         GetInput();
00285                         break;
00286                 case KSwap:
00287                         if (iLastCallStatus == iCallStatus)
00288                                 {
00289                                 iLastCallStatus =  iCallStatus2;
00290                                 }
00291                         else
00292                                 {
00293                                 iLastCallStatus =  iCallStatus;
00294                                 }
00295                         PrintCorrectMenu(GetCurrentDynamicCaps());
00296                         GetInput();
00297                         break;
00298                 case KHangup:
00299                         // Do nothing; all operations on hangup event are handled by the
00300                         // call status notification. In this way remote party hangups can be
00301                         // detected.
00302                         break;
00303                 case KHold:
00304                         if (iThenAnswer)
00305                                 {
00306                                 iThenAnswer = EFalse;
00307                                 iState = EAnswerIncomingCall;
00308                                 iLastOperation = iAnswerIncomingCall;
00309                                 SetActive();
00310                                 CompleteOwnRequest(KErrNone);
00311                                 }
00312                         else
00313                                 {
00314                                 PrintCorrectMenu(GetCurrentDynamicCaps());
00315                                 GetInput();
00316                                 }
00317                         break;
00318                 case KNetworkInfo:
00319                         iState = EGetNetworkName;
00320                         iLastOperation = iNetworkName;
00321                         SetActive();
00322                         CompleteOwnRequest(KErrNone);
00323                         break;
00324                 case KNetworkName:
00325                         iState = EGetOperatorName;
00326                         iLastOperation = iOperatorName;
00327                         SetActive();
00328                         CompleteOwnRequest(KErrNone);
00329                         break;
00330                 case KOperatorName:
00331                         iState = ECallWaiting;
00332                         iLastOperation = iCallWaiting;
00333                         SetActive();
00334                         CompleteOwnRequest(KErrNone);
00335                         break;
00336                 case KLockInfo:
00337                         iState = EGetLineStatus;
00338                         iLastOperation = iLineStatus;
00339                         SetActive();
00340                         CompleteOwnRequest(KErrNone);
00341                         break;
00342                 case KCallWaitingStatus:
00343                         iCallWaitingOn = ETrue;
00344                         iState = EGetLockInfo;
00345                         iLastOperation = iGetLockInfo;
00346                         SetActive();
00347                         CompleteOwnRequest(KErrNone);
00348                         break;
00349                 default:
00350 
00351                         break;
00352                         }
00353                 }
00354         else if(aDerivedType == KPhoneId)
00355                 {
00356                 iLastOperation = iFlightModeInfo;
00357                 SetActive();
00358                 CompleteOwnRequest(KErrNone);
00359                 }
00360         }
00361 
00368 void CMainMenu::ExecNotify(TTelISVExampleType aDerivedType)
00369         {
00370         if (IsActive())
00371                 {
00372                 Cancel();
00373                 }
00374         switch(aDerivedType)
00375                 {
00376         case KNetworkRegInfo:
00377                 {
00378                 TRAPD(err, iNetworkRegInfo->RequestNotificationL());
00379                 if (err != KErrNone)
00380                         {
00381                         iConsole->Printf(_L("%d\n"),err);
00382                         return;
00383                         }
00384                 iState = EGetNetworkInfo;
00385                 iLastOperation = iNetworkInfo;
00386                 SetActive();
00387                 CompleteOwnRequest(KErrNone);
00388                 break;
00389                 }
00390         case KLineStatus:
00391                 {
00392                 TRAPD(err, iLineStatus->RequestNotificationL());
00393                 if (err != KErrNone)
00394                         {
00395                         iConsole->Printf(_L("Request left with error code "));
00396                         iConsole->Printf(_L("%d\n"),err);
00397                         return;
00398                         }               PrintCorrectMenu(GetCurrentDynamicCaps());
00399                 GetInput();
00400                 break;
00401                 }
00402         case KCallStatus:
00403                 if (iLastCallStatus == iCallStatus)
00404                         {
00405                         // Delete the previous object call status object which has now been
00406                         // hung up.
00407                         delete iLastCallStatus;
00408                         iCallStatus = NULL;
00409                         iLastCallStatus = iCallStatus2;
00410                         }
00411                 else
00412                         {
00413                         delete iLastCallStatus;
00414                         iCallStatus2 = NULL;
00415                         iLastCallStatus = iCallStatus;
00416                         }
00417                 if (iLineStatus->IsActive())
00418                         {
00419                         iLineStatus->Cancel();
00420                         }
00421                 iState = EGetLineStatus;
00422                 iLastOperation = iLineStatus;
00423                 SetActive();
00424                 CompleteOwnRequest(KErrNone);
00425                 break;
00426         case KCallWaitingStatus:
00427                 iCallWaitingOn = EFalse;
00428                 iState = EGetLockInfo;
00429                 iLastOperation = iGetLockInfo;
00430                 SetActive();
00431                 CompleteOwnRequest(KErrNone);
00432                 break;
00433         case KNotType:
00434         case KPhoneId:
00435         case KSubscriberId:
00436         case KBatteryInfo:
00437         case KSignalInfo:
00438         case KGetIndicator:
00439         case KLockInfo:
00440         case KNetworkInfo:
00441         case KNetworkName:
00442         case KOperatorName:
00443         case KCallInfo:
00444         case KFlightModeInfo:
00445         case KAnswerIncomingCall:
00446         case KDialCall:
00447         case KDynamicCaps:
00448         case KHold:
00449         case KResume:
00450         case KSwap:
00451         case KSendDTMF:
00452         case KHangup:
00453         case KCallForwardingStatus:
00454         case KCallBarringStatus:
00455         case KIdentityServiceStatus: 
00456         default:
00457                 break;  
00458                 }
00459         }
00460 
00464 void CMainMenu::RunL()
00465         {
00466         switch(iState)
00467                 {
00468         case EStart:
00469                 iState = EGetFlightModeInfo;
00470                 iLastOperation = iPhoneId;
00471                 TRAPD(errPhone, iLastOperation->StartRequestL());
00472                 if (errPhone != KErrNone)
00473                         {
00474                         iConsole->Printf(_L("Request left with error code "));
00475                         iConsole->Printf(_L("%d\n"), errPhone);
00476                         return;
00477                         };
00478                 break;
00479         case EEnd:
00480                 if (iLineStatus->IsActive())
00481                         {
00482                         iLineStatus->Cancel();
00483                         }
00484                 if (iNetworkRegInfo->IsActive())
00485                         {
00486                         iNetworkRegInfo->Cancel();
00487                         }
00488                 if (iNetworkInfo->IsActive())
00489                         {
00490                         iNetworkInfo->Cancel();
00491                         }
00492                 if (iFlightModeInfo->IsActive())
00493                         {
00494                         iFlightModeInfo->Cancel();
00495                         }
00496                 CActiveScheduler::Stop();
00497                 break;
00498         case EAnswerIncomingCall:
00499         case ECallWaiting:
00500         case EGetLockInfo:
00501         case EGetNetworkInfo:
00502         case EGetNetworkName:
00503         case EGetOperatorName:
00504         case EGetFlightModeInfo:
00505         case EGetNetworkRegStatus:
00506         case EGetLineStatus:
00507         case EGetCallStatus:
00508                 iState = ESetNotifier;
00509                 TRAPD(err, iLastOperation->StartRequestL());
00510                 if (err != KErrNone)
00511                         {
00512                         iConsole->Printf(_L("Request left with error code "));
00513                         iConsole->Printf(_L("%d\n"), err);
00514                         return;
00515                         }
00516                 break;
00517         case EHold:
00518         case EResume:
00519         case EHangup:
00520                 CTelephony::TCallId temp;
00521                 if (iLastCallStatus == iCallStatus)
00522                         {
00523                         temp = iCallId;
00524                         }
00525                 else
00526                         {
00527                         temp = iCallId2;
00528                         }
00529                 iState = ESetNotifier;
00530                 TRAPD(errArg, iLastOperation->StartRequestL(temp));
00531                 if (errArg != KErrNone)
00532                         {
00533                         iConsole->Printf(_L("Request left with error code "));
00534                         iConsole->Printf(_L("%d\n"), errArg);
00535                         return;
00536                         }
00537                 break;
00538         case ESwap:
00539                 iState = ESetNotifier;
00540                 TRAPD(errSwap, iLastOperation->StartRequestL(iCallId, iCallId2));
00541                 if (errSwap != KErrNone)
00542                         {
00543                         iConsole->Printf(_L("Request left with error code "));
00544                         iConsole->Printf(_L("%d\n"), errSwap);
00545                         return;
00546                         }
00547                 break;
00548         case EDialCall:
00549                 iState = ESetNotifier;
00550                 TRAPD(errNum, iLastOperation->StartRequestL(KTheNumber));
00551                 if (errNum != KErrNone)
00552                         {
00553                         iConsole->Printf(_L("Request left with error code "));
00554                         iConsole->Printf(_L("%d\n"), errNum);
00555                         return;
00556                         }
00557                 break;
00558         case EWaitingForKeyPress:
00559                 {
00560                 CTelephony::TCallCapsV1 CallCapsV1 = GetCurrentDynamicCaps();
00561                 TUint32 crtlCaps = CallCapsV1.iControlCaps;
00562                 TInt c = iConsole->KeyCode();
00563                 switch(c)
00564                         {
00565                 // Exit
00566                 case 'E':
00567                 case 'e':
00568                 // cancel notifications
00569                         if (iCallStatus != NULL)
00570                                 {
00571                                 iCallStatus->Cancel();
00572                                 }
00573                         if (iCallStatus2 != NULL)
00574                                 {
00575                                 iCallStatus2->Cancel();
00576                                 }
00577                         iLineStatus->Cancel();
00578                         iFlightModeInfo->Cancel();
00579                         iNetworkRegInfo->Cancel();
00580                         iNetworkInfo->Cancel();
00581                         iGetLockInfo->Cancel();
00582                         CActiveScheduler::Stop();
00583                         break;
00584                 // Hangup active call
00585                 case EKeyEscape:
00586                         if (iLastCallStatus != NULL)
00587                                 {
00588                                 iState = EHangup;
00589                                 iLastOperation = iHangup;
00590                                 SetActive();
00591                                 CompleteOwnRequest(KErrNone);
00592                                 }
00593                         else
00594                                 {
00595                                 GetInput();
00596                                 }
00597                         break;
00598                 // Swap active and on hold calls
00599                 case 'S':
00600                 case 's':
00601                         if (crtlCaps & CTelephony::KCapsSwap
00602                         &&  iCallStatus != NULL
00603                         &&  iCallStatus2 !=NULL)
00604                                 {
00605                                 iState = ESwap;
00606                                 iLastOperation = iSwap;
00607                                 SetActive();
00608                                 CompleteOwnRequest(KErrNone);
00609                                 }
00610                         else
00611                                 {
00612                                 GetInput();
00613                                 }
00614                         break;
00615                 // Make another call
00616                 case 'D':
00617                 case 'd':
00618                         if (iLastCallStatus == NULL
00619                         ||  crtlCaps & CTelephony::KCapsResume
00620                         && !iRinging)
00621                                 {
00622                                 iConsole->ClearScreen();
00623                                 iConsole->Printf(_L("Dialling Call\n"));
00624                                 iState = EDialCall;
00625                                 iLastOperation = iDialCall;
00626                                 SetActive();
00627                                 CompleteOwnRequest(KErrNone);
00628                                 }
00629                         else
00630                                 {
00631                                 GetInput();
00632                                 }
00633                         break;
00634                 // Put call on hold
00635                 case 'H':
00636                 case 'h':
00637                         if (crtlCaps & CTelephony::KCapsHold)
00638                                 {
00639                                 iState = EHold;
00640                                 iLastOperation = iHold;
00641                                 SetActive();
00642                                 CompleteOwnRequest(KErrNone);
00643                                 }
00644                         else
00645                                 {
00646                                 GetInput();
00647                                 }
00648                         break;
00649                 // Resume on hold call
00650                 case 'R':
00651                 case 'r':
00652                         if (crtlCaps & CTelephony::KCapsResume
00653                         &&  iLastCallStatus != NULL )
00654                                 {
00655                                 iState = EResume;
00656                                 iLastOperation = iResume;
00657                                 SetActive();
00658                                 CompleteOwnRequest(KErrNone);
00659                                 }
00660                         else
00661                                 {
00662                                 GetInput();
00663                                 }
00664                         break;
00665                 // Answer incoming call
00666                 case 'a':
00667                 case 'A':
00668                         if (iCallWaiting && iLastCallStatus != NULL
00669                         &&  crtlCaps & CTelephony::KCapsResume)
00670                                 {
00671                                 iRinging = EFalse;
00672                                 iState = EAnswerIncomingCall;
00673                                 iLastOperation = iAnswerIncomingCall;
00674                                 SetActive();
00675                                 CompleteOwnRequest(KErrNone);
00676                                 break;
00677                                 }
00678                         else if(iCallWaiting
00679                              && iLastCallStatus != NULL
00680                              && crtlCaps & CTelephony::KCapsHold)
00681                                 {
00682                                 iRinging = EFalse;
00683                                 iThenAnswer = ETrue;
00684                                 iState = EHold;
00685                                 iLastOperation = iHold;
00686                                 SetActive();
00687                                 CompleteOwnRequest(KErrNone);
00688                                 }
00689                         else
00690                                 {
00691                                 GetInput();
00692                                 }
00693                         break;
00694                 // Simulate incoming call
00695                 case 'i':
00696                 case 'I':
00697                         if(iCallWaiting
00698                         && iLastCallStatus != NULL
00699                         && (crtlCaps & CTelephony::KCapsResume ||
00700                             crtlCaps & CTelephony::KCapsHold))
00701                                 {
00702                                 TInt ret = RProperty::Set(KUidPSSimTsyCategory,
00703                                                                                   KPSSimTsyIncomingVoiceCall,
00704                                                                                   0);
00705                                 if(ret!=KErrNone)
00706                                         {
00707                                         iConsole->Printf(_L("Set failed : %d\n"),ret);  
00708                                         }                                                 
00709                                 break;
00710                                 }
00711                 default:
00712                         GetInput();
00713                         }
00714                 }
00715                 break;
00716         default:
00717                 break;
00718                 }
00719         }
00720 
00724 CTelephony::TCallCapsV1 CMainMenu::GetCurrentDynamicCaps()
00725         {
00726         CTelephony::TCallId temp;
00727         CTelephony::TCallCapsV1 callCapsV1;
00728         CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1);
00729         if (iLastCallStatus == iCallStatus)
00730                 {
00731                 temp = iCallId;
00732                 }
00733         else
00734                 {
00735                 temp = iCallId2;
00736                 }
00737         // Retrieves the dynamic call capabilities for calls you dialled or answered with CTelephony
00738         iTelephony->GetCallDynamicCaps(temp, callCapsV1Pckg);
00739         return callCapsV1;
00740         }
00741 
00747 void CMainMenu::PrintCorrectMenu(CTelephony::TCallCapsV1 aCallCapsV1)
00748         {
00749         iConsole->ClearScreen();
00750         iConsole->Printf(KMenuMsg);
00751         if (iRinging)
00752                 {
00753                 iConsole->Printf(_L("There is an incoming call\n"));
00754                 iConsole->Printf(_L("How would you like to proceed?\n"));
00755                 if (aCallCapsV1.iControlCaps & CTelephony::KCapsHold)
00756                         {
00757                         iConsole->Printf(KHoldMsg);
00758                         iConsole->Printf(KAnswerMsg);
00759                         iConsole->Printf(KHangupMsg);
00760                         }
00761                 else
00762                         {
00763                         iConsole->Printf(KResumeMsg);
00764                         iConsole->Printf(KAnswerMsg);
00765                         iConsole->Printf(KHangupMsg);
00766                         }
00767                 }
00768         else
00769                 {
00770                 if (iLastCallStatus == NULL)
00771                         {
00772                         iConsole->Printf(KDialMsg);
00773                         }
00774                 else if (aCallCapsV1.iControlCaps & CTelephony::KCapsSwap
00775                      &&  iCallStatus != NULL
00776                      &&  iCallStatus2 != NULL)
00777                         {
00778                         iConsole->Printf(KSwapMsg);
00779                         iConsole->Printf(KHangupMsg);
00780                         }
00781                 else if (aCallCapsV1.iControlCaps & CTelephony::KCapsHold)
00782                         {
00783                         iConsole->Printf(KHoldMsg);
00784                         iConsole->Printf(KIncomingMsg);
00785                         iConsole->Printf(KHangupMsg);
00786                         }
00787                 else if (aCallCapsV1.iControlCaps & CTelephony::KCapsResume)
00788                         {
00789                         iConsole->Printf(KResumeMsg);
00790                         iConsole->Printf(KDialMsg);
00791                         iConsole->Printf(KIncomingMsg);
00792                         iConsole->Printf(KHangupMsg);
00793                         }
00794                 }
00795         }
00796 
00800 void CMainMenu::GetInput()
00801         {
00802         iConsole->Read(iStatus);
00803         iState = EWaitingForKeyPress;
00804         SetActive();
00805         }
00806 
00810 void CMainMenu::DoCancel()
00811         {
00812         if(iState == EStart)
00813                 {
00814                 CompleteOwnRequest(KErrCancel);
00815                 }
00816         else
00817                 {
00818                 iConsole->ReadCancel();
00819                 }
00820         }

Generated by  doxygen 1.6.2