GPRS Status

Login to reply to this topic.
Sat, 2005-03-26 01:47
Joined: 2004-11-05
Forum posts: 4
I'm trying to programatically get the GPRS status on a P800/P900 phone, but I'm not having any luck.  If you click on the little network status icon in the lower left corner of the screen, it says something like "GPRS: Attached" or "GPRS: Detached".  This is exactly what I need to know - whether GPRS is attached or detached.

I tried the following code that I found in a Series 60 forum, but GetState always returns -19.  Can anyone help me out?

Code:
const TInt KUidGprsStatusValue = 0x100052DB;
const TUid KUidGprsStatus = {KUidGprsStatusValue};
RSystemAgent iIndicatorSystemAgent;
iIndicatorSystemAgent.Connect();
iIndicatorSystemAgent.GetState(KUidGprsStatus);

Tue, 2005-03-29 15:46
Joined: 2004-11-05
Forum posts: 4
GPRS Status
This seems like it should be simple.  Does anyone know how to do it?

Craig
Mon, 2005-04-04 22:04
Joined: 2005-03-01
Forum posts: 5
GPRS Status
in header file(s) :
RConnection iConnect;
RSocketServ iSocketServ;  
TPckgBuf<TInterfaceNotification> iNotification;    

in source files:
iSocketServ.Connect();
iConnect.Open(iSocketServ);

TBool connected = EFalse;
TUint connectionCount;
//Enumerate currently active connections across all socket servers
User::LeaveIfError(iConnect.EnumerateConnections(connectionCount));

if (connectionCount){
       TPckgBuf<TConnectionInfoV2> connectionInfo;
       for (TUint i = 1; i <= connectionCount; ++i){
                       //to do: add code to check is it GPRS
                       iConnect.GetConnectionInfo(i, connectionInfo);
         connected = ETrue;
         aIap = connectionInfo().iIapId;         
         break;   
      }
   }


To be notified for connection changes use
iConnect.AllInterfaceNotification(iNotification, iStatus);
Mon, 2005-04-25 06:50
Joined: 2004-10-27
Forum posts: 19
gprs status
Hi Boris612,

 I am facing problems in getting "AllInterfaceNotification" function to work. Could you please give more information on its usage?

Whenever I call this function, I immediately get a notification once with iStatus  = KErrInUse (-14). And after that nothing happens.
On renewing the request, I keep getting iStatus = -14 only.

Did it work for you properly? Moreover - does this function provide you notifications on network coming up/going down?

TIA,
isymdev






Quote from: boris612
in header file(s) :
RConnection iConnect;
RSocketServ iSocketServ;  
TPckgBuf<TInterfaceNotification> iNotification;    

in source files:
iSocketServ.Connect();
iConnect.Open(iSocketServ);

TBool connected = EFalse;
TUint connectionCount;
 //Enumerate currently active connections across all socket servers
 User::LeaveIfError(iConnect.EnumerateConnections(connectionCount));

if (connectionCount){
        TPckgBuf<TConnectionInfoV2> connectionInfo;
        for (TUint i = 1; i <= connectionCount; ++i){
                        //to do: add code to check is it GPRS
                        iConnect.GetConnectionInfo(i, connectionInfo);
         connected = ETrue;
         aIap = connectionInfo().iIapId;         
         break;   
      }
    }


To be notified for connection changes use
iConnect.AllInterfaceNotification(iNotification, iStatus);
[b][/b]
Fri, 2005-04-29 22:14
Joined: 2005-03-01
Forum posts: 5
Re: gprs status
Quote from: isymdev
Hi Boris612,

 I am facing problems in getting "AllInterfaceNotification" function to work. Could you please give more information on its usage?

Whenever I call this function, I immediately get a notification once with iStatus  = KErrInUse (-14). And after that nothing happens.
On renewing the request, I keep getting iStatus = -14 only.

Did it work for you properly? Moreover - does this function provide you notifications on network coming up/going down?

TIA,
isymdev





In main class write this
Code:
iSocketServ.Connect();
iMyConnection.Open(iSocketServ);
iConnectionNotifier = CConnectionNotifier::NewL(anything you want to pass as the argument(s));

and in class CConnectionNotifier (extends public CActive) these are the main things. (iMyConnection can be passed as argument to this class)

Code:

CConnectionNotifier::CConnectionNotifier(anything you want to pass as the argument(s))
: CActive(CActive::EPriorityStandard) {
   CActiveScheduler::Add(this);
   }

void CConnectionNotifier::ConstructL()
   {

iMyConnection().AllInterfaceNotification(iNotification, iStatus);    
      SetActive();
   }

