de.cau.cs.kieler.krep.evalbench.comm
Interface IConnection

All Known Implementing Classes:
Connection, JNIConnection, RxtxSerialConnection, SocketConnection

public interface IConnection

Interface for connection protocol layers like TCP/IP and RS-232.

Rating yellow
(2010-02-05) review by cmot, msp

Method Summary
 void dispose()
          Closes connection and removes locks on the involved device.
 String hark(int n)
          Harks to incoming data.
 String receive(char exit)
          Tries to receive a sequence of characters until an exit character is read.
 String receive(int n)
          Tries to receive a fixed number of characters.
 LinkedList<Integer> receiveByte(int n)
          Tries to receive a fixed number of characters.
 void send(byte data)
          Sends data to the target.
 void send(byte[] data)
          Sends data to the target.
 void send(String data)
          Sends data to the target.
 

Method Detail

dispose

void dispose()
Closes connection and removes locks on the involved device.


send

void send(String data)
          throws CommunicationException
Sends data to the target.

Parameters:
data - data to be sent
Throws:
CommunicationException - when an exception occurs while sending data

send

void send(byte data)
          throws CommunicationException
Sends data to the target.

Parameters:
data - data to be sent
Throws:
CommunicationException - when an exception occurs while sending data

send

void send(byte[] data)
          throws CommunicationException
Sends data to the target.

Parameters:
data - data to be sent
Throws:
CommunicationException - when an exception occurs while sending data

receive

String receive(char exit)
               throws CommunicationException
Tries to receive a sequence of characters until an exit character is read. The exit character is included in the returned string.

Parameters:
exit - the exit character
Returns:
received data
Throws:
CommunicationException - when a timeout is reached before the exit character is read

receive

String receive(int n)
               throws CommunicationException
Tries to receive a fixed number of characters.

Parameters:
n - the number of characters to be fetched
Returns:
received data
Throws:
CommunicationException - when a timeout is reached before the exit character is read

receiveByte

LinkedList<Integer> receiveByte(int n)
                                throws CommunicationException
Tries to receive a fixed number of characters.

Parameters:
n - the number of characters to be fetched
Returns:
received data
Throws:
CommunicationException - when a timeout is reached before the exit character is read

hark

String hark(int n)
            throws CommunicationException
Harks to incoming data.

Parameters:
n - maximal number of characters to receive
Returns:
characters received in a specific time range
Throws:
CommunicationException - when an exception occurs while receiving data