×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    regarding selecting the access point--------

    I have a code
    this connects to an ip address and downloads images
    I need 2 changes in that
    1>it shows 2 dialogs each time I connect
    2> it does not work for multiple queries

    Now for the 1st problem------

    I guess the code responsible for showing ui is

    TInt bearerFilter =EApBearerTypeAllBearers;
    CActiveApDb* aDb = CActiveApDb::NewL();
    CleanupStack::PushL(aDb);

    CApSettingsHandler* settings = CApSettingsHandler::NewLC(
    *aDb,
    ETrue,
    EApSettingsSelListIsPopUp,
    EApSettingsSelMenuSelectNormal,
    KEApIspTypeAll,
    bearerFilter,
    KEApSortNameAscending,
    0,
    EVpnFilterBoth,
    ETrue);

    TInt iapRet = settings->RunSettingsL(0, iSelectedIap);
    CleanupStack::PopAndDestroy(settings);
    CleanupStack::PopAndDestroy(aDb);

    what should I replace this with?

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: regarding selecting the access point--------

    This code snippet does not connects to an AP, it lets the user select one. What do you do with iSelectedIap later? If nothing, the Socket Server will also ask the user about AP upon the first outgoing connection/transmission attempt.
    You have to RConnection::Start an IAP for avoiding the dialog, search for [b]iap connect[/i] or simply rconnection in the Wiki for some hints.

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    Re: regarding selecting the access point--------

    some more portions are as follows

    iSession.Close();
    // Open RHTTPSession with default protocol ("HTTP/TCP")
    iSession.OpenL();





    {
    // Open socket server and start the connection
    User::LeaveIfError(iSocketServ.Connect());
    User::LeaveIfError(iConnection.Open(iSocketServ));
    // Now we have the iap Id. Use it to connect for the connection
    TCommDbConnPref connectPref;
    // Setup preferences
    connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    // Sets the CommDb ID of the IAP to use for this connection
    connectPref.SetIapId(iSelectedIap);
    // Start connection
    User::LeaveIfError(iConnection.Start(connectPref));
    // Set the sessions connection info...
    RStringPool strPool = iSession.StringPool();
    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
    // ...to use our socket server and connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,
    RHTTPSession::GetTable() ), THTTPHdrVal (iSocketServ.Handle()) );
    // ...to use our connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,
    RHTTPSession::GetTable() ),
    THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))) );

    iConnectionSetupDone = ETrue;









    So, Iguess I just have to assign the value of iSelectedIap to some integer value.Plz confirm
    If so, I would also like to know any links about all the possible values of access points...

    And another problem is------
    the code gives a kern exe 0 panic

    the line---
    isession.close was newly introduced by me because it gave another panic when multiple times socket connection was being done.now that panic is gone and this new one is there..... Can u give some guidelines regarding that.

    Thanks and Regards!
    sandeep Mohapatra
    Last edited by sanee; 2008-10-28 at 15:27.

  4. #4
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    Re: regarding selecting the access point--------

    sorry I think I had a wrong idea about access points.

    They are generally created when we receive sms from service providers, I guess now.

    Or else we can also create our own.

    Theses are stored into phone device, I guess, and into the IAPdatabase.

    While using connections, we have to use those points only.....

    Plz correct me.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: regarding selecting the access point--------

    Your code seems to be OK to run in the emulator, so you can try tracking the panic in the debugger (enable Just In Time debugging in emulator preferences).
    You can also experiment with CApUtils::IapIdFromWapId (and vice versa), unfortunately I do not know for sure if RConnection and CApSelect uses the same identifier.

  6. #6
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    Re: regarding selecting the access point--------

    the code runs ok for 1st time,
    but on 2nd request only, the kern exec panic is there.

  7. #7
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    Rewhat file acces method to use? storing image from socket to file

    There were too much errors in that code so I wrote a new piece of code.
    It has 2 errors.

    1st one
    --------
    with a simple code
    where
    in the MHF RunL(), different cases are there
    under each case nothing else is written, but only printing to console is done.....

    on emulator
    -----------
    on multiple requests, the code crashes on 2nd request

    on device
    ----------
    strangely the code runs fine on the device
    I tried upto 6 requests, and there is no crash....






    2ND PROBLEM(on the device, here crash is on 2nd req, not on 1st, this issue is my ist priority to solve )
    -------------
    Then I inserted code to retrive the information, from MHFRunL()
    and store the image into file. It crashes there. I guess Iknow why it crashes but do not find a solution to handle it.
    I tried again commenting out the file saving part and it worked fine.

    My code is like this------
    Code:
     
    void CTRM_SymbianClientEngine::IssueHTTPGetL(const TDesC8& aUri/*,const TDesC16& bUri*/)
    	{
    	
    	TUriParser8 uri;
    	uri.Parse(aUri);
    	
    	_LIT(KA1,"inside CTRM_SymbClientEngine::IssueHTTPGetL line3");
    	((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA1);
    	
    	TRAPD(err,SetupConnectionParamsL());
    	if(err==KErrNotReady)	
    		{
    		_LIT(KNoIap,"User didn't select an IAP");
    		((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KNoIap);
    		}
    	RStringF method=iSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable());
    	iTransaction=iSession.OpenTransactionL(uri,*this,method);
    	
    	RHTTPHeaders hdr=iTransaction.Request().GetHeaderCollection();
    	
    	SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
        SetHeaderL(hdr, HTTP::EAccept, KAccept);
    		  
    	iTransaction.SubmitL();
    	}
    
    
    void CTRM_SymbianClientEngine::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue)
    	{
    	 RStringF valStr = iSession.StringPool().OpenFStringL(aHdrValue);
    		  CleanupClosePushL(valStr);
    		  THTTPHdrVal val(valStr);
    		  aHeaders.SetFieldL(iSession.StringPool().StringF(aHdrField,
    		    RHTTPSession::GetTable()), val);
    		  CleanupStack::PopAndDestroy();  // valStr
    	}
    
    void CTRM_SymbianClientEngine::SetupConnectionParamsL()
    	{
    	_LIT(KA11,"inside CTRM_SymbClientEngine::SetupConnectionL line2");
    		((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA11);
    	TInt bearerFilter=EApBearerTypeAllBearers;
    	/*TInt currentProfileId;
    	iRepository->Get(KProEngActiveProfile,currentProfileId);
    	
    	_LIT(KPanicStupcon1,"inside CTRM_SymbClientEngine->SetupConnection line 7");
    		    PrintL(KPanicStupcon1);*/
    	iSession.OpenL();
        
        CActiveApDb* aDb=CActiveApDb::NewL();
        CleanupStack::PushL(aDb);
        CApSettingsHandler* settings=CApSettingsHandler::NewLC(*aDb,ETrue,EApSettingsSelListIsPopUp,EApSettingsSelMenuSelectNormal,   
                                            KEApIspTypeAll,bearerFilter,KEApSortNameAscending,0,EVpnFilterBoth,ETrue);
    		    
    	TInt aApRet=settings->RunSettingsL(0,iSelectedIAP);	    
    	CleanupStack::PopAndDestroy(settings);	
    	CleanupStack::PopAndDestroy(aDb);
    	
    	if(aApRet!=KApUiEventSelected)
    		{
    		User::Leave(KErrNotReady);
    		}
    	else
    		{		
    		User::LeaveIfError(iSocketServ.Connect());
    		User::LeaveIfError(iConnection.Open(iSocketServ));
    		TCommDbConnPref connPref;
    		connPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    		connPref.SetIapId(iSelectedIAP);
    		User::LeaveIfError(iConnection.Start(connPref));
    		
    		RStringPool strPool=iSession.StringPool();
    		RHTTPConnectionInfo connInfo=iSession.ConnectionInfo();
    		connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable()),THTTPHdrVal (iSocketServ.Handle()));
    				connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable()),THTTPHdrVal(REINTERPRET_CAST(TInt,&iConnection)));
    		
    		
    		_LIT(KA12,"exiting CTRM_SymbClientEngine::SetupConnectionL");
    				((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA12);
    		}
    		    
    	
    	}
    
    void CTRM_SymbianClientEngine::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent &aEvent)
    	{
    	switch(aEvent.iStatus)
    		{
    
    		case THTTPEvent::EGotResponseHeaders:
    			{
    			_LIT(KA13,"Response text from MHFRunL->EGotResponseHeaders");
    							((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA13);
    	        RHTTPResponse resp = aTransaction.Response();
    			TBuf<30> buf;
    			buf.Copy(resp.StatusText().DesC());
    			((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(buf);
    			}
    			break;
    		case THTTPEvent::EGotResponseBodyData:
    			{
    			_LIT(KA14,"Response text from MHFRunL->EGotResponseBodyData");
    										((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA14);
    				 MHTTPDataSupplier* body=aTransaction.Response().Body();
    				 TPtrC8 dataChunk;
    				 
    				 TBool isLast=body->GetNextDataPart(dataChunk);
    				 
    				 TInt aPos=0;
    				 _LIT(KA15,"before seek");
    				
    				 
    				 if(iMhfState==0)
    					 {
    					 iRLbsImage.Seek(ESeekCurrent,aPos);
    					 iRLbsImage.Write(dataChunk);
    					 }
    				 if(iMhfState==1)
    				 	 {
    				 	 //iRLbsImage.Seek(ESeekStart,0);
    				 	iRLbsImage.Write(0,dataChunk);
    				 	 iMhfState=0;
    				 	 }
    				 /*TInt aErr;
    				 aErr=iRLbsImage.Seek(ESeekCurrent,aPos);
    				 if(aErr!=KErrNone)
    					 {
    					 _LIT(KK,"Error in seek");
    					 ((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KK);
    					 }*/
    				/* _LIT(KA16,"after seek");
    				 										((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA16);
    				 iRLbsImage.Write(dataChunk);
    				 _LIT(KA17,"after write");
    				 										((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA17);*/
    				 
    				 body->ReleaseData();				 
    			}
    			break;
    		case THTTPEvent::EResponseComplete:
    			{
    			_LIT(KA15,"Response text from MHFRunL->EResponseComplete");
    													((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA15);
    			}
    			break;
    		case THTTPEvent::ESucceeded:
    			{
    			_LIT(KA16,"Response text from MHFRunL->ESucceeded");
    													((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA16);
    			//aTransaction.Close();
    			iRLbsImage.Close();	
    			//set image
    
    			/*CTRM_SymbianReadImageFromRFileConvertToBitmap* iImgConverter=CTRM_SymbianReadImageFromRFileConvertToBitmap::NewL();
    			iAppView->SetImgConverter(iImgConverter);
    			iImgConverter->ConvertFileToBitMap(KTxtFileName);//pass file name
    */			}
    			break;
    		case THTTPEvent::EFailed:
    			{
    			_LIT(KA17,"Response text from MHFRunL->EFailed");
    													((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA17);
    													//((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA16);
    						//aTransaction.Close();
    			}
    			break;
    		default:
    			{
    			_LIT(KA18,"Response text from MHFRunL->default");
    													((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KA18);
    			if(aEvent.iStatus<0)
    				{
    				//aTransaction.Close();
    				}
    			else
    				{
    				// Other events are not errors (e.g. permanent and temporary
    				    		          // redirections)
    				}
    			}
    			break;
    		}
    	}
    
    
    where iRLbsimage is a RFile obj....
    
    and its implementation is as follows
    
    void CTRM_SymbianClientEngine::PrepareFileToReceiveGpsImage()
    	{
    	_LIT(KXMLFilePath,"c:\\Data\\Images");
    	TFileName aGpsImage;
    	aGpsImage.Append(KXMLFilePath);
    	aGpsImage.Append(_L("\\LbsSample.jpg"));
    	
    	TInt err=iRLbsImage.Replace(CCoeEnv::Static()->FsSession(),aGpsImage,EFileWrite);
    	if(err==KErrNotFound)//file does not exist - create it
    		{
    		err=iRLbsImage.Create(CCoeEnv::Static()->FsSession(),aGpsImage,EFileWrite);
    
    		if(err!=KErrNone)
    			{
    			_LIT(KGpsFileNtCreated,"Gps File is not created");
    			((CTRM_SymbianAppUi*)(CCoeEnv::Static()->AppUi()))->PrintL(KGpsFileNtCreated);
    			}
    		}
    	}
    Here I guess The reason for crash is as --------
    ------------------------------------------------
    the "aPos" argument of iRLbsImage.Seek function always points to the last position of the file accessed.

    So, in 1 st http request it works fine.
    But in case of 2nd one, the APos is required to have value zero. But I guess it actually acquires a value that was the previous position to which it wrote. And starting to write with this value of aPos, the value of aPos soon crosses the max value(that is the allowable size of file). So it crashes. Whether or not the app crashes, my right requirement is that the value of aPos should be zero at this point.

    Now I guess, using seek() may not be right issue for me..
    Then what function should I select.

    As per my requirements
    --------------------------
    The socket downloads images.
    each image comes in 4 parts---
    with 4 successive calls to
    Code:
     
               case THTTPEvent::EGotResponseBodyData:
               body->GetNextDataPart(dataChunk);
               body->ReleaseData();
    and finally a call to
    Code:
     
                case THTTPEvent::EResponseComplete:
                 where the image download completes.
    using seek helps me in my 1st http req
    because during the 4 succesive downlods of the parts of the same imge , seek() always remembers last position in the RFile that was written to.

    But in a fresh new request, the of seek() shoul access position 0.


    Please suggest a way to do.......

    Regards!
    Last edited by sanee; 2008-11-02 at 07:00.

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Rewhat file acces method to use? storing image from socket to file

    Quote Originally Posted by sanee View Post
    Please suggest a way to do.......
    Here are some suggestions:
    #1 there is no 'crash', get the panic code http://wiki.forum.nokia.com/index.ph...ded_panic_code
    #2 probably your code can be executed in the emulator. In this case enable Just In Time debugging in the preferences, and execute your code in the debugger. It will show where the panic occurs
    #3 use [CODE ] and [/CODE ] tags (without the spaces) in order to preserve indentation of your code snippets, making them readable.

  9. #9
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    Rewhat file acces method to use? storing image from socket to file

    In the emulator
    the crash code is
    HTTP-Core 0



    Plz help.....
    this is urgent.......
    Last edited by sanee; 2008-11-02 at 07:00.

  10. #10
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    Rewhat file acces method to use? storing image from socket to file

    the uri to connect is-

    http://maps.google.com/staticmap?cen...aptype=mobile\
    &markers=40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc\
    &key=ABQIAAAA7mTDJNgGP953Yt-jOVCpaRSSyDKWhj1AwFHP2_2SAaYvELj_yhTyAVWHzDWGNg0x2EqtccgujgzKwA
    Last edited by sanee; 2008-11-02 at 07:01.

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: regarding selecting the access point--------

    Though the Search box in the top-left region is useless most of the time, in this case searching for HTTP-Core 0 brings a relevant hit (amongst irrelevant ones...). Currently it is the ~10th in the list.

  12. #12
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    Rewhat file acces method to use? storing image from socket to file

    yes now, i searched in forum nokia.......
    I got a relevant post.....
    I included the lines...



    iSession.Close();
    iConnection.Close();
    iSocketServ.Close();

    ---------------------

    I had tried that before also...
    (I think Ishould have included that also instead of getting frustrated.)
    It gives me "kern exec o" panic....
    I had got this bug earlier also....
    This error I was not able to debug earlier....
    Earlier I did not find the cause of this error...
    But now, I do...
    The cause is same as I mentioned in 3-posts earlier to this.(3 earlier posts of mine.....or....5 earlier posts of all) The file access. So, my error is reduced from 2 to one.
    The 2nd Problem in that.....

    The kern exeC o panic happens after printing ""before seek"" to the console.
    This is there in
    MHFRUNL()
    under case

    case THTTPEvent::EGotResponseBodyData:

    Now the only error is the file access method, how do I solve this......
    Last edited by sanee; 2008-11-02 at 07:01.

  13. #13
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    53

    reply.....

    I also tried out,
    the same code,
    commenting out the file access part.......

    The code works fine.
    both on emulator and on device.........

    So,
    how to do the file part.......

    Regards!

Similar Threads

  1. Connect to WAP Access Point
    By psousa in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-10-28, 11:56
  2. Nokia 6101 Locked 2 TMobile Midlet can't access internet...
    By Jason Glass in forum Mobile Java Networking & Messaging & Security
    Replies: 45
    Last Post: 2007-11-14, 02:19
  3. Replies: 5
    Last Post: 2007-08-04, 17:56
  4. Connect to WAP Access Point
    By psousa in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2003-05-08, 14:09
  5. Why is client code to CSocketEngine hanging at Access Point dialogue?
    By nawkboy in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2003-03-11, 11:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •