Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
org.direct_bt.EUI48 Class Reference

A packed 48 bit EUI-48 identifier, formerly known as MAC-48 or simply network device MAC address (Media Access Control address). More...

Collaboration diagram for org.direct_bt.EUI48:

Public Member Functions

 EUI48 (final String str) throws IllegalArgumentException
 Construct instance via given string representation. More...
 
 EUI48 (final byte stream[], final int pos)
 Construct instance via given source byte array. More...
 
 EUI48 (final byte address[])
 Construct instance using the given address of the byte array. More...
 
 EUI48 ()
 Construct empty unset instance. More...
 
final boolean equals (final Object obj)
 
final int hashCode ()
 
void clearHash ()
 Method clears the cached hash value. More...
 
void clear ()
 Method clears the underlying byte array b and cached hash value. More...
 
final void putStream (final byte[] source, final int pos)
 Method transfers all bytes representing a EUI48 from the given source array at the given position into this instance and clears its cached hash value. More...
 
final void getStream (final byte[] sink, final int pos)
 Method transfers all bytes representing this instance into the given destination array at the given position. More...
 
BLERandomAddressType getBLERandomAddressType (final BDAddressType addressType)
 Returns the BLERandomAddressType. More...
 
int indexOf (final EUI48Sub needle)
 Finds the index of given EUI48Sub. More...
 
boolean contains (final EUI48Sub needle)
 Returns true, if given EUI48Sub is contained in here. More...
 
final String toString ()
 

Static Public Member Functions

static boolean scanEUI48 (final String str, final EUI48 dest, final StringBuilder errmsg)
 Fills given EUI48 instance via given string representation. More...
 

Public Attributes

final byte b []
 The 6 byte EUI48 address. More...
 

Static Public Attributes

static final EUI48 ANY_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 } )
 EUI48 MAC address matching any device, i.e. More...
 
static final EUI48 ALL_DEVICE = new EUI48( new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff } )
 EUI48 MAC address matching all device, i.e. More...
 
static final EUI48 LOCAL_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0xff } )
 EUI48 MAC address matching local device, i.e. More...
 

Detailed Description

A packed 48 bit EUI-48 identifier, formerly known as MAC-48 or simply network device MAC address (Media Access Control address).

Implementation caches the hash value hashCode(), hence users shall take special care when mutating the underlying data b, read its API notes.

Definition at line 37 of file EUI48.java.

Constructor & Destructor Documentation

◆ EUI48() [1/4]

org.direct_bt.EUI48.EUI48 ( final String  str) throws IllegalArgumentException

Construct instance via given string representation.

Implementation is consistent with toString().

Parameters
stra string of exactly 17 characters representing 6 bytes as hexadecimal numbers separated via colon
"01:02:03:0A:0B:0C"
.
See also
#scanEUI48(String, byte[], StringBuilder)
toString()
Exceptions
IllegalArgumentExceptionif given string doesn't comply with EUI48

Definition at line 100 of file EUI48.java.

Here is the call graph for this function:

◆ EUI48() [2/4]

org.direct_bt.EUI48.EUI48 ( final byte  stream[],
final int  pos 
)

Construct instance via given source byte array.

Definition at line 109 of file EUI48.java.

◆ EUI48() [3/4]

org.direct_bt.EUI48.EUI48 ( final byte  address[])

Construct instance using the given address of the byte array.

Definition at line 118 of file EUI48.java.

◆ EUI48() [4/4]

org.direct_bt.EUI48.EUI48 ( )

Construct empty unset instance.

Definition at line 126 of file EUI48.java.

Here is the caller graph for this function:

Member Function Documentation

◆ clear()

void org.direct_bt.EUI48.clear ( )

Method clears the underlying byte array b and cached hash value.

See also
clearHash()

Definition at line 190 of file EUI48.java.

Here is the caller graph for this function:

◆ clearHash()

void org.direct_bt.EUI48.clearHash ( )

Method clears the cached hash value.

See also
clear()

Definition at line 184 of file EUI48.java.

◆ contains()

boolean org.direct_bt.EUI48.contains ( final EUI48Sub  needle)

Returns true, if given EUI48Sub is contained in here.

If the sub is zero, true is returned.

Definition at line 265 of file EUI48.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

final boolean org.direct_bt.EUI48.equals ( final Object  obj)

Definition at line 131 of file EUI48.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBLERandomAddressType()

BLERandomAddressType org.direct_bt.EUI48.getBLERandomAddressType ( final BDAddressType  addressType)

Returns the BLERandomAddressType.

If BDAddressType is BDAddressType::BDADDR_LE_RANDOM, method shall return a valid value other than BLERandomAddressType::UNDEFINED.

If BDAddressType is not BDAddressType::BDADDR_LE_RANDOM, method shall return BLERandomAddressType::UNDEFINED.

Since
2.2.0

Definition at line 244 of file EUI48.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStream()

final void org.direct_bt.EUI48.getStream ( final byte[]  sink,
final int  pos 
)

Method transfers all bytes representing this instance into the given destination array at the given position.

Implementation is consistent with EUI48(byte[], int).

Parameters
sinkthe destination array
posstarting position in the destination array
See also
EUI48(byte[], int)

Definition at line 225 of file EUI48.java.

◆ hashCode()

final int org.direct_bt.EUI48.hashCode ( )

Implementation uses a lock-free volatile cache.

See also
clearHash()

Definition at line 155 of file EUI48.java.

Here is the caller graph for this function:

◆ indexOf()

int org.direct_bt.EUI48.indexOf ( final EUI48Sub  needle)

Finds the index of given EUI48Sub.

Definition at line 255 of file EUI48.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ putStream()

final void org.direct_bt.EUI48.putStream ( final byte[]  source,
final int  pos 
)

Method transfers all bytes representing a EUI48 from the given source array at the given position into this instance and clears its cached hash value.

Implementation is consistent with EUI48(byte[], int).

Parameters
sourcethe source array
posstarting position in the source array
See also
EUI48(byte[], int)
clearHash()

Definition at line 207 of file EUI48.java.

Here is the caller graph for this function:

◆ scanEUI48()

static boolean org.direct_bt.EUI48.scanEUI48 ( final String  str,
final EUI48  dest,
final StringBuilder  errmsg 
)
static

Fills given EUI48 instance via given string representation.

Implementation is consistent with toString().

Parameters
stra string of exactly 17 characters representing 6 bytes as hexadecimal numbers separated via colon
"01:02:03:0A:0B:0C"
.
destEUI48 to set its value
errmsgerror parsing message if returning false
Returns
true if successful, otherwise false
See also
EUI48(String)
toString()

Definition at line 74 of file EUI48.java.

Here is the caller graph for this function:

◆ toString()

final String org.direct_bt.EUI48.toString ( )

Returns the EUI48 string representation, exactly 17 characters representing 6 bytes as upper case hexadecimal numbers separated via colon

"01:02:03:0A:0B:0C"

.

See also
EUI48(String)

Definition at line 278 of file EUI48.java.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ ALL_DEVICE

final EUI48 org.direct_bt.EUI48.ALL_DEVICE = new EUI48( new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff } )
static

EUI48 MAC address matching all device, i.e.

'ff:ff:ff:ff:ff:ff'.

Definition at line 41 of file EUI48.java.

◆ ANY_DEVICE

final EUI48 org.direct_bt.EUI48.ANY_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 } )
static

EUI48 MAC address matching any device, i.e.

'0:0:0:0:0:0'.

Definition at line 39 of file EUI48.java.

◆ b

final byte org.direct_bt.EUI48.b[]

The 6 byte EUI48 address.

If modifying, it is the user's responsibility to avoid data races.
Further, call clearHash() after mutation is complete.

Definition at line 52 of file EUI48.java.

◆ LOCAL_DEVICE

final EUI48 org.direct_bt.EUI48.LOCAL_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0xff } )
static

EUI48 MAC address matching local device, i.e.

'0:0:0:ff:ff:ff'.

Definition at line 43 of file EUI48.java.


The documentation for this class was generated from the following file: