de.avetana.bluetooth.util
Class BTAddress

java.lang.Object
  extended byde.avetana.bluetooth.util.BTAddress
All Implemented Interfaces:
java.io.Serializable

public class BTAddress
extends java.lang.Object
implements java.io.Serializable

COPYRIGHT:
(c) Copyright 2004 Avetana GmbH ALL RIGHTS RESERVED.

This file is part of the Avetana bluetooth API for Linux.

The Avetana bluetooth API for Linux is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The Avetana bluetooth API is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

The development of the Avetana bluetooth API is based on the work of Christian Lorenz (see the Javabluetooth Stack at http://www.javabluetooth.org) for some classes, on the work of the jbluez team (see http://jbluez.sourceforge.net/) and on the work of the bluez team (see the BlueZ linux Stack at http://www.bluez.org) for the C code. Classes, part of classes, C functions or part of C functions programmed by these teams and/or persons are explicitly mentioned.



Description:
Java representation of a Bluetooth device address. A Bluetooth device address is comprised of six pairs of hex digits, for example 00:12:34:56:78:9A.
This class is based upon the bdaddr_t type, as defined in bluetooth.h of the BlueZ libraries.

See Also:
Serialized Form

Field Summary
 short[] addr_arr
          The address is stored as six 8-bit numbers.
 
Constructor Summary
BTAddress()
          Default constructor
BTAddress(java.lang.String addr_str)
          Creates a BTAddress object from the address addr_str.
 
Method Summary
 boolean equals(BTAddress compare)
          Compares two BTAddress objects to see if they represent the same Bluetooth device address.
static BTAddress parseString(java.lang.String original)
           
 void setValue(java.lang.String addr_str)
          Set the Bluetooth device address.
 java.lang.String toString()
          Returns a String representation of the Bluetooth device address in the form "00:12:34:56:78:9A".
 java.lang.String toStringSep(boolean with)
           
static java.lang.String transform(java.lang.String original)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

addr_arr

public short[] addr_arr
The address is stored as six 8-bit numbers.

Constructor Detail

BTAddress

public BTAddress()
Default constructor


BTAddress

public BTAddress(java.lang.String addr_str)
          throws BTAddressFormatException
Creates a BTAddress object from the address addr_str. The address string should be in the form "00:12:34:56:78:9A".

Parameters:
addr_str - String representation of the Bluetooth device address.
Throws:
BTAddressFormatException - If the String is not a parsable Bluetooth address.
Method Detail

setValue

public void setValue(java.lang.String addr_str)
              throws BTAddressFormatException
Set the Bluetooth device address. Valid string format is "00:12:34:56:78:AB", that is 6, colon separated pairs of hex digits.

Parameters:
addr_str - String representation of the Bluetooth device address.
Throws:
BTAddressFormatException - If the String is not a parsable Bluetooth address.

toString

public java.lang.String toString()
Returns a String representation of the Bluetooth device address in the form "00:12:34:56:78:9A".

Returns:
A String representation of the Bluetooth device address.

toStringSep

public java.lang.String toStringSep(boolean with)

transform

public static java.lang.String transform(java.lang.String original)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

parseString

public static BTAddress parseString(java.lang.String original)
                             throws java.lang.Exception
Throws:
java.lang.Exception

equals

public boolean equals(BTAddress compare)
Compares two BTAddress objects to see if they represent the same Bluetooth device address.

Parameters:
compare - The BTAddress object to compare to this.
Returns:
True if the Bluetooth device addresses are equal, otherwise false.