pub struct LocalServiceProxy { /* private fields */ }

Implementations§

source§

impl LocalServiceProxy

source

pub fn new(channel: AsyncChannel) -> Self

Create a new Proxy for fuchsia.bluetooth.gatt2/LocalService.

source

pub fn take_event_stream(&self) -> LocalServiceEventStream

Get a Stream of events from the remote end of the protocol.

§Panics

Panics if the event stream was already taken.

source

pub fn characteristic_configuration( &self, peer_id: &PeerId, handle: &Handle, notify: bool, indicate: bool ) -> QueryResponseFut<()>

This notifies the current configuration of a particular characteristic/descriptor for a particular peer. It will be called when the peer GATT client changes the configuration.

The Bluetooth stack maintains the state of each peer’s configuration across reconnections. As such, this method will also be called when a peer connects for each characteristic with the initial, persisted state of the newly-connected peer’s configuration. However, clients should not rely on this state being persisted indefinitely by the Bluetooth stack.

  • request peer_id The PeerId of the GATT client associated with this particular CCC.
  • request handle The handle of the characteristic associated with the notify and indicate parameters.
  • request notify True if the client has enabled notifications, false otherwise.
  • request indicate True if the client has enabled indications, false otherwise.
  • response empty Returns nothing to acknowledge the characteristic configuration.
source

pub fn read_value( &self, peer_id: &PeerId, handle: &Handle, offset: i32 ) -> QueryResponseFut<LocalServiceReadValueResult>

Called when a peer requests to read the value of a characteristic or descriptor. It is guaranteed that the peer satisfies the permssions associated with this attribute.

  • request peer_id The PeerId of the GATT client making the read request.
  • request handle The handle of the requested descriptor/characteristic.
  • request offset The offset at which to start reading the requested value.
  • response value The value of the characteristic.
  • error See gatt2.Error documentation for possible errors.
source

pub fn write_value( &self, payload: &LocalServiceWriteValueRequest ) -> QueryResponseFut<LocalServiceWriteValueResult>

Called when a peer issues a request to write the value of a characteristic or descriptor. It is guaranteed that the peer satisfies the permissions associated with this attribute.

  • request peer_id The PeerId of the GATT client making the write request. Always present.
  • request handle The handle of the requested descriptor/characteristic. Always present.
  • request offset The offset at which to start writing the value. If the offset is 0, any existing value should be overwritten by the new value. Otherwise, the existing value from offset:(offset + len(value)) should be changed to value. Always present.
  • request value The new value for the descriptor/characteristic. Always present, but may be the empty string.
  • response The implementation must send an empty response once the value has been updated as confirmation.
  • error See gatt2.Error documentation for possible errors.
source

pub fn peer_update( &self, payload: &LocalServicePeerUpdateRequest ) -> QueryResponseFut<()>

Called to provide GATT information specific to a peer. PeerUpdate will not be called unless the prior invocation received a response. As such, the implementation can simply ignore the first invocation if they are not interested in any PeerUpdate fields.

A PeerUpdate will be made before propagating any other interaction from the peer to the LocalService (Write/ReadValue, CharacteristicConfiguration) on a best-effort basis, as long as all preceding PeerUpdates were acknowledged.

Not currently sent. Comment on https://fxbug.dev/42178509 to request support

  • request peer_id The PeerId the update pertains to. Always present.
  • request mtu The maximum number of bytes that fit in a notification/indication to this peer. Any bytes past this limit are silently truncated. Most clients need not concern themselves with this unless they are using notifications/indications for high throughput. Optional.
  • response An empty response to acknowledge that the update was received.
source

pub fn value_changed_credit(&self, additional_credit: u8) -> Result<(), Error>

Add credit for sending indications/notifications. Implementors are defined to start out with INITIAL_VALUE_CHANGED_CREDITS credits before this method is called. Implementors must keep track of the available credit they have. The implementor can send exactly one OnNotifyValue or OnIndicateValue event for each credit. Note that ValueChangedCredit will only be called if at least one indication/notification has been sent since the prior call.

Trait Implementations§

source§

impl Clone for LocalServiceProxy

source§

fn clone(&self) -> LocalServiceProxy

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LocalServiceProxy

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl LocalServiceProxyInterface for LocalServiceProxy

§

type CharacteristicConfigurationResponseFut = QueryResponseFut<()>

source§

fn characteristic_configuration( &self, peer_id: &PeerId, handle: &Handle, notify: bool, indicate: bool ) -> Self::CharacteristicConfigurationResponseFut

§

type ReadValueResponseFut = QueryResponseFut<Result<Vec<u8>, Error>>

source§

fn read_value( &self, peer_id: &PeerId, handle: &Handle, offset: i32 ) -> Self::ReadValueResponseFut

§

type WriteValueResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn write_value( &self, payload: &LocalServiceWriteValueRequest ) -> Self::WriteValueResponseFut

§

type PeerUpdateResponseFut = QueryResponseFut<()>

source§

fn peer_update( &self, payload: &LocalServicePeerUpdateRequest ) -> Self::PeerUpdateResponseFut

source§

fn value_changed_credit(&self, additional_credit: u8) -> Result<(), Error>

source§

impl Proxy for LocalServiceProxy

§

type Protocol = LocalServiceMarker

The protocol which this Proxy controls.
source§

fn from_channel(inner: AsyncChannel) -> Self

Create a proxy over the given channel.
source§

fn into_channel(self) -> Result<AsyncChannel, Self>

Attempt to convert the proxy back into a channel. Read more
source§

fn as_channel(&self) -> &AsyncChannel

Get a reference to the proxy’s underlying channel. Read more
§

fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>

Attempt to convert the proxy back into a client end. Read more
§

fn is_closed(&self) -> bool

Returns true if the proxy has received the PEER_CLOSED signal.
§

fn on_closed(&self) -> OnSignals<'_, Unowned<'_, Handle>>

Returns a future that completes when the proxy receives the PEER_CLOSED signal.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Encode<Ambiguous1> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T> Encode<Ambiguous2> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more