superwaba.ext.xplat.io
Class SerialSocket

java.lang.Object
  |
  +--waba.io.Stream
        |
        +--waba.io.Socket
              |
              +--superwaba.ext.xplat.io.SerialSocket

public class SerialSocket
extends Socket

class SerialSocket This is the client-side class. It implements a socket-through-a-serial-port. Created by Rick Grehan and ported to SuperWaba by Guich.


Field Summary
static byte CLOSE
           
static byte CREATE
           
static byte READ
           
static byte WRITE
           
 
Fields inherited from class waba.io.Socket
lastError, refreshBeforeEachRead
 
Constructor Summary
SerialSocket(String host, int port, int baud)
          Create and open the Socket
 
Method Summary
 boolean close()
          Close the Socket
 boolean isOpen()
          Return true if socket is open - false otherwise
 int readBytes(byte[] buf, int start, int count)
          Read bytes from the Socket into a byte array
 boolean setReadTimeout(int millis)
          Sets the read timeout.
 void shutdownServer()
          Shutdown the server.
 int writeBytes(byte[] buf, int start, int count)
          Write bytes from the Socket into a byte array
 
Methods inherited from class waba.io.Socket
disconnect
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

CREATE

public static final byte CREATE

READ

public static final byte READ

WRITE

public static final byte WRITE

CLOSE

public static final byte CLOSE
Constructor Detail

SerialSocket

public SerialSocket(String host,
                    int port,
                    int baud)
Create and open the Socket
Method Detail

isOpen

public boolean isOpen()
Return true if socket is open - false otherwise
Overrides:
isOpen in class Socket

readBytes

public int readBytes(byte[] buf,
                     int start,
                     int count)
Read bytes from the Socket into a byte array
Overrides:
readBytes in class Socket
Tags copied from class: Socket
Parameters:
buf - the byte array to read data into
start - the start position in the byte array
count - the number of bytes to read

writeBytes

public int writeBytes(byte[] buf,
                      int start,
                      int count)
Write bytes from the Socket into a byte array
Overrides:
writeBytes in class Socket
Tags copied from class: Socket
Parameters:
buf - the byte array to write data from
start - the start position in the byte array
count - the number of bytes to write

close

public boolean close()
Close the Socket
Overrides:
close in class Socket

shutdownServer

public void shutdownServer()
Shutdown the server.

setReadTimeout

public boolean setReadTimeout(int millis)
Sets the read timeout. Note that this is the timeout for a Serial connection. The default is 10 seconds.
Overrides:
setReadTimeout in class Socket
Tags copied from class: Socket
Parameters:
millis - timeout in milliseconds.