Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
DBTConst.hpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2021 Gothel Software e.K.
4 * Copyright (c) 2021 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
26#ifndef DBT_CONST_HPP_
27#define DBT_CONST_HPP_
28
29#include <cstddef>
30
31#include <jau/int_types.hpp>
32
33namespace direct_bt {
34
35 using namespace jau::fractions_i64_literals;
36 using namespace jau::int_literals;
37
38 /** \addtogroup DBTSystemAPI
39 *
40 * @{
41 */
42
43#ifdef __linux__
44
45 /**
46 * Linux/BlueZ prohibits access to the existing SMP implementation via L2CAP (socket).
47 */
48 inline constexpr const bool SMP_SUPPORTED_BY_OS = false;
49
50 inline constexpr const bool USE_LINUX_BT_SECURITY = true;
51
52 inline constexpr const bool CONSIDER_HCI_CMD_FOR_SMP_STATE = false;
53
54 inline constexpr const bool SCAN_DISABLED_POST_CONNECT = true;
55
56#else
57
58 inline constexpr const bool SMP_SUPPORTED_BY_OS = true;
59
60 inline constexpr const bool USE_LINUX_BT_SECURITY = false;
61
62 inline constexpr const bool CONSIDER_HCI_CMD_FOR_SMP_STATE = true;
63
64 inline constexpr const bool SCAN_DISABLED_POST_CONNECT = false;
65
66#endif
67
68 /**
69 * Maximum time in fractions of seconds to wait for a thread shutdown.
70 *
71 * Usually used for socket reader threads, like used within HCIHandler.
72 */
73 inline constexpr const jau::fraction_i64 THREAD_SHUTDOWN_TIMEOUT_MS = 8_s;
74
75 /**
76 * Maximum time in fractions of seconds to wait for the next SMP event.
77 */
78 inline constexpr const jau::fraction_i64 SMP_NEXT_EVENT_TIMEOUT_MS = 2_s;
79
80 /**
81 * Maximum time in fractions of seconds to wait for L2CAP client connection when adapter is in server mode.
82 */
84
85 /**
86 * Maximum number of enabling discovery in background in case of failure
87 */
88 inline constexpr const jau::nsize_t MAX_BACKGROUND_DISCOVERY_RETRY = 3;
89
90 /**@}*/
91
92} // namespace direct_bt
93
94#endif /* DBT_CONST_HPP_ */
constexpr const bool CONSIDER_HCI_CMD_FOR_SMP_STATE
Definition: DBTConst.hpp:62
constexpr const bool SMP_SUPPORTED_BY_OS
Definition: DBTConst.hpp:58
constexpr const jau::fraction_i64 THREAD_SHUTDOWN_TIMEOUT_MS
Maximum time in fractions of seconds to wait for a thread shutdown.
Definition: DBTConst.hpp:73
constexpr const bool SCAN_DISABLED_POST_CONNECT
Definition: DBTConst.hpp:64
constexpr const jau::fraction_i64 L2CAP_CLIENT_CONNECT_TIMEOUT_MS
Maximum time in fractions of seconds to wait for L2CAP client connection when adapter is in server mo...
Definition: DBTConst.hpp:83
constexpr const jau::fraction_i64 SMP_NEXT_EVENT_TIMEOUT_MS
Maximum time in fractions of seconds to wait for the next SMP event.
Definition: DBTConst.hpp:78
constexpr const jau::nsize_t MAX_BACKGROUND_DISCOVERY_RETRY
Maximum number of enabling discovery in background in case of failure.
Definition: DBTConst.hpp:88
constexpr const bool USE_LINUX_BT_SECURITY
Definition: DBTConst.hpp:60
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
Definition: int_types.hpp:53