net.wimpi.modbus.net
Interface UDPTerminal

All Known Implementing Classes:
UDPMasterTerminal, UDPSlaveTerminal

public interface UDPTerminal

Interface defining a UDPTerminal.

Version:
1.2 (@date@)
Author:
Dieter Wimberger

Method Summary
 void activate()
          Activate this UDPTerminal.
 void deactivate()
          Deactivates this UDPTerminal.
 InetAddress getLocalAddress()
          Returns the local address of this UDPTerminal.
 int getLocalPort()
          Returns the local port of this UDPTerminal.
 ModbusUDPTransport getModbusTransport()
          Returns the ModbusTransport associated with this UDPTerminal.
 boolean isActive()
          Tests if this UDPTerminal is active.
 byte[] receiveMessage()
          Receives and returns a message.
 void sendMessage(byte[] msg)
          Sends the given message.
 

Method Detail

getLocalAddress

InetAddress getLocalAddress()
Returns the local address of this UDPTerminal.

Returns:
an InetAddress instance.

getLocalPort

int getLocalPort()
Returns the local port of this UDPTerminal.

Returns:
the local port as int.

isActive

boolean isActive()
Tests if this UDPTerminal is active.

Returns:
true if active, false otherwise.

activate

void activate()
              throws Exception
Activate this UDPTerminal.

Throws:
Exception - if there is a network failure.

deactivate

void deactivate()
Deactivates this UDPTerminal.


getModbusTransport

ModbusUDPTransport getModbusTransport()
Returns the ModbusTransport associated with this UDPTerminal.

Returns:
a ModbusTransport instance.

sendMessage

void sendMessage(byte[] msg)
                 throws Exception
Sends the given message.

Parameters:
msg - the message as byte[].
Throws:
Exception - if sending the message fails.

receiveMessage

byte[] receiveMessage()
                      throws Exception
Receives and returns a message.

Returns:
the message as a newly allocated byte[].
Throws:
Exception - if receiving a message fails.


Copyright © 2012. All Rights Reserved.