superwaba.ext.ce.io.gprs
Class GPRS

java.lang.Object
  |
  +--superwaba.ext.ce.io.gprs.GPRS

public class GPRS
extends java.lang.Object

This class is used to open GPRS connections on Pocket PC 2002 (and up) smartphones. Here is a sample code:

if (GPRS.getConnectionState() != GPRS.PPC_CONNMGR_STATUS_CONNECTED)
{
showMessage("gprs not connected " + GPRS.getConnectionState());

boolean ready = GPRS.openConnection();
showMessage("gprs attempt " + GPRS.getConnectionState() + " " + ready);

if (!ready)
{
boolean status = GPRS.openConnection(20000);
showMessage("gprs sp connection attempt2 " + GPRS.getConnectionState() + " " + status);
}
}
else
{
showMessage("gprs connected " + GPRS.getConnectionState());
}
 
If you don't call closeConnection at application's exit, the library will automatically call it. You have to manually install the files lib/ce/CeIoGPRS.pdb and lib/ce/platform/processor/CeIoGPRS.dll

Since:
SuperWaba 5.5

Field Summary
static int PPC_CONNMGR_STATUS_CONNECTED
          Returned in getConnectionState: The connection is established.
static int PPC_CONNMGR_STATUS_CONNECTIONCANCELED
          Returned in getConnectionState: The user aborted the connection, or the connection request was terminated because a more secure connection was established.
static int PPC_CONNMGR_STATUS_CONNECTIONDISABLED
          Returned in getConnectionState: The connection can be made, but the connection itself is disabled.
static int PPC_CONNMGR_STATUS_CONNECTIONFAILED
          Returned in getConnectionState: The connection has failed and cannot be re-established.
static int PPC_CONNMGR_STATUS_DISCONNECTED
          Returned in getConnectionState: The connection is disconnected.
static int PPC_CONNMGR_STATUS_NOPATHTODESTINATION
          Returned in getConnectionState: No path to the destination is available.
static int PPC_CONNMGR_STATUS_UNKNOWN
          Returned in getConnectionState: The status is unknown.
static int PPC_CONNMGR_STATUS_WAITINGCONNECTION
          Returned in getConnectionState: The device is attempting to connect.
static int PPC_CONNMGR_STATUS_WAITINGCONNECTIONABORT
          Returned in getConnectionState: The device is aborting connection attempt.
static int PPC_CONNMGR_STATUS_WAITINGDISCONNECTION
          Returned in getConnectionState: The connection is being disconnected.
static int PPC_CONNMGR_STATUS_WAITINGFORNETWORK
          Returned in getConnectionState: The device is waiting for a task with a higher priority to connect to the network before connecting to the same network.
static int PPC_CONNMGR_STATUS_WAITINGFORPATH
          Returned in getConnectionState: A path to the destination exists but is not presently available (for example, the device is out of radio range or is not plugged into its cradle).
static int PPC_CONNMGR_STATUS_WAITINGFORPHONE
          Returned in getConnectionState: A voice call is in progress and is using resources that this connection requires.
static int PPC_CONNMGR_STATUS_WAITINGFORRESOURCE
          Returned in getConnectionState: Another client is using resources that this connection requires.
static int PPC_UTLLIB_CONMGRSTATUSERROR
          Returned in getConnectionState: it was impossible to get the connection status from the device
static int PPC_UTLLIB_NOCONNECTION
          Returned in getConnectionState: there are no active GPRS connections.
 
Constructor Summary
GPRS()
           
 
Method Summary
static boolean closeConnection()
          closes a GPRS connection.
static int getConnectionState()
          Get the state of the GPRS connection
static boolean openConnection()
          Open a GPRS connection
static int openConnection(int timeout)
          Open a connection specifying a timeout interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PPC_UTLLIB_NOCONNECTION

public static final int PPC_UTLLIB_NOCONNECTION
Returned in getConnectionState: there are no active GPRS connections. It does NOT means that a connection is impossible, but just that you had not called connect or that you had already called disconnect.

PPC_UTLLIB_CONMGRSTATUSERROR

