DAAPI B (b02)
- Java ME Embedded 3.3 Release

Package com.oracle.deviceaccess.dac

Interfaces and classes for writing analog outputs using a Digital to Analog Converter (DAC).

See: Description

Package com.oracle.deviceaccess.dac Description

Interfaces and classes for writing analog outputs using a Digital to Analog Converter (DAC).

One DAC converter can have several channels. Each channel can generate an analog output from numerical values that are converted to output voltages.

In order to access and control a specific DAC channel, an application should first open and obtain an DACChannel instance for the DAC channel the application wants to access and control, using its numerical ID, name, type (interface) and/or properties:

Using its ID
 DACChannel channel = (DACChannel) PeripheralManager.open(5);
Using its name and interface
 DACChannel channel = (DACChannel) PeripheralManager.open("LED", DACChannel.class, null);
Once the peripheral opened, an application can write output values to a DAC channel using methods of the DACChannel interface such as the setValue method.
When done, the application should call the DACChannel.close() method to release DAC channel.
The following sample codes give examples of using the DAC API:
 class VaryingDimmer implements GenerationListener {
     private DACChannel channel = null;
     public void start(int channelID) throws IOException, PeripheralNotAvailableException, PeripheralNotFoundException {
         if (channel != null) {
             throw new InvalidStateException();
         channel = (DACChannel) PeripheralManager.open(channelID);
         channel.setSamplingInterval(1000); // every 1000 milliseconds
         // Creates a series of samples varying from min value to max value
         int[] values = new int[10];
         int min = channel.getMinValue();
         int max = channel.getMaxValue();
         for (int i = 0; i < values.length; i++) {
             values[i] = min + (((max - min) / (values.length - 1)) * i);
         channel.startGeneration(values, 0, values.length, false, this);
     public void outputGenerated(GenerationEvent event) {
         event.setActualNumber(event.getNumber()); // Replay the same sample series
     public void stop() throws IOException, PeripheralNotAvailableException {
         if (channel != null) {
Because of performance issue, procedures handling analog outputs, and especially event listeners, should be implemented to be as fast as possible.


DAC channels are opened by invoking one of the com.oracle.deviceaccess.PeripheralManager.open methods. The "com.oracle.deviceaccess.dac" permission allows access to be granted to DAC channels as a whole.
DAAPI B (b02)
5-February-2013 04:40

Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.