void CConnectionNotifier::RunL()
   {

if (iNotification().iState == EInterfaceUp){
//i.e. display that you are connected
}
else if (iNotification().iState == EInterfaceDown){
              //i.e. display that you are discconnected
}
     
iMyConnection().AllInterfaceNotification(iNotification, iStatus);
       SetActive();
   }
Mon, 2005-05-02 05:45
Joined: 2004-10-27
Forum posts: 19
GPRS Status
Hi Boris,

Thanks for your reply. It works for me now.
But I had to run this code as a separate example to get it working. Writing this code in the same gprs example program, gives me -14 in the notification always.
any idea why.

thanks again
isymdev
Thu, 2005-06-30 16:40
Joined: 2005-06-30
Forum posts: 4
Re: GPRS Status
Me too, I get this KErrInuse iStatus when I call SetActive()... Sad
Did you find out what went wrong? Did you find out how to monitor the connection in one application and not to do it externally?

Thanks for your reply,

Dominik
Fri, 2005-07-01 14:54
Joined: 2005-06-30
Forum posts: 4
Re: GPRS Status
Okay, I found it.

As you said, you needed a new application to make it work.
Thanks for that! This led me to the following idea:

Creating a new RConnection object in one and the same application. So one RConnection - say activeConn - is used to keep a handle for the active connection you previously set up with activeConn.Start() - and then a second one - let's call it monitorConn - used for monitoring.

When you create an ActiveObject (maybe: CConnStateMonitor) and call AllInterfacesNotification on monitorConn now then SetActive(), RunL gets called when the state of a connection changes. In this way I get notified of any connection going down or up and the TInterfaceNotification member is updated in the CConnStateMonitor object.

Now you have to filter out whether it was your own connection going down or coming up,
by use of the iConnectionInfo member of TInterfaceNotification, something like:

Code:
iWrappedNotification().iConnectionInfo.iIapId == myIapId &&
iWrappedNotification().iState == EInterfaceDown; // or EInterfaceUp

HTH, and good luck,

Dominik
Thu, 2005-07-14 19:51
Joined: 2005-07-14
Forum posts: 1
Re: GPRS Status
Hi

Does anyone know where the const  KUidGprsStatus=0x100052DB comes from ?

This is known as "undocumented constants for getting  GPRS Context" in this forum.

This value does not work with SystemAgent on UIQ, I just want to make sure the value is correct.

thanks.
Thu, 2007-08-02 06:44
Joined: 2007-08-02
Forum posts: 4
Re: GPRS Status


if (connectionCount){
TPckgBuf connectionInfo;
for (TUint i = 1; i <= connectionCount; ++i){
//to do: add code to check is it GPRS
iConnect.GetConnectionInfo(i, connectionInfo);
connected = ETrue;
aIap = connectionInfo().iIapId;
break;
}
}

Hi Boris and all:
//to do: add code to check is it GPRS
How can I achieve this. Using Conn Info I will get only IAP id and INetId. But I don't know how to get conn type
based on this.
I guess I have to relate this with some tables.

Could some one plz help me in this regard.

Suggest some material where I can get complete database tables interaction.

Thanks
bytes

Wed, 2007-10-10 10:28
Joined: 2007-08-02
Forum posts: 4
Re: GPRS Status

Frns,

I got the answer:

I have to lookup in to IAP table for IAp Id whose "service_type" is "OutgoingGprs", then its GPRS connection.

-Venu

Wed, 2008-01-23 11:01
Joined: 2006-06-15
Forum posts: 19
Re: GPRS Status

hello friends

really a great and healthy discussion over .By following this i am able to get the notification of active gprs connnection in the background .in
if (iNotification().iState == EInterfaceUp)
{
//i.e. display that you are connected
}

now i want to moniter the data upload or download in that gprs transaction. But i don't want to actively open the connection via my application .
how could i monitor that .
as i know RConnectionMonitor is the api for that and

iMonitor.GetUintAttribute(elem.iConnectionId, elem.iSubConnectionId, KDownlinkData, iDataTransfer, iStatus);

is method for that but struggling to implement it.
Or there could me other way also to get this information .

pls guide me ..

regard's
vivek

Sat, 2008-01-19 14:35
Joined: 2006-06-15
Forum posts: 19
Re: GPRS Status

first thing i want to know that how will i find the connection index of the of that gprs which we are not opening via our application

waiting for the reply

thanks vivek

Mon, 2008-05-05 13:04
Joined: 2008-05-05
Forum posts: 1
Re: GPRS Status

Hi,

Anyone can please give me the code for finding whether GPRS data connection or not?
I am not finding much information about "service_type" and "OutgoingGprs".

  • Login to reply to this topic.