1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! L2CAP connection-oriented channels.
//!
//! The one place CoreBluetooth stops being request/response. Instead of
//! attributes you get a bidirectional byte pipe with no 512-byte ceiling and no
//! ATT round trip per write — the right tool for firmware images, audio, or
//! anything else that would otherwise be thousands of characteristic writes.
//!
//! Neither side is Web Bluetooth; the specification has no L2CAP.
//!
//! ```no_run
//! # use webbluetooth::stream::StreamExt;
//! # async fn example(device: webbluetooth::BluetoothDevice) -> webbluetooth::Result<()> {
//! let channel = device.open_l2cap_channel(0x0080).await?;
//! let mut incoming = channel.take_incoming().expect("first call");
//!
//! channel.send(b"hello")?;
//! while let Some(chunk) = incoming.next().await {
//! println!("{} bytes", chunk.len());
//! }
//! # Ok(())
//! # }
//! ```
//!
//! **A chunk is not a message.** L2CAP CoC is a byte stream: what arrives in
//! one chunk is whatever one read returned. Frame it yourself.
//! # Where the pieces are
//!
//! The channel type itself is [`webbluetooth_core::l2cap`], which is where the
//! backlog, the async stream and the close notification live — they are the
//! same on every platform, and were written three times over before they were
//! written once. What is here is the choice of *which* platform socket fills
//! it in, and the step that turns whatever a backend hands over into a
//! channel.
use crateResult;
use l2cap as platform;
use l2cap as platform;
use l2cap as platform;
pub use L2capChannel;
pub use ;
/// Build a channel from whatever the backend had to hand over.
///
/// One name, three platforms. A backend returns the raw thing its stack
/// produced — a `CBL2CAPChannel` from Apple, an address to connect to on
/// Linux, an already-connected socket on Android — because opening a channel
/// is the only part of this that is platform work. This is where that becomes
/// a channel.
pub
/// See [`from_target`].
pub
/// See [`from_target`].
pub