コード例 #1
0
// --------------------------------------------------------------------------
// UPnPAppSettingItemHomeIAP::CheckAPSecurity
// Checks if selected access point is unsecured and shows warning note
// --------------------------------------------------------------------------
//
TInt UPnPAppSettingItemHomeIAP::CheckAPSecurityL(TInt aAccessPoint)
    {
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
    TUint32 serviceId = 0;
    TUint32 securityMode = 0;

    CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP );
    CleanupStack::PushL( db );

    CCommsDbTableView* view = db->OpenViewMatchingUintLC(TPtrC(IAP),
                              TPtrC(COMMDB_ID), aAccessPoint);

    TInt error = view->GotoFirstRecord();

    if( error == KErrNone )
        {
        view->ReadUintL(TPtrC(IAP_SERVICE), serviceId);
        }

    CCommsDbTableView* wLanServiceTable = NULL;

    TRAPD(err,
    {// this leaves if the table is empty....
    wLanServiceTable = db->OpenViewMatchingUintLC(
        TPtrC( WLAN_SERVICE ),
        TPtrC( WLAN_SERVICE_ID ),
        serviceId );
    CleanupStack::Pop( wLanServiceTable );
    });
コード例 #2
0
// ---------------------------------------------------------
// RHssInterface::CheckBackgroundScanL
// ---------------------------------------------------------
//
EXPORT_C TUint32 RHssInterface::CheckBackgroundScanL()
	{
	DEBUG( "RHssInterface::CheckBackgroundScanL()" );
    CCommsDatabase*    commDB = NULL;
    CCommsDbTableView* table  = NULL;

    // Open commDB
    commDB = CCommsDatabase::NewL();
    CleanupStack::PushL( commDB );

    table = commDB->OpenViewMatchingUintLC( KHssWlanDeviceSettings,
	                                        KHssWlanDeviceSettingsType,
	                                        KHssWlanUserSettings );

    TInt err = table->GotoFirstRecord();

    if ( err )
        {
        User::Leave( err );  
        }
	
	TUint32 scanInterval;
    table->ReadUintL( KHssBgScanInterval, scanInterval ); 

    // cleanup
    CleanupStack::PopAndDestroy( table );
    CleanupStack::PopAndDestroy( commDB );
    
    return (scanInterval);
	
	}
コード例 #3
0
   bool GetProxy( char*& aHost, uint32& aPort, const int32 aIAP )
   { 
# ifdef NAV2_CLIENT_SERIES60_V2
      CCommsDatabase * comdb = CCommsDatabase::NewL();
# else
      CCommsDatabase * comdb = CCommsDatabase::NewL( EDatabaseTypeUnspecified );
# endif
      CleanupStack::PushL( comdb );
   
      // First get the IAP
      CCommsDbTableView* iaptable = comdb->OpenViewMatchingUintLC( TPtrC( IAP ), 
                                                                TPtrC( COMMDB_ID ), aIAP );
      TInt iapres = iaptable->GotoFirstRecord();
      bool found = false;
      if ( iapres == KErrNone ) {
         HBufC* iap_name = iaptable->ReadLongTextLC( TPtrC( COMMDB_NAME) );
         uint32 iap_service = 0;
         iaptable->ReadUintL( TPtrC( IAP_SERVICE ), iap_service );
            
         // The current IAP exists!
         HBufC* iap_type = iaptable->ReadLongTextLC( TPtrC( IAP_SERVICE_TYPE ) );
      
         // Find Proxy for ISP (and same service type)
         CCommsDbTableView* proxytable = comdb->OpenViewMatchingUintLC( TPtrC( PROXIES ), 
                                                                     TPtrC( PROXY_ISP ), iap_service );
         TInt dretval= proxytable->GotoFirstRecord();
         while ( dretval == KErrNone && !found ) {
            // Check if matching proxy service type
            HBufC* proxy_service_type = proxytable->ReadLongTextLC( TPtrC( PROXY_SERVICE_TYPE ) );
            if ( proxy_service_type != NULL &&
               proxy_service_type->CompareC( *iap_type ) == 0 ) 
            {
               // Match!
               // PROXY_USE_PROXY_SERVER 
               TBool proxy_use_proxy_server = 0;
               proxytable->ReadBoolL( TPtrC( PROXY_USE_PROXY_SERVER ), proxy_use_proxy_server );
# ifdef NAV2_CLIENT_SERIES60_V2
               if ( proxy_use_proxy_server ) {
# endif
               // PROXY_SERVER_NAME - Name of the proxy server
               HBufC* proxy_server_name = proxytable->ReadLongTextLC( 
               TPtrC( PROXY_SERVER_NAME ) );
               if ( proxy_server_name ) {
                  found = true;
                  // Convert to something we can use.
                  aHost = WFTextUtil::TDesCToUtf8L( proxy_server_name->Des() );
                  proxytable->ReadUintL( TPtrC( PROXY_PORT_NUMBER ), aPort );
               
                  // Sanity on port
                  if ( aPort == 9201 ) {
                     // We don't talk wap
                     // XXX: Or no proxy at all?
                     aPort = 8080;
                  } else if ( aPort == 0 ) {
                     // Not valid => no proxy
                     found = false;
                     delete [] aHost;
                     aHost = NULL;
                  }
               } // End if have proxy_server_name
                     
               CleanupStack::PopAndDestroy( proxy_server_name );
# ifdef NAV2_CLIENT_SERIES60_V2
               } // End if proxy_use_proxy_server is true
# endif
            } // End if service type matches
            CleanupStack::PopAndDestroy( proxy_service_type );
            dretval = proxytable->GotoNextRecord(); // next proxy
         } // End while all proxies

         // XXX: Perhaps "IAP_SERVICE_TYPE" table -> [GPRS|ISP]_IP_GATEWAY 
         // especially in s60v1
         CleanupStack::PopAndDestroy( proxytable );
         CleanupStack::PopAndDestroy( iap_type );
         CleanupStack::PopAndDestroy( iap_name );
      } // End if the current IAP is found
      
      CleanupStack::PopAndDestroy( iaptable );
      CleanupStack::PopAndDestroy( comdb );
     
      return found;   
   }