|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
io.AbstractDriver
io.AbstractSerialDriver
stella.io.RS485Server
stella.io.RS485Configurator
stella.jview.JRS485Config
public class JRS485Config
A GUI for controlling the RS485 setup. This configurator tool is not independently checking the serial line for different modules. The address has to be stated in the properties, see {link #KEY_ADDRESS}. On startup, the module configuration is read in by sending the read configuration command, $(Add)2 to the module. The state of the checksumming flag, the module's input range and the baud rate is deduced from the reply. After successfully reading the configuration, the control window is launched. It should look similar to the following:
RS485Configurator.SIMPLE_COMMAND prefix. The value of the key points to the string
representation of the actual command to send to the module, see also
RS485Configurator.ADDRESSFILL. In the example, a command that reads the status of the
watch dog is shown.JExitButton,
displays all commands sent to the module and the replies received. Commands
sent display in black, while responses are blue colored. The console display
(black background) does also show I/O along the serial line, bytes sent out
are preceeded by a > sign, while bytes received show up with a
leading <.KEY_RESPONDTIME.
Insuccessful commands are answered with a No response, canceling
error message displayed in red in the status field.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class stella.io.RS485Server |
|---|
RS485Server.Checksum, RS485Server.Command, RS485Server.Info, RS485Server.Scan |
| Nested classes/interfaces inherited from class io.AbstractSerialDriver |
|---|
AbstractSerialDriver.Available |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private JTextField |
address
The text field for the current address, non-editable. |
private JTextField |
addressinput
The text field for the address. |
private JRadioButton |
checkoff
The radio buttons related to the check flag false. |
private JRadioButton |
checkon
The radio buttons related to the check flag true. |
private HashMap |
commandline
A HashMap linking one-parameter commands to text fields. |
private JTextArea |
console
The text are used for console-like I/O. |
private static int |
DEFCOLUMN
The default number of columns in the console (20). |
private static long |
DEFRESPONDTIME
The default respond time, 1 sec. |
private static int |
DEFROW
The default number of rows in the console (10). |
private JTextField |
direct
The text field for direct input. |
private JComboBox |
jbaud
The baud rates available. |
private JComboBox |
jrange
The input ranges available. |
static String |
KEY_COLUMN
The key to the number of columns of the console. |
static String |
KEY_RESPONDTIME
The key for the response-reading timeout (ms). |
static String |
KEY_ROW
The key to the number of rows of the console. |
private static String |
MAINCOMMAND
The unique identifier for the main configure command. |
private JStatusExit |
status
The status panel of the configurator. |
private static Color |
TEXTBACKGROUND
The background color of the console text area. |
private static Font |
TEXTFONT
The font of the console text area. |
private static Color |
TEXTFOREGROUND
The foreground color of the console text area. |
| Fields inherited from class stella.io.RS485Configurator |
|---|
ADDRESSFILL, KEY_ADDRESS, LEADCHAR, RESERVED, SIMPLE_COMMAND, SINGLE_COMMAND |
| Fields inherited from class stella.io.RS485Server |
|---|
KEY_CHECKCHAR, KEY_CHECKSUM, KEY_CLOSE, KEY_CR, KEY_ECHO, KEY_FAILTIME, KEY_FAILURES, KEY_INVALID, KEY_MAXBUFFER, KEY_MAXBUSY, KEY_QUERYTIME, KEY_REINIT, KEY_STARTUP, KEY_TIMEBUSY, lock |
| Fields inherited from class io.AbstractSerialDriver |
|---|
inport, KEY_BAUDRATE, KEY_CLOSETIMEOUT, KEY_DATABIT, KEY_FLOWCONTROL, KEY_INBUFFER, KEY_NOTIFYCOOLDOWN, KEY_OUTBUFFER, KEY_PARITYBIT, KEY_PORTNAME, KEY_RECEIVEFRAMING, KEY_RECEIVETHRESHOLD, KEY_RECEIVETIMEOUT, KEY_STOPBIT, KEY_TIMEOUT, outport, staticlock |
| Fields inherited from class io.AbstractDriver |
|---|
KEY_DRIVERNAME |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
JRS485Config(Map prop)
Constructs a new RS485-configuration tool. |
|
| Method Summary | |
|---|---|
void |
actionPerformed(ActionEvent ae)
Handles action events delivered from the ok buttons. |
void |
exit()
Closes the serial line on normal exits through the exit button. |
Icon |
getIcon()
Might return an icon, if one was stated in the properties |
Component |
getRepresentation()
Returns a panel comprising all configuration possibilities. |
private JButton |
listeningOKButton(String actcom)
Returns a button labeled 'ok'. |
static void |
main(String[] arg)
Launches the graphical RS485 Configuration tool. |
boolean |
setOpen()
Opens the serial port. |
String |
writeCommand(String mess)
The read method echos the read result to the console and to the status line. |
| Methods inherited from class stella.io.RS485Server |
|---|
deferCommand, ensureCommand, getCheckSum, getCheckSumming, isReading, open, readString, setCheckSumming, toString, writeString |
| Methods inherited from class io.AbstractSerialDriver |
|---|
close, createPortEventListener, createPortEventListener, deregisterSoleEventListener, disableEvent, enableEvent, getDriverName, isOpen, registerSoleEventListener, resetOriginalParameters |
| Methods inherited from class io.AbstractDriver |
|---|
createDriver, equals, hashCode |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.Initializable |
|---|
init |
| Field Detail |
|---|
public static final String KEY_COLUMN
public static final String KEY_ROW
public static final String KEY_RESPONDTIME
private static final int DEFCOLUMN
private static final int DEFROW
private static final long DEFRESPONDTIME
private static final Color TEXTFOREGROUND
private static final Color TEXTBACKGROUND
private static final Font TEXTFONT
private static final String MAINCOMMAND
private JTextField direct
private JStatusExit status
private JTextArea console
private JTextField address
private JTextField addressinput
private JComboBox jbaud
private JComboBox jrange
private JRadioButton checkon
private JRadioButton checkoff
private HashMap commandline
| Constructor Detail |
|---|
public JRS485Config(Map prop)
getRepresentation().
| Method Detail |
|---|
public Icon getIcon()
getIcon in interface Displayablepublic Component getRepresentation()
RS485Configurator.RESERVED commands is fixed, they all constitute to a single
panel. The default setting is derived from the config string that is read
in during open. Therefore, opening the serial line is done automatically
if this method is called.
getRepresentation in interface Displayable
public boolean setOpen()
throws IOException
setOpen in class RS485ConfiguratorIOExceptionpublic void exit()
exit in interface ExitCleaningexit in class RS485Serverpublic void actionPerformed(ActionEvent ae)
actionPerformed in interface ActionListener
public String writeCommand(String mess)
throws IOException
JStatusPanel.done(java.lang.String) is used.
writeCommand in class RS485Servermess - The command to write
IOExceptionprivate JButton listeningOKButton(String actcom)
public static void main(String[] arg)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||