org.bluemelon.bluesense
Class DacOutputDevice

java.lang.Object
  extended by org.bluemelon.bluesense.Device
      extended by org.bluemelon.bluesense.DacOutputDevice

public class DacOutputDevice
extends Device

Interface to the servo motor module BM7006. The BM7006 can be used to output up to 8 analog signals.


Field Summary
static int BSDAC_P1
          Port value for pin 1
static int BSDAC_P2
          Port value for pin 2
static int BSDAC_P3
          Port value for pin 3
static int BSDAC_P4
          Port value for pin 4
static int BSDAC_P5
          Port value for pin 5
static int BSDAC_P6
          Port value for pin 6
static int OUTPUTCOUNT
          The number of outputs that can be controlled
static int PROXY_ID
           
static java.lang.String PROXY_TITLE
           
static int[] SUPPORTS
           
 
Constructor Summary
DacOutputDevice(Master master, int deviceId)
          Creates a 'software' analog output device proxy with a given id.
 
Method Summary
 int getCurrentOutput(int port)
          Returns the current set value of a specific output.
 void getCurrentOutputs(int[] outputArray)
          Fills an array with the current set output values.
 int getPendingOutput(int port)
          Returns the value of a specific output, which is currently underway to the device
 void getPendingOutputs(int[] outputs)
          Fills an array with output values which are currently underway to the device
 boolean getRequestSetOutputsDone()
          Checks if the output set request is finished
 long getTimeOutUs()
          Returns the current set time out delay.
 void requestGetOutputs()
          Sends a request to retrieve the current set output values
 void requestSetOutput(int port, int output)
          Requests the dac output device to set one of its outputs to a new value
 void requestSetOutputs(int relevantOutputs, int[] outputs)
          Requests the analog output device to set its outputs to new values
 void setTimeOutUs(int timeOutUs)
          Sets the time out value which is used to check if a request was acknowledged in the set time.
 
Methods inherited from class org.bluemelon.bluesense.Device
addDeviceEventListener, detect, getFirmwareVersion, getId, getType, getTypeName, isAccessible, removeDeviceEventListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_TITLE

public static final java.lang.String PROXY_TITLE

SUPPORTS

public static final int[] SUPPORTS

PROXY_ID

public static final int PROXY_ID

OUTPUTCOUNT

public static final int OUTPUTCOUNT
The number of outputs that can be controlled


BSDAC_P1

public static final int BSDAC_P1
Port value for pin 1


BSDAC_P2

public static final int BSDAC_P2
Port value for pin 2


BSDAC_P3

public static final int BSDAC_P3
Port value for pin 3


BSDAC_P4

public static final int BSDAC_P4
Port value for pin 4


BSDAC_P5

public static final int BSDAC_P5
Port value for pin 5


BSDAC_P6

public static final int BSDAC_P6
Port value for pin 6

Constructor Detail

DacOutputDevice

public DacOutputDevice(Master master,
                       int deviceId)
Creates a 'software' analog output device proxy with a given id. The device will inacessible until a physical device with the same id is detected.

Parameters:
master -
deviceId -
Method Detail

requestSetOutputs

public void requestSetOutputs(int relevantOutputs,
                              int[] outputs)
Requests the analog output device to set its outputs to new values

Parameters:
relevantOutputs - a bit mask indicating which outputs to update
outputs - a pointer to an array of uint8_t values with enough space for all outputs. @see OUTPUTCOUNT Only those outputs for which a bit in the bit mask is set will be sent to the device. Note that each output is a value between 0 and 255.

requestSetOutput

public void requestSetOutput(int port,
                             int output)
Requests the dac output device to set one of its outputs to a new value

Parameters:
port - one of the port pin values. @see bsDacOutput_p1
output - an uint8_t representing the new value of the output. Note that each output is value between 0 and 255.

requestGetOutputs

public void requestGetOutputs()
Sends a request to retrieve the current set output values


getPendingOutputs

public void getPendingOutputs(int[] outputs)
Fills an array with output values which are currently underway to the device

Parameters:
outputs - a pointer to an array of uint8_t outputs with enough space for all outputs. @see OUTPUTCOUNT

getPendingOutput

public int getPendingOutput(int port)
Returns the value of a specific output, which is currently underway to the device

Parameters:
port - one of the port pin values. @see bsDacOutput_p1
Returns:
the value to be set on the output.

getRequestSetOutputsDone

public boolean getRequestSetOutputsDone()
Checks if the output set request is finished

Returns:
1 if request finished, 0 if request still busy

getCurrentOutput

public int getCurrentOutput(int port)
Returns the current set value of a specific output.

Parameters:
port - one of the port pin values. @see bsDacOutput_p1
Returns:
the output value.

getCurrentOutputs

public void getCurrentOutputs(int[] outputArray)
Fills an array with the current set output values.

Parameters:
outputArray - a pointer to an array of uint8_t values with enough space for all outputs. @see OUTPUTCOUNT

getTimeOutUs

public long getTimeOutUs()
Returns the current set time out delay. The time out delay is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Returns:
the time out value in microseconds.

setTimeOutUs

public void setTimeOutUs(int timeOutUs)
Sets the time out value which is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
timeOutUs - the value in microseconds which is the maximum duraion between a request and its answer.