Port developer debug tests to iOS

This commit is contained in:
James Babcock committed 2026-10-31 13:57:18 -07:00
1 parent bc57557f04
commit a5eda29368
16 files changed
+737 -151

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
import { FaceclawCommunicatorBridge } from "./faceclaw-communicator.ios";
import { type ImuReading } from "./imu-types";
export * from "./imu-types";
/**
* IMU (accelerometer) access on iOS: the same API as imu.ts over the running
* shared-Kotlin session. As there, the stream is experimental, the calls are
* no-ops while no session is running, and a listener stays with the session
* it subscribed to.
*/
/** Enable/disable the accelerometer report stream. No-op if not connected. */
export function setImuReportEnabled(enable: boolean, reportFreq: number): void {
try {
FaceclawCommunicatorBridge.getActive()?.setImuReportEnabled(enable, reportFreq);
} catch (error) {
console.warn(`setImuReportEnabled failed: ${error}`);
}
}
/** Subscribe to IMU readings; returns an unsubscribe function. */
export function addImuListener(listener: (reading: ImuReading) => void): () => void {
const active = FaceclawCommunicatorBridge.getActive();
if (!active) return () => {};
const unsubscribe = active.addImuListener(listener);
return () => {
try {
unsubscribe();
} catch {
// The session may be gone after a disconnect; nothing to clean up.
}
};
}