public abstract class PLCServer extends SimpleManipulator implements java.beans.PropertyChangeListener
SimpleDataSource.NameEditorData
DataSource.Writable
Modifier and Type | Field and Description |
---|---|
static int |
BINARY_VALUE
The value type BINARY
|
static int |
BOOLEAN_VALUE
The value type BOOLEAN
|
static int |
BOTHSWAP
Definition for point swap style.
|
static int |
BYTESWAP
Definition for point swap style.
|
static java.lang.String |
cvsRev |
static int |
DOUBLE_WORD_VALUE
The value type DOUBLE WORD
|
static int |
FLOAT_VALUE
The value type FLOAT
|
static int |
NOSWAP
Definition for point swap style.
|
static int |
STRING_VALUE
The value type STRING
|
static int |
WORD_VALUE
The value type WORD
|
static int |
WORDSWAP
Definition for point swap style.
|
UPDATE_DISPLAYED_VALUE, VALUE_INPUT
customTimer, EXPORT_READ_ONLY, EXPORT_READ_WRITE, NO_EXPORT, requiresSyncWrite, sharedTimer, syncWriteTimeout, timebase
autoSuspend, AUTOSUSPEND_DEFAULT, AUTOSUSPEND_NEVER, AUTOSUSPEND_NO_LISTENERS, AUTOSUSPEND_NO_LISTENERS_AND_NO_SOURCES, colorHi, colorHiHi, colorLo, colorLoLo, colorNormal, connectors, consoleLogger, currentColor, currentValue, debugLevel, DEFAULT_AUTOSUSPEND, dontConnect, gwtLog, hardSuspended, popupLogger, PRIMARYOUTPORTNAME, sendColors, stopped, suspended, timedPopupLogger, traceLogger, valueHi, valueHiHi, valueLo, valueLoLo
Constructor and Description |
---|
PLCServer()
Create the PLCServer.
|
Modifier and Type | Method and Description |
---|---|
void |
configure()
Sets the timebase of the server.
|
void |
destroy()
Stops the data source.
|
int |
fromBCD(int bcdValue)
Convert the incoming value from a BCD value.
|
long |
fromBCD(int bcdValue,
int length)
Convert the incoming value from a BCD value.
|
java.lang.String |
getAddressType()
Return the address type.
|
int |
getBit()
Returns the bit of the word of interest.
|
int |
getBitCount()
Returns the number of bits required from the word of interest.
|
abstract int |
getByteOffset()
Returns the offset of the register of this server.
|
int |
getDefaultQualityForLocation(int location)
The default for all PLC server is to only accept good quality values.
|
java.lang.String |
getDeviceName()
Gets the id of the server.
|
PLCDeviceServer |
getDeviceServer()
Gets the device server.
|
int |
getDirty()
This method returns the value of the dirty flag.
|
int |
getLength()
Returns the number of bytes that need to be read to satisfy this server.
|
boolean |
getOptimizeReads()
Optimize the reading of registers.
|
boolean |
getOutputBytes()
String values will be output as byte[] if set to true
|
PLCAddressBlock |
getPLCAddressBlock()
Returns the address block for this server.
|
boolean |
getSigned()
Values will be signed if this is true.
|
int |
getStaticLocationFor(java.lang.String loc)
This is used by the StaticMethodEvent to determine which valueChanged method to call.
|
int |
getStationAddress()
The destination address for this server.
|
int |
getSwapStyle()
This returns the 32 bit swap style.
|
static int |
inByteSwap(int value,
int swapFormat)
This method will swap the bytes in the value according to the swap format.
|
boolean |
isBCD() |
boolean |
isConfigured()
Returns true if the configuration of this server is complete.
|
boolean |
isDirty()
This method returns true if the block has been marked as dirty.
|
boolean |
isSimilar(PLCServer server)
This will be called by the PLCAddressBlock to determine if the server is
"similar" to this server.
|
boolean |
isTriggerOnThread() |
static void |
outByteSwap(int value,
int swapFormat,
byte[] buf,
int offset)
This method will swap the bytes in the value according to the swap format.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This will be called whenever the name of the device server that we are
attached to changes.
|
void |
setAddressType(java.lang.String addressType)
Sets the address type.
|
void |
setBCD(boolean bcd) |
void |
setBit(int b)
The bit to read if this word is being decomposed into bits.
|
void |
setBitCount(int bc)
Set the bit count.
|
void |
setDeviceName(java.lang.String deviceName)
Sets the name of the device server
|
void |
setDirty(boolean flag)
Dirty tracking.
|
void |
setLength(int length)
Returns the number of bytes that need to be read to satisfy this server.
|
void |
setOptimizeReads(boolean optimize)
Optimize the reading of registers.
|
void |
setOutputBytes(boolean outputBytes)
String values will be output as byte[] if this is true.
|
void |
setSigned(boolean signed)
Values will be signed if this is true.
|
void |
setStationAddress(int stationAddress)
The destination address for this server.
|
void |
setSwapStyle(int swapStyle)
This sets the 32 bit swap style.
|
void |
setTimebase(double newValue)
Sets the timebase of the server.
|
void |
setTriggerOnThread(boolean triggerOnThread) |
abstract void |
setValueFrom(byte[] image,
int offset,
int quality)
Update the value of the server from an address block
|
void |
setValueObject(ValueObjectInterface value)
This method is called by beans and other data sources to set the value of this server.
|
boolean |
shouldBeAdded()
Returns true if the server needs to be added to an address block.
|
void |
start()
This will attach the server to its device server.
|
void |
stop()
Disconnects the server from the device server and then stops the server.
|
int |
toBCD(int intValue)
Convert the incoming value to a BCD value.
|
int |
toBCD(long intValue,
int length)
Convert the incoming value to a BCD value.
|
java.lang.String |
toString()
returns a string representation of this server.
|
PLCDataBlock |
triggerRead()
This method will trigger a read of the server and will update the listeners.
|
void |
triggerValueChanged(ValueChangedEvent event)
This allows a server without a timebase to be triggered for a read
|
abstract PLCDataBlock |
validateResponse(PLCDataBlock msgOut,
PLCDataBlock msgIn)
Returns true if the response to a write message is correct.
|
void |
valueChanged(int loc,
ValueChangedEvent e)
This calls the proper valueChanged method based on
the return from the getStaticLocationFor method.
|
void |
VIBEvent(VIBEvent vibEvent)
We are interested in few events.
|
getInPortNames, setBooleanValue, setBoolValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setShortValue, setStringValue, valueInput
addConnector, addConnector, addDataSource, addPropertyChangeListener, addValueChangedListener, addVetoableChangeListener, authenticatedClientRequest, clientRequest, clientResponse, determineSuspendedStatus, getClassLicenseManager, getContainer, getCustomTimer, getDataSource, getDataSources, getDisplayName, getExportCriteria, getExposeComponentConnections, getName, getOutPortNames, getPullFromServers, getPushData, getPushName, getPushToServers, getServerListData, getTimebase, getTrace, isActive, isScreenLocal, refreshCurrentValue, removeConnector, removeDataSource, removePropertyChangeListener, removeValueChangedListener, removeVetoableChangeListener, requestSyncWrite, setAutoSuspend, setClassLicenseManager, setContainer, setCustomTimer, setDataSourceName, setExportCriteria, setExposeComponentConnections, setName, setPullFromServers, setPushData, setPushName, setPushToServers, setScreenLocal, setServerListData, setTrace, tick
addVIBEventListener, checkScript, executeInScriptInternal, executeScript, executeScriptInternal, executeScriptInternal, getAutoSuspend, getBooleanValue, getBoolValue, getColorHi, getColorHiHi, getColorLo, getColorLoLo, getColorNormal, getConnectors, getConsoleLogger, getCurrentColor, getDataSourceName, getDoubleValue, getFloatValue, getGWTLogger, getIncomingValueObject, getInScript, getIntValue, getLongValue, getParent, getPopupLogger, getScript, getScriptEngine, getSendColors, getSources, getStringValue, getSyncWriteTimeout, getTimedPopupLogger, getTraceLogger, getValueHi, getValueHiHi, getValueLo, getValueLoLo, getValueObject, init, isHardSuspended, isRunning, isSendOnlyChangedValuesDefault, isSuspended, logException, logGWT, logGWT, logMessage, logTrace, n2sortConnectors, performScriptSubstitutions, popupMessage, post, removeConnector, removeVIBEventListener, replaceConnectors, scriptExtensionSubstition, setColorHi, setColorHiHi, setColorLo, setColorLoLo, setColorNormal, setConsoleLogger, setGWTLogger, setHardSuspended, setInScript, setParent, setPopupLogger, setScript, setSendColors, setSendOnlyChangedValuesDefault, setSyncWriteTimeout, setTimedPopupLogger, setTraceLogger, setValueHi, setValueHiHi, setValueLo, setValueLoLo, updateColor, updateListeners, updateListeners, updateListeners, whoAmI
public static final int BINARY_VALUE
public static final int BOOLEAN_VALUE
public static final int BOTHSWAP
public static final int BYTESWAP
public static final java.lang.String cvsRev
public static final int DOUBLE_WORD_VALUE
public static final int FLOAT_VALUE
public static final int NOSWAP
public static final int STRING_VALUE
public static final int WORD_VALUE
public static final int WORDSWAP
public void configure()
newValue
- The new value.DataSource#setParameters
public void destroy() throws BadParameterException
destroy
in class SimpleDataSource
BadParameterException
#suspend
public int fromBCD(int bcdValue)
bcdValue
- the incoming bcd encoded int.public long fromBCD(int bcdValue, int length)
bcdValue
- the incoming bcd encoded int.length
- in bytes this must be either 1, 2, or 4public java.lang.String getAddressType()
public int getBit()
public int getBitCount()
public abstract int getByteOffset()
public int getDefaultQualityForLocation(int location) throws BadParameterException
getDefaultQualityForLocation
in class SimpleManipulator
location
- the method index.BadParameterException
- never thrown.public java.lang.String getDeviceName()
public PLCDeviceServer getDeviceServer()
public int getDirty()
public int getLength()
public boolean getOptimizeReads()
public boolean getOutputBytes()
public PLCAddressBlock getPLCAddressBlock()
refreshImage
method which can be called to force a one-time
read of all the servers using the address block. Note that if refreshImage
is called, all servers
associated with that address block and their listeners will be updated according to the normal rules (always send,
deadbands, etc.) This is mandatory. If only certain servers were updated, there would be the possiblity of a
known mismatch between the PLC and the servers.public boolean getSigned()
public int getStaticLocationFor(java.lang.String loc) throws BadParameterException
getStaticLocationFor
in class Manipulator
BadParameterException
public int getStationAddress()
public int getSwapStyle()
public static int inByteSwap(int value, int swapFormat)
value
- the value to swapswapStyle
- the swap style to use, the should be on of the defined types WORDSWAP, NOSWAP, BYTESWAP, BOTHSWAPpublic boolean isBCD()
public boolean isConfigured()
public boolean isDirty()
public boolean isSimilar(PLCServer server)
public boolean isTriggerOnThread()
public static void outByteSwap(int value, int swapFormat, byte[] buf, int offset)
value
- the value to swapswapStyle
- the swap style to use, the should be on of the defined types WORDSWAP, NOSWAP, BYTESWAP, BOTHSWAPbuf
- the bytes are swapped into the buffer which is assumed to have enough space to hold themoffset
- the starting offset in the bufferpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public void setAddressType(java.lang.String addressType)
public void setBCD(boolean bcd)
bcd
- set to true to cause BCD conversions on reading and writing.public void setBit(int b)
public void setBitCount(int bc)
public void setDeviceName(java.lang.String deviceName)
deviceName
- the name of the devicepublic void setDirty(boolean flag)
public void setLength(int length)
public void setOptimizeReads(boolean optimize)
public void setOutputBytes(boolean outputBytes)
outputBytes
- set to true to output String value as byte[]public void setSigned(boolean signed)
signed
- set to true for signed outputpublic void setStationAddress(int stationAddress)
public void setSwapStyle(int swapStyle)
public void setTimebase(double newValue)
setTimebase
in class SimpleDataSource
newValue
- The new value.DataSource#setParameters
public void setTriggerOnThread(boolean triggerOnThread)
triggerOnThread
- The triggerOnThread to set.public abstract void setValueFrom(byte[] image, int offset, int quality) throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public void setValueObject(ValueObjectInterface value) throws VIBUpdateFailedException
setValueObject
in class SimpleDataSource
value
- the new ValueObject value for the serverVIBUpdateFailedException
setValueObject(com.ergotech.vib.valueobjects.ValueObjectInterface)
public boolean shouldBeAdded()
public void start() throws BadParameterException, VIBUpdateFailedException
start
in class SimpleDataSource
BadParameterException
VIBUpdateFailedException
DataSource.start()
public void stop() throws BadParameterException
stop
in class SimpleDataSource
BadParameterException
SimpleDataSource.stop()
public int toBCD(int intValue)
intValue
- the incoming ieee encoded int.public int toBCD(long intValue, int length)
intValue
- the incoming ieee encoded int.length
- in bytes this must be either 1, 2, or 4public java.lang.String toString()
toString
in class Manipulator
public PLCDataBlock triggerRead() throws VIBUpdateFailedException
VIBUpdateFailedException
public void triggerValueChanged(ValueChangedEvent event) throws VIBUpdateFailedException
VIBUpdateFailedException
public abstract PLCDataBlock validateResponse(PLCDataBlock msgOut, PLCDataBlock msgIn) throws PLCException
PLCException
public void valueChanged(int loc, ValueChangedEvent e) throws VIBUpdateFailedException, BadParameterException
valueChanged
in class Manipulator
VIBUpdateFailedException
BadParameterException
public void VIBEvent(VIBEvent vibEvent) throws BadParameterException
VIBEvent
in class SimpleDataSource
BadParameterException
Copyright © 1999-2025 ErgoTech Systems, Inc. All Rights Reserved.