Struct ockam_transport_ble::BleTransport
source · [−]pub struct BleTransport { /* private fields */ }
Expand description
High level management interface for BLE transports
Be aware that only one BleTransport
can exist per node, as it
registers itself as a router for the BLE
address type. Multiple
calls to BleTransport::create
will panic.
To register additional connections on an already initialised
BleTransport
, use
ble.connect()
. To listen for
incoming connections use
ble.listen()
use ockam_transport_ble::{BleClient, BleTransport};
use ockam_transport_ble::driver::btleplug::BleAdapter;
// Create a ble_client
let ble_adapter = BleAdapter::try_new().await?;
let ble_client = BleClient::with_adapter(ble_adapter);
// Initialize the BLE Transport.
let ble = BleTransport::create(&ctx).await?;
// Try to connect to BleServer
ble.connect(ble_client, "ockam_ble_1".to_string()).await?;
Implementations
sourceimpl BleTransport
impl BleTransport
sourcepub async fn create(ctx: &Context) -> Result<Self>
pub async fn create(ctx: &Context) -> Result<Self>
Create a new BLE transport and router for the current node
sourcepub async fn connect<A: BleClientDriver + BleStreamDriver + Send + 'static, S: AsRef<str> + Debug>(
&self,
ble_client: BleClient<A>,
peer: S
) -> Result<()>
pub async fn connect<A: BleClientDriver + BleStreamDriver + Send + 'static, S: AsRef<str> + Debug>(
&self,
ble_client: BleClient<A>,
peer: S
) -> Result<()>
Establish an outgoing BLE connection on an existing transport
Starts a new pair of Ble connection workers
One worker handles outgoing messages, while another handles incoming messages. The local worker address is chosen based on the peer the worker is meant to be connected to.
Trait Implementations
sourceimpl AsyncTryClone for BleTransport
impl AsyncTryClone for BleTransport
Auto Trait Implementations
impl !RefUnwindSafe for BleTransport
impl Send for BleTransport
impl Sync for BleTransport
impl Unpin for BleTransport
impl !UnwindSafe for BleTransport
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more