|
||||||||||
| 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.CastingRS485Server
public class CastingRS485Server
A class that acts as a serial caster, additionally to its RS485 server
capabilities. On init(), this caster binds itself to a running
registry if the KEY_BIND property is true.
RmiSerialListeners can subscribe to the caster services using the
methods defined in RmiSerialCaster.
To allow subclasses to specify which commands sent to the serial line should
actually invoke a serial event, the writeCommand(java.lang.String) method is splitted
into a normal method (directly passed to the superclass), and a method
adding a serial flag that sparks the generation of a serial
event if true.
| 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 static boolean |
DEFBIND
The default binding behavior. |
static String |
KEY_BIND
The key specifying the binding behavior of this caster. |
private List |
listeners
The list of serial listeners. |
| 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_RESPONDTIME, 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 stella.rmi.RmiSerialCaster |
|---|
NAMING_EXTENSION |
| 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 | |
|---|---|
CastingRS485Server(Map prop)
Constructs a new casting RS485 server. |
|
| Method Summary | |
|---|---|
void |
addRmiSerialListener(RmiSerialListener ear)
Adds an rmi-enabled serial listener to this class's listeners list. |
boolean |
bindToRegistry()
Binds myself to a running registry using the static binding method in AbstractRmiCaster. |
void |
exit()
Unbind from registry, if bound after closing serial port. |
void |
init()
The init method specialises initialization for a Driver object
necessary prior to use. |
boolean |
isValid()
The method for listeners to check if the remote reference is still valid. |
protected void |
notifyListeners(SerialEvent se)
Notifies all registerd listeners of an upcoming serial event. |
void |
removeRmiSerialListener(RmiSerialListener ear)
Removes an rmi-enabled serial listener from this class's listeners. |
boolean |
unbindFromRegistry()
Uninds myself to a running registry using the static binding method in AbstractRmiCaster. |
String |
writeCommand(String cmd)
Writes a command to the serial line. |
String |
writeCommand(String cmd,
boolean flag)
Writes a command to the serial line. |
String |
writeString(String mess,
boolean flag)
Writes the string to the port. |
| 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, 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 |
| Field Detail |
|---|
public static final String KEY_BIND
private static final boolean DEFBIND
private List listeners
| Constructor Detail |
|---|
public CastingRS485Server(Map prop)
init() method is called.
| Method Detail |
|---|
public void init()
Driver object
necessary prior to use. The casting RS485 server registers itself at a
running registry after calling the parental method. Regisering only
takes place if the parental init method returned true. If registering
fails, but the serial line could be opened successfully, this method
still returns true.
init in interface Initializableinit in class PropertyResources
public boolean bindToRegistry()
throws RemoteException
AbstractRmiCaster.
bindToRegistry in interface RmiCasterRemoteException
public boolean unbindFromRegistry()
throws RemoteException
AbstractRmiCaster.
unbindFromRegistry in interface RmiCasterRemoteException
public boolean isValid()
throws RemoteException
isValid in interface RmiCasterRemoteExceptionpublic void exit()
exit in interface ExitCleaningexit in class RS485Server
public String writeString(String mess,
boolean flag)
throws IOException
IOException
public String writeCommand(String cmd)
throws IOException
writeCommand in class RS485Servercmd - The command to writecount - The number of bytes to read as a command reply. Zero for
unspecified numbers.
IOException
public String writeCommand(String cmd,
boolean flag)
throws IOException
cmd - The command to writecount - The number of bytes to read as a command reply. Zero for
unspecified numbers.flag - True, if serial events should be generated.
IOException
public void addRmiSerialListener(RmiSerialListener ear)
throws RemoteException
addRmiSerialListener in interface RmiSerialCasterRemoteException
public void removeRmiSerialListener(RmiSerialListener ear)
throws RemoteException
removeRmiSerialListener in interface RmiSerialCasterRemoteExceptionprotected void notifyListeners(SerialEvent se)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||