Java Reference
In-Depth Information
This example uses a more limited combination of MSA Component
JSRs and capabilities, which is sufficient to provide the basis for a
geotagging application. The main APIs used for such an application are
JSR-234 AMMS and JSR-179 Location. Both APIs are part of the full MSA
(JSR-179 Location is conditionally mandatory). This example does not
fully exploit the power of these Component JSRs but it still illustrates the
richness of Java applications that target a full MSA-compliant Java ME
platform. (To clarify, both JSRs are supported by S60 5th Edition, S60 3rd
Edition FP2 and UIQ 3.3.)
6.2.3 Radio Tuner
In the previous example, we used JSR-179 and JSR-234. You could also
use those Component JSRs to create a location-based radio tuner, which
can discover and listen to radio stations in the current location.
To discover local radio stations, we can query a remote server using
JSR-172 Web Services or, as in the previous example, an alternative
protocol such as REST. Again, JSR-234 AMMS provides interfaces for
tuner features, such as audio radio playback and access for Radio Data
System (RDS) features.
TunerControl is the main class for controlling a tuner. It is used to
control, for instance, the frequency and modulation used. The channel
presets of the device are also accessed via TunerControl . The core
functionality is the radio tuner. Having retrieved the tuner control, you
use it for tuning the radio frequency as in the example below:
Player radioPlayer = Manager.createPlayer("capture://radio");
radioPlayer.realize();
radioPlayer.addPlayerListener(new MyPlayerListener(this));
tunerControl = (TunerControl) radioPlayer.getControl
("javax.microedition.amms.control.tuner.TunerControl");
tunerControl.setStereoMode(TunerControl.STEREO);
rdsControl = (RDSControl)radioPlayer.getControl
("javax.microedition.amms.control.tuner.RDSControl");
rdsControl.setAutomaticTA(true);
radioPlayer.start();
int freq = tunerControl.seek(966000, TunerControl.MODULATION_FM, true);
tunerControl.setFrequency(freq, TunerControl.MODULATION_FM);
We need to provide a rich and compelling user experience. Again, we
can implement it using JSR-226 SVG, or JSR-184 3D for additional effects.
The following code example illustrates the combining of a compelling UI
and data; it uses JSR-226 SVG to display channel information retrieved
from JSR-234 AMMS:
 
Search WWH ::




Custom Search