### Build and Run Browser Demo Source: https://github.com/aetherall/tobiifree/blob/main/README.md Builds the WebAssembly core and embeds it into the SDK, then starts the browser demo application for live gaze visualization. This demo uses WebUSB. ```shell just bundle # build wasm + embed in SDK just demo ``` -------------------------------- ### Run TobiiFree Daemon (Direct USB) Source: https://github.com/aetherall/tobiifree/blob/main/README.md Starts the tobiifreed daemon, which communicates directly with the Tobii eye tracker via USB. ```shell just tobiifreed ``` -------------------------------- ### Run Overlay via Daemon (Unix Socket) Source: https://github.com/aetherall/tobiifree/blob/main/README.md Starts the overlay application to communicate with the tobiifreed daemon through a Unix socket. Requires the daemon to be running in another terminal. ```shell just tobiifreed # terminal 1 just overlay -- --socket # terminal 2 ``` -------------------------------- ### Build and Run Tobiifree Overlay (Direct) Source: https://github.com/aetherall/tobiifree/blob/main/applications/tobiifree-overlay/README.md Navigate to the application directory and use 'zig build run' to build and execute the Tobiifree Overlay. ```sh cd applications/tobiifree-overlay zig build run ``` -------------------------------- ### Build and Run Tobiifree Overlay Source: https://github.com/aetherall/tobiifree/blob/main/applications/tobiifree-overlay/README.md Use 'just overlay' to build and run the application. Alternatively, use 'just build-overlay' to build only, with the executable located at zig-out/bin/tobiifree-overlay. ```sh just overlay ``` ```sh just build-overlay ``` -------------------------------- ### Build Nix Package for Overlay Source: https://github.com/aetherall/tobiifree/blob/main/README.md Builds the tobiifree-overlay GTK4 application binary using Nix. ```shell nix build .#tobiifree-overlay ``` -------------------------------- ### Build Nix Package for Browser Demo Source: https://github.com/aetherall/tobiifree/blob/main/README.md Builds the tobiifree-demo static single-page application using Nix, which can be deployed to any web server. ```shell nix build .#tobiifree-demo ``` -------------------------------- ### Set Up USB Permissions Source: https://github.com/aetherall/tobiifree/blob/main/README.md Run these commands once to copy the udev rules and reload the udev system, ensuring proper USB device access. ```shell sudo cp assets/99-tobii.rules /etc/udev/rules.d/ sudo udevadm control --reload && sudo udevadm trigger ``` -------------------------------- ### Build Nix Package for Daemon Source: https://github.com/aetherall/tobiifree/blob/main/README.md Builds the tobiifreed daemon binary using Nix. ```shell nix build .#tobiifreed ``` -------------------------------- ### Run Gaze Overlay (Direct USB) Source: https://github.com/aetherall/tobiifree/blob/main/README.md Launches the tobiifree-overlay application, which displays a gaze dot directly connected via USB. ```shell just overlay ``` -------------------------------- ### Enter Nix Development Shell Source: https://github.com/aetherall/tobiifree/blob/main/README.md Use this command to enter the development shell, which provides necessary tools like Zig, Node.js, libusb, and GTK4. ```shell nix develop ``` -------------------------------- ### Client to Daemon Commands (Cmd) Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Lists the commands that a client can send to the tobiifreed daemon. Each command has an ID, an optional payload, and a corresponding response type. ```plaintext | Cmd | ID | Payload | |---|---|---| | `subscribe` | 0x01 | — | | `get_display_area` | 0x02 | — | | `set_display_area` | 0x03 | 5×f64 (w,h,ox,oy,z) | | `set_display_area_corners` | 0x04 | 9×f64 (tl,tr,bl) | | `query_realm` | 0x10 | — | | `open_realm` | 0x11 | realm_type (u32) | | `realm_response` | 0x12 | realm_id, field_210, digest | | `close_realm` | 0x13 | realm_id (u32) | | `cal_stimulus` | 0x20 | — | | `cal_add_point` | 0x21 | x (f64), y (f64), eye_choice (u32) | | `cal_compute` | 0x22 | — | | `cal_retrieve` | 0x23 | — | | `cal_apply` | 0x24 | calibration blob | | `disconnect` | 0xFF | — | ``` -------------------------------- ### Client → Daemon Commands (Cmd) Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Lists the commands that a client can send to the tobiifreed daemon, including their IDs, expected payloads, and corresponding responses. ```APIDOC ## Client → Daemon Commands (`Cmd`) | Cmd | ID | Payload | Response | |---------------------|------|---------------------------------------|--------------------| | `subscribe` | 0x01 | — | gaze stream starts | | `get_display_area` | 0x02 | — | display_area response | | `set_display_area` | 0x03 | 5×f64 (w,h,ox,oy,z) | — | | `set_display_area_corners` | 0x04 | 9×f64 (tl,tr,bl) | — | | `query_realm` | 0x10 | — | realm info response | | `open_realm` | 0x11 | realm_type (u32) | challenge response | | `realm_response` | 0x12 | realm_id, field_210, digest | ack response | | `close_realm` | 0x13 | realm_id (u32) | ack response | | `cal_stimulus` | 0x20 | — | stimulus points response | | `cal_add_point` | 0x21 | x (f64), y (f64), eye_choice (u32) | status response | | `cal_compute` | 0x22 | — | status response | | `cal_retrieve` | 0x23 | — | calibration blob response | | `cal_apply` | 0x24 | calibration blob | ack response | | `disconnect` | 0xFF | — | — | ``` -------------------------------- ### tobiifreed Daemon Architecture Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Illustrates the communication flow between the browser/app, the tobiifreed daemon, and the ET5 device via WebSocket, Unix socket, and USB. ```text ┌─────────┐ ┌─────────┐ ┌──────────┐ │ Browser │─ws──▶│ │ │ │ │ │ │ tobiifreed │─usb──▶ ET5 │ │ App │─sock▶│ │ │ │ └─────────┘ └─────────┘ └──────────┘ ``` -------------------------------- ### Daemon to Client Events (Srv) Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Lists the events that the tobiifreed daemon can send to clients. These include gaze data, command responses, display area updates, and error notifications. ```plaintext | Srv | ID | Payload | |---|---|---| | `gaze` | 0x01 | GazeSample (232 bytes) | | `response` | 0x02 | cmd_type (u8) + response payload | | `display_area` | 0x03 | 9×f64 corners | | `err` | 0xFF | error code (u32) | ``` -------------------------------- ### Daemon → Client Events (Srv) Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Lists the events that the tobiifreed daemon can send to clients, including their IDs, payloads, and associated data structures. ```APIDOC ## Daemon → Client Events (`Srv`) | Srv | ID | Payload | |----------------|------|------------------------| | `gaze` | 0x01 | GazeSample (232 bytes) | | `response` | 0x02 | cmd_type (u8) + response payload | | `display_area` | 0x03 | 9×f64 corners | | `err` | 0xFF | error code (u32) | ``` -------------------------------- ### Tracker Interface Definition (Zig) Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Defines the interface for the Tracker, the Zig protocol engine. It includes functions for initialization, polling, gaze event handling, and deinitialization. This struct is used by sources that communicate directly with hardware or via a daemon. ```zig pub const Tracker = struct { send_fn: *const fn ([]const u8) bool, recv_fn: *const fn ([]u8) ?usize, pub fn init(opts: InitOptions) !Tracker; // runs handshake pub fn poll(self: *Tracker) void; // drives recv + gaze dispatch pub fn onGaze(self: *Tracker, cb: GazeFn) void; pub fn deinit(self: *Tracker) void; }; ``` -------------------------------- ### Daemon Protocol Framing Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Specifies the framing structure for messages exchanged between daemon clients and the tobiifreed daemon. It consists of a message type byte, a 32-bit little-endian payload length, and the payload itself. ```plaintext [u8 msg_type] [u32 LE payload_len] [payload...] ``` -------------------------------- ### Daemon Protocol Message Framing Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Defines the structure of messages exchanged between daemon clients and the tobiifreed daemon, consisting of a message type, payload length, and the payload itself. ```APIDOC ## Daemon Protocol Message Framing Messages are structured as follows: ``` [u8 msg_type] [u32 LE payload_len] [payload...] ``` - `msg_type`: A single byte indicating the type of message (command or event). - `payload_len`: A 32-bit unsigned integer in little-endian format specifying the size of the payload in bytes. - `payload`: The actual data content of the message. ``` -------------------------------- ### TypeScript Source Interface Definition Source: https://github.com/aetherall/tobiifree/blob/main/ARCHITECTURE.md Defines the public interface for all eye tracker operations, ensuring a consistent API regardless of the underlying transport (USB or WebSocket). Consumers interact with this interface without needing to know the specific implementation details. ```typescript interface Source { subscribeToGaze(listener: (s: GazeSample) => void): Unsubscribe; getDisplayArea(): Promise; setDisplayArea(rect: DisplayRect): Promise; setDisplayAreaCorners(area: DisplayArea): Promise; getCalibrationStimulusPoints(): Promise; calAddPoint(x: number, y: number, eyeChoice?: number): Promise; calComputeAndApply(): Promise; calRetrieve(): Promise; calApply(blob: Uint8Array): Promise; closeRealm(realmId: number): Promise; close(): Promise; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.