Class RadioDevice


  • public final class RadioDevice
    extends java.lang.Object
    Provides 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
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getState​(int type)
      Retrieves the current state of the provided radio.

      Currently works only on Android.
      Always return RADIO_STATE_DISABLED on other platforms.
      static boolean isSupported​(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 void setState​(int type, int state)
      Change the state of the provided radio.

      Fully functional only on Android devices.
      Does nothing on other platforms.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isSupported

        public static boolean isSupported​(int type)
                                   throws java.lang.IllegalArgumentException
        Determines 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.IllegalArgumentException
        Retrieves 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.IllegalArgumentException
        Change 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