get rid of that damn IAP selection box

Login to reply to this topic.
Wed, 2005-12-14 07:19
Joined: 2005-07-13
Forum posts: 75
Hey guys,
I have read so many articles about programatically setting the IAP settings to GPRS that my eyes hurt, problem is every solution doesnt seem to work for me!!

Has anyone out there been able to implement a solution? I want to be able to automatically select GPRS so that I can send a file to a server, without user notification. Is this possible on Series 60??

Any answers would be awesome!!
R

"beer is proof that god loves us, and wants us to be happy!"


Wed, 2005-12-14 09:24
Joined: 2005-02-11
Forum posts: 214
Re: get rid of that damn IAP selection box
Code:
// Open an RConnection object. Note that you must provide the RSocketServ object
TInt ret;
ret=conn.Open(iSocketServ);
isConn=1;
// Create overrides
TCommDbConnPref prefs;
prefs. SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
prefs.SetIapId(aIap);
// Start an Outgoing Connection with overrides
TRequestStatus status;
conn.Start(prefs,status);
User::WaitForRequest(status);

"I only know that I know nothing." (Socrates)

Fri, 2005-12-16 14:01
Joined: 2005-09-09
Forum posts: 20
Re: get rid of that damn IAP selection box
 CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);
   db->SetGlobalSettingL(TPtrC(ASK_USER_BEFORE_DIAL),(TInt)false);   
   delete db;

I think this thing also works.

regards
Thu, 2005-12-22 05:30
Joined: 2005-07-13
Forum posts: 75
Re: get rid of that damn IAP selection box
the main problem I have is to set the access point to GPRS automatically.....any ideas how to do this?!

I.e. in the examples you need to specify the uid of the gprs connection, but how do I find this? Also I am using RSockets to connect.....

thanks
R

"beer is proof that god loves us, and wants us to be happy!"

Thu, 2005-12-22 06:53
Joined: 2005-07-13
Forum posts: 75
Re: get rid of that damn IAP selection box
here is my code for connecting to the server....

int ConnectToServer(RSocket &conn, PSERVERINFO pServerInfo)
{   
   TInetAddr addr;

   int z;

   TUint16 server[MAX_PATH];
   TBuf16<MAX_PATH> serverW;
   
   #ifndef __WINS__
      // This only works on target machine
      z = mbstowcs((__wchar_t*)server, pServerInfo->szServer, MAX_PATH);
   #else
      // This only works on emulator
      z = mbstowcs(server, pServerInfo->szServer, MAX_PATH);
   #endif

   serverW.Copy((TUint16*)server, z);


   RHostResolver resolver;
   TNameEntry name;
   TNameRecord nameRec;
   TRequestStatus aStatus;



   TInt ret;
   ret=conn.Open(iSocketServ);
   isConn=1;
   // Create overrides
   TCommDbConnPref prefs;
   prefs. SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
   prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
   prefs.SetIapId(aIap);
   // Start an Outgoing Connection with overrides
   TRequestStatus status;
   conn.Start(prefs,status);
   User::WaitForRequest(status);

   TInt err;
   RSocketServ ss;

   err=ss.Connect();

   if(err==KErrNone)
   {
      err=resolver.Open(ss, KAfInet, KProtocolInetUdp);

      if(err==KErrNone)
      {
         TPtrC16 serverDesc;
         serverDesc.Set(serverW.Ptr(), z);
         resolver.GetByName(serverDesc, name, aStatus);
         User::WaitForRequest(aStatus);
         if(aStatus.Int()==KErrNone)
         {
            nameRec = name();
            addr = (TInetAddr) nameRec.iAddr;
            addr.SetPort(pServerInfo->port);
            err=conn.Open(ss, KAfInet, KSockStream, KUndefinedProtocol);
            
            if(err==KErrNone)
            {

               TRequestStatus stat;
               conn.Connect(addr, stat);
               User::WaitForRequest(stat);

               if(stat.Int()==KErrNone)
               {
                  // LyncMDA Server connection established.  RSocket = sock
                  ////////////////////////////////////////////////////////////////
                  TBuf8<512> buff;
                  TBuf16<512> sBuff;
                  int z;
                  z=recvLine(conn,buff, 512); //Server Ready message
                  buff.Append(0);

                  sBuff.Copy(buff);
               }
               else
               {
                  return stat.Int();
               }
            }
            
            else
            {
               return err;
            }
         }
      }
      
      else
      {
         return err;
      }

      resolver.Close();
         
   }
   else
   {
      return err;
   }
   
   return KErrNone;
}

"beer is proof that god loves us, and wants us to be happy!"

Thu, 2005-12-22 09:25
Joined: 2005-09-09
Forum posts: 20
Re: get rid of that damn IAP selection box
hi

check out the conncetion preferences table in CommDB, it has
default GPRS settings, rather settings in prefrence order:-

   CCommsDbConnectionPrefTableView* prefView = db->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionOutgoing);
   prefView->GotoFirstRecord();
   CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
   prefView->ReadConnectionPreferenceL(pref);
   TUint32 id = pref.iBearer.iIapId;

Now id is the access point id of the default connection, the one you wanted.

ABhinav
  • Login to reply to this topic.