|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectikayaki.squid.Degausser
public class Degausser
Offers an interface for controlling the degausser (demagnetizer). Because the data link is implemented in the degausser by a single board computer running a small basic program, the response time of the degausser to commands is slow. This class will make sure that commands are not sent faster than the device can handle.
Field Summary | |
---|---|
private int |
degausserDelay
1-9 seconds default delay 1 second |
private int |
degausserRamp
(3, 5, 7, 9) default 3 |
private boolean |
demagnetizing
|
private double |
maximumField
|
private Stack<String> |
messageBuffer
buffer for incoming messages, readed when needed. |
private double |
minimumField
|
private int |
pollTimeout
|
private SynchronousQueue<String> |
queue
Synchronous queue for waiting result message from degausser |
protected SerialIO |
serialIO
COM port for communication. |
private boolean |
waitingForMessage
|
Constructor Summary | |
---|---|
Degausser()
Creates a new degausser interface. |
Method Summary | |
---|---|
protected void |
blockingWrite(String command)
|
boolean |
demagnetizeY(double amp)
Performs full sequence to demagnetize Y (and X) coil with the given amplitude. |
boolean |
demagnetizeZ(double amp)
Performs full sequence to demagnetize Z coil with the given amplitude. |
protected void |
executeRampCycle()
Performs Ramp up and down. |
protected void |
executeRampDown()
Brings Ramp down. |
protected void |
executeRampUp()
Performs Ramp up. |
int |
getAmplitude()
Sends amplitude query to degausser and returns answer. |
char |
getCoil()
Sends coil query to degausser and returns answer. |
int |
getDelay()
Sends delay query to degausser and returns answer. |
int |
getRamp()
Sends ramp query to degausser and returns answer. |
char |
getRampStatus()
Sends status query to degausser and returns answer. |
boolean |
isDemagnetizing()
|
boolean |
isOK()
Checks if connection is ok. |
void |
serialIOEvent(SerialIOEvent event)
Propagates serial port message event. |
protected void |
setAmplitude(double amplitude)
Sets amplitude to ramp, range 1.0 to maximumField. |
protected void |
setCoil(char coil)
Sets coil X,Y,Z. |
void |
updateSettings()
Checks which settings have changed and updates the degausser interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Stack<String> messageBuffer
private SynchronousQueue<String> queue
private int pollTimeout
protected SerialIO serialIO
private int degausserDelay
private int degausserRamp
private boolean waitingForMessage
private double minimumField
private double maximumField
private boolean demagnetizing
Constructor Detail |
---|
public Degausser() throws SerialIOException
SerialIOException
Method Detail |
---|
public void updateSettings()
protected void setCoil(char coil)
coil
- coil to set on.protected void setAmplitude(double amplitude)
amplitude
- amplitude to demag.
IllegalArgumentException
- if the amplitude is not in the allowed range.protected void executeRampUp()
protected void executeRampDown()
protected void executeRampCycle()
protected void blockingWrite(String command) throws SerialIOException
SerialIOException
public boolean demagnetizeZ(double amp)
amp
- amplitude to demag.
public boolean demagnetizeY(double amp)
amp
- amplitude to demag.
public boolean isDemagnetizing()
public char getRampStatus()
public int getRamp()
public int getDelay()
public char getCoil()
public int getAmplitude()
public boolean isOK()
public void serialIOEvent(SerialIOEvent event)
SerialIOListener
serialIOEvent
in interface SerialIOListener
event
- the event that happened.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |