Refactor iOS glasses connection handling to shared code, fixing incompatible-version-detection and other error cases

This commit is contained in:
James Babcock committed 2026-10-03 15:08:37 -07:00
1 parent 9b0bf77d79
commit 66ca06f584
16 files changed
+341 -119

No files matched your search

+4 -1
View File
@@ -1,6 +1,6 @@
import type { RingInput } from "../g2/ring-input";
import { File, knownFolders, path, type ImageSource } from "@nativescript/core";
import { type FirmwareInfo } from "../g2/firmware-compat";
import { REQUIRED_FACECLAW_FIRMWARE_VERSION, type FirmwareInfo } from "../g2/firmware-compat";
import { type CompassEvent } from "./compass-types";
import { fromData, toData } from "./kotlin-data";
import { previewPixels } from "./ios-graphics";
@@ -23,6 +23,7 @@ export type CommunicatorPhase =
| "charging"
| "retrying"
| "unpaired"
| "incompatible-firmware"
| "disconnecting";
export type CommunicatorState = {
@@ -203,6 +204,8 @@ export class FaceclawCommunicatorBridge {
String(addresses.left ?? "").toUpperCase(),
String(addresses.ring ?? "").toUpperCase(),
);
// The shared session halts on any other firmware ("incompatible-firmware").
this.communicator.setRequiredFirmwareRevisionRevision(REQUIRED_FACECLAW_FIRMWARE_VERSION);
this.listenerProxy = SessionListener.new() as SessionListener;
this.listenerProxy.bridge = this;
this.communicator.setListenerListener(this.listenerProxy);
+4 -1
View File
@@ -14,6 +14,7 @@ export type CommunicatorPhase =
| "charging"
| "retrying"
| "unpaired"
| "incompatible-firmware"
| "disconnecting";
export type CommunicatorState = {
@@ -34,7 +35,7 @@ export type FrameMetrics = {
tileCount: number;
};
import { type FirmwareInfo } from "../g2/firmware-compat";
import { REQUIRED_FACECLAW_FIRMWARE_VERSION, type FirmwareInfo } from "../g2/firmware-compat";
export type { FirmwareInfo };
@@ -169,6 +170,8 @@ export class FaceclawCommunicatorBridge {
addresses.left,
addresses.ring ?? "",
);
// The shared session halts on any other firmware ("incompatible-firmware").
this.communicator.setRequiredFirmwareRevision(REQUIRED_FACECLAW_FIRMWARE_VERSION);
this.listenerProxy = new com.faceclaw.app.FaceclawBleCommunicatorListener({
onStateChange: (phase: string, status: string) => {
const state = {