Hi ,
I want to hide the pop up asking for IAP.
I've referred to HTTPTaskManager example that is available in wiki.
But i coundt connect to GPRS.
calling query from Appui and i have implemented query in responseview in y projectCode:if (iResponseView->QueryIapL(iap, 0)) { iEngine->SetIap(iap); iEngine->ConnectL(); }
Code:void CBlueIdClientEngine::ConstructL() { User::LeaveIfError(iSockServ.Connect()); User::LeaveIfError(iConnection.Open(iSockServ)); // Open RHTTPSession with default protocol ("HTTP/TCP") TRAPD( err, iSession.OpenL() ); if (err != KErrNone) { HBufC* textResource = StringLoader::LoadLC(R_WEBCLIENT_IAP_CONF_ERR, err); CAknErrorNote* errorNote; errorNote = new (ELeave) CAknErrorNote; // Show the error Note with textResource loaded with StringLoader. errorNote->ExecuteLD(*textResource); // Pop HBuf from CleanUpStack and Destroy it. CleanupStack::PopAndDestroy(textResource); User::Leave(err); } LoadIapsL(); //CBlueIdClientEngine* iEngine = CBlueIdClientEngine::NewL(*this); // Install this class as the callback for authentication requests. When // page requires authentication the framework calls GetCredentialsL to get // user name and password. InstallAuthenticationL(iSession); } void CBlueIdClientEngine::LoadIapsL() { // open commdb CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP); CleanupStack::PushL(commDb); // open IAP table CCommsDbTableView* commView = commDb->OpenIAPTableViewMatchingBearerSetLC( ECommDbBearerCSD | ECommDbBearerGPRS, ECommDbConnectionDirectionOutgoing); // search all IAPs if (commView->GotoFirstRecord() == KErrNone) { do { TIap iap; commView->ReadTextL(TPtrC(COMMDB_NAME), iap.iName); commView->ReadUintL(TPtrC(COMMDB_ID), iap.iId); User::LeaveIfError(iIAPs.Append(iap)); } while (commView->GotoNextRecord() == KErrNone); } CleanupStack::PopAndDestroy(/*commView*/); CleanupStack::PopAndDestroy(/*commDb*/); } void CBlueIdClientEngine::SetIap(const TUint32& aId) { iIap = aId; } TBool CBlueIdClientEngine::IapSet() const { if (iIap == 0) { return EFalse; } else { return ETrue; } } RArray<TIap>& CBlueIdClientEngine::Iaps() { return iIAPs; } void CBlueIdClientEngine::ConnectL() { // this functionality is not applicable for the emulator #ifndef __WINS__ TBool connected = EFalse; // Lets first check are we already connected. TUint connectionCount; User::LeaveIfError(iConnection.EnumerateConnections(connectionCount)); TPckgBuf<TConnectionInfoV2> connectionInfo; for (TUint i = 1; i <= connectionCount; i++) { User::LeaveIfError(iConnection.GetConnectionInfo(i, connectionInfo)); if (connectionInfo().iIapId == iIap) { connected = ETrue; break; } } // Not yet connected, start connection if (!connected) { //Define preferences for connection TCommDbConnPref prefs; prefs.SetIapId(/*iIap*/ 2); prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); //Start Connection iOpeningConnection = ETrue; ConnectionCreated(); return; } //Set properties for the HTTP session RStringPool strP = iSession.StringPool(); RHTTPConnectionInfo connInfo = iSession.ConnectionInfo(); connInfo.SetPropertyL(strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSockServ.Handle())); TInt connPtr = REINTERPRET_CAST(TInt, &iConnection); connInfo.SetPropertyL(strP.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr)); #endif // __WINS__ } void CBlueIdClientEngine::ConnectionCreated() { iOpeningConnection = EFalse; TRAPD(error, //Set properties for the HTTP session RStringPool strP = iSession.StringPool(); RHTTPConnectionInfo connInfo = iSession.ConnectionInfo(); connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), THTTPHdrVal (iSockServ.Handle()) ); TInt connPtr = REINTERPRET_CAST(TInt, &iConnection); connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ), THTTPHdrVal (connPtr) ); ) }void CBlueIdClientEngine::IssueHTTPGetL(const TDesC8& aUri) { ConnectL(); TUriParser8 uri; uri.Parse(aUri); // Get request method string for HTTP GET RStringF method = iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable()); // Open transaction with previous method and parsed uri. This class will // receive transaction events in MHFRunL and MHFRunError. iTransaction = iSession.OpenTransactionL(uri, *this, method); // Set headers for request; user agent and accepted content type RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection(); SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent); SetHeaderL(hdr, HTTP::EAccept, KAccept); // Submit the transaction. After this the framework will give transaction // events via MHFRunL and MHFRunError. iTransaction.SubmitL(); iRunning = ETrue; // Load a string from the resource file HBufC* textResource = StringLoader::LoadLC(R_WEBCLIENT_CONNECTING); iObserver.ClientEvent(*textResource); CleanupStack::PopAndDestroy(textResource); }calling connectL() from IssueHTTPGetL
Thanks,
kusuma




