com.eurotech.framework.protocol.modbus
Class ModbusProtocolDevice

java.lang.Object
  extended by com.eurotech.framework.protocol.modbus.ModbusProtocolDevice
Direct Known Subclasses:
Modbus

public abstract class ModbusProtocolDevice
extends Object

This is the parent class from which all protocol implementations should be extended. This class provides a means to access and control a field device through a device specific protocol.

The general idea is that devices have data to be accessed and control points to be managed; however, the exact means to access a given point, such as the state of a door switch, or to control a given function, such as turning on a light, vary greatly from one protocol to another.

To make a more versatile implementation for the application side, the protocol specific configurations will re-map all points of interest to generic data addresses (dataAddress). These generic points then will be accessible using a variety of specific methods for primitive types. Mechanisms will also be provided to access the map, if desired, to find what specific primitive type a given point may be; however, normally, there should probably be some preconceived notion of what data type exists at each address in a given environment and implementation.

If a protocol must extend beyond the primitive types for some reason, there will be the option to use the readObject and writeObject methods. Knowledge about the class of the object used or returned will be specific to the given protocol.

All read functions will return an array whose length is the same as the requested count in the read. Any protocol needing to return more or less data than requested must implement the readObject method.

Author:
matt.demaree

Constructor Summary
ModbusProtocolDevice()
           
 
Method Summary
abstract  void configureConnection(org.osgi.service.io.ConnectionFactory connFactory, Properties connectionConfig)
          configure access to the physical device.
 void configureDataMap(Properties dataConfig)
          configure addressing schemes between the physical device and the client presentation of the data.
abstract  void configureProtocol(Properties protocolConfig)
          any protocol specific configuration elements would be configured here.
abstract  void connect()
          attempt to connect to the field device using the provided configuration.
abstract  void disconnect()
          attempt to disconnect from the field device.
abstract  int getConnectStatus()
          for expedience, can test the status of the connection prior to attempting a command.
abstract  String getDataType(int dataAddress)
          get the primitive data type for the selected address.
abstract  int getEndOfRange(int dataAddress)
          gets the last address in a contiguous block of the same type data.
abstract  NmeaPosition getNmeaPosition()
           
abstract  org.osgi.util.position.Position getPosition()
           
abstract  String getProtocolName()
          returns the protocol name for the specific protocol implemented.
abstract  int getStartOfRange(int dataAddress)
          gets the first address in a contiguous block of the same type data.
abstract  String getUnitAddress()
          this returns the address given the RTU in the configureProtocol.
abstract  boolean isAddressMapped(int dataAddress)
          validate that the protocol has a mapping for the desired address.
 boolean[] readBooleans(int dataAddress, int count)
          read 1 or more boolean points from the attached field device.
 byte[] readBytes(int dataAddress, int count)
          read 1 or more byte points from the attached field device.
 char[] readChars(int dataAddress, int count)
          read 1 or more char points from the attached field device.
 double[] readDoubles(int dataAddress, int count)
          read 1 or more double points from the attached field device.
 float[] readFloats(int dataAddress, int count)
          read 1 or more float points from the attached field device.
 int[] readInts(int dataAddress, int count)
          read 1 or more int points from the attached field device.
 long[] readLongs(int dataAddress, int count)
          read 1 or more long points from the attached field device.
 Object readObject(int dataAddress)
          read a single object from the address.
 short[] readShorts(int dataAddress, int count)
          read 1 or more short points from the attached field device.
 long[] readUnsignedInts(int dataAddress, int count)
          read 1 or more unsigned int points from the attached field device.
 int[] readUnsignedShorts(int dataAddress, int count)
          read 1 or more unsigned short points from the attached field device.
abstract  String toString()
          returns the unit name given in the configureProtocol call.
 void writeBooleans(int dataAddress, boolean[] data)
          write 1 or more boolean values to the attached field device.
 void writeBytes(int dataAddress, byte[] data)
          write 1 or more byte values to the attached field device.
 void writeChars(int dataAddress, char[] data)
          write 1 or more char values to the attached field device.
 void writeDoubles(int dataAddress, double[] data)
          write 1 or more double values to the attached field device.
 void writeFloats(int dataAddress, float[] data)
          write 1 or more float values to the attached field device.
 void writeInts(int dataAddress, int[] data)
          write 1 or more int values to the attached field device.
 void writeLongs(int dataAddress, long[] data)
          write 1 or more long values to the attached field device.
 void writeObject(int dataAddress, Object data)
          write a single object to the address.
 void writeShorts(int dataAddress, short[] data)
          write 1 or more short values to the attached field device.
 void writeUnsignedInts(int dataAddress, long[] data)
          write 1 or more unsigned int values to the attached field device.
 void writeUnsignedShorts(int dataAddress, int[] data)
          write 1 or more unsigned short values to the attached field device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModbusProtocolDevice

public ModbusProtocolDevice()
Method Detail

toString

public abstract String toString()
returns the unit name given in the configureProtocol call. Prior to configuration, this method will return the built-in name of the protocol, the same as returned by getProtocolName.