public static final int PPC_UTLLIB_CONMGRSTATUSERROR
Returned in getConnectionState: it was impossible to get the connection status from the device

PPC_CONNMGR_STATUS_UNKNOWN

public static final int PPC_CONNMGR_STATUS_UNKNOWN
Returned in getConnectionState: The status is unknown.

PPC_CONNMGR_STATUS_CONNECTED

public static final int PPC_CONNMGR_STATUS_CONNECTED
Returned in getConnectionState: The connection is established.

PPC_CONNMGR_STATUS_DISCONNECTED

public static final int PPC_CONNMGR_STATUS_DISCONNECTED
Returned in getConnectionState: The connection is disconnected.

PPC_CONNMGR_STATUS_WAITINGFORPATH

public static final int PPC_CONNMGR_STATUS_WAITINGFORPATH
Returned in getConnectionState: A path to the destination exists but is not presently available (for example, the device is out of radio range or is not plugged into its cradle).

PPC_CONNMGR_STATUS_WAITINGFORRESOURCE

public static final int PPC_CONNMGR_STATUS_WAITINGFORRESOURCE
Returned in getConnectionState: Another client is using resources that this connection requires.

PPC_CONNMGR_STATUS_WAITINGFORPHONE

public static final int PPC_CONNMGR_STATUS_WAITINGFORPHONE
Returned in getConnectionState: A voice call is in progress and is using resources that this connection requires.

PPC_CONNMGR_STATUS_WAITINGFORNETWORK

public static final int PPC_CONNMGR_STATUS_WAITINGFORNETWORK
Returned in getConnectionState: The device is waiting for a task with a higher priority to connect to the network before connecting to the same network. This status value is returned only to clients that specify a priority of CONNMGR_PRIORITY_LOWBKGND when requesting a connection.

PPC_CONNMGR_STATUS_NOPATHTODESTINATION

public static final int PPC_CONNMGR_STATUS_NOPATHTODESTINATION
Returned in getConnectionState: No path to the destination is available.

PPC_CONNMGR_STATUS_CONNECTIONFAILED

public static final int PPC_CONNMGR_STATUS_CONNECTIONFAILED
Returned in getConnectionState: The connection has failed and cannot be re-established. This may be because the connection request was terminated when a more secure connection was established.

PPC_CONNMGR_STATUS_CONNECTIONCANCELED

public static final int PPC_CONNMGR_STATUS_CONNECTIONCANCELED
Returned in getConnectionState: The user aborted the connection, or the connection request was terminated because a more secure connection was established.

PPC_CONNMGR_STATUS_CONNECTIONDISABLED

public static final int PPC_CONNMGR_STATUS_CONNECTIONDISABLED
Returned in getConnectionState: The connection can be made, but the connection itself is disabled. This value is returned only to clients that set the bDisabled value in the CONNMGR_CONNECTIONINFO structure.

PPC_CONNMGR_STATUS_WAITINGCONNECTION

public static final int PPC_CONNMGR_STATUS_WAITINGCONNECTION
Returned in getConnectionState: The device is attempting to connect.

PPC_CONNMGR_STATUS_WAITINGCONNECTIONABORT

public static final int PPC_CONNMGR_STATUS_WAITINGCONNECTIONABORT
Returned in getConnectionState: The device is aborting connection attempt.

PPC_CONNMGR_STATUS_WAITINGDISCONNECTION

public static final int PPC_CONNMGR_STATUS_WAITINGDISCONNECTION
Returned in getConnectionState: The connection is being disconnected.
Constructor Detail

GPRS

public GPRS()
Method Detail

openConnection

public static boolean openConnection()
Open a GPRS connection

closeConnection

public static boolean closeConnection()
closes a GPRS connection. IMPORTANT: The Connection Manager in Pocket PC 2003 and later will NOT drop the connection by default. It'll leave it up indefinitely.
Returns:
If the connection was closed.

getConnectionState

public static int getConnectionState()
Get the state of the GPRS connection

openConnection

public static int openConnection(int timeout)
Open a connection specifying a timeout interval. The timeout parameter should be greater than 1000ms.