forked from auracaster/bumble_mirror
Proof-of-concept Rust wrapper
This contains Rust wrappers around enough of the Python API to implement Rust versions of the `battery_client` and `run_scanner` examples. The goal is to gather feedback on the approach, and of course to show that it is possible. The module structure mirrors that of the Python. The Rust API is not optimally Rust-y, but given the constraints of everything having to delegate to Python, it's at least usable. Notably, this does not yet solve the packaging problem: users must have an appropriate virtualenv, libpython, etc. [PyOxidizer](https://github.com/indygreg/PyOxidizer) may be a viable path there.
This commit is contained in:
28
rust/src/wrapper/gatt_client.rs
Normal file
28
rust/src/wrapper/gatt_client.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2023 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! GATT client support
|
||||
|
||||
use pyo3::PyObject;
|
||||
|
||||
/// Equivalent to the Python `ProfileServiceProxy`.
|
||||
pub trait ProfileServiceProxy {
|
||||
/// The module containing the proxy class
|
||||
const PROXY_CLASS_MODULE: &'static str;
|
||||
/// The module class name
|
||||
const PROXY_CLASS_NAME: &'static str;
|
||||
|
||||
/// Wrap a PyObject in the Rust wrapper type
|
||||
fn wrap(obj: PyObject) -> Self;
|
||||
}
|
||||
Reference in New Issue
Block a user