superwaba.ext.xplat.io
Class SerialPDB

java.lang.Object
  |
  +--superwaba.ext.xplat.io.SerialPDB

public class SerialPDB
extends Object

This is the client-side class. It implements a pdbconduit-through-a-serial-port. Created by Guich from the SerialSocket class created by Rick Grehan. See examples/io/PDBConduit.


Field Summary
protected  byte[] buf
          temp buffer
static byte DELETE
           
protected  DataStream ds
          DataStream object
static byte GET_CATALOG
           
static byte GET_TXT
           
static byte PUT_CATALOG
           
static byte PUT_TXT
           
static byte SHUTDOWN
           
protected  SerialPort sport
          Serial port object
 
Constructor Summary
SerialPDB(int baud, int timeout)
          Create and open the Serial connection
 
Method Summary
 void delete(String fileName)
          Delete a catalog at the server.
protected  void flush()
           
 boolean get(Catalog fillIn, String name, int startRecord, int endRecord, boolean onlyDirty, boolean resetDirtyAttr)
          Requests the server to send the specified catalog, placing the records in the given fillIn catalog. startRecord and endRecord can be -1 to bring the full Catalog.
 String[] get(String fileName)
          Get a String array from the server from the specified text file.
 boolean isOpen()
          Return true if we're connected
 boolean put(Catalog cat2send, String name, int startRecord, int endRecord, boolean onlyDirty, boolean resetDirtyAttr)
          Send the specified catalog to the server.
 boolean put(String fileName, boolean deleteIfExists, String[] strings)
          Send the following String array to the server, placing it in the given txt filename.
 void shutdownServer()
          Shutdown the server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

PUT_CATALOG

public static final byte PUT_CATALOG

GET_CATALOG

public static final byte GET_CATALOG

PUT_TXT

public static final byte PUT_TXT

GET_TXT

public static final byte GET_TXT

DELETE

public static final byte DELETE

SHUTDOWN

public static final byte SHUTDOWN

sport

protected SerialPort sport
Serial port object

ds

protected DataStream ds
DataStream object

buf

protected byte[] buf
temp buffer
Constructor Detail

SerialPDB

public SerialPDB(int baud,
                 int timeout)
Create and open the Serial connection
Method Detail

isOpen

public boolean isOpen()
Return true if we're connected

put

public boolean put(Catalog cat2send,
                   String name,
                   int startRecord,
                   int endRecord,
                   boolean onlyDirty,
                   boolean resetDirtyAttr)
Send the specified catalog to the server. If onlyDirty is true, only dirty records will be sent. You may also specify resetDirtyAttr to reset the flag in all record sync'ed. startRecord and endRecord can be -1 to send all Catalog. You may specify in the name the full path to the catalog.

get

public boolean get(Catalog fillIn,
                   String name,
                   int startRecord,
                   int endRecord,
                   boolean onlyDirty,
                   boolean resetDirtyAttr)
Requests the server to send the specified catalog, placing the records in the given fillIn catalog. startRecord and endRecord can be -1 to bring the full Catalog. If onlyDirty is true, only dirty records will be received. You may also specify resetDirtyAttr to reset the flag in all record sync'ed. You may specify in the name parameter the full path to the file.

put

public boolean put(String fileName,
                   boolean deleteIfExists,
                   String[] strings)
Send the following String array to the server, placing it in the given txt filename. You may specify the full path to the fileName.

get

public String[] get(String fileName)
Get a String array from the server from the specified text file. You may specify the full path to the fileName.

delete

public void delete(String fileName)
Delete a catalog at the server. This method does NOT delete a txt (txt files are always overwritten)!

shutdownServer

public void shutdownServer()
Shutdown the server.

flush

protected void flush()