com.ibutton.tmex.container
Class iButtonContainerGeneral

java.lang.Object
  |
  +--com.ibutton.tmex.container.iButtonContainerGeneral
Direct Known Subclasses:
iButtonContainer01, iButtonContainer02, iButtonContainer04, iButtonContainer05, iButtonContainer06, iButtonContainer08, iButtonContainer09, iButtonContainer0A, iButtonContainer0B, iButtonContainer0C, iButtonContainer0F, iButtonContainer10, iButtonContainer11, iButtonContainer12, iButtonContainer14, iButtonContainer16, iButtonContainer18, iButtonContainer1A, iButtonContainer1B, iButtonContainer1C, iButtonContainer1D, iButtonContainer1F, iButtonContainer20, iButtonContainer21, iButtonContainer23, iButtonContainer40

public class iButtonContainerGeneral
extends java.lang.Object
implements iButtonContainer

General iButton container class that implements an iButtonContainer and adds basic communication functions. This class should only be used if a device specific class is not available or known. Most iButtonConainter classes will extend this basic class.


Field Summary
protected  DSPortAdapter adapter
          Reference to the adapter that is needed to communicate with this iButton.
protected  iButtonID ID
          ID number of the current iButton found
 
Constructor Summary
iButtonContainerGeneral()
          Constructs a General purpose iButton container class.
 
Method Summary
 char[] dataBlock(char[] dataBlock, int off, int len)
          Sends a block of data and returns the data received in the same array.
 java.lang.String getAlternateNames()
          Retrieve the alternate Dallas Semiconductor part numbers or names.
 boolean getBit()
          Gets a bit from the MicroLan.
 char[] getBlock(int len)
          Get a block of data and return it in an array.
 char getByte()
          Gets a byte from the MicroLan.
 java.lang.String getDescription()
          Retrieve a short description of the function of the iButton type.
 java.lang.String getiButtonPartName()
          Retrieve the Dallas Semiconductor part number of the iButton as a string.
 int[] getID()
          Get the ID as an array of ints.
 java.lang.String getIDString()
          Get the ID as a String.
 boolean isAlarming()
          Checks to see that if the iButton is currently connected to the MicroLan whether it is in an 'alarm' condition.
 boolean isPresent()
          Verifies that this iButton is currently connected to the MicroLan.
 void putBit(boolean bitValue)
          Sends a bit to the MicroLan.
 void putByte(char byteValue)
          Sends a byte to the MicroLan.
 int reset()
          Sends a Reset to the MicroLan.
 boolean select()
          Selects this iButton by broadcasting the serial number ID.
 void setupContainer(DSPortAdapter sourceAdapter, iButtonID newID)
          Provided the adapter object used to access this iButton and provide the ID of this iButton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adapter

protected DSPortAdapter adapter
Reference to the adapter that is needed to communicate with this iButton.

ID

protected iButtonID ID
ID number of the current iButton found
Constructor Detail

iButtonContainerGeneral

public iButtonContainerGeneral()
Constructs a General purpose iButton container class. This constructor does not contain a source adapter. The method setSourceAdapter must be called right after before this container can be used.
Method Detail

setupContainer

public void setupContainer(DSPortAdapter sourceAdapter,
                           iButtonID newID)
Provided the adapter object used to access this iButton and provide the ID of this iButton.
Specified by:
setupContainer in interface iButtonContainer

getiButtonPartName

public java.lang.String getiButtonPartName()
Retrieve the Dallas Semiconductor part number of the iButton as a string. For example 'Crypto iButton' or 'DS1992'.
Specified by:
getiButtonPartName in interface iButtonContainer
Returns:
string represetation of the iButton name.

getAlternateNames

public java.lang.String getAlternateNames()
Retrieve the alternate Dallas Semiconductor part numbers or names. A 'family' of MicroLAN devices may have more than one part number depending on packaging. There can also be nicknames such as 'Crypto iButton'.
Specified by:
getAlternateNames in interface iButtonContainer
Returns:
string represetation of the alternate names.

