mirror of
https://github.com/ruvnet/RuView
synced 2026-08-09 20:21:43 +00:00
feat(sensing): native macOS CoreWLAN WiFi sensing adapter
Add native macOS LiDAR / WiFi sensing support via CoreWLAN: - mac_wifi.swift: Swift helper to poll RSSI/Noise at 10Hz - MacosWifiCollector: Python adapter for the sensing pipeline - Auto-detect Darwin platform in ws_server.py
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import Foundation
|
||||
import CoreWLAN
|
||||
|
||||
// Output format: JSON lines for easy parsing by Python
|
||||
// {"timestamp": 1234567.89, "rssi": -50, "noise": -90, "tx_rate": 866.0}
|
||||
|
||||
func main() {
|
||||
guard let interface = CWWiFiClient.shared().interface() else {
|
||||
fputs("{\"error\": \"No WiFi interface found\"}\n", stderr)
|
||||
exit(1)
|
||||
}
|
||||
|
||||
// Flush stdout automatically to prevent buffering issues with Python subprocess
|
||||
setbuf(stdout, nil)
|
||||
|
||||
// Run at ~10Hz
|
||||
let interval: TimeInterval = 0.1
|
||||
|
||||
while true {
|
||||
let timestamp = Date().timeIntervalSince1970
|
||||
let rssi = interface.rssiValue()
|
||||
let noise = interface.noiseMeasurement()
|
||||
let txRate = interface.transmitRate()
|
||||
|
||||
let json = """
|
||||
{"timestamp": \(timestamp), "rssi": \(rssi), "noise": \(noise), "tx_rate": \(txRate)}
|
||||
"""
|
||||
print(json)
|
||||
|
||||
Thread.sleep(forTimeInterval: interval)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user