public abstract class RadioTuner extends Object
RadioManager.openTuner(int,
RadioManager.BandConfig, boolean, RadioTuner.Callback, Handler)
.Modifier and Type | Class and Description |
---|---|
static class |
RadioTuner.Callback
Callback provided by the client application when opening a
RadioTuner
to receive asynchronous operation results, updates and error notifications. |
Modifier and Type | Field and Description |
---|---|
static int |
DIRECTION_DOWN
Scanning directions DOWN for
step(int, boolean) , scan(int, boolean) |
static int |
DIRECTION_UP
Scanning direction UP for
step(int, boolean) , scan(int, boolean) |
static int |
ERROR_CANCELLED
A pending seek or tune operation was cancelled
|
static int |
ERROR_CONFIG
The requested configuration could not be applied
|
static int |
ERROR_HARDWARE_FAILURE
Indicates a failure of radio IC or driver.
|
static int |
ERROR_SCAN_TIMEOUT
A pending seek or tune operation timed out
|
static int |
ERROR_SERVER_DIED
Indicates a failure of the radio service.
|
Constructor and Description |
---|
RadioTuner() |
Modifier and Type | Method and Description |
---|---|
abstract int |
cancel()
Cancel a pending scan or tune operation.
|
abstract void |
close()
Close the tuner interface.
|
abstract int |
getConfiguration(RadioManager.BandConfig[] config)
Get current configuration.
|
abstract boolean |
getMute()
Get mute state.
|
abstract int |
getProgramInformation(RadioManager.ProgramInfo[] info)
Get current station information.
|
abstract boolean |
hasControl()
Indicates if this client actually controls the tuner.
|
abstract boolean |
isAntennaConnected()
Get current antenna connection state for current configuration.
|
abstract int |
scan(int direction,
boolean skipSubChannel)
Scan up or down to next valid station.
|
abstract int |
setConfiguration(RadioManager.BandConfig config)
Set the active band configuration for this module.
|
abstract int |
setMute(boolean mute)
Set mute state.
|
abstract int |
step(int direction,
boolean skipSubChannel)
Step up or down by one channel spacing.
|
abstract int |
tune(int channel,
int subChannel)
Tune to a specific frequency.
|
public static final int DIRECTION_UP
step(int, boolean)
, scan(int, boolean)
public static final int DIRECTION_DOWN
step(int, boolean)
, scan(int, boolean)
public static final int ERROR_HARDWARE_FAILURE
public static final int ERROR_SERVER_DIED
public static final int ERROR_CANCELLED
public static final int ERROR_SCAN_TIMEOUT
public static final int ERROR_CONFIG
public abstract void close()
RadioTuner.Callback
callback will not be called
anymore and associated resources will be released.
Must be called when the tuner is not needed to make hardware resources available to others.public abstract int setConfiguration(RadioManager.BandConfig config)
config
- The desired band configuration (FmBandConfig or AmBandConfig).RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_BAD_VALUE
if parameters are invalid, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract int getConfiguration(RadioManager.BandConfig[] config)
config
- a BandConfig array of lengh 1 where the configuration is returned.RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_BAD_VALUE
if parameters are invalid, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract int setMute(boolean mute)
mute
- the requested mute state.RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract boolean getMute()
true
if the radio tuner audio source is muted or a problem occured
retrieving the mute state, false
otherwise.public abstract int step(int direction, boolean skipSubChannel)
RadioTuner.Callback
onProgramInfoChanged() will be called when step completes or
onError() when cancelled or timeout.direction
- DIRECTION_UP
or DIRECTION_DOWN
.skipSubChannel
- indicates to skip sub channels when the configuration currently
selected supports sub channel (e.g HD Radio). N/A otherwise.RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_BAD_VALUE
if parameters are invalid, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract int scan(int direction, boolean skipSubChannel)
RadioTuner.Callback
onProgramInfoChanged() will be called when scan completes or
onError() when cancelled or timeout.direction
- DIRECTION_UP
or DIRECTION_DOWN
.skipSubChannel
- indicates to skip sub channels when the configuration currently
selected supports sub channel (e.g HD Radio). N/A otherwise.RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_BAD_VALUE
if parameters are invalid, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract int tune(int channel, int subChannel)
RadioTuner.Callback
onProgramInfoChanged() will be called when tune completes or
onError() when cancelled or timeout.channel
- the specific channel or frequency to tune to.subChannel
- the specific sub-channel to tune to. N/A if the selected configuration
does not support cub channels.RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_BAD_VALUE
if parameters are invalid, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract int cancel()
RadioTuner.Callback
onError() will be called with
ERROR_CANCELLED
.RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_BAD_VALUE
if parameters are invalid, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract int getProgramInformation(RadioManager.ProgramInfo[] info)
info
- a ProgramInfo array of lengh 1 where the information is returned.RadioManager.STATUS_OK
in case of success, RadioManager.STATUS_ERROR
in case of unspecified error, RadioManager.STATUS_NO_INIT
if the native service cannot be reached, RadioManager.STATUS_BAD_VALUE
if parameters are invalid, RadioManager.STATUS_INVALID_OPERATION
if the call is out of sequence, RadioManager.STATUS_DEAD_OBJECT
if the binder transaction to the native
service fails, public abstract boolean isAntennaConnected()
true
if the antenna is connected, false
otherwise.public abstract boolean hasControl()
RadioManager#openTuner(int,
RadioManager.BandConfig, boolean, Callback, Handler)
returns a non null tuner interface.
Control is lost when another client opens an interface on the same tuner.
When this happens, RadioTuner.Callback.onControlChanged(boolean)
is received.
The client can either wait for control to be returned (which is indicated by the same
callback) or close and reopen the tuner interface.true
if this interface controls the tuner,
false
otherwise or if a problem occured retrieving the state.