Direct-BT
v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
java
org
direct_bt
GAPFlags.java
Go to the documentation of this file.
1
/**
2
* Author: Sven Gothel <sgothel@jausoft.com>
3
* Copyright (c) 2022 Gothel Software e.K.
4
* Copyright (c) 2022 ZAFENA AB
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining
7
* a copy of this software and associated documentation files (the
8
* "Software"), to deal in the Software without restriction, including
9
* without limitation the rights to use, copy, modify, merge, publish,
10
* distribute, sublicense, and/or sell copies of the Software, and to
11
* permit persons to whom the Software is furnished to do so, subject to
12
* the following conditions:
13
*
14
* The above copyright notice and this permission notice shall be
15
* included in all copies or substantial portions of the Software.
16
*
17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
*/
25
package
org.direct_bt;
26
27
/**
28
* Bit mask of 'Extended Inquiry Response' (EIR) data fields,
29
* indicating a set of related data.
30
*
31
* @since 2.5.3
32
*
33
* @see {@link EInfoReport}
34
*/
35
public
class
GAPFlags
{
36
37
/**
38
* Each enum represents a 'Extended Inquiry Response' (EIR) data field type bit.
39
*
40
* @since 2.5.3
41
*
42
* @see {@link GAPFlags}
43
* @see {@link EInfoReport}
44
*/
45
public
enum
Bit
{
46
NONE
((
byte
)0),
47
LE_Ltd_Disc
((
byte
)(1 << 0)),
48
LE_Gen_Disc
((
byte
)(1 << 1)),
49
BREDR_UNSUP
((
byte
)(1 << 2)),
50
Dual_SameCtrl
((
byte
)(1 << 3)),
51
Dual_SameHost
((
byte
)(1 << 4)),
52
RESERVED1
((
byte
)(1 << 5)),
53
RESERVED2
((
byte
)(1 << 6)),
54
RESERVED3
((
byte
)(1 << 7));
55
56
Bit
(
final
byte
v) { value = v; }
57
public
final
byte
value
;
58
}
59
60
public
byte
mask
;
61
62
public
GAPFlags
(
final
byte
v) {
63
mask
= v;
64
}
65
66
public
boolean
isSet
(
final
Bit
bit) {
return
0 != (
mask
& bit.value ); }
67
public
void
set
(
final
Bit
bit) {
mask
= (byte)(
mask
| bit.value); }
68
69
@Override
70
public
String
toString
() {
71
int
count = 0;
72
final
StringBuilder out =
new
StringBuilder();
73
for
(
final
Bit
dt :
Bit
.values()) {
74
if
(
isSet
(dt) ) {
75
if
( 0 < count ) { out.append(
", "
); }
76
out.append(dt.name()); count++;
77
}
78
}
79
if
( 1 < count ) {
80
out.insert(0,
"["
);
81
out.append(
"]"
);
82
}
83
return
out.toString();
84
}
85
}
org.direct_bt.GAPFlags
Bit mask of 'Extended Inquiry Response' (EIR) data fields, indicating a set of related data.
Definition:
GAPFlags.java:35
org.direct_bt.GAPFlags.isSet
boolean isSet(final Bit bit)
Definition:
GAPFlags.java:66
org.direct_bt.GAPFlags.GAPFlags
GAPFlags(final byte v)
Definition:
GAPFlags.java:62
org.direct_bt.GAPFlags.mask
byte mask
Definition:
GAPFlags.java:60
org.direct_bt.GAPFlags.toString
String toString()
Definition:
GAPFlags.java:70
org.direct_bt.GAPFlags.Bit
Each enum represents a 'Extended Inquiry Response' (EIR) data field type bit.
Definition:
GAPFlags.java:45
org.direct_bt.GAPFlags.Bit.value
final byte value
Definition:
GAPFlags.java:57
org.direct_bt.GAPFlags.Bit.RESERVED1
RESERVED1
Definition:
GAPFlags.java:52
org.direct_bt.GAPFlags.Bit.LE_Gen_Disc
LE_Gen_Disc
Definition:
GAPFlags.java:48
org.direct_bt.GAPFlags.Bit.LE_Ltd_Disc
LE_Ltd_Disc
Definition:
GAPFlags.java:47
org.direct_bt.GAPFlags.Bit.NONE
NONE
Definition:
GAPFlags.java:46
org.direct_bt.GAPFlags.Bit.RESERVED3
RESERVED3
Definition:
GAPFlags.java:54
org.direct_bt.GAPFlags.Bit.RESERVED2
RESERVED2
Definition:
GAPFlags.java:53
org.direct_bt.GAPFlags.Bit.Bit
Bit(final byte v)
Definition:
GAPFlags.java:56
org.direct_bt.GAPFlags.Bit.BREDR_UNSUP
BREDR_UNSUP
Definition:
GAPFlags.java:49
org.direct_bt.GAPFlags.Bit.Dual_SameHost
Dual_SameHost
Definition:
GAPFlags.java:51
org.direct_bt.GAPFlags.Bit.Dual_SameCtrl
Dual_SameCtrl
Definition:
GAPFlags.java:50
Generated on Sun May 12 2024 09:26:40 for Direct-BT by
1.9.4