Handle long presses: push-to-talk, with a tap-like fallback

On a real G2 a touch held slightly too long is reported as a long press
(sysEvent type 9, then type 10 on release; source 1 right temple, 3 left),
not as a tap, and was ignored. A long press now does what a tap does. If it
started a recording and is held at least 700 ms, releasing it sends
(push-to-talk); released sooner, it behaves like a tap and the recording
continues until the next tap or press.

Tests: 219 unit/integration; simulator 7 scenarios (long_press /
long_press_release through the automation API). Not reviewed, not deployed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-21 13:11:55 -08:00
co-authored by Claude Fable 5.2
parent b8191a7bd2
commit 9cb34b3125
8 changed files with 148 additions and 7 deletions
+6 -2
View File
@@ -191,13 +191,17 @@ describe('start-up when a callable Even host appears during the wait', () => {
await wait(20);
const afterTap = diagnostics()['Glasses input']!;
expect(afterTap).toContain('1 gesture/lifecycle event(s)');
expect(afterTap).not.toContain('ignored;');
expect(afterTap).toContain('sysEvent(type=none,source=1) -> tap');
// The tap really drove the app: unpaired, so the state stays put, but it was delivered.
push('sysEvent', { eventType: 9, eventSource: 1 }); // long press: outside the contract
push('sysEvent', { eventType: 9, eventSource: 1 }); // long press: recognised
await wait(20);
expect(diagnostics()['Glasses input']).toContain('sysEvent(type=9,source=1) -> long_press');
push('sysEvent', { eventType: 8, imuData: { x: 1, y: 2, z: 3 } }); // IMU: outside the contract
await wait(20);
const afterLongPress = diagnostics()['Glasses input']!;
expect(afterLongPress).toContain('1 ignored');
expect(afterLongPress).toContain('sysEvent(type=9,source=1) -> ignored');
expect(afterLongPress).toContain('sysEvent(type=8) -> ignored');
push('audioEvent', { audioPcm: [1, 2, 3, 4] });
await wait(20);
push('sysEvent', { eventType: 3 });