Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Static Public Member Functions | Static Public Attributes | List of all members
org.direct_bt.BTUtils Class Reference
Collaboration diagram for org.direct_bt.BTUtils:

Static Public Member Functions

static String decodeUTF8String (final byte[] buffer, final int offset, final int size)
 Decodes the given consecutive UTF-8 characters within buffer to String. More...
 
static short getHCIConnSupervisorTimeout (final int conn_latency, final int conn_interval_max_ms)
 Defining the supervising timeout for LE connections to be a multiple of the maximum connection interval as follows: More...
 
static short getHCIConnSupervisorTimeout (final int conn_latency, final int conn_interval_max_ms, final int min_result_ms, final int multiplier)
 Defining the supervising timeout for LE connections to be a multiple of the maximum connection interval as follows: More...
 
static final String toUUID128 (final String uuid16)
 Converts the given 4 digits uuid16 value to UUID128 representation. More...
 

Static Public Attributes

static final String UUID128_BASE = "00000000-0000-1000-8000-00805f9b34fb"
 Base UUID128 used to express a UUID16, etc. More...
 

Detailed Description

Definition at line 29 of file BTUtils.java.

Member Function Documentation

◆ toUUID128()

static final String org.direct_bt.BTUtils.toUUID128 ( final String  uuid16)
static

Converts the given 4 digits uuid16 value to UUID128 representation.

Parameters
uuid16the 4 characters long uuid16 value to convert
Returns
UUID128 representation if uuid16 is 4 characters long, otherwise UUID128_BASE.

Definition at line 40 of file BTUtils.java.

◆ getHCIConnSupervisorTimeout() [1/2]

static short org.direct_bt.BTUtils.getHCIConnSupervisorTimeout ( final int  conn_latency,
final int  conn_interval_max_ms,
final int  min_result_ms,
final int  multiplier 
)
static

Defining the supervising timeout for LE connections to be a multiple of the maximum connection interval as follows:

 ( 1 + conn_latency ) * conn_interval_max_ms * max(2, multiplier) [ms]

If above result is smaller than the given min_result_ms, min_result_ms/10 will be returned.

Parameters
conn_latencythe connection latency
conn_interval_max_msthe maximum connection interval in [ms]
min_result_msthe minimum resulting supervisor timeout, defaults to 500ms. If above formula results in a smaller value, min_result_ms/10 will be returned.
multiplierrecommendation is 6, we use 10 as default for safety.
Returns
the resulting supervising timeout in 1/10 [ms], suitable for the BTDevice#connectLE(short, short, short, short, short, short).
See also
BTDevice::connectLE(short, short, short, short, short, short)

Definition at line 62 of file BTUtils.java.

Here is the caller graph for this function:

◆ getHCIConnSupervisorTimeout() [2/2]

static short org.direct_bt.BTUtils.getHCIConnSupervisorTimeout ( final int  conn_latency,
final int  conn_interval_max_ms 
)
static

Defining the supervising timeout for LE connections to be a multiple of the maximum connection interval as follows:

 ( 1 + conn_latency ) * conn_interval_max_ms * max(2, multiplier) [ms]

If above result is smaller than the given min_result_ms, min_result_ms/10 will be returned.

  • Using minimum resulting supervisor timeout of 500ms.
  • Using multiplier of 10 as default for safety.
Parameters
conn_latencythe connection latency
conn_interval_max_msthe maximum connection interval in [ms]
Returns
the resulting supervising timeout in 1/10 [ms], suitable for the BTDevice#connectLE(short, short, short, short, short, short).
See also
BTDevice::connectLE(short, short, short, short, short, short)

Definition at line 84 of file BTUtils.java.

◆ decodeUTF8String()

static String org.direct_bt.BTUtils.decodeUTF8String ( final byte[]  buffer,
final int  offset,
final int  size 
)
static

Decodes the given consecutive UTF-8 characters within buffer to String.

Definition at line 91 of file BTUtils.java.

Here is the caller graph for this function:

Member Data Documentation

◆ UUID128_BASE

final String org.direct_bt.BTUtils.UUID128_BASE = "00000000-0000-1000-8000-00805f9b34fb"
static

Base UUID128 used to express a UUID16, etc.

Definition at line 33 of file BTUtils.java.


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