public class FCOCRAPDevice extends FCOCDevice
Modifier and Type | Field and Description |
---|---|
static int |
m_nINITMAXPACKETSIZE
Initial FRAP packet size (before getting device infos)
|
m_aInterfacesInfo
Constructor and Description |
---|
FCOCRAPDevice(int nNumberOfRegisters,
int nBufferSize,
FCOIPort CommunicationPort,
int nLocalAddress,
int nRemoteAddress,
boolean isNested,
int nInterface) |
FCOCRAPDevice(int nNumberOfRegisters,
int nBufferSize,
long lThreadSleep,
FCOIPort CommunicationPort,
int nLocalAddress,
int nRemoteAddress,
boolean isNested,
int nInterface) |
FCOCRAPDevice(int nNumberOfRegisters,
int nBufferSize,
long lThreadSleep,
int nParentMaxBufferSize,
FCOIPort CommunicationPort,
int nLocalAddress,
int nRemoteAddress,
boolean isNested,
int nInterface) |
Modifier and Type | Method and Description |
---|---|
void |
addDeviceListener(FCOIDeviceEvent DevListener)
Adds an
DeviceListener to the device. |
FCOCDevice |
addOtherDevice(java.lang.String szOtherDeviceName,
int nAddress,
int nNumberOfRegisters)
Add another device to this FRAP device (same main bus).
|
void |
addRegister(java.lang.String szRegisterName,
int nRegisterAddress,
int nRegisterSize,
int nRegisterAccessType,
int nDataType,
boolean isAutoReadEnabled)
Add a new register to this device.
|
FCOCDevice |
addSubDevice(java.lang.String szNestedDeviceName,
int nSubAddress,
int nNumberOfRegisters,
int nInterface)
Add a new nested device to this FRAP device.
|
void |
delete()
Ask device object to stop its communication thread.
|
FCOIPort |
getCommunicationPort() |
int |
getInterface() |
int |
getMaxPacketSize() |
int |
getRemoteAddress() |
void |
removeDeviceListener(FCOIDeviceEvent DevListener)
Removes an
DeviceListener from the device. |
void |
removeOtherDevice(java.lang.String szOtherDeviceName)
Remove another device to this FRAP device.
|
void |
removeSubDevice(java.lang.String szNestedDeviceName)
Remove a nested device to this FRAP device.
|
void |
run()
Main communication thread loop (threadLoop() in dot net lib)
|
void |
setBufferSize(int nBufferSize)
Change the current communication buffer size.
|
int |
setMaxPacketSize(int nMaxPacketSize)
Set Max Packet Size (properties provided only for main class)
|
void |
setMaxParentBufferSize(int nParentMaxBufferSize)
Tell device what is its parent interface max buffer size
|
void |
setNewRemoteAddress(int nRemoteAddress) |
void |
setThreadLoopTime(long lThreadSleep)
Set sleep time to wait for an answer to an ask packet.
|
addRegister, askGetInterfaceInfo, call, getBufferSize, getDeviceListeners, getLastValueRead, getLastValueWritten, getRegisterAddress, getThisInterfaceInfo, getThreadLoopTime, getValue, getValue, receivedGetInterfacesInfo, removeRegister, setAutoreadState, setAutoreadSupended, setDebugLogEnabled, setInterfaceComSupendedState, setValue, setValue
public static final int m_nINITMAXPACKETSIZE
public FCOCRAPDevice(int nNumberOfRegisters, int nBufferSize, long lThreadSleep, int nParentMaxBufferSize, FCOIPort CommunicationPort, int nLocalAddress, int nRemoteAddress, boolean isNested, int nInterface) throws java.io.IOException
nNumberOfRegisters
- Max number of registers of this devicenBufferSize
- Communication link buffer size in bytes (max 16383 in current implementation)lThreadSleep
- Sleep time in millisecondsnParentMaxBufferSize
- Communication link buffer size in bytes of the parent device (for nested devices)CommunicationPort
- FiveCo communication port object implementing FCOIportnLocalAddress
- FRAP protocol local address (1-255)nRemoteAddress
- FRAP protocol remote (device) address (0-255)isNested
- Is this device the main one or a nested one ? Use also true for other devices on the main com with -1 as
interface.nInterface
- Interface number of this device (0-15)java.io.IOException
- Occurs when com parameters failed.public FCOCRAPDevice(int nNumberOfRegisters, int nBufferSize, long lThreadSleep, FCOIPort CommunicationPort, int nLocalAddress, int nRemoteAddress, boolean isNested, int nInterface) throws java.io.IOException
nNumberOfRegisters
- Max number of registers of this devicenBufferSize
- Communication link buffer size in bytes (max 16383 in current implementation)lThreadSleep
- Sleep time in millisecondsCommunicationPort
- FiveCo communication port object implementing FCOIportnLocalAddress
- FRAP protocol local address (1-255)nRemoteAddress
- FRAP protocol remote (device) address (0-255)isNested
- Is this device the main one or a nested one ? Use also true for other devices on the main com with -1 as
interface.nInterface
- Interface number of this device (0-15)java.io.IOException
- Occurs when com parameters failed.public FCOCRAPDevice(int nNumberOfRegisters, int nBufferSize, FCOIPort CommunicationPort, int nLocalAddress, int nRemoteAddress, boolean isNested, int nInterface) throws java.io.IOException
nNumberOfRegisters
- Max number of registers of this devicenBufferSize
- Communication link buffer size in bytes (max 127 in current implementation)CommunicationPort
- FiveCo communication port object implementing FCOIportnLocalAddress
- FRAP protocol local address (1-255)nRemoteAddress
- FRAP protocol remote (device) address (0-255)isNested
- Is this device the main one or a nested one ? Use also true for other devices on the main com with -1 as
interface.nInterface
- Interface number of this device (0-15)java.io.IOException
- Occurs when communication parameters failed.public void delete()
FCOCDevice
Ask device object to stop its communication thread.
delete
in class FCOCDevice
public void addDeviceListener(FCOIDeviceEvent DevListener)
FCOCDevice
DeviceListener
to the device.addDeviceListener
in class FCOCDevice
DevListener
- the DeviceListener
to be addedpublic void removeDeviceListener(FCOIDeviceEvent DevListener)
FCOCDevice
DeviceListener
from the device.removeDeviceListener
in class FCOCDevice
DevListener
- the listener to be removedpublic void addRegister(java.lang.String szRegisterName, int nRegisterAddress, int nRegisterSize, int nRegisterAccessType, int nDataType, boolean isAutoReadEnabled) throws java.lang.IllegalArgumentException
Add a new register to this device.
addRegister
in class FCOCDevice
szRegisterName
- Name of the registernRegisterAddress
- Register index in registers tablenRegisterSize
- Register's sizenRegisterAccessType
- Access type between nAT_FCT, nAT_R, nAT_W and nAT_RWnDataType
- Data packing class type between nDT_INT (Long), nDT_UINT (Long), nDT_BIN (BitSet), nDT_PERCENT (Double
0-100), nDT_TEXT (string), nDT_ARRAY (Byte[]), nDT_FIXEDP (Double)isAutoReadEnabled
- Ask thread to read this register at each communication loopjava.lang.IllegalArgumentException
- If one parameter is not valid (see console)public FCOCDevice addSubDevice(java.lang.String szNestedDeviceName, int nSubAddress, int nNumberOfRegisters, int nInterface) throws java.io.IOException
Add a new nested device to this FRAP device.
addSubDevice
in class FCOCDevice
szNestedDeviceName
- Name of this nested device for further referencenSubAddress
- New sub device addressnNumberOfRegisters
- Maximum registers count of the sub devicenInterface
- Interface number of the sub device (0-15)java.io.IOException
- Exception thrown if a parameter is invalidpublic void removeSubDevice(java.lang.String szNestedDeviceName)
Remove a nested device to this FRAP device.
removeSubDevice
in class FCOCDevice
szNestedDeviceName
- Name of the nested device to removepublic void setThreadLoopTime(long lThreadSleep)
Set sleep time to wait for an answer to an ask packet.
setThreadLoopTime
in class FCOCDevice
lThreadSleep
- Sleep time in millisecondspublic int getInterface()
getInterface
in class FCOCDevice
public FCOCDevice addOtherDevice(java.lang.String szOtherDeviceName, int nAddress, int nNumberOfRegisters) throws java.io.IOException
Add another device to this FRAP device (same main bus).
szOtherDeviceName
- Name of this device for further referencenAddress
- New device addressnNumberOfRegisters
- Maximum registers count of the sub devicejava.io.IOException
- Exception thrown if a parameter is invalidpublic void removeOtherDevice(java.lang.String szOtherDeviceName)
Remove another device to this FRAP device.
szOtherDeviceName
- Name of the device to removepublic void setNewRemoteAddress(int nRemoteAddress)
nRemoteAddress
- New remote addresspublic int getRemoteAddress()
public FCOIPort getCommunicationPort()
public void setMaxParentBufferSize(int nParentMaxBufferSize)
FCOCDevice
setMaxParentBufferSize
in class FCOCDevice
nParentMaxBufferSize
- Parent buffer sizepublic void setBufferSize(int nBufferSize)
FCOCDevice
setBufferSize
in class FCOCDevice
nBufferSize
- New buffer sizepublic int setMaxPacketSize(int nMaxPacketSize)
nMaxPacketSize
- New max packet size (truncated if too big)public int getMaxPacketSize()
public void run()
FCOCDevice
run
in interface java.lang.Runnable
run
in class FCOCDevice