Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
java
org
direct_bt
BTMode.java
Go to the documentation of this file.
1
/**
2
* Author: Sven Gothel <sgothel@jausoft.com>
3
* Copyright (c) 2020 Gothel Software e.K.
4
* Copyright (c) 2020 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
* Bluetooth adapter operating mode
29
* <p>
30
* See {@link #get(int)} for its native integer mapping.
31
* </p>
32
* @since 2.0.0
33
*/
34
public
enum
BTMode
{
35
/** Zero mode, neither DUAL, BREDR nor LE. Usually an error. */
36
NONE
(0),
37
/** Dual Bluetooth mode, i.e. BREDR + LE. */
38
DUAL
(1),
39
/** BREDR only Bluetooth mode */
40
BREDR
(2),
41
/** LE only Bluetooth mode */
42
LE
(3);
43
44
public
final
int
value
;
45
46
/**
47
* Maps the specified name to a constant of BTMode.
48
* <p>
49
* Implementation simply returns {@link #valueOf(String)}.
50
* This maps the constant names itself to their respective constant.
51
* </p>
52
* @param name the string name to be mapped to a constant of this enum type.
53
* @return the corresponding constant of this enum type.
54
* @throws IllegalArgumentException if the specified name can't be mapped to a constant of this enum type
55
* as described above.
56
*/
57
public
static
BTMode
get
(
final
String name)
throws
IllegalArgumentException {
58
return
valueOf(name);
59
}
60
61
/**
62
* Maps the specified integer value to a constant of {@link BTMode}.
63
* @param value the integer value to be mapped to a constant of this enum type.
64
* @return the corresponding constant of this enum type, using {@link #NONE} if not supported.
65
*/
66
public
static
BTMode
get
(
final
int
value) {
67
switch
(value) {
68
case
0x01:
return
DUAL;
69
case
0x02:
return
BREDR;
70
case
0x03:
return
LE;
71
default
:
return
NONE;
72
}
73
}
74
75
BTMode
(
final
int
v) {
76
value = v;
77
}
78
}
org.direct_bt.BTMode.BTMode
BTMode(final int v)
Definition:
BTMode.java:75
org.direct_bt.BTMode.LE
LE
LE only Bluetooth mode.
Definition:
BTMode.java:42
org.direct_bt.BTMode.BREDR
BREDR
BREDR only Bluetooth mode.
Definition:
BTMode.java:40
org.direct_bt.BTMode.DUAL
DUAL
Dual Bluetooth mode, i.e.
Definition:
BTMode.java:38
org.direct_bt.BTMode
Bluetooth adapter operating mode.
Definition:
BTMode.java:34
org.direct_bt.BTMode.NONE
NONE
Zero mode, neither DUAL, BREDR nor LE.
Definition:
BTMode.java:36
org.direct_bt.BTMode.value
final int value
Definition:
BTMode.java:44
Generated on Wed Sep 1 2021 22:28:08 for Direct-BT by
1.8.18