satengine/SatServer/Commands/SendSSCmd/src/csatsendsshandler.cpp
changeset 0 ff3b6d0fd310
child 5 7237db0d9fca
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Process forwarding procedures.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "csatsendsshandler.h"
       
    20 #include <PsuiWaitingObs.h>
       
    21 #include <PsuiContainer.h>
       
    22 #include <PsetCallWaiting.h>
       
    23 #include <PsetContainer.h>
       
    24 #include <PsetCallBarring.h>
       
    25 #include <PsuiBarringObs.h>
       
    26 #include <PsetCallDiverting.h>
       
    27 #include <PsuiDivertObs.h>
       
    28 #include <PsetCli.h>
       
    29 #include <PsuiCliObserver.h>
       
    30 
       
    31 #include "csatsendssbarringnouiobs.h"
       
    32 #include "csatsendssdivertnouiobs.h"
       
    33 #include "csatsendsscallwaitingnouiobs.h"
       
    34 #include "csatsendssclinouiobs.h"
       
    35 
       
    36 #include    "SatLog.h"
       
    37 
       
    38 // ================= MEMBER FUNCTIONS ==========================================
       
    39 
       
    40 // Destructor
       
    41 CSatSendSsHandler::~CSatSendSsHandler()
       
    42     {
       
    43     delete iDivert;
       
    44     delete iBarring;
       
    45     delete iWaiting;
       
    46     delete iCli;
       
    47     delete iSettings;
       
    48     delete iSatCwObserver;
       
    49     delete iSatCbObserver;
       
    50     delete iSatCliObserver;
       
    51     delete iSatCfObserver;
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CSatSendSsHandler::ProcessForwardingL
       
    56 // -----------------------------------------------------------------------------
       
    57 void CSatSendSsHandler::ProcessForwardingL(
       
    58         TAction aAction,
       
    59         TForwardingProcedure aForwarding,
       
    60         const TDesC& aNumber,
       
    61         const TDesC& aBasicCode,
       
    62         const TDesC& aTimer )
       
    63     {
       
    64     LOG( SIMPLE, "CSatSendSsHandler::ProcessForwardingL calling" )
       
    65 
       
    66     TBasicServiceGroups bsc = ChangeToBsc( aBasicCode );
       
    67     ConnectToSsEngineL();
       
    68 
       
    69     TCallDivertSetting setDivert;
       
    70     setDivert.iNumber.Copy( aNumber );
       
    71     setDivert.iServiceGroup = EServiceGroupVoice;
       
    72     setDivert.iStatus = EDivertingStatusUnknown;
       
    73     setDivert.iNoReplyTimer = 0;// all unconditional
       
    74 
       
    75     LOG2( NORMAL, 
       
    76     "CSatSendSsHandler::ProcessForwardingL aForwarding: %d", aForwarding )
       
    77     switch ( aForwarding )
       
    78         {
       
    79         case EForwardingNotReachable:
       
    80             {
       
    81             LOG( NORMAL, 
       
    82             "CSatSendSsHandler::ProcessForwardingL EForwardingNotReachable" )
       
    83             setDivert.iCondition = EDivertConditionNotReachable;
       
    84             break;
       
    85             }
       
    86 
       
    87         case EForwardingNoReply:
       
    88             {
       
    89             LOG( NORMAL, 
       
    90             "CSatSendSsHandler::ProcessForwardingL EForwardingNoReply" )
       
    91             if ( aTimer.Length() != 0 )
       
    92                 {
       
    93                 TLex input( aTimer );
       
    94                 User::LeaveIfError( input.Val( setDivert.iNoReplyTimer ) );
       
    95                 }
       
    96             else
       
    97                 {
       
    98                 LOG( NORMAL, 
       
    99                 "CSatSendSsHandler::ProcessForwardingL iNoReplyTimer" )
       
   100                 setDivert.iNoReplyTimer = iDivert->GetTimerValueL();
       
   101                 }
       
   102             setDivert.iCondition = EDivertConditionNoReply;
       
   103             break;
       
   104             }
       
   105 
       
   106         case EForwardingBusy:
       
   107             {
       
   108             LOG( NORMAL, 
       
   109             "CSatSendSsHandler::ProcessForwardingL EForwardingBusy" )
       
   110             setDivert.iCondition = EDivertConditionBusy;
       
   111             break;
       
   112             }
       
   113 
       
   114         case EForwardingUnconditional:
       
   115             {
       
   116             LOG( NORMAL, 
       
   117             "CSatSendSsHandler::ProcessForwardingL EForwardingUnconditional" )
       
   118             setDivert.iCondition = EDivertConditionUnconditional;
       
   119             break;
       
   120             }
       
   121 
       
   122         case EForwardingAll:
       
   123             {
       
   124             LOG( NORMAL, 
       
   125             "CSatSendSsHandler::ProcessForwardingL EForwardingAll" )
       
   126             setDivert.iCondition = EDivertConditionAllCalls;
       
   127             break;
       
   128             }
       
   129 
       
   130         case EForwardingAllConditional:
       
   131             {
       
   132             LOG( NORMAL, 
       
   133             "CSatSendSsHandler::ProcessForwardingL \
       
   134             EForwardingAllConditional" )
       
   135             setDivert.iCondition = EDivertConditionAllConditionalCases;
       
   136             break;
       
   137             }
       
   138 
       
   139         default:
       
   140             {
       
   141             LOG( NORMAL, 
       
   142             "CSatSendSsHandler::ProcessForwardingL Unknown forwarding" )
       
   143             break;
       
   144             }
       
   145         }
       
   146 
       
   147     switch ( aAction )
       
   148         {
       
   149         case EActivate:
       
   150             {
       
   151             LOG( NORMAL, "CSatSendSsHandler::EActivate" )
       
   152             setDivert.iSetting = EActivateDiverting;
       
   153             iDivert->SetDivertingL( setDivert, bsc );
       
   154             break;
       
   155             }
       
   156 
       
   157         case EDeactivate:
       
   158             {
       
   159             LOG( NORMAL, "CSatSendSsHandler::EDeactivate" )
       
   160             setDivert.iSetting = ECancelDiverting;
       
   161             iDivert->SetDivertingL( setDivert, bsc );
       
   162             break;
       
   163             }
       
   164 
       
   165         case EInterrogate:
       
   166             {
       
   167             LOG( NORMAL, "CSatSendSsHandler::EInterrogate" )
       
   168             iDivert->GetDivertingStatusL( EServiceGroupVoice,
       
   169                 setDivert.iCondition, bsc );
       
   170             break;
       
   171             }
       
   172 
       
   173         case ERegister:
       
   174             {
       
   175             LOG( NORMAL, "CSatSendSsHandler::ERegister" )
       
   176             setDivert.iSetting = ERegisterDiverting;
       
   177             iDivert->SetDivertingL( setDivert, bsc );
       
   178             break;
       
   179             }
       
   180 
       
   181         case EErase:
       
   182             {
       
   183             LOG( NORMAL, "CSatSendSsHandler::EErase" )
       
   184             setDivert.iSetting = EEraseDiverting;
       
   185             iDivert->SetDivertingL( setDivert, bsc );
       
   186             break;
       
   187             }
       
   188 
       
   189         default:
       
   190             {
       
   191             LOG( NORMAL, "  Unknown action" )
       
   192             break;
       
   193             }
       
   194         }
       
   195 
       
   196     LOG( SIMPLE, "CSatSendSsHandler::ProcessForwardingL exiting" )
       
   197     }
       
   198 
       
   199 // -----------------------------------------------------------------------------
       
   200 // CSatSendSsHandler::ProcessBarringL
       
   201 // -----------------------------------------------------------------------------
       
   202 void CSatSendSsHandler::ProcessBarringL(
       
   203         TAction aAction,
       
   204         TBarringProcedure aBarring,
       
   205         const TDesC& aPassword,
       
   206         const TDesC& aBasicCode )
       
   207     {
       
   208     LOG2( SIMPLE, "CSatSendSsHandler::ProcessBarringL calling, aBarring: %d",
       
   209           aBarring )
       
   210 
       
   211     TBasicServiceGroups bsc = ChangeToBsc( aBasicCode );
       
   212     ConnectToSsEngineL();
       
   213     TCallBarringSetting setBarring;
       
   214     setBarring.iServiceGroup = EServiceGroupVoice;
       
   215 
       
   216     setBarring.iPassword = aPassword;
       
   217     switch ( aBarring )
       
   218         {
       
   219         case EBarringAllOutgoingCalls:
       
   220             {
       
   221             setBarring.iType = EBarringTypeAllOutgoing;
       
   222             break;
       
   223             }
       
   224 
       
   225         case EBarringAllOutgoingInternationalCalls:
       
   226             {
       
   227             setBarring.iType = EBarringTypeOutgoingInternational;
       
   228             break;
       
   229             }
       
   230 
       
   231         case EBarringAllOutgoingInternationalCallsExceptHome:
       
   232             {
       
   233             setBarring.iType = EBarringTypeOutgoingInternationalExceptToHomeCountry;
       
   234             break;
       
   235             }
       
   236 
       
   237         case EBarringAllIncomingCalls:
       
   238             {
       
   239             setBarring.iType = EBarringTypeAllIncoming;
       
   240             break;
       
   241             }
       
   242 
       
   243         case EBarringAllIncomingCallsWhenRoaming:
       
   244             {
       
   245             setBarring.iType = EBarringTypeIncomingWhenRoaming;
       
   246             break;
       
   247             }
       
   248 
       
   249         case EBarringAllServices:
       
   250             {
       
   251             setBarring.iType = EBarringTypeAllServices;
       
   252             break;
       
   253             }
       
   254 
       
   255         case EBarringAllOutgoingServices:
       
   256             {
       
   257             setBarring.iType = EBarringTypeAllOutgoingServices;
       
   258             break;
       
   259             }
       
   260 
       
   261         case EBarringAllIncomingServices:
       
   262             {
       
   263             setBarring.iType = EBarringTypeAllIncomingServices;
       
   264             break;
       
   265             }
       
   266 
       
   267         default:
       
   268             {
       
   269             break;
       
   270             }
       
   271         }
       
   272     LOG2( SIMPLE, "CSatSendSsHandler::ProcessBarringL aAction: %d", aAction )
       
   273     switch ( aAction )
       
   274         {
       
   275         case EActivate:
       
   276             {
       
   277             setBarring.iSetting = EActivateBarring;
       
   278             iBarring->SetBarringL( setBarring, bsc );
       
   279             break;
       
   280             }
       
   281 
       
   282         case EDeactivate:
       
   283             {
       
   284             setBarring.iSetting = ECancelBarring;
       
   285             iBarring->SetBarringL( setBarring, bsc );
       
   286             break;
       
   287             }
       
   288 
       
   289         case EInterrogate:
       
   290             {
       
   291             iBarring->GetBarringStatusL( EServiceGroupVoice, setBarring.iType );
       
   292             break;
       
   293             }
       
   294 
       
   295         case ERegister:
       
   296         case EErase:
       
   297         default:
       
   298             {
       
   299             break;
       
   300             }
       
   301         }
       
   302 
       
   303     LOG( SIMPLE, "CSatSendSsHandler::ProcessBarringL exiting" )
       
   304     }
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // CSatSendSsHandler::ProcessPasswordChangeL
       
   308 // -----------------------------------------------------------------------------
       
   309 void CSatSendSsHandler::ProcessPasswordChangeL(
       
   310         TPasswordProcedure aPassword,
       
   311         const TDesC& aOldPassword,
       
   312         const TDesC& aNewPassword,
       
   313         const TDesC& aVerifyNewPassword )
       
   314     {
       
   315     LOG( SIMPLE, "CSatSendSsHandler::ProcessPasswordChangeL calling" )
       
   316 
       
   317     ConnectToSsEngineL();
       
   318 
       
   319     //check the validity of aNewPassword and aVerifyNewPassword
       
   320     if ( aNewPassword.Compare( aVerifyNewPassword ) != 0 )
       
   321         {
       
   322         LOG( SIMPLE, 
       
   323         "CSatSendSsHandler::ProcessPasswordChangeL password error" )
       
   324         // if not equal, show "PASSWORD ERROR"
       
   325         iSatCbObserver->HandleBarringErrorL( 1 );
       
   326         }
       
   327     else
       
   328         {
       
   329         RMobilePhone::TMobilePhonePasswordChangeV2 passWords;
       
   330         passWords.iOldPassword = aOldPassword;
       
   331         passWords.iNewPassword = aNewPassword;
       
   332         passWords.iVerifiedPassword = aVerifyNewPassword;
       
   333         // if equal send to cpsetcallbarring
       
   334         if ( aPassword == EPasswordBarring )
       
   335             {
       
   336             LOG( SIMPLE, 
       
   337             "CSatSendSsHandler::ProcessPasswordChangeL EPasswordBarring" )
       
   338             iBarring->ChangePasswordL( passWords, ETrue );
       
   339             }
       
   340         else
       
   341             {
       
   342             LOG( SIMPLE, 
       
   343             "CSatSendSsHandler::ProcessPasswordChangeL others" )
       
   344             iBarring->ChangePasswordL( passWords, EFalse );
       
   345             }
       
   346         }
       
   347 
       
   348     LOG( SIMPLE, "CSatSendSsHandler::ProcessPasswordChangeL exiting" )
       
   349     }
       
   350 
       
   351 // -----------------------------------------------------------------------------
       
   352 // CSatSendSsHandler::ChangeToBsc
       
   353 // -----------------------------------------------------------------------------
       
   354 TBasicServiceGroups CSatSendSsHandler::ChangeToBsc(
       
   355     const TDesC& aBasicCode ) const
       
   356     {
       
   357     LOG( SIMPLE, "CSatSendSsHandler::ChangeToBsc calling" )
       
   358 
       
   359     // Null values must be handled as well, length == 0
       
   360     if ( aBasicCode.Length() == 0 )
       
   361         {
       
   362         LOG( SIMPLE, "CSatSendSsHandler::ChangeToBsc length is zero" )
       
   363         return EAllTeleAndBearer;
       
   364         }
       
   365 
       
   366     TInt value = 0;
       
   367     TLex input( aBasicCode );
       
   368     input.Val( value );
       
   369 
       
   370     // Presumed that the values given in aBasicCode are not acting violently
       
   371     TBasicServiceGroups returnValue =
       
   372         static_cast<TBasicServiceGroups>( value );
       
   373 
       
   374     LOG( SIMPLE, "CSatSendSsHandler::ChangeToBsc exiting" )
       
   375     return returnValue;
       
   376     }
       
   377 
       
   378 // -----------------------------------------------------------------------------
       
   379 // CSatSendSsHandler::ConnectToSsEngine
       
   380 // -----------------------------------------------------------------------------
       
   381 void CSatSendSsHandler::ConnectToSsEngineL()
       
   382     {
       
   383     LOG( SIMPLE, "CSatSendSsHandler::ConnectToSsEngineL calling" )
       
   384 
       
   385     if ( !iSettings ) //create connection
       
   386         {
       
   387         LOG( SIMPLE, 
       
   388         "CSatSendSsHandler::ConnectToSsEngineL iSettings false" )
       
   389         //creates the containers
       
   390         iSettings = CPsetContainer::NewL();
       
   391 
       
   392         //call waiting engine
       
   393         iSatCwObserver = new ( ELeave ) CSatSendSsCallWaitingNoUiObs();
       
   394 
       
   395         iWaiting = iSettings->CreateCWObjectL( *iSatCwObserver );
       
   396 
       
   397         //call barring engine
       
   398         iSatCbObserver = new ( ELeave ) CSatSendSsBarringNoUiObs();
       
   399 
       
   400         iBarring = iSettings->CreateCBObjectL( *iSatCbObserver );
       
   401 
       
   402         iSatCliObserver = new ( ELeave ) CSatSendSsCliNoUiObs();
       
   403 
       
   404         iCli = iSettings->CreateCliObjectL( *iSatCliObserver );
       
   405 
       
   406         //call divert observer and engine
       
   407         iSatCfObserver = new ( ELeave ) CSatSendSsDivertNoUiObs();
       
   408 
       
   409         iDivert = iSettings->CreateCFObjectL( *iSatCfObserver );
       
   410         }
       
   411 
       
   412     LOG( SIMPLE, "CSatSendSsHandler::ConnectToSsEngineL exiting" )
       
   413     }
       
   414 
       
   415 // -----------------------------------------------------------------------------
       
   416 // CSatSendSsHandler::Cancel
       
   417 // -----------------------------------------------------------------------------
       
   418 //
       
   419 void CSatSendSsHandler::Cancel()
       
   420     {
       
   421     LOG( SIMPLE, "CSatSendSsHandler::Cancel calling" )
       
   422 
       
   423     if ( iWaiting )
       
   424         {
       
   425         iWaiting->CancelProcess();
       
   426         }
       
   427 
       
   428     if ( iBarring )
       
   429         {
       
   430         iBarring->CancelCurrentRequest();
       
   431         }
       
   432 
       
   433     if ( iCli )
       
   434         {
       
   435         iCli->CancelAll();
       
   436         }
       
   437 
       
   438     if ( iDivert )
       
   439         {
       
   440         iDivert->CancelCurrentRequest();
       
   441         }
       
   442 
       
   443     LOG( SIMPLE, "CSatSendSsHandler::Cancel exiting" )
       
   444     }
       
   445 
       
   446 // -----------------------------------------------------------------------------
       
   447 // CSatSendSsHandler::ProcessWaitingL
       
   448 // -----------------------------------------------------------------------------
       
   449 void CSatSendSsHandler::ProcessWaitingL(
       
   450         TAction aAction,
       
   451         const TDesC& aBasicCode )
       
   452     {
       
   453     LOG2( SIMPLE, "CSatSendSsHandler::ProcessWaitingL calling,aAction: %d",
       
   454           aAction )
       
   455 
       
   456     TBasicServiceGroups bsc = ChangeToBsc( aBasicCode );
       
   457     ConnectToSsEngineL();
       
   458 
       
   459     switch ( aAction )
       
   460         {
       
   461         case EActivate:
       
   462             {
       
   463             iWaiting->SetCallWaitingL( MPsetCallWaiting::EActivateCallWaiting,
       
   464                 bsc );
       
   465             break;
       
   466             }
       
   467 
       
   468         case EDeactivate:
       
   469             {
       
   470             iWaiting->SetCallWaitingL( MPsetCallWaiting::EDeactivateCallWaiting,
       
   471                 bsc );
       
   472             break;
       
   473             }
       
   474 
       
   475         case EInterrogate:
       
   476             {
       
   477             iWaiting->GetCallWaitingStatusL();
       
   478             break;
       
   479             }
       
   480 
       
   481         case ERegister:
       
   482         case EErase:
       
   483         default:
       
   484             {
       
   485             break;
       
   486             }
       
   487         }
       
   488 
       
   489     LOG( SIMPLE, "CSatSendSsHandler::ProcessWaitingL exiting" )
       
   490     }
       
   491 
       
   492 // -----------------------------------------------------------------------------
       
   493 // CSatSendSsHandler::ProcessClipStatusL
       
   494 // -----------------------------------------------------------------------------
       
   495 void CSatSendSsHandler::ProcessClipStatusL()
       
   496     {
       
   497     LOG( SIMPLE, "CSatSendSsHandler::ProcessClipStatusL calling" )
       
   498 
       
   499     ConnectToSsEngineL();
       
   500     iCli->GetClipModeL();
       
   501 
       
   502     LOG( SIMPLE, "CSatSendSsHandler::ProcessClipStatusL exiting" )
       
   503     }
       
   504 
       
   505 // -----------------------------------------------------------------------------
       
   506 // CSatSendSsHandler::ProcessClirStatusL
       
   507 // -----------------------------------------------------------------------------
       
   508 void CSatSendSsHandler::ProcessClirStatusL()
       
   509     {
       
   510     LOG( SIMPLE, "CSatSendSsHandler::ProcessClirStatusL calling" )
       
   511 
       
   512     ConnectToSsEngineL();
       
   513     iCli->GetClirModeL();
       
   514 
       
   515     LOG( SIMPLE, "CSatSendSsHandler::ProcessClirStatusL calling" )
       
   516     }
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CSatSendSsHandler::ProcessColpStatusL
       
   520 // -----------------------------------------------------------------------------
       
   521 void CSatSendSsHandler::ProcessColpStatusL()
       
   522     {
       
   523     LOG( SIMPLE, "CSatSendSsHandler::ProcessColpStatusL calling" )
       
   524 
       
   525     ConnectToSsEngineL();
       
   526     iCli->GetColpModeL();
       
   527 
       
   528     LOG( SIMPLE, "CSatSendSsHandler::ProcessColpStatusL exiting" )
       
   529     }
       
   530 
       
   531 // -----------------------------------------------------------------------------
       
   532 // CSatSendSsHandler::ProcessColrStatusL
       
   533 // -----------------------------------------------------------------------------
       
   534 void CSatSendSsHandler::ProcessColrStatusL()
       
   535     {
       
   536     LOG( SIMPLE, "CSatSendSsHandler::ProcessColrStatusL calling" )
       
   537 
       
   538     ConnectToSsEngineL();
       
   539     iCli->GetColrModeL();
       
   540 
       
   541     LOG( SIMPLE, "CSatSendSsHandler::ProcessColrStatusL exiting " )
       
   542     }
       
   543 
       
   544 // -----------------------------------------------------------------------------
       
   545 // CSatSendSsHandler::ProcessCnapStatusL
       
   546 // -----------------------------------------------------------------------------
       
   547 void CSatSendSsHandler::ProcessCnapStatusL()
       
   548     {
       
   549     LOG( SIMPLE, "CSatSendSsHandler::ProcessCnapStatusL calling" )
       
   550 
       
   551     ConnectToSsEngineL();
       
   552     iCli->GetCnapL();
       
   553 
       
   554     LOG( SIMPLE, "CSatSendSsHandler::ProcessCnapStatusL exiting" )
       
   555     }
       
   556 
       
   557 // -----------------------------------------------------------------------------
       
   558 // CSatSendSsHandler::RequestComplete
       
   559 // -----------------------------------------------------------------------------
       
   560 void CSatSendSsHandler::RequestComplete()
       
   561     {
       
   562     LOG( SIMPLE, "CSatSendSsHandler::RequestComplete calling - exiting" )
       
   563     }
       
   564 
       
   565 // -----------------------------------------------------------------------------
       
   566 // CSatSendSsHandler::RequestStatusChanged
       
   567 // -----------------------------------------------------------------------------
       
   568 void CSatSendSsHandler::RequestStatusChanged( TInt aNewStatus )
       
   569     {
       
   570     LOG( SIMPLE, "CSatSendSsHandler::RequestStatusChanged calling" )
       
   571 
       
   572     TInt status = aNewStatus;
       
   573     status = status;
       
   574     LOG2( SIMPLE, "   RequestStatusChanged (%i)", status )
       
   575 
       
   576     LOG( SIMPLE, "CSatSendSsHandler::RequestStatusChanged exiting" )
       
   577     }
       
   578 
       
   579 //  End of File