mirror of
https://github.com/seemueller-io/yachtpit.git
synced 2025-09-08 22:46:45 +00:00
AIS (Automatic identification system) Integration: Maritime (#12)
* WIP: Enable dynamic AIS stream handling based on user location and map focus. - Prevent AIS stream from starting immediately; start upon user interaction. - Add `ais_stream_started` state for WebSocket management. - Extend `useRealAISProvider` with `userLocationLoaded` and `mapFocused` to control stream. - Update frontend components to handle geolocation and map focus. - Exclude test files from compilation Introduce WebSocket integration for AIS services - Added WebSocket-based `useRealAISProvider` React hook for real-time AIS vessel data. - Created various tests including unit, integration, and browser tests to validate WebSocket functionality. - Added `ws` dependency to enable WebSocket communication. - Implemented vessel data mapping and bounding box handling for dynamic updates. * **Introduce Neumorphic UI design with new themes and styles** - Added NeumorphicTheme implementation for light and dark modes. - Refactored `LayerSelector` and `MapNext` components to use the neumorphic style and color utilities. - Updated `menu.rs` with neumorphic-inspired button and background styling. - Enhanced GPS feed and vessel popups with neumorphic visuals, improving clarity and aesthetics. - Temporarily disabled base-map dependency in `yachtpit` for isolation testing. * update names in layer selector * Update search button text to "Search..." for better clarity. * Add key event handlers for search and result selection in App.tsx * Implement AIS Test Map application with WebSocket-based vessel tracking and Mapbox integration. * Refactor AIS server to use Axum framework with shared stream manager and state handling. Fix metadata key mismatch in frontend vessel mapper. * Remove AIS provider integration and related vessel markers * Remove `ais-test-map` application, including dependencies, configuration, and source files. * ais data feed functional, bb query is overshot, performance degraded * Add AIS module as a build dependency --------- Co-authored-by: geoffsee <>
This commit is contained in:
1308
crates/ais/Cargo.lock
generated
Normal file
1308
crates/ais/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
crates/ais/Cargo.toml
Normal file
30
crates/ais/Cargo.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
[package]
|
||||
name = "ais"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "ais"
|
||||
path = "src/main.rs"
|
||||
|
||||
[profile.dev]
|
||||
debug = false
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
tokio-tungstenite = { version = "0.20", features = ["native-tls"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
futures-util = "0.3"
|
||||
url = "2.4"
|
||||
axum = { version = "0.7", features = ["ws"] }
|
||||
tower = "0.4"
|
||||
tower-http = { version = "0.5", features = ["cors"] }
|
||||
base64 = "0.22.1"
|
||||
tokio-util = "0.7.15"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-test = "0.4"
|
||||
axum-test = "14.0"
|
||||
mockito = "1.0"
|
||||
serde_json = "1.0"
|
91
crates/ais/error.md
Normal file
91
crates/ais/error.md
Normal file
@@ -0,0 +1,91 @@
|
||||
/Users/williamseemueller/.cargo/bin/cargo run --color=always --package ais --bin ais --profile dev
|
||||
warning: function `start_ais_stream_with_callbacks` is never used
|
||||
--> src/ais.rs:78:8
|
||||
|
|
||||
78 | pub fn start_ais_stream_with_callbacks() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(dead_code)]` on by default
|
||||
|
||||
warning: `ais` (bin "ais") generated 1 warning
|
||||
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
|
||||
Running `target/debug/ais`
|
||||
|
||||
thread 'main' panicked at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/js-sys-0.3.77/src/lib.rs:6063:9:
|
||||
cannot access imported statics on non-wasm targets
|
||||
stack backtrace:
|
||||
0: __rustc::rust_begin_unwind
|
||||
at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panicking.rs:697:5
|
||||
1: core::panicking::panic_fmt
|
||||
at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/core/src/panicking.rs:75:14
|
||||
2: js_sys::global::get_global_object::SELF::init::__wbg_static_accessor_SELF_37c5d418e4bf5819
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/js-sys-0.3.77/src/lib.rs:6063:9
|
||||
3: js_sys::global::get_global_object::SELF::init
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/js-sys-0.3.77/src/lib.rs:6063:9
|
||||
4: core::ops::function::FnOnce::call_once
|
||||
at /Users/williamseemueller/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
|
||||
5: once_cell::unsync::Lazy<T,F>::force::{{closure}}
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:775:28
|
||||
6: once_cell::unsync::OnceCell<T>::get_or_init::{{closure}}
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:591:57
|
||||
7: once_cell::unsync::OnceCell<T>::get_or_try_init
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:629:23
|
||||
8: once_cell::unsync::OnceCell<T>::get_or_init
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:591:19
|
||||
9: once_cell::unsync::Lazy<T,F>::force
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:774:13
|
||||
10: <wasm_bindgen::__rt::LazyCell<T> as core::ops::deref::Deref>::deref
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm-bindgen-0.2.100/src/rt/mod.rs:56:9
|
||||
11: wasm_bindgen::JsThreadLocal<T>::with
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm-bindgen-0.2.100/src/lib.rs:1271:18
|
||||
12: js_sys::global::get_global_object
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/js-sys-0.3.77/src/lib.rs:6082:29
|
||||
13: core::ops::function::FnOnce::call_once
|
||||
at /Users/williamseemueller/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
|
||||
14: once_cell::unsync::Lazy<T,F>::force::{{closure}}
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:775:28
|
||||
15: once_cell::unsync::OnceCell<T>::get_or_init::{{closure}}
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:591:57
|
||||
16: once_cell::unsync::OnceCell<T>::get_or_try_init
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:629:23
|
||||
17: once_cell::unsync::OnceCell<T>::get_or_init
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:591:19
|
||||
18: once_cell::unsync::Lazy<T,F>::force
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:774:13
|
||||
19: <once_cell::unsync::Lazy<T,F> as core::ops::deref::Deref>::deref
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:843:13
|
||||
20: js_sys::global
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/js-sys-0.3.77/src/lib.rs:6051:12
|
||||
21: wasm_bindgen_futures::queue::Queue::new
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm-bindgen-futures-0.4.50/src/queue.rs:89:35
|
||||
22: core::ops::function::FnOnce::call_once
|
||||
at /Users/williamseemueller/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
|
||||
23: once_cell::unsync::Lazy<T,F>::force::{{closure}}
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:775:28
|
||||
24: once_cell::unsync::OnceCell<T>::get_or_init::{{closure}}
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:591:57
|
||||
25: once_cell::unsync::OnceCell<T>::get_or_try_init
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:629:23
|
||||
26: once_cell::unsync::OnceCell<T>::get_or_init
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:591:19
|
||||
27: once_cell::unsync::Lazy<T,F>::force
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:774:13
|
||||
28: <once_cell::unsync::Lazy<T,F> as core::ops::deref::Deref>::deref
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/once_cell-1.21.3/src/lib.rs:843:13
|
||||
29: wasm_bindgen_futures::queue::Queue::with
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm-bindgen-futures-0.4.50/src/queue.rs:124:11
|
||||
30: wasm_bindgen_futures::task::singlethread::Task::spawn
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm-bindgen-futures-0.4.50/src/task/singlethread.rs:36:9
|
||||
31: wasm_bindgen_futures::spawn_local
|
||||
at /Users/williamseemueller/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm-bindgen-futures-0.4.50/src/lib.rs:93:5
|
||||
32: ais::ais::start_ais_stream
|
||||
at ./src/ais.rs:22:5
|
||||
33: ais::main
|
||||
at ./src/main.rs:7:5
|
||||
34: core::ops::function::FnOnce::call_once
|
||||
at /Users/williamseemueller/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
|
||||
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
|
||||
|
||||
Process finished with exit code 101
|
||||
|
||||
|
1007
crates/ais/src/ais.rs
Normal file
1007
crates/ais/src/ais.rs
Normal file
File diff suppressed because it is too large
Load Diff
36
crates/ais/src/main.rs
Normal file
36
crates/ais/src/main.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
use std::sync::Arc;
|
||||
use axum::Router;
|
||||
use axum::routing::get;
|
||||
use tower_http::cors::CorsLayer;
|
||||
use crate::ais::{AisStreamManager, AppState};
|
||||
|
||||
mod ais;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Create the shared state with the AIS stream manager
|
||||
let state = AppState {
|
||||
ais_stream_manager: Arc::new(AisStreamManager::new()),
|
||||
};
|
||||
|
||||
// Create and start the Axum HTTP server
|
||||
let app = create_router(state);
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
|
||||
|
||||
println!("AIS server running on http://0.0.0.0:3000");
|
||||
|
||||
axum::serve(listener, app)
|
||||
.with_graceful_shutdown(ais::shutdown_signal())
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Create the Axum router
|
||||
fn create_router(state: AppState) -> Router {
|
||||
Router::new()
|
||||
.route("/ais", get(crate::ais::get_ais_data))
|
||||
.route("/ws", get(crate::ais::websocket_handler))
|
||||
.layer(CorsLayer::permissive())
|
||||
.with_state(state)
|
||||
}
|
Reference in New Issue
Block a user