public class CastingRS485Server extends RS485Server implements RmiSerialCaster
init(), this caster binds itself to a running
registry if the KEY_BIND property is true. RmiSerialListener
s 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.
RS485Server.Checksum, RS485Server.Command, RS485Server.Info, RS485Server.ScanAbstractSerialDriver.Available| Modifier and Type | Field and Description |
|---|---|
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.
|
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, lockinport, 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, LOCK, outport, STATICLOCKKEY_DRIVERNAMEKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORNAMING_EXTENSIONCONFIG, KEY_CLASS| Constructor and Description |
|---|
CastingRS485Server(Map<String,String> prop)
Constructs a new casting RS485 server.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
deferCommand, ensureCommand, getCheckSum, getCheckSumming, isReading, open, readString, setCheckSumming, toString, writeStringclose, createPortEventListener, createPortEventListener, deregisterSoleEventListener, disableEvent, enableEvent, getDriverName, isOpen, registerSoleEventListener, resetOriginalParameterscreateDriver, equals, hashCodeaugment, augment, augment, augment, augment, clone, 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, initProperties, isNew, parseObject, parseObject, reload, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringPropertiespublic static final String KEY_BIND
private static final boolean DEFBIND
private List listeners
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 AbstractSerialDriverpublic boolean bindToRegistry()
throws RemoteException
AbstractRmiCaster.bindToRegistry in interface RmiCasterRemoteExceptionpublic boolean unbindFromRegistry()
throws RemoteException
AbstractRmiCaster.unbindFromRegistry in interface RmiCasterRemoteExceptionpublic boolean isValid()
throws RemoteException
isValid in interface RmiCasterRemoteExceptionpublic void exit()
exit in interface ExitCleaningexit in class RS485Serverpublic String writeString(String mess, boolean flag) throws IOException
IOExceptionpublic 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.IOExceptionpublic 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.IOExceptionpublic void addRmiSerialListener(RmiSerialListener ear) throws RemoteException
addRmiSerialListener in interface RmiSerialCasterRemoteExceptionpublic void removeRmiSerialListener(RmiSerialListener ear) throws RemoteException
removeRmiSerialListener in interface RmiSerialCasterRemoteExceptionprotected void notifyListeners(SerialEvent se)