|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
NetworkCellInfoListener | Listener type for network cell information changes |
NetworkRegistrationListener | A listener type for GSM/GPRS network registration state changes |
NetworkSignalListener | Listener type for signal strength level changes. |
NetworkUSSDListener | Listener type for Network USSD Responce Events. |
Class Summary | |
---|---|
Network | Provides control over the Network features. |
NetworkUSSD | Provides Unstructured Supplementary Service Data(USSD) service. |
NetworkUSSDResponseData | The NetworkUSSDResponseData class is designed to hold the NetworkUSSDResponseData sent by the network. |
Exception Summary | |
---|---|
NetworkException | Exception type for Network class. |
NetworkUSSDException | Exception type for NetworkUSSD class. |
Network package - Perform operations and get indications related to the GSM Network (registration status, Network clock and more).
The main goals of this class are:
(1) Provide the ability to get Network indications and query status of the network, such as signal strength, location
elements, current operator name, GSM/GPRS registration status, current time and preferred operators list.
Network (GSM/GPRS), registration status, cell information and signal strength may be queried/notified in two ways:
NetworkRegistrationListener.onGSMRegStateChanged(int)
,
NetworkRegistrationListener.onGPRSRegStateChanged(int)
,NetworkCellInfoListener.onCellInfoChanged(int, int)
,
NetworkSignalListener.onSignalStrengthLevelChanged(int, int)
Network.getGSMRegState()
, Network.getGPRSRegState()
, Network.getCellID()
, Network.getCellLAC()
,Network.getSignalStrengthRSSI()
, Network.getSignalStrengthBER()
Network.getPreferredOperatorsListInAlphaNames()
,Network.addOperatorNumericNameToPreferredList(java.lang.String, int)
, Network.deleteOperatorFromPreferredList(int)
), Network.getOperatorNameAlpha()
, Network.getOperatorNameNumeric()
),Network.getNITZClock()
)Network.getLineIdPresentationStatus()
and Network.getLineIdRestrictionStatus()
- Network's requests. Network.setLineIdRestriction(int)
public class OEMNetworkTest1MIDlet extends MIDlet implements NetworkRegistrationListener, NetworkCellInfoListener { // constructor public OEMNetworkTest1MIDlet () { super(); } // implement handlers public void onGSMRegStateChanged(int new_reg_state) { System.out.println("MIDLET: GSM Reg State Changed "+new_reg_state); } public void onGPRSRegStateChanged(int new_reg_state) { System.out.println("MIDLET: GPRS Reg State Changed "+new_reg_state); } public void onCellInfoChanged(int new_cell_id, int new_cell_lac) { System.out.println("MIDLET: Cell Info Changed: "+Integer.toHexString(new_cell_lac)+","+Integer.toHexString(new_cell_id)); } public void startApp() throws MIDletStateChangeException { try { Network.getInstance().setNetworkRegistrationListener(this); Network.getInstance().setNetworkCellInfoListener(this); } catch (OEMException e) { e.printStackTrace(); } // Main function String string_cell_id = ""; String string_lac = ""; String string_nitz = ""; int gsm_reg_status = 0; int gprs_reg_status = 0; int clip_ss_status = 0; try { // get date, time and timezone string_nitz = Network.getInstance().getNITZClock(); System.out.println("MIDLET: Date, Time and TimeZone: "+string_nitz); // get and display GSM registration state gsm_reg_status = Network.getInstance().getGSMRegState(); System.out.println("MIDLET: GSM Registration State: "+gsm_reg_status); // get and display GPRS registration state gprs_reg_status = Network.getInstance().getGPRSRegState(); System.out.println("MIDLET: GPRS Registration State: "+gprs_reg_status); // get and display Cell info string_lac = Network.getInstance().getCellLAC(); string_cell_id = Network.getInstance().getCellID(); System.out.println("MIDLET: Cell Info: "+string_lac+","+string_cell_id); // request CLIP status and wait for reply clip_ss_status = Network.getInstance().getLineIdPresentationStatus(); System.out.println("MIDLET: CLIP ss status: "+clip_ss_status); } catch (OEMException e) { e.printStackTrace(); } } public void pauseApp() { } public void destroyApp(boolean unconditional) { notifyDestroyed(); } } |
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |