trouble_host/
config.rs

1//! Compile-time configuration.
2//!
3//! `trouble` has some configuration settings that are set at compile time.
4//!
5//! They can be set in two ways:
6//!
7//! - Via Cargo features: enable a feature like `<name>-<value>`. `name` must be in lowercase and
8//!   use dashes instead of underscores. For example. `l2cap-rx-queue-size-4`. Only a selection of values
9//!   is available, check `Cargo.toml` for the list.
10//! - Via environment variables at build time: set the variable named `TROUBLE_HOST_<value>`. For example
11//!   `TROUBLE_HOST_L2CAP_RX_QUEUE_SIZE=1 cargo build`. You can also set them in the `[env]` section of `.cargo/config.toml`.
12//!   Any value can be set, unlike with Cargo features.
13//!
14//! Environment variables take precedence over Cargo features. If two Cargo features are enabled for the same setting
15//! with different values, compilation fails.
16mod raw {
17    #![allow(unused)]
18    include!(concat!(env!("OUT_DIR"), "/config.rs"));
19}
20
21/// Connection event queue size
22///
23/// This is the connection event queue size for every connection.
24///
25/// Default: 2.
26pub const CONNECTION_EVENT_QUEUE_SIZE: usize = raw::CONNECTION_EVENT_QUEUE_SIZE;
27
28// ======== L2CAP parameters
29//
30/// L2CAP TX queue size
31///
32/// This is the tx queue size for l2cap packets not sent directly in HCI (i.e. attributes).
33///
34/// If the controller does not support tx buffering, increasing this value will allow
35/// a higher throughput between the controller and host.
36///
37/// Default: 8.
38pub const L2CAP_TX_QUEUE_SIZE: usize = raw::L2CAP_TX_QUEUE_SIZE;
39
40/// L2CAP RX queue size
41///
42/// This is the rx queue size of every l2cap channel. Every channel have to be able
43/// to buffer at least 1 packet, but if the controller already does buffering this
44/// may be sufficient.
45///
46/// If the controller does not support rx buffering, increasing this value will allow
47/// a higher throughput between the controller and host.
48///
49/// Default: 8.
50pub const L2CAP_RX_QUEUE_SIZE: usize = raw::L2CAP_RX_QUEUE_SIZE;
51
52/// L2CAP default packet pool size
53///
54/// This is the default packet pool size of all l2cap channels. There has to be at least
55/// 1 packet that can be allocated, but the pool is shared among different channels.
56///
57/// Default: 16.
58pub const DEFAULT_PACKET_POOL_SIZE: usize = raw::DEFAULT_PACKET_POOL_SIZE;
59
60/// L2CAP default packet pool mtu
61///
62/// This is the default packet pool mtu for all l2cap channels.
63///
64/// Default: 251.
65pub const DEFAULT_PACKET_POOL_MTU: usize = raw::DEFAULT_PACKET_POOL_MTU;
66
67/// Default: 1.
68pub const GATT_CLIENT_NOTIFICATION_MAX_SUBSCRIBERS: usize = raw::GATT_CLIENT_NOTIFICATION_MAX_SUBSCRIBERS;
69
70/// GATT notification queue size.
71///
72/// Default: 1.
73pub const GATT_CLIENT_NOTIFICATION_QUEUE_SIZE: usize = raw::GATT_CLIENT_NOTIFICATION_QUEUE_SIZE;