cardbus
Class CardBus

java.lang.Object
  |
  +--cardbus.CardBus

public class CardBus
extends java.lang.Object


Constructor Summary
CardBus()
           
 
Method Summary
(package private) static void ()
           
static void closeConnections()
          Disposes a handle to the driver.
static void connect()
          Gets handle to the driver.
static boolean connect(int device_number)
          Gets handle to the driver.
static java.lang.String[] getPortNames()
          Finds the names of all the available CardBus devices on the computer in use.
 int readIoFixAddr8bit(int address, int noOfBytesToRead, byte[] bufferForReadValues)
          Reads 8-bit words from I/O space at a fixed address.
 int readMemoryFixAddr32bit(int address, int noOfBytesToRead, byte[] bufferForReadValues)
          Reads 32-bit words from memory space at a fixed address.
 java.lang.String sendAndReceiveData(java.lang.String messageToBeSent, int timeOutValue)
          Sends a String over an existing CardBus connection and waits for a reply
 void sendData(java.lang.String messageToBeSent)
          Sends a String over an existing CardBus connection
 int writeIoFixAddr8bit(int address, int noOfBytesToWrite, byte[] bufferWithValuesToWrite)
          Writes 8-bit words to I/O space at a fixed address.
 int writeMemFixAddr32bit(int address, int noOfBytesToWrite, byte[] bufferWithValuesToWrite)
          Writes 32-bit words to memory space at a fixed address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardBus

public CardBus()
Method Detail

static void ()

closeConnections

public static void closeConnections()
Disposes a handle to the driver. This method will never throw any exceptions, not even if a handle wasn't established in the first place. Handles can be kept for long periods of time and it is NOT recommended that the handle be disposed after each access with the hardware.

connect

public static void connect()
                    throws CardbusGetHandleException
Gets handle to the driver. Before any communiation with the hardware can take place, a handle must be established. The handle can be kept for long periods of time and it is NOT recommended that the handle be disposed after each access with the hardware.
Throws:
CardbusGetHandleException - if there was a problem

connect

public static boolean connect(int device_number)
Gets handle to the driver. Before any communiation with the hardware can take place, a handle must be established. The handle can be kept for long periods of time and it is NOT recommended that the handle be disposed after each access with the hardware.
Parameters:
device_number - for the appropriate device
Returns:
true if connection is established

getPortNames

public static java.lang.String[] getPortNames()
Finds the names of all the available CardBus devices on the computer in use.
Returns:
a String[] array containg the names of the CardBus devices found

readIoFixAddr8bit

public int readIoFixAddr8bit(int address,
                             int noOfBytesToRead,
                             byte[] bufferForReadValues)
                      throws CardbusNoHandleException,
                             CardbusBadParameterException,
                             UnknownCardbusErrorException
Reads 8-bit words from I/O space at a fixed address.
Parameters:
address - the address at which the access to the hardware will take place at. The address must be in the asssigned I/O space.
noOfBytesToRead - the number of bytes to read.
bufferForReadValues - a buffer for the read data. The size of the buffer in bytes must be equal to or greater than noOfBytesToRead.
Returns:
a negative number if there was a problem, otherwise the number of bytes read will be returned.
Throws:
CardbusBadParameterException - if one or several parameter have invalid values.
CardbusNoHandleException - if there is currently no handle established with the driver.
UnknownCardbusErrorException - if an unknown error occurred.

readMemoryFixAddr32bit

public int readMemoryFixAddr32bit(int address,
                                  int noOfBytesToRead,
                                  byte[] bufferForReadValues)
                           throws CardbusNoHandleException,
                                  CardbusBadParameterException,
                                  UnknownCardbusErrorException
Reads 32-bit words from memory space at a fixed address.
Parameters:
address - the address at which the access to the hardware will take place at. The address must be in the asssigned memory space. Must be a multiple of 4.
noOfBytesToRead - the number of bytes to read. Must be a multiple of 4.
bufferForReadValues - a buffer for the read data. The size of the buffer in bytes must be equal to or greater than noOfBytesToRead.
Returns:
a negative number if there was a problem, otherwise the number of bytes read will be returned.
Throws:
CardbusBadParameterException - if one or several parameter have invalid values.
CardbusNoHandleException - if there is currently no handle established with the driver.
UnknownCardbusErrorException - if an unknown error occurred.

sendAndReceiveData

public java.lang.String sendAndReceiveData(java.lang.String messageToBeSent,
                                           int timeOutValue)
                                    throws UnknownCardbusErrorException
Sends a String over an existing CardBus connection and waits for a reply
Parameters:
messageToBeSent - a String to be sent over the existing CardBus connection, excluding the carriage return and the linefeed at the end
timeOutValue - specifies how many milli-seconds after the message was sent the waiting for a reply will cease and Timeout will be returned
Returns:
If a timeout occurs then the String Timeout will be returned. Otherwise, the received reply message, excluding the initial @ and the carriage return and linefeed at the end, will be returned.
Throws:
UnknownCardbusErrorException - if an I/O error occurs while trying to receive data over the CardBus connection

sendData

public void sendData(java.lang.String messageToBeSent)
              throws UnknownCardbusErrorException
Sends a String over an existing CardBus connection
Parameters:
messageToBeSent - a String to be sent over the existing CardBus connection, excluding the carriage return and the linefeed at the end
Throws:
UnknownCardbusErrorException - if an I/O error occurs while trying to send data over the CardBus connection

writeIoFixAddr8bit

public int writeIoFixAddr8bit(int address,
                              int noOfBytesToWrite,
                              byte[] bufferWithValuesToWrite)
                       throws CardbusNoHandleException,
                              CardbusBadParameterException,
                              UnknownCardbusErrorException
Writes 8-bit words to I/O space at a fixed address.
Parameters:
address - the address at which the access to the hardware will take place at. The address must be in the asssigned I/O space.
noOfBytesToWrite - the number of bytes to write.
bufferWithValuesToWrite - a buffer containing the data to be stored in the hardware. The size of the buffer in bytes must be equal to or greater than noOfBytesToWrite.
Returns:
a negative number if there was a problem, otherwise the number of bytes written will be returned.
Throws:
CardbusBadParameterException - if one or several parameter have invalid values.
CardbusNoHandleException - if there is currently no handle established with the driver.
UnknownCardbusErrorException - if an unknown error occurred.

writeMemFixAddr32bit

public int writeMemFixAddr32bit(int address,
                                int noOfBytesToWrite,
                                byte[] bufferWithValuesToWrite)
                         throws CardbusNoHandleException,
                                CardbusBadParameterException,
                                UnknownCardbusErrorException
Writes 32-bit words to memory space at a fixed address.
Parameters:
address - the address at which the first access to the hardware will take place at. The address must be in the asssigned memory space. Must be a multiple of 4.
noOfBytesToWrite - the number of bytes to write. Must be a multiple of 4.
bufferWithValuesToWrite - a buffer containing the data to be stored in the hardware. The size of the buffer in bytes must be equal to or greater than noOfBytesToWrite.
Returns:
a negative number if there was a problem, otherwise the number of bytes written will be returned.
Throws:
CardbusBadParameterException - if one or several parameter have invalid values.
CardbusNoHandleException - if there is currently no handle established with the driver.
UnknownCardbusErrorException - if an unknown error occurred.