Show in Diagnostics what the glasses deliver (event types only)
During the second device session a tap on the glasses did nothing and the phone page could not show whether the Even app had delivered any event. The Even adapter now counts gesture/lifecycle events, ignored events and audio frames and records the last non-audio event by envelope and type code (never audio or content). The phone's Diagnostics shows it and refreshes when an event arrives, including one that changes no state. Not reviewed. Not deployed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -179,6 +179,36 @@ describe('start-up when a callable Even host appears during the wait', () => {
|
||||
expect(diag['HUD page']).toBe('created');
|
||||
});
|
||||
|
||||
it('Diagnostics shows what the glasses deliver, by type only: a tap is visible, an unknown event is visible as ignored, audio is only counted', async () => {
|
||||
const even = fakeEvenHost();
|
||||
(window as any).flutter_inappwebview = even.host;
|
||||
booted = await boot(document, window);
|
||||
expect(diagnostics()['Glasses input']).toContain('0 gesture/lifecycle event(s), 0 ignored, 0 audio frame(s); last: none yet');
|
||||
|
||||
// The Even app pushes events to the page through this SDK entry point.
|
||||
const push = (type: string, jsonData: unknown) => (window as any)._listenEvenAppMessage({ type: 'listen_even_app_data', method: 'evenHubEvent', data: { type, jsonData } });
|
||||
push('sysEvent', { eventSource: 1 }); // a tap: no eventType on the wire
|
||||
await wait(20);
|
||||
const afterTap = diagnostics()['Glasses input']!;
|
||||
expect(afterTap).toContain('1 gesture/lifecycle event(s)');
|
||||
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
|
||||
await wait(20);
|
||||
const afterLongPress = diagnostics()['Glasses input']!;
|
||||
expect(afterLongPress).toContain('1 ignored');
|
||||
expect(afterLongPress).toContain('sysEvent(type=9,source=1) -> ignored');
|
||||
push('audioEvent', { audioPcm: [1, 2, 3, 4] });
|
||||
await wait(20);
|
||||
push('sysEvent', { eventType: 3 });
|
||||
await wait(20);
|
||||
const afterAudio = diagnostics()['Glasses input']!;
|
||||
expect(afterAudio).toContain('1 audio frame(s)');
|
||||
expect(afterAudio).toContain('-> double_tap');
|
||||
// Nothing from the audio payload appears anywhere in Diagnostics.
|
||||
expect(JSON.stringify(diagnostics())).not.toContain('1,2,3,4');
|
||||
});
|
||||
|
||||
it('a host present from the first instant is used without waiting out the timeout', async () => {
|
||||
const even = fakeEvenHost();
|
||||
(window as any).flutter_inappwebview = even.host;
|
||||
|
||||
Reference in New Issue
Block a user