com.motorola.oem.network
Class NetworkUSSD

java.lang.Object
  extended by OEM
      extended by com.motorola.oem.network.NetworkUSSD

public class NetworkUSSD
extends OEM

 Provides Unstructured Supplementary Service Data(USSD) service.
 


Field Summary
static byte NETWORK_USSD_DCS_GSM_7BIT
          Data Coding Scheme - 7 bit.
static byte NETWORK_USSD_DCS_GSM_8BIT
          Data Coding Scheme - 8 bit.
static byte NETWORK_USSD_DCS_UCS2
          Data Coding Scheme - UCS2 (16 bit).
static byte NETWORK_USSD_DCS_UCS2_LANGUAGE_INDICATOR
          Data Coding Scheme - UCS2 (16 bit), USSD string preceded by language indicator.
 
Method Summary
static NetworkUSSD getInstance()
          Returns a reference to the class's single instance.
 boolean isDcsSupported(byte dcs)
          Checks whether the type of Data Coding Scheme(DCS) is supported.
 void sendUSSD(java.lang.String stringToSend)
          Send a USSD string to the network.
 void sendUSSD(java.lang.String stringToSend, byte dcs)
          Send a USSD string to the network according to specified data coding scheme.
 void setNetworkUSSDListener(NetworkUSSDListener listener)
          Set a listener for USSD events.
 void terminateUSSD()
          Send a request to terminate a USSD transaction.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NETWORK_USSD_DCS_UCS2

public static final byte NETWORK_USSD_DCS_UCS2
Data Coding Scheme - UCS2 (16 bit).

See Also:
Constant Field Values

NETWORK_USSD_DCS_UCS2_LANGUAGE_INDICATOR

public static final byte NETWORK_USSD_DCS_UCS2_LANGUAGE_INDICATOR
Data Coding Scheme - UCS2 (16 bit), USSD string preceded by language indicator.

See Also:
Constant Field Values

NETWORK_USSD_DCS_GSM_8BIT

public static final byte NETWORK_USSD_DCS_GSM_8BIT
Data Coding Scheme - 8 bit.

See Also:
Constant Field Values

NETWORK_USSD_DCS_GSM_7BIT

public static final byte NETWORK_USSD_DCS_GSM_7BIT
Data Coding Scheme - 7 bit.

See Also:
Constant Field Values
Method Detail

getInstance

public static NetworkUSSD getInstance()
                               throws NetworkUSSDException
Returns a reference to the class's single instance. If the instance does not exist, then it is created and its reference is returned.

Returns:
reference to class NetworkUSSD's instance
Throws:
NetworkUSSDException - Failed to construct the NetworkUSSD object.

isDcsSupported

public boolean isDcsSupported(byte dcs)
Checks whether the type of Data Coding Scheme(DCS) is supported. This function checks if the specified data coding scheme is supported by the device.

Parameters:
dcs - data coding scheme according to GSM spec.
Returns:
true - if the DCS is supprted, false - otherwise

sendUSSD

public void sendUSSD(java.lang.String stringToSend,
                     byte dcs)
              throws NetworkUSSDException
Send a USSD string to the network according to specified data coding scheme. NetworkUSSDListener should be registered to receive network USSD response data (NetworkUSSDResponseData).

Parameters:
stringToSend - contains the USSD string sent to the network
dcs - Data Coding Scheme, determines how to encode stringToSend
Throws:
NetworkUSSDException - Platform error (error code NetworkUSSDException.PLATFORM_ERROR)
NetworkUSSDException - Request string syntax error(error code NetworkUSSDException.SYNTAX_ERROR)
NetworkUSSDException - Data coding scheme is not supported (error code NetworkUSSDException.UNSUPPORTED_DCS_ERROR)
See Also:
setNetworkUSSDListener(com.motorola.oem.network.NetworkUSSDListener), NetworkUSSDListener.onNetworkUSSDResponseArrived(com.motorola.oem.network.NetworkUSSDResponseData)

sendUSSD

public void sendUSSD(java.lang.String stringToSend)
              throws NetworkUSSDException
Send a USSD string to the network. NetworkUSSDListener should be registered to receive network response data (NetworkUSSDResponseData).

Parameters:
stringToSend - contains the USSD string sent to the network in NETWORK_USSD_DCS_GSM_7BIT data coding scheme
Throws:
NetworkUSSDException - Platform error (error code NetworkUSSDException.PLATFORM_ERROR)
NetworkUSSDException - Request string syntax error(error code NetworkUSSDException.SYNTAX_ERROR)
NetworkUSSDException - Data Coding Scheme is not supported (error code NetworkUSSDException.UNSUPPORTED_DCS_ERROR)
See Also:
setNetworkUSSDListener(com.motorola.oem.network.NetworkUSSDListener), NetworkUSSDListener.onNetworkUSSDResponseArrived(com.motorola.oem.network.NetworkUSSDResponseData)

setNetworkUSSDListener

public void setNetworkUSSDListener(NetworkUSSDListener listener)
Set a listener for USSD events. User can reconfigure existing listener at any time.

Parameters:
listener - External listener object to receive USSD events. Setting null listener will cause masking of USSD events.

terminateUSSD

public void terminateUSSD()
Send a request to terminate a USSD transaction.