giovynet.serial
Class Com

java.lang.Object
  extended by giovynet.nativelink.SerialPort
      extended by giovynet.serial.Com

public class Com
extends SerialPort

This class represents a serial port null moden.


Nested Class Summary
 class Com.ActionListenerReadPortException
          Action Listener from read port exception.
 class Com.ComException
          Com Exception.
 
Field Summary
 
Fields inherited from class giovynet.nativelink.SerialPort
OS
 
Constructor Summary
Com(Parameters parameters)
          Object that handles the serial null modem communication
 
Method Summary
 void addActionListenerReadPort(ActionListenerReadPort actionListenerReadPort)
          ONLY FOR WINDOWS O.S.
 void close()
          Close seril port.
 char receiveSingleChar()
          Read a character and it returns like type char.
 int receiveSingleDataInt()
          Receives a single data, like integer representation.
 java.lang.String receiveSingleString()
          Read a character and it returns like type String.
 java.lang.String receiveToString(int amount)
          Receives data and returns them in String.
 void receiveToStringBuilder(int untilAmount, java.lang.StringBuilder stringBuilder)
          Receives data type "String" and stores them in an instance of the StringBuilder class.
 void removeActionListenerReadPort()
          ONLY FOR WINDOWS O.S.
 void sendArrayChar(char[] data)
          Write array char.
 void sendSingleData(char data)
          Write a single chraracter like char type.
 void sendSingleData(int data)
          Send a single data, like integer representation or hex representation with
prefix Ox.
 void sendSingleData(java.lang.String data)
          Write a single character like String type.
 void sendString(java.lang.String data)
          ONLY FOR WINDOWS O.S.
 
Methods inherited from class giovynet.nativelink.SerialPort
closePortC, getFreeSerialPort, getStateSerialPortC, openPortC, readDataInt, readPortC, readPortLikeCharC, setTimeOutSerialPortC, writeDataInt, writePortC, writePortC
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Com

public Com(Parameters parameters)
    throws java.lang.Exception
Object that handles the serial null modem communication

Parameters:
parameters -
Throws:
Com.ComException
java.lang.Exception
Method Detail

sendString

public void sendString(java.lang.String data)
                throws java.lang.Exception
ONLY FOR WINDOWS O.S. Write a String.

Parameters:
data - String to send
Throws:
Com.ComException
java.lang.Exception

sendArrayChar

public void sendArrayChar(char[] data)
                   throws java.lang.Exception
Write array char.

Parameters:
data - Array char to send.
Throws:
Com.ComException
java.lang.Exception

receiveToString

public java.lang.String receiveToString(int amount)
                                 throws java.lang.Exception
Receives data and returns them in String.

Parameters:
amount - Number of characters to receive.
Returns:
String String from characters received.
Throws:
java.lang.Exception

receiveToStringBuilder

public void receiveToStringBuilder(int untilAmount,
                                   java.lang.StringBuilder stringBuilder)
                            throws java.lang.Exception
Receives data type "String" and stores them in an instance of the StringBuilder class.

Parameters:
untilAmount - Number of characters to receive.
stringBuilder - StringBuilder to store characters received.
Throws:
java.lang.Exception

receiveSingleString

public java.lang.String receiveSingleString()
                                     throws java.lang.Exception
Read a character and it returns like type String.

Returns:
one data string
Throws:
Com.ComException
java.lang.Exception

receiveSingleChar

public char receiveSingleChar()
                       throws java.lang.Exception
Read a character and it returns like type char.

Returns:
one data char
Throws:
Com.ComException
java.lang.Exception

receiveSingleDataInt

public int receiveSingleDataInt()
                         throws java.lang.Exception
Receives a single data, like integer representation.

Returns:
one data int
Throws:
Com.ComException
java.lang.Exception

sendSingleData

public void sendSingleData(java.lang.String data)
                    throws java.lang.Exception
Write a single character like String type.

Parameters:
data - String
Throws:
Com.ComException
java.lang.Exception

sendSingleData

public void sendSingleData(char data)
                    throws java.lang.Exception
Write a single chraracter like char type.

Parameters:
data - char
Throws:
Com.ComException
java.lang.Exception

sendSingleData

public void sendSingleData(int data)
                    throws java.lang.Exception
Send a single data, like integer representation or hex representation with
prefix Ox.

Parameters:
data -
Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Close seril port.

Throws:
java.lang.Exception

addActionListenerReadPort

public void addActionListenerReadPort(ActionListenerReadPort actionListenerReadPort)
                               throws Com.ActionListenerReadPortException
ONLY FOR WINDOWS O.S. Add Action Listener for read port.

Parameters:
actionListenerReadPort -
Throws:
serial.Com.ActionListenerReadPortException
Com.ActionListenerReadPortException

removeActionListenerReadPort

public void removeActionListenerReadPort()
                                  throws Com.ComException
ONLY FOR WINDOWS O.S. Remove Action Listener from read port.

Throws:
serial.Com.ComException
Com.ComException