From 5f8471a7ed8400195984dbb91de74f6e4c6b2f05 Mon Sep 17 00:00:00 2001 From: griffin Date: Tue, 26 May 2026 09:44:48 -0700 Subject: [PATCH] feat(macos-rssi-bridge): add `make start` one-shot orchestration `make start` builds both binaries, launches the v2 sensing-server and the bridge under a single process group, opens both UIs (sensing UI on :8080 and the tomography dashboard on :9090/dashboard), and tears both down cleanly on Ctrl-C via a TRAP. Adds `make stop` for stray-process cleanup and `make build-server` so the sensing-server build can be invoked independently. README updated to point at the one-command flow. Co-authored-by: Cursor --- scripts/macos-rssi-bridge/Makefile | 38 ++++++++++++++++++++++++++++- scripts/macos-rssi-bridge/README.md | 9 +++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/scripts/macos-rssi-bridge/Makefile b/scripts/macos-rssi-bridge/Makefile index e43d2e4b..2a5e8079 100644 --- a/scripts/macos-rssi-bridge/Makefile +++ b/scripts/macos-rssi-bridge/Makefile @@ -1,4 +1,4 @@ -.PHONY: all build clean test scan run run-verbose listen install-helper help +.PHONY: all build build-server clean start stop test scan run run-verbose listen install-helper dashboard help HELPER := mac_wifi BRIDGE := target/release/macos-rssi-bridge @@ -8,12 +8,22 @@ TARGET_HOST ?= 127.0.0.1 TARGET_PORT ?= 5005 INTERVAL ?= 1.5 +# Sensing-server (built from the v2 workspace and run from v2/ so it can +# resolve its default --ui-path of ../ui). +SENSING_SERVER_DIR := ../../v2 +SENSING_SERVER_BIN := target/release/sensing-server +SENSING_UI_URL := http://localhost:8080 +BRIDGE_DASHBOARD := http://localhost:9090/dashboard + all: build help: @echo "macos-rssi-bridge — Mac WiFi card → RuView sensing-server bridge" @echo "" + @echo " make start build + run everything: sensing-server + bridge + open UIs" + @echo " make stop kill any running sensing-server / bridge processes" @echo " make build compile mac_wifi (Swift) + macos-rssi-bridge (Rust)" + @echo " make build-server compile the v2 sensing-server (release)" @echo " make scan run a single multi-BSSID scan, print JSON" @echo " make run start the bridge → udp://$(TARGET_HOST):$(TARGET_PORT) + http://localhost:9090" @echo " make run-verbose same, with per-frame stats on stderr" @@ -32,6 +42,32 @@ $(HELPER): mac_wifi.swift $(BRIDGE): src/main.rs Cargo.toml cargo build --release +build-server: + cd $(SENSING_SERVER_DIR) && cargo build --release -p wifi-densepose-sensing-server --no-default-features + +# One-shot: builds everything, starts sensing-server + bridge under a single +# process group, opens both UIs, waits for Ctrl-C, and kills both children +# cleanly. The sensing-server is run with cwd=v2/ so its default --ui-path of +# ../ui resolves; the bridge stays in this directory so ./mac_wifi works. +start: build build-server + @echo "[start] sensing-server + macos-rssi-bridge → $(SENSING_UI_URL)" + @trap 'echo; echo "[start] stopping…"; kill $$SERVER_PID $$BRIDGE_PID 2>/dev/null; wait 2>/dev/null; exit 0' INT TERM; \ + ( cd $(SENSING_SERVER_DIR) && ./$(SENSING_SERVER_BIN) --udp-port $(TARGET_PORT) ) & \ + SERVER_PID=$$!; \ + echo "[start] sensing-server pid=$$SERVER_PID — waiting 3s for UDP bind…"; \ + sleep 3; \ + ./$(BRIDGE) --helper ./$(HELPER) --target-host $(TARGET_HOST) \ + --target-port $(TARGET_PORT) --interval $(INTERVAL) & \ + BRIDGE_PID=$$!; \ + echo "[start] bridge pid=$$BRIDGE_PID — dashboard: $(BRIDGE_DASHBOARD)"; \ + ( sleep 2; open $(SENSING_UI_URL) 2>/dev/null; open $(BRIDGE_DASHBOARD) 2>/dev/null ) & \ + echo "[start] press Ctrl-C to stop both"; \ + wait + +stop: + -@pkill -f "$(SENSING_SERVER_BIN)" 2>/dev/null && echo "[stop] sensing-server killed" || echo "[stop] no sensing-server" + -@pkill -f "$(BRIDGE)" 2>/dev/null && echo "[stop] bridge killed" || echo "[stop] no bridge" + test: cargo test --release diff --git a/scripts/macos-rssi-bridge/README.md b/scripts/macos-rssi-bridge/README.md index 5cc23c24..2fe4f3ae 100644 --- a/scripts/macos-rssi-bridge/README.md +++ b/scripts/macos-rssi-bridge/README.md @@ -39,6 +39,15 @@ Toolchain: `swiftc` 6.0+ and Cargo 1.80+. Tested on macOS 26 (Tahoe) arm64. ## Run +One command — builds both, launches the sensing-server and the bridge, +opens both UIs, and cleans up on Ctrl-C: + +```bash +make start # → sensing-server (:8080) + bridge (:9090/dashboard) +make stop # kill any leftover sensing-server / bridge process +``` + +Or run them manually in two terminals if you want to see logs side-by-side. In one terminal, the sensing-server (provides UI + UDP receiver): ```bash