Package totalcross.io.device
Class RadioDevice
- java.lang.Object
-
- totalcross.io.device.RadioDevice
-
public final class RadioDevice extends java.lang.ObjectProvides access to the device's radios and information about their status. Refer to each method documentation for detailed information about the supported usage.- Since:
- TotalCross 1.15
-
-
Field Summary
Fields Modifier and Type Field Description static intBLUETOOTHstatic intBLUETOOTH_STATE_DISCOVERABLEstatic intPHONEstatic intRADIO_STATE_DISABLEDstatic intRADIO_STATE_ENABLEDstatic intWIFI
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetState(int type)Retrieves the current state of the provided radio.
Currently works only on Android.
Always return RADIO_STATE_DISABLED on other platforms.static booleanisSupported(int type)Determines if the provided radio type is supported by the device.
Fully functional on Android devices.
Always return false on other platforms.static voidsetState(int type, int state)Change the state of the provided radio.
Fully functional only on Android devices.
Does nothing on other platforms.
-
-
-
Field Detail
-
WIFI
public static final int WIFI
- See Also:
- Constant Field Values
-
PHONE
public static final int PHONE
- See Also:
- Constant Field Values
-
BLUETOOTH
public static final int BLUETOOTH
- See Also:
- Constant Field Values
-
RADIO_STATE_DISABLED
public static final int RADIO_STATE_DISABLED
- See Also:
- Constant Field Values
-
RADIO_STATE_ENABLED
public static final int RADIO_STATE_ENABLED
- See Also:
- Constant Field Values
-
BLUETOOTH_STATE_DISCOVERABLE
public static final int BLUETOOTH_STATE_DISCOVERABLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isSupported
public static boolean isSupported(int type) throws java.lang.IllegalArgumentExceptionDetermines if the provided radio type is supported by the device.
Fully functional on Android devices.
Always return false on other platforms.- Parameters:
type- The radio type to check for support.- Returns:
- True if the provided radio type is supported; otherwise false.
- Throws:
java.lang.IllegalArgumentException- Since:
- TotalCross 1.15
-
getState
public static int getState(int type) throws java.lang.IllegalArgumentExceptionRetrieves the current state of the provided radio.
Currently works only on Android.
Always return RADIO_STATE_DISABLED on other platforms.- Parameters:
type- The radio type to have its state returned.- Returns:
- One of the RadioDevice representing the radio state.
- Throws:
java.lang.IllegalArgumentException- Since:
- TotalCross 1.15
-
setState
public static void setState(int type, int state) throws java.lang.IllegalArgumentExceptionChange the state of the provided radio.
Fully functional only on Android devices.
Does nothing on other platforms.- Parameters:
type- The radio type to have its state changed.state- The new state for the given radio type.- Throws:
java.lang.IllegalArgumentException- Since:
- TotalCross 1.15
-
-