예제 #1
0
void CRconn::RunL()
{
	TUint count;
	TInt ret;

	DEBUG_INFO("CRconn::RunL err=%d\n", iStatus.Int());

	if (KErrNone == iStatus.Int()) {
		udp_rconn_set(&iServ, &iConn);
		tcp_rconn_set(&iServ, &iConn);
	}

	/* Get the IAP id of the underlying interface of this RConnection */
	TUint32 iapId = 0;
	ret = iConn.GetIntSetting(_L("IAP\\Id"), iapId);
	if (KErrNone == ret) {
		DEBUG_INFO("RConn: Using IAP=%u\n", iapId);
	}

	ret = iConn.EnumerateConnections(count);
	if (KErrNone != ret) {
		DEBUG_WARNING("EnumerateConnections: ret=%d\n", ret);
	}
	else {
		DEBUG_INFO("Enumerated connections: %u\n", count);
	}

	ch(kerr2errno(iStatus.Int()), iapId);
}
예제 #2
0
// -----------------------------------------------------------------------------
// CMceLocalAddrResolver::ConstructL
// -----------------------------------------------------------------------------
//
void CMceLocalAddrResolver::ConstructL( TUint32 aIapId )
    {
	// The actual IAP ID is fetched dynamically 
	// to make local IP address lookup work in a case
	// where there are several IAPs used which have different IDs 
	// but all point to the same physical AP.
    
    RConnection connection;
    User::LeaveIfError( connection.Open( iSocketServ ) );
    CleanupClosePushL( connection );
    
    // The connection has to be started to get the actual IAP ID from it
    // At this point the physical connection should be already up
    // as the related SIP profile has been registered using it and
    // the synchronous RConnection::Start should return quickly and
    // should not hang the whole MCE server process for too long
    TConnPrefList prefList;
    TExtendedConnPref preferences;
    preferences.SetIapId( aIapId );
    prefList.AppendL( &preferences ); 
    connection.Start( prefList );    
    
    // Fetch the actual IAP ID from the started connection
	_LIT( KIapIdSetting, "IAP\\Id" );
	User::LeaveIfError( connection.GetIntSetting( KIapIdSetting, iIapId ) );
	
	CleanupStack::PopAndDestroy(); // connection
    }
XQAccessPoint XQAccessPointManagerPrivate::systemAccessPointL() const
{
    XQAccessPoint iap;

    RSocketServ serv;
    TInt retVal = serv.Connect();
    if (retVal != KErrNone) {
        return iap;
    }
    CleanupClosePushL(serv);
    RConnection conn;
    retVal = conn.Open(serv);
    if (retVal != KErrNone) {
        CleanupStack::PopAndDestroy(&serv);
        return iap;
    }
    CleanupClosePushL(conn);
    retVal = conn.Start();
    if (retVal != KErrNone) {
        CleanupStack::PopAndDestroy(&conn);
        CleanupStack::PopAndDestroy(&serv);
        return iap;
    }
    
    _LIT(KSetting, "IAP\\Id");
    unsigned long int iapId = 0;
    conn.GetIntSetting(KSetting, iapId);

    CleanupStack::PopAndDestroy(&conn);
    CleanupStack::PopAndDestroy(&serv);

    QList<XQAccessPoint> iaps = accessPoints();
    for (int i=0; i < iaps.count(); i++) {
        if (iaps[i].id() == iapId) {
            iap = iaps[i];
            break;
        }
    }
    
    return iap;
}