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
impl GattServerFacade
pub fn new() -> GattServerFacade
Sourcepub async fn publish_server(&self, args: Value) -> Result<(), Error>
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:
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] }] }] }
pub async fn close_server(&self)
pub fn cleanup(&self)
pub fn print(&self)
Trait Implementations§
Source§impl Debug for GattServerFacade
impl Debug for GattServerFacade
Source§impl Facade for GattServerFacade
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,
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,
Auto Trait Implementations§
impl !Freeze for GattServerFacade
impl !RefUnwindSafe for GattServerFacade
impl Send for GattServerFacade
impl Sync for GattServerFacade
impl Unpin for GattServerFacade
impl !UnwindSafe for GattServerFacade
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, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more