See: Description
Interface | Description |
---|---|
DACChannel |
The
DACChannel interface provides methods for controlling a DAC (Digital to Analog Converter) channel. |
GenerationListener |
The
GenerationListener interface defines methods for getting notified of the completion of the conversion of
a set of raw output values and that more output values to be converted may be provided. |
Class | Description |
---|---|
DACChannelConfig |
The
DACChannelConfig class encapsulates the hardware addressing information, and static and dynamic
configuration parameters of an DAC channel. |
GenerationEvent |
The
GenerationEvent class encapsulates DAC channel analog output generation completion conditions. |
Exception | Description |
---|---|
InvalidOutputSamplingRateException |
Thrown by an instance of
DACChannel in case the requested output sampling rate is higher than the maximum
output sampling rate the DAC device can support. |
DACChannel
instance for the DAC channel the application wants to
access and control, using its numerical ID, name, type (interface) and/or properties:
DACChannel channel = (DACChannel) PeripheralManager.open(5);
DACChannel channel = (DACChannel) PeripheralManager.open("LED", DACChannel.class, null);
DACChannel
interface such as the
setValue
method. When done, the application should call thechannel.setValue(brightness);
DACChannel.close()
method to release DAC channel. The following sample codes give examples of using the DAC API:channel.close();
Because of performance issue, procedures handling analog outputs, and especially event listeners, should be implemented to be as fast as possible.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) { channel.stopGeneration(); channel.close(); } } }
com.oracle.deviceaccess.PeripheralManager.open
methods. The "com.oracle.deviceaccess.dac"
permission allows
access to be granted to DAC channels as a whole.Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.