|
jAER project on SourceForge | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jaer.biasgen.Biasgen
public class Biasgen
Describes a complete bias generator, with a masterbias. a bunch of IPots, and a hardware interface. This class handles the USB commands for the masterbias and ipots.
When using this class in conjunction with another use of the HardwareInterface, it is much better to share the same interface if possible. Do this by constructing the Biasgen using an existing HardwareInterface.
Users of this class should also check for unitialized bias values and warn the user that bias settings should be loaded.
Biasgen can implement the formatting of the raw bytes that are sent, although for historical reasons the default implementation is that it asks the BiasgenHardwareInterface to do this formatting. A particular system can override formatConfigurationBytes to implement a particular low level format.
Biasgen also implements a default method getControlPanel for building it's own user GUI interface, but subclasses can override this method to build their own arbitrarily-complex JPanel for control.
| Nested Class Summary | |
|---|---|
protected static interface |
Biasgen.HasPreference
Marks a class (for example, some object in a subclass of Biasgen) as having a preference that can be loaded and stored. |
| Field Summary | |
|---|---|
protected javax.swing.JPanel |
controlPanel
The built-in control panel that is built by getControlPanel on first call |
protected BiasgenHardwareInterface |
hardwareInterface
The hardware interface for this Biasgen object |
protected PotArray |
potArray
|
| Constructor Summary | |
|---|---|
Biasgen(Chip chip)
Constructs a new biasgen. |
|
| Method Summary | |
|---|---|
javax.swing.JPanel |
buildControlPanel()
Builds the default control panel and returns it. |
void |
close()
Closes the device and frees the internal device handle. |
void |
endBatchEdit()
call this to end the edit and send the values over the hardware interface. |
void |
exportPreferences(java.io.OutputStream os)
exports preference values for this subtree of all Preferences (the biasgen package subtreee). |
void |
flashConfiguration(Biasgen biasgen)
flashes the the ipot values onto the hardware interface. |
byte[] |
formatConfigurationBytes(Biasgen biasgen)
This method formats and returns a byte array of configuration information (e.g. |
Chip |
getChip()
Returns chip associated with this biasgen. |
javax.swing.JPanel |
getControlPanel()
Returns the graphical control panel for this Biasgen. |
BiasgenHardwareInterface |
getHardwareInterface()
|
java.util.ArrayList<IPotGroup> |
getIPotGroups()
|
Masterbias |
getMasterbias()
|
java.lang.String |
getName()
|
int |
getNumPots()
|
PotArray |
getPotArray()
A Biasgen has a single PotArray of biases. |
Pot |
getPotByName(java.lang.String name)
Get an IPot by name. |
Pot |
getPotByNumber(int number)
Get an IPot by number in IPotArray. |
java.lang.String |
getTypeName()
get text name of interface, e.g. |
void |
importPreferences(java.io.InputStream is)
Imports preference values for this subtree of all Preferences (the biasgen package subtreee). |
boolean |
isBatchEditOccurring()
boolean that flags that a batch edit is occurring |
boolean |
isInitialized()
Checks for unitialized biases (no non-zero preference values). |
boolean |
isOpen()
|
void |
loadPreferences()
Loads preferences for the potArray and masterbias. |
void |
open()
opens the first available hardware interface found |
void |
putPref(java.lang.String key,
boolean value)
Use this method to put a value only if the value is different than the stored Preference value. |
void |
putPref(java.lang.String key,
double value)
Use this method to put a value to the preferences only if the value is different than the stored Preference value. |
void |
putPref(java.lang.String key,
float value)
Use this method to put a value to the preferences only if the value is different than the stored Preference value. |
void |
putPref(java.lang.String key,
int value)
Use this method to put a value to the preferences only if the value is different than the stored Preference value. |
void |
putPref(java.lang.String key,
java.lang.String value)
Use this method to put a value only if the value is different than the stored Preference value. |
void |
resume()
restores biases after suspend |
void |
sendConfiguration(Biasgen biasgen)
sends the ipot values over the hardware interface if there is not a batch edit occuring. |
void |
setBatchEditOccurring(boolean batchEditOccurring)
sets boolean to flag batch edit occuring |
void |
setChip(Chip chip)
Sets chip associated with this biasgen |
void |
setControlPanel(javax.swing.JPanel panel)
Sets the control panel but doesn't do anything to rebuild the GUI interface. |
void |
setHardwareInterface(BiasgenHardwareInterface hardwareInterface)
Assigns the HardwareInterface to this Biasgen. |
void |
setIPotGroups(java.util.ArrayList<IPotGroup> iPotGroups)
|
void |
setMasterbias(Masterbias masterbias)
|
void |
setName(java.lang.String name)
|
void |
setPotArray(PotArray PotArray)
|
void |
setPowerDown(boolean powerDown)
sends the powerdown vendor request to power down the chip. |
void |
showUnitializedBiasesWarningDialog(java.awt.Frame container)
Shows a dialog centered on the screen warning user to load bias settings |
void |
startBatchEdit()
call this when starting a set of related pot value changes. |
void |
storePreferences()
Stores preferences to the Preferences node for the potArray and masterbias. |
void |
suspend()
sets all the biases to zero current |
java.lang.String |
toString()
|
void |
update(java.util.Observable observable,
java.lang.Object object)
called when observable (masterbias) calls notifyObservers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected transient PotArray potArray
protected BiasgenHardwareInterface hardwareInterface
protected javax.swing.JPanel controlPanel
| Constructor Detail |
|---|
public Biasgen(Chip chip)
HardwareInterfaceException| Method Detail |
|---|
public javax.swing.JPanel getControlPanel()
public javax.swing.JPanel buildControlPanel()
public void setControlPanel(javax.swing.JPanel panel)
panel - the new panelpublic PotArray getPotArray()
public void setPotArray(PotArray PotArray)
public Masterbias getMasterbias()
public void setMasterbias(Masterbias masterbias)
public java.lang.String getName()
public void setName(java.lang.String name)
public void exportPreferences(java.io.OutputStream os)
throws java.io.IOException
exportPreferences in interface BiasgenPreferencesos - an output stream, typically constructed for a FileOutputStream
java.io.IOException - if the output stream cannot be written
public void importPreferences(java.io.InputStream is)
throws java.io.IOException,
java.util.prefs.InvalidPreferencesFormatException,
HardwareInterfaceException
importPreferences in interface BiasgenPreferencesis - an input stream, typically constructed for a FileInputStream
java.io.IOException - if the output stream cannot be read
java.util.prefs.InvalidPreferencesFormatException
HardwareInterfaceExceptionpublic void loadPreferences()
loadPreferences in interface BiasgenPreferencespublic void storePreferences()
storePreferences in interface BiasgenPreferences
public void putPref(java.lang.String key,
java.lang.String value)
key - your key.value - your value.
public void putPref(java.lang.String key,
boolean value)
key - your key.value - your value.
public void putPref(java.lang.String key,
int value)
key - your key.value - your value.
public void putPref(java.lang.String key,
float value)
key - your key.value - your value.
public void putPref(java.lang.String key,
double value)
key - your key.value - your value.public java.lang.String toString()
toString in class java.lang.Objectpublic void startBatchEdit()
endBatchEdit()
public void endBatchEdit()
throws HardwareInterfaceException
HardwareInterfaceExceptionstartBatchEdit()
public void update(java.util.Observable observable,
java.lang.Object object)
update in interface java.util.Observerpublic Pot getPotByName(java.lang.String name)
name - name of pot as assigned in IPot
public Pot getPotByNumber(int number)
number - name of pot as assigned in IPot
public BiasgenHardwareInterface getHardwareInterface()
public void setHardwareInterface(BiasgenHardwareInterface hardwareInterface)
hardwareInterface - the hardware interface.public int getNumPots()
public void close()
HardwareInterface
close in interface HardwareInterface
public void flashConfiguration(Biasgen biasgen)
throws HardwareInterfaceException
flashConfiguration in interface BiasgenHardwareInterfacebiasgen - the bias generator object.
This parameter is necessary because the same method is used in the hardware interface,
which doesn't know about the particular bias generator instance.
HardwareInterfaceException - if there is a hardware error. If there is no interface, prints a message and just returns.
public void open()
throws HardwareInterfaceException
open in interface HardwareInterfaceHardwareInterfaceException - if there is a problem. Diagnostics are printeds.
public void sendConfiguration(Biasgen biasgen)
throws HardwareInterfaceException
sendConfiguration in interface BiasgenHardwareInterfacebiasgen - the bias generator object.
This parameter is necessary because the same method is used in the hardware interface,
which doesn't know about the particular bias generator instance.
HardwareInterfaceException - if there is a hardware error. If there is a null HardwareInterface, just returns.startBatchEdit(),
endBatchEdit()public byte[] formatConfigurationBytes(Biasgen biasgen)
sendConfiguration(net.sf.jaer.biasgen.Biasgen). This method delegates the task of formatting these
bytes to the Biasgen object rather than the more generic HardwareInterface.
A Biasgen can override this method to customize the bytes that are sent. The default implementation asks the BiasgenHardwareInterface for the bytes.
formatConfigurationBytes in interface BiasgenHardwareInterfacebiasgen - source of the configuration
public void setPowerDown(boolean powerDown)
throws HardwareInterfaceException
BiasgenHardwareInterfaceTypically this method toggles the powerDown pin correctly to ensure on-chip biasgen is powered up. Chip may have been plugged in without being powered up. If powerdown is true, simply sets powerdown high. If powerdown is false, powerdown is toggled high and then low, to make sure a nagative transistion occurs. This transistion is necessary to ensure the startup circuit starts up the masterbias again.
setPowerDown in interface BiasgenHardwareInterfacepowerDown - true to power OFF the biasgen, false to power on
HardwareInterfaceExceptionpublic java.lang.String getTypeName()
HardwareInterface
getTypeName in interface HardwareInterfacepublic boolean isOpen()
isOpen in interface HardwareInterfacepublic void suspend()
resume()public void resume()
suspend()public boolean isBatchEditOccurring()
startBatchEdit(),
endBatchEdit()public void setBatchEditOccurring(boolean batchEditOccurring)
batchEditOccurring - true to signal that it is occuringstartBatchEdit(),
endBatchEdit()public java.util.ArrayList<IPotGroup> getIPotGroups()
public void setIPotGroups(java.util.ArrayList<IPotGroup> iPotGroups)
public Chip getChip()
public void setChip(Chip chip)
chip - the chippublic boolean isInitialized()
public void showUnitializedBiasesWarningDialog(java.awt.Frame container)
container - the window or panel that should contain the dialog
|
jAER project on SourceForge | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||