Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Opietooth2::OTDeviceAddress Class Reference

#include </home/clem/local/src/opie/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h>

Collaboration diagram for Opietooth2::OTDeviceAddress:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OTDeviceAddress ()
 OTDeviceAddress (const bdaddr_t &bdaddr, bool networkbyteorder=false)
 OTDeviceAddress (const QString &s)
QString toString () const
const bdaddr_t & getBDAddr (void) const
bdaddr_t getBDAddrInNetworkByteOrder () const
void setBDAddr (const bdaddr_t &bdaddr, bool networkbyteorder=false)
bool operator< (const OTDeviceAddress &b) const
bool operator== (const OTDeviceAddress &b) const
bool operator!= (const OTDeviceAddress &b) const

Static Public Attributes

static const OTDeviceAddress local
static const OTDeviceAddress any
static const OTDeviceAddress invalid

Protected Attributes

bdaddr_t BDaddr
bool IsValid

Detailed Description

Represents a Bluetooth device address. This class allows easy conversion of Bluetooth addresses from and to strings. It also works with the bdaddr_t type used by BlueZ. The class offers a comparsion and less-than operator, so that it can be used a key in an STL map or similar. The string conversion functions of BlueZ are used internally, so the string format is the same than for BlueZ's ba2str().

Definition at line 29 of file OTDeviceAddress.h.


Constructor & Destructor Documentation

OTDeviceAddress::OTDeviceAddress  ) 
 

Default constructor. The resulting address is equal to DeviceAddress::invalid.

Definition at line 30 of file OTDeviceAddress.cpp.

References BDaddr, and IsValid.

OTDeviceAddress::OTDeviceAddress const bdaddr_t &  bdaddr,
bool  networkbyteorder = false
[explicit]
 

Initialize the object with a BlueZ bdaddr_t.

Parameters:
bdaddr address
networkbyteorder if true, bdaddr is assumed to be in network byte order and converted to host byte order first.

Definition at line 36 of file OTDeviceAddress.cpp.

References setBDAddr().

OTDeviceAddress::OTDeviceAddress const QString s  )  [explicit]
 

Initializes the object with an address given as a string. The string must be in a format which is understood by the BlueZ str2ba function, like 00:61:58:4C:E6:AD. Case doesn't matter.

Parameters:
s address string

Definition at line 41 of file OTDeviceAddress.cpp.

References BDaddr, getBDAddr(), IsValid, and QString::latin1().


Member Function Documentation

const bdaddr_t& Opietooth2::OTDeviceAddress::getBDAddr void   )  const [inline]
 

Converts the DeviceAddress into a BlueZ bdaddr_t.

Parameters:
networkbyteorder if true, the address is returned in network byte order.
Returns:
the address as bdaddr_t

Definition at line 64 of file OTDeviceAddress.h.

References BDaddr.

Referenced by Opietooth2::OTDriver::getLinkQuality(), Opietooth2::OTDriver::getPeerName(), OTDeviceAddress(), Opietooth2::OTPeer::timerEvent(), and Opietooth2::OTPeer::updateServices().

bdaddr_t OTDeviceAddress::getBDAddrInNetworkByteOrder  )  const
 

Definition at line 71 of file OTDeviceAddress.cpp.

References BDaddr.

bool Opietooth2::OTDeviceAddress::operator!= const OTDeviceAddress b  )  const [inline]
 

Definition at line 87 of file OTDeviceAddress.h.

bool OTDeviceAddress::operator< const OTDeviceAddress b  )  const
 

Less-than-operator. Mainly there to use DeviceAddress inside STL containers, like STL sets or as a key in a STL map.

Parameters:
b the DeviceAddress to compare to (right hand side)
Returns:
true if this < b, false otherwise.

Definition at line 83 of file OTDeviceAddress.cpp.

References BDaddr, and IsValid.

bool OTDeviceAddress::operator== const OTDeviceAddress b  )  const
 

Equality operator. Tests two device addresses for equality.

Parameters:
b the DeviceAddress to compare to (right hand side)
Returns:
true if this and b have the same address or if both are invalid, false otherwise

Definition at line 77 of file OTDeviceAddress.cpp.

References BDaddr, and IsValid.

void OTDeviceAddress::setBDAddr const bdaddr_t &  bdaddr,
bool  networkbyteorder = false
 

Definition at line 61 of file OTDeviceAddress.cpp.

References BDaddr, and IsValid.

Referenced by Opietooth2::OTDriver::init(), Opietooth2::OTGateway::loadActiveNetworkSetups(), OTDeviceAddress(), and Opietooth2::OTInquiry::slotHCIEvent().

QString OTDeviceAddress::toString  )  const
 

convert the address to a string.

Returns:
address string

Definition at line 54 of file OTDeviceAddress.cpp.

References BDaddr.

Referenced by Opietooth2::OTInquiry::slotHCIEvent(), and Opietooth2::OTPeer::updateServices().


Member Data Documentation

const OTDeviceAddress OTDeviceAddress::any [static]
 

Initial value:

 
                OTDeviceAddress("00:00:00:00:00:00")
The address 00:00:00:00:00:00

Definition at line 25 of file OTDeviceAddress.cpp.

Referenced by Opietooth2::OTPeer::timerEvent(), and Opietooth2::OTPeer::updateServices().

bdaddr_t Opietooth2::OTDeviceAddress::BDaddr [protected]
 

Definition at line 101 of file OTDeviceAddress.h.

Referenced by getBDAddr(), getBDAddrInNetworkByteOrder(), operator<(), operator==(), OTDeviceAddress(), setBDAddr(), and toString().

const OTDeviceAddress OTDeviceAddress::invalid [static]
 

Initial value:

An address tagged as invalid

Definition at line 23 of file OTDeviceAddress.cpp.

bool Opietooth2::OTDeviceAddress::IsValid [protected]
 

Definition at line 102 of file OTDeviceAddress.h.

Referenced by operator<(), operator==(), OTDeviceAddress(), and setBDAddr().

const OTDeviceAddress OTDeviceAddress::local [static]
 

Initial value:

  
                OTDeviceAddress("00:00:00:FF:FF:FF")
The address 00:00:00:FF:FF:FF

Definition at line 27 of file OTDeviceAddress.cpp.


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 18:03:00 2005 for OPIE by  doxygen 1.4.2