|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ModbusProtocolDeviceService
OSGI service providing a connection to a device via Serial link (RS232/RS485) or Ethernet using Modbus protocol.
This service implements a subset of Modbus Application Protocol as defined by Modbus Organization :
http://www.modbus.org/specs.php.
For the moment in Ethernet mode, only RTU over TCP/IP is supported
Function codes implemented are :
Field Summary | |
---|---|
static String |
SERVICE_NAME
name of this service |
Method Summary | |
---|---|
void |
configureConnection(Properties connectionConfig)
Configure access to the physical device. |
void |
configureProtocol(Properties protocolConfig)
Required properties for modbus protocol configuration. |
void |
connect()
attempt to connect to the field device using the provided configuration. |
void |
disconnect()
attempt to disconnect from the field device. |
ModbusCommEvent |
getCommEventCounter()
Modbus function 11 (0x0B) Get a status word and an event count from the device. Return values in a ModbusCommEvent. |
ModbusCommEvent |
getCommEventLog()
Modbus function 12 (0x0C) Get a status word, an event count, a message count and a list of event bytes from the device. Return values in a ModbusCommEvent. |
int |
getConnectStatus()
for expedience, can test the status of the connection prior to attempting a command. |
NmeaPosition |
getNmeaPosition()
Return NMEA Position of the device |
org.osgi.util.position.Position |
getPosition()
Return OSGI Position of the device |
String |
getProtocolName()
returns the protocol name for the specific protocol implemented. |
String |
getUnitAddress()
this returns the address given the RTU in the configureProtocol. |
boolean[] |
readCoils(int dataAddress,
int count)
Modbus function 01 Read 1 to 2000 contiguous status of coils from the attached field device. |
boolean[] |
readDiscreteInputs(int dataAddress,
int count)
Modbus function 02 Read 1 to 2000 contiguous status of discrete inputs from the attached field device. |
boolean[] |
readExceptionStatus()
Modbus function 07 read the content of 8 Exception Status outputs in the field device. |
int[] |
readHoldingRegisters(int dataAddress,
int count)
Modbus function 03 Read contents of 1 to 125 contiguous block of holding registers from the attached field device. |
int[] |
readInputRegisters(int dataAddress,
int count)
Modbus function 04 Read contents of 1 to 125 contiguous block of input registers from the attached field device. |
String |
toString()
returns the unit name given in the configureProtocol call. |
void |
writeMultipleCoils(int dataAddress,
boolean[] data)
Modbus function 15 (0x0F) write multiple coils in a sequence of coils to either ON or OFF in the attached field device. |
void |
writeMultipleRegister(int dataAddress,
int[] data)
Modbus function 16 (0x10) write a block of contiguous registers (1 to 123) in the attached field device. |
void |
writeSingleCoil(int dataAddress,
boolean data)
Modbus function 05 write a single output to either ON or OFF in the attached field device. |
void |
writeSingleRegister(int dataAddress,
int data)
Modbus function 06 write a single holding register in the attached field device. |
Field Detail |
---|
static final String SERVICE_NAME
Method Detail |
---|
String toString()
toString
in class Object
Object.toString()
String getProtocolName()
String getUnitAddress()
void configureProtocol(Properties protocolConfig) throws ModbusProtocolException
protocolConfig
- (key/value pairing directly from configuration file)ModbusProtocolException(INVALID_CONFIGURATION)
- unspecified problem with the configuration
ModbusProtocolException
void configureConnection(Properties connectionConfig) throws ModbusProtocolException
connectionConfig
- (key/value pairing directly from configuration file)ModbusProtocolException(INVALID_CONFIGURATION)
- unspecified problem with the configuration
ModbusProtocolException
int getConnectStatus()
All protocols must implement this method.
EsfConnectionStatus
.void connect() throws ModbusProtocolException
Refer to getConnectStatus
to determine if the
connection is completed.
All protocols must implement this method.
ModbusProtocolException(INVALID_CONFIGURATION)
- this operates on the basic assumption that access to a device
should exist, if the device is unreachable, it is interpreted
as a failure of the configuration.
ModbusProtocolException
void disconnect()
All protocols must implement this method.
getConnectStatus()
boolean[] readCoils(int dataAddress, int count) throws ModbusProtocolException
dataAddress
- starting addresscount
- quantity of coils
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
boolean[] readDiscreteInputs(int dataAddress, int count) throws ModbusProtocolException
dataAddress
- starting addresscount
- quantity of inputs
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
void writeSingleCoil(int dataAddress, boolean data) throws ModbusProtocolException
dataAddress
- Output address.data
- Output value (boolean) to write.
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
void writeMultipleCoils(int dataAddress, boolean[] data) throws ModbusProtocolException
dataAddress
- Starting Output address.data
- Outputs value (array of boolean) to write.
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
int[] readHoldingRegisters(int dataAddress, int count) throws ModbusProtocolException
dataAddress
- starting addresscount
- quantity of registers (maximum 0x7D)
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
int[] readInputRegisters(int dataAddress, int count) throws ModbusProtocolException
dataAddress
- starting addresscount
- quantity of registers (maximum 0x7D)
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
void writeSingleRegister(int dataAddress, int data) throws ModbusProtocolException
dataAddress
- Output address.data
- Output value (2 bytes) to write.
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
boolean[] readExceptionStatus() throws ModbusProtocolException
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
ModbusCommEvent getCommEventCounter() throws ModbusProtocolException
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
ModbusCommEvent getCommEventLog() throws ModbusProtocolException
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
void writeMultipleRegister(int dataAddress, int[] data) throws ModbusProtocolException
dataAddress
- Output address.data
- Registers value (array of int converted in 2 bytes values) to write.
ModbusProtocolException(NOT_CONNECTED)
- current connection is in a status other than CONNECTED
ModbusProtocolException(TRANSACTION_FAILURE)
- should include a protocol specific message to help clarify
the cause of the exception
ModbusProtocolException
org.osgi.util.position.Position getPosition()
Position
NmeaPosition getNmeaPosition()
NmeaPosition
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |