cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp
branchRCL_3
changeset 35 95674584745d
parent 16 b23265fb36da
child 40 997690c3397a
equal deleted inserted replaced
21:53b7818cd282 35:95674584745d
    23 #include "cbsettinghandler.h"
    23 #include "cbsettinghandler.h"
    24 
    24 
    25 #include "atmisccmdpluginconsts.h"
    25 #include "atmisccmdpluginconsts.h"
    26 #include "debug.h"
    26 #include "debug.h"
    27 
    27 
    28 const TInt KSCPMaxHashLength( 32 );
       
    29 
       
    30 CCLCKCommandHandler* CCLCKCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
    28 CCLCKCommandHandler* CCLCKCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
    31     {
    29     {
    32     TRACE_FUNC_ENTRY
    30     TRACE_FUNC_ENTRY
    33     CCLCKCommandHandler* self = new (ELeave) CCLCKCommandHandler(aCallback, aATCmdParser, aPhone);
    31     CCLCKCommandHandler* self = new (ELeave) CCLCKCommandHandler(aCallback, aATCmdParser, aPhone);
    34     CleanupStack::PushL(self);
    32     CleanupStack::PushL(self);
   302     delete callBarringList;
   300     delete callBarringList;
   303     TRACE_FUNC_EXIT
   301     TRACE_FUNC_EXIT
   304     return KErrNone;
   302     return KErrNone;
   305     }
   303     }
   306 
   304 
   307 void CCLCKCommandHandler::HandleCommandCancel()
       
   308     {
       
   309     TRACE_FUNC_ENTRY
       
   310     Cancel();
       
   311     TRACE_FUNC_EXIT
       
   312     }
       
   313 
       
   314 void CCLCKCommandHandler::IssueCLCKCommand()
   305 void CCLCKCommandHandler::IssueCLCKCommand()
   315     {
   306     {
   316     TRACE_FUNC_ENTRY
   307     TRACE_FUNC_ENTRY
   317     Trace(KDebugPrintD, "iCLCKCommandType: ", iCLCKCommandType);
   308     Trace(KDebugPrintD, "iCLCKCommandType: ", iCLCKCommandType);
   318     iReply.Zero();
   309     iReply.Zero();
   325             SetActive();
   316             SetActive();
   326             break;
   317             break;
   327             }
   318             }
   328         case (CCLCKCommandHandler::ECLCKLockSet):
   319         case (CCLCKCommandHandler::ECLCKLockSet):
   329             {
   320             {
   330             if (iPassword.Compare(KNullDesC8) == 0)
   321             if (iPassword.Length() == 0)
   331                 {
   322                 {
   332                 iCallback->CreateReplyAndComplete( EReplyTypeError);
   323                 iCallback->CreateReplyAndComplete( EReplyTypeError);
   333                 }
   324                 }
   334             else
   325             else
   335                 {
   326                 {
   336                 // Set the property to ignore security events in other clients
   327                 // Set the property to ignore security events in other clients
   337                 // it allows to avoid GUI promt for security code
   328                 // it allows to avoid GUI promt for security code
   338                 TInt  ret = KErrNone;
   329                 TInt  ret = KErrNone;
   339                 // TODO: reenable when KIgnoreSecurityEvent propety definition is submitted to codeline
   330                 if (iLockType == RMobilePhone::ELockICC)
   340 //                if (iLockType == RMobilePhone::ELockICC)
   331                     {
   341 //                    {
   332                     ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPin1Required);
   342 //                    ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPin1Required);
   333                     }
   343 //                    }
   334                 else
   344 //                else
   335                     {
   345 //                    {
   336                     ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPhonePasswordRequired);
   346 //                    ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPhonePasswordRequired);
   337                     }
   347 //                    }
       
   348                 Trace(KDebugPrintD, "RProperty::Set: ", ret);
   338                 Trace(KDebugPrintD, "RProperty::Set: ", ret);
   349                 if (ret == KErrNone)
   339                 if (ret == KErrNone)
   350                     {
   340                     {
   351                     // Start security event handler - this will notify whether a 
   341                     // Start security event handler - this will notify whether a 
   352                     // password is required to complete the set lock request.
   342                     // password is required to complete the set lock request.
   371             SetActive();
   361             SetActive();
   372             break;
   362             break;
   373             }
   363             }
   374         case (CCLCKCommandHandler::ECLCKBarringSet):
   364         case (CCLCKCommandHandler::ECLCKBarringSet):
   375             {
   365             {
   376             if (iPassword.Compare(KNullDesC8) == 0)
   366             if (iPassword.Length() == 0)
   377                 {
   367                 {
   378                 iCallback->CreateReplyAndComplete(EReplyTypeError);
   368                 iCallback->CreateReplyAndComplete(EReplyTypeError);
   379                 }
   369                 }
   380             else
   370             else
   381                 {
   371                 {
   544     }
   534     }
   545 
   535 
   546 TInt CCLCKCommandHandler::ParseCCLCKCommand()
   536 TInt CCLCKCommandHandler::ParseCCLCKCommand()
   547     {
   537     {
   548     TRACE_FUNC_ENTRY
   538     TRACE_FUNC_ENTRY
   549     TCmdFacilityType facilityType = ECmdFacilityTypeUnknown;
   539     TPtrC8 command;
   550     TInt mode = 0;
   540     TInt ret = iATCmdParser.NextTextParam(command);
   551     TInt ret = KErrNone;
   541     if (ret != KErrNone)
   552 
       
   553     TPtrC8 command = iATCmdParser.NextTextParam(ret);
       
   554     if (!command.Compare(KNullDesC8) || ret != KErrNone)
       
   555         {
   542         {
   556         TRACE_FUNC_EXIT
   543         TRACE_FUNC_EXIT
   557         return KErrArgument;
   544         return KErrArgument;
   558         }
   545         }
   559     
   546     
       
   547     TInt mode = 0;
   560     ret = iATCmdParser.NextIntParam(mode);
   548     ret = iATCmdParser.NextIntParam(mode);
   561     if (!command.Compare(KNullDesC8) || ret != KErrNone)
   549     if (ret != KErrNone)
   562         {
   550         {
   563         TRACE_FUNC_EXIT
   551         TRACE_FUNC_EXIT
   564         return KErrArgument;
   552         return KErrArgument;
   565         }
   553         }
   566     
   554     
   567     iPassword.Create(iATCmdParser.NextTextParam(ret));
   555     TPtrC8 tmpPwd;
   568     Trace(KDebugPrintD, "NextTextParam returned: ", ret);
   556     ret = iATCmdParser.NextTextParam(tmpPwd);
   569     if (ret != KErrNone && ret != KErrNotFound)
   557     if (ret != KErrNone && ret != KErrNotFound)
   570         {
   558         {
   571         TRACE_FUNC_EXIT
   559         TRACE_FUNC_EXIT
   572         return KErrArgument;
   560         return KErrArgument;
   573         }
   561         }
   574     
   562     
   575     if (iPassword.Compare(KNullDesC8) != 0)
   563     iPassword.Create(tmpPwd);
   576         {
   564     if (iPassword.Length() != 0)
   577         ret = iATCmdParser.NextIntParam(iInfoClass);
   565         {
   578         Trace(KDebugPrintD, "NextIntParam(iInfoClass): ", ret);
   566         ret = iATCmdParser.NextIntParam(iInfoClass);;
   579         if (ret == KErrNotFound)
   567         if (ret == KErrNotFound)
   580             {
   568             {
   581             iInfoClass = 7;
   569             iInfoClass = 7; // Default value, see ETSI TS 127 007 V6.9.0 (2007-06)
   582             }
   570             }
   583         if ((ret != KErrNone && ret != KErrNotFound ) || 
   571         else if (ret != KErrNone || iATCmdParser.NextParam().Length() != 0)
   584             iATCmdParser.NextParam().Compare(KNullDesC8) != 0)
       
   585             {
   572             {
   586             TRACE_FUNC_EXIT
   573             TRACE_FUNC_EXIT
   587             return KErrArgument;
   574             return KErrArgument;
   588             }
   575             }
   589         }
   576         }
   590     
   577     
   591     if (command.Compare(KATCLCKPS) == 0)
   578     TCmdFacilityType facilityType = ECmdFacilityTypeUnknown;
       
   579     
       
   580     if (command.CompareF(KATCLCKPS) == 0)
   592         {
   581         {
   593         // Lock phone to SIM on/off
   582         // Lock phone to SIM on/off
   594         iSecurityCode = RMobilePhone::ESecurityCodePhonePassword;
   583         iSecurityCode = RMobilePhone::ESecurityCodePhonePassword;
   595         iLockType = RMobilePhone::ELockPhoneToICC;
   584         iLockType = RMobilePhone::ELockPhoneToICC;
   596         facilityType = ECmdFacilityTypeLock;
   585         facilityType = ECmdFacilityTypeLock;
   597         }
   586         }
   598     else if (command.Compare(KATCLCKSC) == 0)
   587     else if (command.CompareF(KATCLCKSC) == 0)
   599         {
   588         {
   600         // PIN on/off
   589         // PIN on/off
   601         iSecurityCode = RMobilePhone::ESecurityCodePin1;
   590         iSecurityCode = RMobilePhone::ESecurityCodePin1;
   602         iLockType = RMobilePhone::ELockICC;
   591         iLockType = RMobilePhone::ELockICC;
   603         facilityType = ECmdFacilityTypeLock;
   592         facilityType = ECmdFacilityTypeLock;
   604         }
   593         }
   605     else if (command.Compare(KATCLCKAO) == 0)
   594     else if (command.CompareF(KATCLCKAO) == 0)
   606         {
   595         {
   607         iCondition = RMobilePhone::EBarAllOutgoing;
   596         iCondition = RMobilePhone::EBarAllOutgoing;
   608         facilityType = ECmdFacilityTypeBarring;
   597         facilityType = ECmdFacilityTypeBarring;
   609         }
   598         }
   610     else if (command.Compare(KATCLCKOI) == 0)
   599     else if (command.CompareF(KATCLCKOI) == 0)
   611         {
   600         {
   612         iCondition = RMobilePhone::EBarOutgoingInternational;
   601         iCondition = RMobilePhone::EBarOutgoingInternational;
   613         facilityType = ECmdFacilityTypeBarring;
   602         facilityType = ECmdFacilityTypeBarring;
   614         }
   603         }
   615     else if (command.Compare(KATCLCKOX) == 0)
   604     else if (command.CompareF(KATCLCKOX) == 0)
   616         {
   605         {
   617         iCondition = RMobilePhone::EBarOutgoingInternationalExHC;
   606         iCondition = RMobilePhone::EBarOutgoingInternationalExHC;
   618         facilityType = ECmdFacilityTypeBarring;
   607         facilityType = ECmdFacilityTypeBarring;
   619         }
   608         }
   620     else if (command.Compare(KATCLCKAI) == 0)
   609     else if (command.CompareF(KATCLCKAI) == 0)
   621         {
   610         {
   622         iCondition = RMobilePhone::EBarAllIncoming;
   611         iCondition = RMobilePhone::EBarAllIncoming;
   623         facilityType = ECmdFacilityTypeBarring;
   612         facilityType = ECmdFacilityTypeBarring;
   624         }
   613         }
   625     else if (command.Compare(KATCLCKIR) == 0)
   614     else if (command.CompareF(KATCLCKIR) == 0)
   626         {
   615         {
   627         iCondition = RMobilePhone::EBarIncomingRoaming;
   616         iCondition = RMobilePhone::EBarIncomingRoaming;
   628         facilityType = ECmdFacilityTypeBarring;
   617         facilityType = ECmdFacilityTypeBarring;
   629         }
   618         }
   630     else if (command.Compare(KATCLCKAB) == 0)
   619     else if (command.CompareF(KATCLCKAB) == 0)
   631         {
   620         {
   632         iCondition = RMobilePhone::EBarAllCases;
   621         iCondition = RMobilePhone::EBarAllCases;
   633         facilityType = ECmdFacilityTypeAllBarring;
   622         facilityType = ECmdFacilityTypeAllBarring;
   634         }
   623         }
   635     else if (command.Compare(KATCLCKAG) == 0)
   624     else if (command.CompareF(KATCLCKAG) == 0)
   636         {
   625         {
   637         iCondition = RMobilePhone::EBarAllOutgoingServices;
   626         iCondition = RMobilePhone::EBarAllOutgoingServices;
   638         facilityType = ECmdFacilityTypeAllBarring;
   627         facilityType = ECmdFacilityTypeAllBarring;
   639         }
   628         }
   640     else if (command.Compare(KATCLCKAC) == 0)
   629     else if (command.CompareF(KATCLCKAC) == 0)
   641         {
   630         {
   642         iCondition = RMobilePhone::EBarAllIncomingServices;
   631         iCondition = RMobilePhone::EBarAllIncomingServices;
   643         facilityType = ECmdFacilityTypeAllBarring;
   632         facilityType = ECmdFacilityTypeAllBarring;
   644         }
   633         }
   645     else 
   634     else 
   680             break;
   669             break;
   681             }
   670             }
   682         case (ECmdFacilityTypeBarring):
   671         case (ECmdFacilityTypeBarring):
   683             {
   672             {
   684             iCBInfo.iPassword.Copy(iPassword);
   673             iCBInfo.iPassword.Copy(iPassword);
   685             if (iInfoClass == 0)
       
   686                 {
       
   687                 iInfoClass = 7; // Default value, see ETSI TS 127 007 V6.9.0 (2007-06)
       
   688                 }
       
   689             switch (mode)
   674             switch (mode)
   690                 {
   675                 {
   691                 case 0: // AT+CLCK="AO",0
   676                 case 0: // AT+CLCK="AO",0
   692                     {
   677                     {
   693                     iCLCKCommandType = ECLCKBarringSet;
   678                     iCLCKCommandType = ECLCKBarringSet;