summaryrefslogtreecommitdiff
path: root/system/rust/src/gatt/channel.rs
blob: 57d1b53b0665cbc03a77872b1d752a6fc4442253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! This represents the TX end of an ATT Transport, to be either mocked (in
//! test) or linked to FFI (in production).

use crate::packets::att;
use pdl_runtime::EncodeError;

use super::ids::TransportIndex;

/// An instance of this trait will be provided to the GattModule on
/// initialization.
pub trait AttTransport {
    /// Serializes and sends a packet to the device associated with the
    /// specified transport. Note that the packet may be dropped if the link
    /// is disconnected, but the result will still be Ok(()).
    ///
    /// The tcb_idx is an identifier for this transport supplied from the
    /// native stack, and represents an underlying ACL-LE connection.
    fn send_packet(&self, tcb_idx: TransportIndex, packet: att::Att) -> Result<(), EncodeError>;
}