pub struct LocalServiceProxy { /* private fields */ }
Implementations§
Source§impl LocalServiceProxy
impl LocalServiceProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.bluetooth.gatt2/LocalService.
Sourcepub fn take_event_stream(&self) -> LocalServiceEventStream
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.
Sourcepub fn characteristic_configuration(
&self,
peer_id: &PeerId,
handle: &Handle,
notify: bool,
indicate: bool,
) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
pub fn characteristic_configuration( &self, peer_id: &PeerId, handle: &Handle, notify: bool, indicate: bool, ) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
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 thenotify
andindicate
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.
Sourcepub fn read_value(
&self,
peer_id: &PeerId,
handle: &Handle,
offset: i32,
) -> QueryResponseFut<LocalServiceReadValueResult, DefaultFuchsiaResourceDialect>
pub fn read_value( &self, peer_id: &PeerId, handle: &Handle, offset: i32, ) -> QueryResponseFut<LocalServiceReadValueResult, DefaultFuchsiaResourceDialect>
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.
Sourcepub fn write_value(
&self,
payload: &LocalServiceWriteValueRequest,
) -> QueryResponseFut<LocalServiceWriteValueResult, DefaultFuchsiaResourceDialect>
pub fn write_value( &self, payload: &LocalServiceWriteValueRequest, ) -> QueryResponseFut<LocalServiceWriteValueResult, DefaultFuchsiaResourceDialect>
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 tovalue
. 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.
Sourcepub fn peer_update(
&self,
payload: &LocalServicePeerUpdateRequest,
) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
pub fn peer_update( &self, payload: &LocalServicePeerUpdateRequest, ) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
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.
Sourcepub fn value_changed_credit(&self, additional_credit: u8) -> Result<(), Error>
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
impl Clone for LocalServiceProxy
Source§fn clone(&self) -> LocalServiceProxy
fn clone(&self) -> LocalServiceProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for LocalServiceProxy
impl Debug for LocalServiceProxy
Source§impl LocalServiceProxyInterface for LocalServiceProxy
impl LocalServiceProxyInterface for LocalServiceProxy
type CharacteristicConfigurationResponseFut = QueryResponseFut<()>
type ReadValueResponseFut = QueryResponseFut<Result<Vec<u8>, Error>>
type WriteValueResponseFut = QueryResponseFut<Result<(), Error>>
type PeerUpdateResponseFut = QueryResponseFut<()>
fn characteristic_configuration( &self, peer_id: &PeerId, handle: &Handle, notify: bool, indicate: bool, ) -> Self::CharacteristicConfigurationResponseFut
fn read_value( &self, peer_id: &PeerId, handle: &Handle, offset: i32, ) -> Self::ReadValueResponseFut
fn write_value( &self, payload: &LocalServiceWriteValueRequest, ) -> Self::WriteValueResponseFut
fn peer_update( &self, payload: &LocalServicePeerUpdateRequest, ) -> Self::PeerUpdateResponseFut
fn value_changed_credit(&self, additional_credit: u8) -> Result<(), Error>
Source§impl Proxy for LocalServiceProxy
impl Proxy for LocalServiceProxy
Source§type Protocol = LocalServiceMarker
type Protocol = LocalServiceMarker
Proxy
controls.Source§fn from_channel(inner: AsyncChannel) -> Self
fn from_channel(inner: AsyncChannel) -> Self
Source§fn into_channel(self) -> Result<AsyncChannel, Self>
fn into_channel(self) -> Result<AsyncChannel, Self>
Source§fn as_channel(&self) -> &AsyncChannel
fn as_channel(&self) -> &AsyncChannel
§fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
Auto Trait Implementations§
impl Freeze for LocalServiceProxy
impl !RefUnwindSafe for LocalServiceProxy
impl Send for LocalServiceProxy
impl Sync for LocalServiceProxy
impl Unpin for LocalServiceProxy
impl !UnwindSafe for LocalServiceProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)