getDescription

public java.lang.String getDescription()
Retrieve a short description of the function of the iButton type.
Specified by:
getDescription in interface iButtonContainer
Returns:
string represetation of the function description.

isPresent

public boolean isPresent()
                  throws PortNotSelectedException,
                         PortInUseException,
                         AdapterNotDetectedException,
                         MicroLanIOException
Verifies that this iButton is currently connected to the MicroLan.
Specified by:
isPresent in interface iButtonContainer
Returns:
'true' if device present on the MicroLAN.
Throws:
PortNotSelectedException -  
PortInUseException -  
AdapterNotDetectedException -  
MicroLanIOException -  

isAlarming

public boolean isAlarming()
                   throws PortNotSelectedException,
                          PortInUseException,
                          AdapterNotDetectedException,
                          MicroLanIOException
Checks to see that if the iButton is currently connected to the MicroLan whether it is in an 'alarm' condition. This does not apply to all iButton types.
Specified by:
isAlarming in interface iButtonContainer
Returns:
'true' if device present on the MicroLAN.
Throws:
PortNotSelectedException -  
PortInUseException -  
AdapterNotDetectedException -  
MicroLanIOException -  

select

public boolean select()
               throws PortNotSelectedException,
                      PortInUseException,
                      AdapterNotDetectedException,
                      MicroLanIOException
Selects this iButton by broadcasting the serial number ID. Warning, this does not verify that the device is currenly present on the MicroLAN (See isPresent).
Returns:
'TRUE' if device ID was sent else 'FALSE'.
Throws:
PortNotSelectedException -  
PortInUseException -  
AdapterNotDetectedException -  
MicroLanIOException -  

putBit

public void putBit(boolean bitValue)
            throws MicroLanIOException
Sends a bit to the MicroLan.
Parameters:
bitValue - the bit value to send to the MicroLan.
Throws:
MicroLanIOException -  

getBit

public boolean getBit()
               throws MicroLanIOException
Gets a bit from the MicroLan.
Returns:
the bit value recieved from the the MicroLan.
Throws:
MicroLanIOException -  

putByte

public void putByte(char byteValue)
             throws MicroLanIOException
Sends a byte to the MicroLan.
Parameters:
byteValue - the byte value to send to the MicroLan.
Throws:
MicroLanIOException -  

getByte

public char getByte()
             throws MicroLanIOException
Gets a byte from the MicroLan.
Returns:
the byte value to be recieved from the the MicroLan.
Throws:
MicroLanIOException -  

getBlock

public char[] getBlock(int len)
                throws MicroLanIOException
Get a block of data and return it in an array.
Parameters:
len - length of data bytes receive
Throws:
MicroLanIOException -  

dataBlock

public char[] dataBlock(char[] dataBlock,
                        int off,
                        int len)
                 throws MicroLanIOException
Sends a block of data and returns the data received in the same array. It starts sending data from the index at offset 'off' for length 'len'.
Parameters:
dataBlock - array of data (ints) to transfer to and from the MicroLan. Only the least significant 8 bits of each array element is used.
off - offset into the array of data to start
len - length of data to send / receive starting at 'off'
Returns:
the result block
Throws:
MicroLanIOException -  

reset

public int reset()
          throws MicroLanIOException
Sends a Reset to the MicroLan.
Returns:
the result of the reset. Potential results are:
  • 0 no devices present on the MicroLan.
  • 1 normal presence pulse detected on the MicroLan indicating there is a device present.
  • 2 alarming presence pulse detected on the MicroLan indicating there is a device present and it is in the alarm condition.
Throws:
MicroLanIOException -  

getID

public int[] getID()
Get the ID as an array of ints.
Specified by:
getID in interface iButtonContainer
Returns:
array of ints that is the iButton ID

getIDString

public java.lang.String getIDString()
Get the ID as a String.
Specified by:
getIDString in interface iButtonContainer
Returns:
String representation of the iButton ID