model.device
Class USBDMXInterface

java.lang.Object
  extended by model.device.ADMXDevice
      extended by model.device.USBDMXInterface

public class USBDMXInterface
extends ADMXDevice

This is a concrete implementation of the ADMXDevice framework for the USBDMX.com DMX controller. This driver required the D2xx driver for the USBDMX.com controller to be installed on the system, and utilizes the USBDMX Java Driver.dll file to communicate with the driver.

TODO: fadeValue is commented out because the program never uses it, and the code for it is out of date. It should probably exist, but I havn't seen the need yet.


Constructor Summary
USBDMXInterface()
          This constructor will instantiate a new USBDMX.com device.
 
Method Summary
 void closeDevice()
          This method will be called before the program closes, or when the program is disconnecting from the device.
 Channel[] fadeValues(Channel[] startValues, Channel[] endValues, long fadeUpMillis, long fadeDownMillis, IUpdateChannel channelUpdater, IUpdateFadeProgress fadeUpdater)
          This method will start a fade from the startValues to the endValues.
 void setMaxAddress(short address)
          This method allows you to set a maximum address on the device, if the device supports it.
 Channel setValue(Channel channel)
          This method sets the given channel, value pair on the device.
 Channel[] setValues(Channel[] channels)
          This method sets a series of values on the device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

USBDMXInterface

public USBDMXInterface()
                throws ADMXDeviceException
This constructor will instantiate a new USBDMX.com device. It will open the connection to the device, and enable DMX transmition.

Throws:
ADMXDeviceException - This exception will be thrown if there is an error trying to connect to the USBDMX.com device.
Method Detail

setValue

public Channel setValue(Channel channel)
                 throws ADMXDeviceException
This method sets the given channel, value pair on the device.

Specified by:
setValue in class ADMXDevice
Parameters:
channel - The Channel object with the address, value pair to set on the device.
Returns:
A Channel object containing the new value of the given address.
Throws:
ADMXDeviceException - This exception will be thrown if there is an error while writting to the device.

setValues

public Channel[] setValues(Channel[] channels)
                    throws ADMXDeviceException
This method sets a series of values on the device.

Specified by:
setValues in class ADMXDevice
Parameters:
channels - The array of address, value pairs to set on the device.
Returns:
The Channel objects containing the new values of the given addresses.
Throws:
ADMXDeviceException - This exception will be thrown if there is an error while writting to the device.

fadeValues

public Channel[] fadeValues(Channel[] startValues,
                            Channel[] endValues,
                            long fadeUpMillis,
                            long fadeDownMillis,
                            IUpdateChannel channelUpdater,
                            IUpdateFadeProgress fadeUpdater)
                     throws ADMXDeviceException
This method will start a fade from the startValues to the endValues. The two Channel object arrays must be the same length and contain the same channel addresses, in the same order. IUpdateChannel and IUpdateFadeProgress are used to update the view during the fade.

Specified by:
fadeValues in class ADMXDevice
Parameters:
startValues - The Channel object array of the starting values for the fade. These values will be faded down in fadeDownMillis milliseconds. This array must be the same length as endValues, and contain the same addresses in the same order.
endValues - The Channel object array of the ending values for the fade. These values will be faded up in fadeUpMillis milliseconds. This array must be the same length as startValues, and contain the same addresses in the same order.
fadeUpMillis - The time in milliseconds that it will take to fade in the endValues.
fadeDownMillis - The time in milliseconds that it will take to fade out the startValues.
channelUpdater - This interface contains two methods that will be called every time a new value is written to the device. These methods tell the model the current values of the channels during the fade. Using these values, the view can be updated as the channels fade.
fadeUpdater - This class contains two methods that are used to update the fade progress bars during the fade. They should be called every time a value is written to the device.
Returns:
An array of Channel objects with the final values of the faded channels.
Throws:
ADMXDeviceException - This exception will be thrown if there is an error while writting to the device.

setMaxAddress

public void setMaxAddress(short address)
                   throws ADMXDeviceException
This method allows you to set a maximum address on the device, if the device supports it.

TODO: This method should be renamed to setMaxChannels().

Specified by:
setMaxAddress in class ADMXDevice
Parameters:
maxChannels - The maximum number of channels.
Throws:
ADMXDeviceException - This exception will be thrown if there is an error while writting to the device.

closeDevice

public void closeDevice()
                 throws ADMXDeviceException
This method will be called before the program closes, or when the program is disconnecting from the device. If the device does not need to be 'closed' in any way, this method can be left blank.

Specified by:
closeDevice in class ADMXDevice
Throws:
ADMXDeviceException - This exception will be thrown if there is an error while closing the device.