pub struct GattServerFacade { /* private fields */ }
Expand description

Perform Gatt Server operations.

Note this object is shared among all threads created by server.

Implementations§

source§

impl GattServerFacade

source

pub fn new() -> GattServerFacade

source

pub async fn publish_server(&self, args: Value) -> Result<(), Error>

Publish a GATT Server.

The input is a JSON object representing the attributes of the GATT server Database to setup. This function will also start listening for incoming requests to Characteristics and Descriptors in each Service.

This is primarially using the same input syntax as in the Android AOSP ACTS test framework at: <aosp_root>/tools/test/connectivity/acts/framework/acts/test_utils/bt/gatt_test_database.py

A “database” key wraps the database at: /tools/test/connectivity/acts/framework/acts/controllers/fuchsia_lib/bt/gatts_lib.py

Example python dictionary that’s turned into JSON (sub dic values can be found in <aosp_root>/tools/test/connectivity/acts/framework/acts/test_utils/bt/bt_constants.py:

SMALL_DATABASE = { ‘services’: [{ ‘uuid’: ‘00001800-0000-1000-8000-00805f9b34fb’, ‘type’: gatt_service_types[‘primary’], ‘characteristics’: [{ ‘uuid’: gatt_char_types[‘device_name’], ‘properties’: gatt_characteristic[‘property_read’], ‘permissions’: gatt_characteristic[‘permission_read’], ‘handle’: 0x0003, ‘value_type’: gatt_characteristic_value_format[‘string’], ‘value’: ‘Test Database’ }, { ‘uuid’: gatt_char_types[‘appearance’], ‘properties’: gatt_characteristic[‘property_read’], ‘permissions’: gatt_characteristic[‘permission_read’], ‘handle’: 0x0005, ‘value_type’: gatt_characteristic_value_format[‘sint32’], ‘offset’: 0, ‘value’: 17 }, { ‘uuid’: gatt_char_types[‘peripheral_pref_conn’], ‘properties’: gatt_characteristic[‘property_read’], ‘permissions’: gatt_characteristic[‘permission_read’], ‘handle’: 0x0007 }] }, { ‘uuid’: ‘00001801-0000-1000-8000-00805f9b34fb’, ‘type’: gatt_service_types[‘primary’], ‘characteristics’: [{ ‘uuid’: gatt_char_types[‘service_changed’], ‘properties’: gatt_characteristic[‘property_indicate’], ‘permissions’: gatt_characteristic[‘permission_read’] | gatt_characteristic[‘permission_write’], ‘handle’: 0x0012, ‘value_type’: gatt_characteristic_value_format[‘byte’], ‘value’: [0x0000], ‘descriptors’: [{ ‘uuid’: gatt_char_desc_uuids[‘client_char_cfg’], ‘permissions’: gatt_descriptor[‘permission_read’] | gatt_descriptor[‘permission_write’], ‘value’: [0x0000] }] }, { ‘uuid’: ‘0000b004-0000-1000-8000-00805f9b34fb’, ‘properties’: gatt_characteristic[‘property_read’], ‘permissions’: gatt_characteristic[‘permission_read’], ‘handle’: 0x0015, ‘value_type’: gatt_characteristic_value_format[‘byte’], ‘value’: [0x04] }] }] }

source

pub async fn close_server(&self)

source

pub fn cleanup(&self)

source

pub fn print(&self)

Trait Implementations§

source§

impl Debug for GattServerFacade

source§

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

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

impl Facade for GattServerFacade

source§

fn handle_request<'life0, 'async_trait>( &'life0 self, method: String, args: Value ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asynchronously handle the incoming request for the given method and arguments, returning a future object representing the pending operation.
source§

fn cleanup(&self)

In response to a request to /cleanup, cleanup any cross-request state.
source§

fn print(&self)

In response to a request to /print, log relevant facade state.

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
source§

impl<T> DebugExt for T
where T: Debug,

source§

fn debug(&self) -> String

source§

impl<T> Encode<Ambiguous1> for T

source§

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> Encode<Ambiguous2> for T

source§

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> IntoAny for T
where T: 'static + Send + Sync,

§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Cast the given object into a dyn std::any::Any.
source§

impl<T, U> IntoExt<U> for T
where U: FromExt<T>,

source§

fn into_ext(self) -> U

Performs the conversion.
source§

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

source§

const PRESENT: Presence<Self> = _

source§

const ABSENT: Presence<Self> = _

§

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, 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.
source§

impl<T, U> TryIntoExt<U> for T
where U: TryFromExt<T>,

§

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

source§

fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>

Tries to perform the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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
source§

impl<St> WithTag for St

source§

fn tagged<T>(self, tag: T) -> Tagged<T, St>

Produce a new stream from this one which yields item tupled with a constant tag