bt_common/
lib.rs

1// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5extern crate core as rust_core;
6#[macro_use]
7extern crate lazy_static;
8
9/// Peers are identified by ids, which should be treated as opaque by service
10/// libraries. Stack implementations should ensure that each PeerId identifies a
11/// single peer over a single instance of the stack - a
12/// [`bt_gatt::Central::connect`] should always attempt to connect to the
13/// same peer as long as the PeerId was retrieved after the `Central` was
14/// instantiated. PeerIds can be valid longer than that (often if the peer is
15/// bonded)
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
17pub struct PeerId(pub u64);
18
19impl rust_core::fmt::Display for PeerId {
20    fn fmt(
21        &self,
22        f: &mut rust_core::fmt::Formatter<'_>,
23    ) -> std::result::Result<(), std::fmt::Error> {
24        write!(f, "{:x}", self.0)
25    }
26}
27
28pub mod core;
29
30pub mod company_id;
31pub use company_id::CompanyId;
32
33pub mod generic_audio;
34
35pub mod packet_encoding;
36
37pub mod uuids;
38pub use crate::uuids::Uuid;
39
40pub mod debug_command;