Author: jvermillard
Date: Thu Mar 24 17:27:09 2011
New Revision: 1085047
URL: http://svn.apache.org/viewvc?rev=1085047&view=rev
Log:
adding javadoc
Modified:
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusConstants.java
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusTable.java
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/transport/ModbusTransport.java
Modified:
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusConstants.java
URL:
http://svn.apache.org/viewvc/mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusConstants.java?rev=1085047&r1=1085046&r2=1085047&view=diff
==============================================================================
---
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusConstants.java
(original)
+++
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusConstants.java
Thu Mar 24 17:27:09 2011
@@ -19,6 +19,12 @@
*/
package org.apache.mina.modbus;
+/**
+ * Command numbers used by Modbus.
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ *
+ */
public interface ModbusConstants {
public static final int READ_DISCRETE_INPUTS = 02;
Modified:
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusTable.java
URL:
http://svn.apache.org/viewvc/mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusTable.java?rev=1085047&r1=1085046&r2=1085047&view=diff
==============================================================================
---
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusTable.java
(original)
+++
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/ModbusTable.java
Thu Mar 24 17:27:09 2011
@@ -27,16 +27,48 @@ package org.apache.mina.modbus;
*/
public interface ModbusTable {
+ /**
+ * Called when the Modbus master ask to write a word at a given address in
the table
+ * @param address the address for writing
+ * @param value the value to be written
+ */
public void writeWord(int address, int value);
+ /**
+ * Called when the Modbus master ask to read a word at a given address in
the table
+ * @param address the address to read
+ * @return the value in the table at this address
+ */
public int readWord(int address);
+ /**
+ * Called when the Modbus master ask to write a coil at a given address in
the table
+ * @param address the address for writing
+ * @param value the value to be written
+ */
public void writeCoil(int address, boolean value);
+ /**
+ * Called when the Modbus master ask to read a coil at a given address in
the table
+ * @param address the address to read
+ * @return the value in the table at this address
+ */
public boolean readCoil(int address);
+ /**
+ * Is a given range of address are readable.
+ * @param addressStart the start address of the range
+ * @param count the length of the range
+ * @return <code>true</code> if the range is in the table and readable
+ */
public boolean canAccessDataToRead(int addressStart, int count);
+ /**
+ * Is a given range of address are writable.
+ * @param addressStart the start address of the range
+ * @param count the length of the range
+ * @return <code>true</code> if the range is in the table and writable
+ */
public boolean canAccessDataToWrite(int addressStart, int count);
public void start();
Modified:
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/transport/ModbusTransport.java
URL:
http://svn.apache.org/viewvc/mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/transport/ModbusTransport.java?rev=1085047&r1=1085046&r2=1085047&view=diff
==============================================================================
---
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/transport/ModbusTransport.java
(original)
+++
mina/sandbox/jvermillard/mina-modbus/src/main/java/org/apache/mina/modbus/transport/ModbusTransport.java
Thu Mar 24 17:27:09 2011
@@ -24,14 +24,45 @@ import org.apache.mina.filter.codec.Prot
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.modbus.msg.ModbusMessage;
+/**
+ * A transport implementation for Modbus messages.
+ * In charge of creating a codec adapted to the transport.
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ *
+ */
public interface ModbusTransport {
+
+ /**
+ * Create the {@link ProtocolEncoder} for the given {@link ModbusMessage}
+ */
ProtocolEncoder createEncoder();
+ /**
+ * Create the {@link ProtocolDecoder} for the given {@link ModbusMessage}
+ * @param <code>true</code> if master mode
+ */
ProtocolDecoder createDecoder(boolean master);
+ /**
+ * Connect the {@link ModbusTransport} with the given {@link IoHandler}
+ * @param handler the handler providing the logic for this connection
+ */
void connect(IoHandler handler);
+ /**
+ * For a given {@link ModbusMessage} create the corresponding nominal
reply (e.g. with the correct
+ * transaction ID). It's up to the business logic to place the good values
in the created reply.
+ * @param query the incoming {@link ModbusMessage}
+ * @return the reply
+ */
ModbusMessage createReplyMessage(ModbusMessage query);
+ /**
+ * CReate a new {@link ModbusMessage} for this {@link ModbusTransport}
+ * @param functionCode the command number
+ * @param unitId the target unit (usefull on certain transport)
+ * @return
+ */
ModbusMessage createMessage(int functionCode, int unitId);
}