Overrides:
toString in class Object
Returns:
assigned unit name
See Also:
Object.toString()

getProtocolName

public abstract String getProtocolName()
returns the protocol name for the specific protocol implemented. This name should follow Java member naming conventions, so the first (or only) part of the name should be all lower case, all subsequent parts to the name should begin with an upper case and continue with lower case.

Returns:
name following the above rules

getUnitAddress

public abstract String getUnitAddress()
this returns the address given the RTU in the configureProtocol. Until configured, this returns an empty string. The address is returned as a string rather than an integer or other number as some protocols may have multi-part addresses or addresses that contain non-numeric parts.

Returns:
address of physical device this instance represents

configureProtocol

public abstract void configureProtocol(Properties protocolConfig)
                                throws ModbusProtocolException
any protocol specific configuration elements would be configured here. Typically this will only be the RTU name and maybe the physical address. Most protocols will only allow this method to be called once after instantiation.

Parameters:
protocolConfig - key/value pairing directly from configuration file or may be generated.
Throws:
ModbusProtocolException(INVALID_CONFIGURATION) - unspecified problem with the configuration
ModbusProtocolException

configureConnection

public abstract void configureConnection(org.osgi.service.io.ConnectionFactory connFactory,
                                         Properties connectionConfig)
                                  throws ModbusProtocolException
configure access to the physical device. Although the Dictionary is protocol/connection specific, every connection dictionary should have a ProtocolConnectionType indication of the type of the connection. The key should also be consistently defined as ConnectionType.

Parameters:
connectionConfig - key/value pairing directly from configuration file or may be generated.
Throws:
ModbusProtocolException(INVALID_CONFIGURATION) - unspecified problem with the configuration
ModbusProtocolException

configureDataMap

public void configureDataMap(Properties dataConfig)
                      throws ModbusProtocolException
configure addressing schemes between the physical device and the client presentation of the data. Various protocols may use a variety of commands and sequences to access data of various types, all the data will be presented to and received from the client based on an arbitrary addressing scheme. All data addressing should use positive integer addresses to reference data and the data map provides the cross-over between client addressing and physical addressing.

For most protocols, additional entries may be added to the data mapping at any time and will replace any mapping already existing, without any warning or indication of said replacement. It is not possible to remove a data mapping.

Protocols are not required to implement this method.

