Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose bindings #31

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "MAVSDK-Proto"]
path = proto
path = mavsdk-bindings/proto
url = https://github.com/mavlink/MAVSDK-Proto.git
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ version = "0.1.0"
authors = ["Ildar Sadykov <[email protected]>"]
edition = "2021"

[workspace]
members = [
".",
"mavsdk-bindings",
]

[dependencies]
tonic = "0.6.0"
prost = "0.9.0"

thiserror = "1.0.30"
futures-util = { version = "0.3.17", default-features = false }
mavsdk-bindings = { path = "./mavsdk-bindings" }
prost = "0.9.0"

[dev-dependencies]
tokio = { version = "1.12.0", features = ["rt-multi-thread", "macros", "time"] }

[build-dependencies]
tonic-build = "0.6.0"
13 changes: 13 additions & 0 deletions mavsdk-bindings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "mavsdk-bindings"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tonic = "0.6.0"
prost = "0.9.0"

[build-dependencies]
tonic-build = "0.6.0"
File renamed without changes.
12 changes: 12 additions & 0 deletions mavsdk-bindings/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
macro_rules! include_plugin {
($plugin: ident, $path: tt ) => {
#[allow(clippy::all, clippy::pedantic)]
pub mod $plugin {
tonic::include_proto!($path);
}
};
}

include_plugin!(info, "mavsdk.rpc.info");
include_plugin!(mocap, "mavsdk.rpc.mocap");
include_plugin!(telemetry, "mavsdk.rpc.telemetry");
2 changes: 1 addition & 1 deletion src/info.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{FromRpcResponse, RequestError, RequestResult, TonicResult};

mod pb {
tonic::include_proto!("mavsdk.rpc.info");
pub use mavsdk_bindings::info::*;
}

#[derive(PartialEq, Clone, Default, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/mocap.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{FromRpcResponse, RequestError, RequestResult, TonicResult};

mod pb {
tonic::include_proto!("mavsdk.rpc.mocap");
pub use mavsdk_bindings::mocap::*;
}

/// Global position/attitude estimate from a vision source.
Expand Down
2 changes: 1 addition & 1 deletion src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{RequestError, RequestResult};
use futures_util::stream::{Stream, StreamExt};

mod pb {
tonic::include_proto!("mavsdk.rpc.telemetry");
pub use mavsdk_bindings::telemetry::*;
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
Expand Down
Loading