Skip to content

Commit 13d9063

Browse files
committed
Refactor AimxClient to AimxConnection across aimdb-cli and aimdb-mcp
- Updated dependencies in Cargo.toml to include futures crate. - Replaced instances of AimxClient with AimxConnection in graph, record, and watch commands in aimdb-cli. - Modified live output formatting to accommodate changes in event structure. - Refactored connection handling in aimdb-mcp to use AimxConnection instead of AimxClient. - Ensured all relevant functions and tests are updated to reflect the new connection structure.
1 parent cf969b5 commit 13d9063

28 files changed

Lines changed: 313 additions & 3044 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# AimDB Makefile
22
# Simple automation for common development tasks
33

4-
.PHONY: help build test clean fmt fmt-check clippy doc all check test-embedded test-wasm wasm wasm-test examples deny audit security publish publish-check
4+
.PHONY: help build test clean clean-embedded fmt fmt-check clippy doc all check test-embedded test-wasm wasm wasm-test examples deny audit security publish publish-check
55
.DEFAULT_GOAL := help
66

7+
# Separate target dir for embedded checks so an interrupted example build
8+
# (cargo build --target thumbv7em-none-eabihf) cannot leave corrupted .rmeta
9+
# files that break the next cargo check run (E0786). Clean it with
10+
# `make clean-embedded`.
11+
EMBEDDED_CHECK_TARGET_DIR := target/embedded-check
12+
713
# Colors for output
814
GREEN := \033[0;32m
915
YELLOW := \033[0;33m
@@ -255,6 +261,12 @@ doc:
255261
clean:
256262
@printf "$(GREEN)Cleaning...$(NC)\n"
257263
cargo clean
264+
@rm -rf $(EMBEDDED_CHECK_TARGET_DIR)
265+
266+
clean-embedded:
267+
@printf "$(GREEN)Cleaning embedded check artifacts...$(NC)\n"
268+
@rm -rf $(EMBEDDED_CHECK_TARGET_DIR)
269+
cargo clean --target thumbv7em-none-eabihf
258270

259271
## Testing commands
260272
test-wasm:
@@ -266,29 +278,29 @@ test-wasm:
266278
test-embedded:
267279
@printf "$(BLUE)Testing embedded/MCU cross-compilation compatibility...$(NC)\n"
268280
@printf "$(YELLOW) → Checking aimdb-data-contracts (no_std + alloc) on thumbv7em-none-eabihf target$(NC)\n"
269-
cargo check --package aimdb-data-contracts --target thumbv7em-none-eabihf --no-default-features --features alloc
281+
cargo check --package aimdb-data-contracts --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features alloc
270282
@printf "$(YELLOW) → Checking aimdb-core (no_std minimal) on thumbv7em-none-eabihf target$(NC)\n"
271-
cargo check --package aimdb-core --target thumbv7em-none-eabihf --no-default-features --features alloc
283+
cargo check --package aimdb-core --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features alloc
272284
@printf "$(YELLOW) → Checking aimdb-core (no_std + alloc + json-serialize) on thumbv7em-none-eabihf target$(NC)\n"
273-
cargo check --package aimdb-core --target thumbv7em-none-eabihf --no-default-features --features "alloc,json-serialize"
285+
cargo check --package aimdb-core --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "alloc,json-serialize"
274286
@printf "$(YELLOW) → Checking aimdb-core (no_std/embassy) on thumbv7em-none-eabihf target$(NC)\n"
275-
cargo check --package aimdb-core --target thumbv7em-none-eabihf --no-default-features --features alloc
287+
cargo check --package aimdb-core --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features alloc
276288
@printf "$(YELLOW) → Checking aimdb-embassy-adapter on thumbv7em-none-eabihf target$(NC)\n"
277-
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime"
289+
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime"
278290
@printf "$(YELLOW) → Checking aimdb-embassy-adapter with network support on thumbv7em-none-eabihf target$(NC)\n"
279-
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,embassy-net-support"
291+
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,embassy-net-support"
280292
@printf "$(YELLOW) → Checking aimdb-embassy-adapter with profiling on thumbv7em-none-eabihf target$(NC)\n"
281-
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,profiling"
293+
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,profiling"
282294
@printf "$(YELLOW) → Checking aimdb-embassy-adapter with metrics on thumbv7em-none-eabihf target$(NC)\n"
283-
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,metrics"
295+
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,metrics"
284296
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (Embassy) on thumbv7em-none-eabihf target$(NC)\n"
285-
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime"
297+
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime"
286298
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (Embassy + defmt) on thumbv7em-none-eabihf target$(NC)\n"
287-
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,defmt"
299+
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,defmt"
288300
@printf "$(YELLOW) → Checking aimdb-knx-connector (Embassy) on thumbv7em-none-eabihf target$(NC)\n"
289-
cargo check --package aimdb-knx-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime"
301+
cargo check --package aimdb-knx-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime"
290302
@printf "$(YELLOW) → Checking aimdb-knx-connector (Embassy + defmt) on thumbv7em-none-eabihf target$(NC)\n"
291-
cargo check --package aimdb-knx-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,defmt"
303+
cargo check --package aimdb-knx-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,defmt"
292304

293305
## Example projects
294306
examples:

aimdb-client/src/connection.rs

Lines changed: 0 additions & 292 deletions
This file was deleted.

aimdb-client/src/discovery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! Scans known directories for running AimDB instances.
44
5-
use crate::connection::AimxClient;
5+
use crate::engine::AimxConnection;
66
use crate::error::{ClientError, ClientResult};
77
use crate::protocol::WelcomeMessage;
88
use std::path::PathBuf;
@@ -78,7 +78,7 @@ async fn probe_instance(socket_path: &PathBuf) -> ClientResult<InstanceInfo> {
7878
// Try to connect with a short timeout
7979
let connect_timeout = Duration::from_millis(500);
8080

81-
let client = tokio::time::timeout(connect_timeout, AimxClient::connect(socket_path))
81+
let client = tokio::time::timeout(connect_timeout, AimxConnection::connect(socket_path))
8282
.await
8383
.map_err(|_| {
8484
ClientError::connection_failed(

0 commit comments

Comments
 (0)