Parameters:
dataConfig - key/value pairing directly from configuration file or may be generated.
Throws:
ModbusProtocolException(INVALID_CONFIGURATION) - unspecified problem with the configuration
ModbusProtocolException(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

getConnectStatus

public abstract int getConnectStatus()
for expedience, can test the status of the connection prior to attempting a command. A connection status of CONNECTED does not assure that a subsequent command will succeed.

All protocols must implement this method.

Returns:
current connection status as defined in EsfConnectionStatus.

connect

public abstract void connect()
                      throws ModbusProtocolException
attempt to connect to the field device using the provided configuration. Attempts to connect before configuring the connection or any issues with connecting to the field device will result in an exception being thrown. This includes things like a networking failure in the case of a protocol configured to access the field device of a network.

Refer to getConnectStatus to determine if the connection is completed.

All protocols must implement this method.

Throws:
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

disconnect

public abstract void disconnect()
attempt to disconnect from the field device. This should close any port used exclusively for this protocol to talk with its attached device. Attempting to close an already closed connection is not invalid.

All protocols must implement this method.

See Also:
getConnectStatus()

isAddressMapped

public abstract boolean isAddressMapped(int dataAddress)
validate that the protocol has a mapping for the desired address.

All protocols must implement this method.

Parameters:
dataAddress - this is the local address, not the field address
Returns:
true if address is mapped, false otherwise

getStartOfRange

public abstract int getStartOfRange(int dataAddress)
                             throws ModbusProtocolException
gets the first address in a contiguous block of the same type data. Most protocols are capable of working with more than one data type, often grouped in sections or records, this method works on the mapping provided for the given device to determine a range of same typed data.

All protocols must implement this method.

Parameters:
dataAddress - may be the first or last address or anywhere in between for the range determined.
Returns:
the first address within the block of same data types
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - the requested data address is not mapped
ModbusProtocolException

getEndOfRange

public abstract int getEndOfRange(int dataAddress)
                           throws ModbusProtocolException
gets the last address in a contiguous block of the same type data. Most protocols are capable of working with more than one data type, often grouped in sections or records, this method works on the mapping provided for the given device to determine a range of same typed data.

All protocols must implement this method.

Parameters:
dataAddress - may be the first or last address or anywhere n between for the range determined.
Returns:
the last address within (inclusive of) the block of same data types
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - the requested data address is not mapped
ModbusProtocolException

getDataType

public abstract String getDataType(int dataAddress)
                            throws ModbusProtocolException
get the primitive data type for the selected address.

All protocols must implement this method.

Parameters:
dataAddress - address of the data point for which the data type is being requested
Returns:
an enumeration of the data type from PrototocolPrimitiveDataTypes
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - the requested data address is not mapped
ModbusProtocolException

readBooleans

public boolean[] readBooleans(int dataAddress,
                              int count)
                       throws ModbusProtocolException
read 1 or more boolean points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of booleans representing the requested data points. true for a given point if the point is set, false otherwise.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type boolean
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readBytes

public byte[] readBytes(int dataAddress,
                        int count)
                 throws ModbusProtocolException
read 1 or more byte points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of bytes representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type byte
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readChars

public char[] readChars(int dataAddress,
                        int count)
                 throws ModbusProtocolException
read 1 or more char points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of chars representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type char
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readDoubles

public double[] readDoubles(int dataAddress,
                            int count)
                     throws ModbusProtocolException
read 1 or more double points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of doubles representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type double
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readFloats

public float[] readFloats(int dataAddress,
                          int count)
                   throws ModbusProtocolException
read 1 or more float points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of floats representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type float
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readInts

public int[] readInts(int dataAddress,
                      int count)
               throws ModbusProtocolException
read 1 or more int points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of ints representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type int
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readUnsignedInts

public long[] readUnsignedInts(int dataAddress,
                               int count)
                        throws ModbusProtocolException
read 1 or more unsigned int points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of longs representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type int
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readLongs

public long[] readLongs(int dataAddress,
                        int count)
                 throws ModbusProtocolException
read 1 or more long points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of longs representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type long
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readObject

public Object readObject(int dataAddress)
                  throws ModbusProtocolException
read a single object from the address. The class of the object read is a function of the particular protocol and the real mapping of this data address.

Protocols are not required to implement this method.

Parameters:
dataAddress - used to reference an object of some type to be read
Returns:
an Object who's class is protocol dependent
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - the dataAddress is not mapped
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readShorts

public short[] readShorts(int dataAddress,
                          int count)
                   throws ModbusProtocolException
read 1 or more short points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of shorts representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type short
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

readUnsignedShorts

public int[] readUnsignedShorts(int dataAddress,
                                int count)
                         throws ModbusProtocolException
read 1 or more unsigned short points from the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first point to read
count - count of points to read
Returns:
an array of ints representing the requested data points
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type short
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeBooleans

public void writeBooleans(int dataAddress,
                          boolean[] data)
                   throws ModbusProtocolException
write 1 or more boolean values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more booleans to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type boolean
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeBytes

public void writeBytes(int dataAddress,
                       byte[] data)
                throws ModbusProtocolException
write 1 or more byte values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more bytes to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type byte
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeChars

public void writeChars(int dataAddress,
                       char[] data)
                throws ModbusProtocolException
write 1 or more char values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more chars to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type char
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeDoubles

public void writeDoubles(int dataAddress,
                         double[] data)
                  throws ModbusProtocolException
write 1 or more double values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more doubles to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type double
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeFloats

public void writeFloats(int dataAddress,
                        float[] data)
                 throws ModbusProtocolException
write 1 or more float values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more floats to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type float
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeInts

public void writeInts(int dataAddress,
                      int[] data)
               throws ModbusProtocolException
write 1 or more int values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more ints to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type int
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeUnsignedInts

public void writeUnsignedInts(int dataAddress,
                              long[] data)
                       throws ModbusProtocolException
write 1 or more unsigned int values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more longs to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type int
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeLongs

public void writeLongs(int dataAddress,
                       long[] data)
                throws ModbusProtocolException
write 1 or more long values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more longs to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type long
ModbusProtocolException(NOT_CONNECTED) - current connection is in a status other than CONNECTED
ModbusProtocolException(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeObject

public void writeObject(int dataAddress,
                        Object data)
                 throws ModbusProtocolException
write a single object to the address. The class of the object written is a function of the particular protocol and the real mapping of this data address.

Protocols are not required to implement this method.

Parameters:
dataAddress - used to reference an object of some type to be written
data - an Object who's class is protocol dependent
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeShorts

public void writeShorts(int dataAddress,
                        short[] data)
                 throws ModbusProtocolException
write 1 or more short values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more shorts to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type short
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

writeUnsignedShorts

public void writeUnsignedShorts(int dataAddress,
                                int[] data)
                         throws ModbusProtocolException
write 1 or more unsigned short values to the attached field device.

Protocols are not required to implement this method.

Parameters:
dataAddress - first address to write to
data - array of 1 or more ints to write. The data will be written to consecutive addresses starting with dataAddress.
Throws:
ModbusProtocolException(INVALID_DATA_ADDRESS) - at least one of the points in the inclusive range of addresses is not mapped
ModbusProtocolException(INVALID_DATA_TYPE) - at least one of the points in the inclusive range of addresses is not of type short
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(METHOD_NOT_SUPPORTED) - exception always thrown by default method
ModbusProtocolException

getPosition

public abstract org.osgi.util.position.Position getPosition()

getNmeaPosition

public abstract NmeaPosition getNmeaPosition()


Copyright © 2013. All Rights Reserved.