eapol/eapol_framework/eapol_symbian/am/eap_notifier/src/eap_auth_observer.cpp
changeset 49 43351a4f2da3
parent 36 c98682f98478
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    14 * Description: Dialog observer implementation
    14 * Description: Dialog observer implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 15 %
    19 * %version: 12 %
    20 */
    20 */
    21 
    21 
    22 // System include files
    22 // System include files
    23 #include <hb/hbcore/hbsymbianvariant.h>
    23 #include <hb/hbcore/hbsymbianvariant.h>
    24 #include <e32debug.h>
    24 #include <e32debug.h>
    86 // ---------------------------------------------------------------------------
    86 // ---------------------------------------------------------------------------
    87 //
    87 //
    88 void CEapAuthObserver::DataReceived( CHbSymbianVariantMap& aData )
    88 void CEapAuthObserver::DataReceived( CHbSymbianVariantMap& aData )
    89 {
    89 {
    90     RDebug::Print(_L("CEapAuthObserver::DataReceived") );
    90     RDebug::Print(_L("CEapAuthObserver::DataReceived") );
       
    91         
       
    92     TInt status = KErrNone;    
    91     
    93     
    92     if ( iType == CEapAuthNotifier::EEapNotifierTypeLEapUsernamePasswordDialog )
    94     if ( iType == CEapAuthNotifier::EEapNotifierTypeLEapUsernamePasswordDialog )
    93         {
    95         {
    94         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeLEapUsernamePasswordDialog") );
    96         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeLEapUsernamePasswordDialog") );
    95         UsernamePasswordDlgDataReceived(aData);
    97         UsernamePasswordDlgDataReceived(aData);
       
    98         TRAP_IGNORE( iNotifier->CompleteL( status ));
    96         }
    99         }
    97     else if ( iType == CEapAuthNotifier::EEapNotifierTypeGTCUsernamePasswordDialog )
   100     else if ( iType == CEapAuthNotifier::EEapNotifierTypeGTCUsernamePasswordDialog )
    98         {
   101         {
    99         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeGTCUsernamePasswordDialog") );
   102         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeGTCUsernamePasswordDialog") );
   100         UsernamePasswordDlgDataReceived(aData);
   103         UsernamePasswordDlgDataReceived(aData);
       
   104         TRAP_IGNORE( iNotifier->CompleteL( status ));
   101         }
   105         }
   102     else if ( iType == CEapAuthNotifier::EEapNotifierTypePapUsernamePasswordDialog )
   106     else if ( iType == CEapAuthNotifier::EEapNotifierTypePapUsernamePasswordDialog )
   103         {
   107         {
   104         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypePapUsernamePasswordDialog") );
   108         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypePapUsernamePasswordDialog") );
   105         UsernamePasswordDlgDataReceived(aData);
   109         UsernamePasswordDlgDataReceived(aData);
       
   110         TRAP_IGNORE( iNotifier->CompleteL( status ));
   106         }
   111         }
   107     else if ( iType == CEapAuthNotifier::EEapNotifierTypeEapMsChapV2UsernamePasswordDialog )
   112     else if ( iType == CEapAuthNotifier::EEapNotifierTypeEapMsChapV2UsernamePasswordDialog )
   108         {
   113         {
   109         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeEapMsChapV2UsernamePasswordDialog") );
   114         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeEapMsChapV2UsernamePasswordDialog") );
   110         UsernamePasswordDlgDataReceived(aData);
   115         UsernamePasswordDlgDataReceived(aData);
       
   116         TRAP_IGNORE( iNotifier->CompleteL( status ));
   111         }
   117         }
   112     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2UsernamePasswordDialog )
   118     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2UsernamePasswordDialog )
   113         {
   119         {
   114         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2UsernamePasswordDialog") );
   120         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2UsernamePasswordDialog") );
   115         UsernamePasswordDlgDataReceived(aData);
   121         UsernamePasswordDlgDataReceived(aData);
       
   122         TRAP_IGNORE( iNotifier->CompleteL( status ));
   116         }
   123         }
   117     else if ( iType == CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog )
   124     else if ( iType == CEapAuthNotifier::EEapNotifierTypeGTCQueryDialog )
   118         {
   125         {
   119         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeGTCQueryDialog") ); 
   126         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeGTCQueryDialog") ); 
   120         PwdQueryDataReceived(aData);
   127         PwdQueryDataReceived(aData);
       
   128         TRAP_IGNORE( iNotifier->CompleteL( status ));
   121         }
   129         }
   122     else if ( iType == CEapAuthNotifier::EEapNotifierTypePapAuthQueryDialog )
   130     else if ( iType == CEapAuthNotifier::EEapNotifierTypePapAuthQueryDialog )
   123         {
   131         {
   124         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypePapAuthQueryDialog") ); 
   132         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypePapAuthQueryDialog") ); 
   125         PwdQueryDataReceived(aData);
   133         PwdQueryDataReceived(aData);
       
   134         TRAP_IGNORE( iNotifier->CompleteL( status ));
   126         }
   135         }
   127     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastPacStorePwQueryDialog )
   136     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastPacStorePwQueryDialog )
   128         {
   137         {
   129         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastPacStorePwQueryDialog") ); 
   138         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastPacStorePwQueryDialog") ); 
   130         PwdQueryDataReceived(aData);
   139         PacStorePwdQueryDataReceived(aData);
   131         }
   140         }
   132     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastCreateMasterkeyQueryDialog )
   141     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastCreateMasterkeyQueryDialog )
   133         {
   142         {
   134         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastCreateMasterkeyQueryDialog") ); 
   143         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastCreateMasterkeyQueryDialog") ); 
   135         PwdQueryDataReceived(aData);
   144         PwdQueryDataReceived(aData);
       
   145         TRAP_IGNORE( iNotifier->CompleteL( status ));
   136         }
   146         }
   137     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastPacFilePwQueryDialog )
   147     else if ( iType == CEapAuthNotifier::EEapNotifierTypeFastPacFilePwQueryDialog )
   138         {
   148         {
   139         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastPacFilePwQueryDialog") ); 
   149         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeFastPacFilePwQueryDialog") ); 
   140         PwdQueryDataReceived(aData);
   150         PwdQueryDataReceived(aData);
       
   151         TRAP_IGNORE( iNotifier->CompleteL( status ));
   141         }
   152         }
   142     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2OldPasswordDialog )
   153     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2OldPasswordDialog )
   143         {
   154         {
   144         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2OldPasswordDialog") ); 
   155         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2OldPasswordDialog") ); 
   145         OldPwdQueryDataReceived(aData);
   156         OldPwdQueryDataReceived(aData);
       
   157         TRAP_IGNORE( iNotifier->CompleteL( status ));
   146         }
   158         }
   147     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2NewPasswordDialog )
   159     else if ( iType == CEapAuthNotifier::EEapNotifierTypeMsChapV2NewPasswordDialog )
   148         {
   160         {
   149         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2NewPasswordDialog") ); 
   161         RDebug::Print(_L("CEapAuthObserver::DataReceived: EEapNotifierTypeMsChapV2NewPasswordDialog") ); 
   150         PwdQueryDataReceived(aData);
   162         PwdQueryDataReceived(aData);
   151         }
   163         TRAP_IGNORE( iNotifier->CompleteL( status ));
   152     
   164         }
   153     TInt status = KErrNone;
   165     
   154     
   166     
   155     TRAP_IGNORE( iNotifier->CompleteL( status ));
   167     
       
   168     //TRAP_IGNORE( iNotifier->CompleteL( status ));
   156 }
   169 }
   157 
   170 
   158 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   159 // Handles the user name password input received from the dialog
   172 // Handles the user name password input received from the dialog
   160 // ---------------------------------------------------------------------------
   173 // ---------------------------------------------------------------------------
   249         }
   262         }
   250        
   263        
   251     iNotifier->SetSelectedPassword( PasswordInfo );   
   264     iNotifier->SetSelectedPassword( PasswordInfo );   
   252 }
   265 }
   253 
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // Handles the PAC Store password query user input received from the dialog
       
   269 // ---------------------------------------------------------------------------
       
   270 //
       
   271 void CEapAuthObserver::PacStorePwdQueryDataReceived( CHbSymbianVariantMap& aData )
       
   272 {
       
   273     RDebug::Print(_L("CEapAuthObserver::PacStorePwdQueryDataReceived") ); 
       
   274         
       
   275     TBool Match = EFalse;   
       
   276     TInt  status = KErrNone;    
       
   277     
       
   278     _LIT(KPassword, "password");
       
   279     
       
   280     CEapAuthNotifier::TEapDialogInfo PasswordInfo;
       
   281     TDesC* Data = NULL;
       
   282            
       
   283     const CHbSymbianVariant *my_variant = aData.Get(KPassword); 
       
   284     if ( my_variant != NULL )
       
   285         {
       
   286         ASSERT( my_variant->Type() == CHbSymbianVariant::EDes  );
       
   287     
       
   288         Data = reinterpret_cast<TDesC*>(my_variant->Data());     
       
   289         PasswordInfo.iPassword.Copy( Data->Ptr(), Data->Length() );
       
   290 
       
   291         RDebug::Print(_L("CEapAuthObserver::PwdQueryDataReceived: PasswordInfo.iPassword = %S\n"), &PasswordInfo.iPassword );
       
   292         }
       
   293              
       
   294      // Check if given password can be used to open the PAC store.
       
   295      Match = iNotifier->CheckPasswordMatchingL(PasswordInfo);
       
   296 
       
   297      if ( Match != EFalse )
       
   298         {
       
   299         RDebug::Print(_L("CEapAuthObserver::PacStorePwdQueryDataReceived: Match == TRUE") );     
       
   300         iNotifier->SetSelectedPassword( PasswordInfo );   
       
   301         //update(true); 
       
   302         TRAP_IGNORE( iNotifier->CompleteL( status ));    
       
   303         } 
       
   304      else
       
   305         {
       
   306         RDebug::Print(_L("CEapAuthObserver::PacStorePwdQueryDataReceived: Match == FALSE") );       
       
   307         //update(false);       
       
   308         }
       
   309      iNotifier->UpdateDialogL(Match);       
       
   310 }
       
   311 
   254 // Derived function:
   312 // Derived function:
   255 // ---------------------------------------------------------------------------
   313 // ---------------------------------------------------------------------------
   256 // From class MHbDeviceDialogObserver.
   314 // From class MHbDeviceDialogObserver.
   257 // Handles the closing of the dialog
   315 // Handles the closing of the dialog
   258 // ---------------------------------------------------------------------------
   316 // ---------------------------------------------------------------------------