Proc macro preparation
This commit is contained in:
17
examples/Cargo.toml
Normal file
17
examples/Cargo.toml
Normal file
@@ -0,0 +1,17 @@
|
||||
[package]
|
||||
name = "simconnect-sdk-examples"
|
||||
version = "0.1.0"
|
||||
authors = ["Mihai Dinculescu <mihai.dinculescu@outlook.com>"]
|
||||
edition = "2021"
|
||||
description = "SimConnect SDK Examples"
|
||||
license = "MIT"
|
||||
|
||||
[[bin]]
|
||||
name = "basic"
|
||||
path = "src/basic.rs"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = [ "env-filter" ] }
|
||||
|
||||
simconnect-sdk = { path = "../simconnect-sdk" }
|
@@ -1,11 +1,10 @@
|
||||
use logging::setup_logging;
|
||||
use simconnect_sdk::{
|
||||
ConditionEnum, DataType, Notification, NotificationData, PeriodEnum, SimConnect,
|
||||
SimConnectError,
|
||||
};
|
||||
use tracing::{error, info};
|
||||
|
||||
mod logging;
|
||||
use simconnect_sdk_examples::setup_logging;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GpsData {
|
||||
@@ -16,7 +15,7 @@ pub struct GpsData {
|
||||
pub gps_ground_speed: f64,
|
||||
}
|
||||
|
||||
impl simconnect_sdk::SimConnectObject for GpsData {
|
||||
impl simconnect_sdk::SimConnectObjectExt for GpsData {
|
||||
fn register(client: &mut SimConnect, id: u32) -> Result<(), SimConnectError> {
|
||||
client.add_to_data_definition(id, "PLANE LATITUDE", "degrees", DataType::F64)?;
|
||||
client.add_to_data_definition(id, "PLANE LONGITUDE", "degrees", DataType::F64)?;
|
||||
@@ -47,7 +46,7 @@ pub struct OnGround {
|
||||
pub sim_on_ground: bool,
|
||||
}
|
||||
|
||||
impl simconnect_sdk::SimConnectObject for OnGround {
|
||||
impl simconnect_sdk::SimConnectObjectExt for OnGround {
|
||||
fn register(client: &mut SimConnect, id: u32) -> Result<(), SimConnectError> {
|
||||
client.add_to_data_definition(id, "SIM ON GROUND", "bool", DataType::Bool)?;
|
||||
client.request_data_on_sim_object(id, PeriodEnum::Second, ConditionEnum::None)?;
|
@@ -13,6 +13,3 @@ pub fn setup_logging() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn main() {}
|
Reference in New Issue
Block a user