Skip to content

Track state of connections, seats, and devices#21

Open
glamberson wants to merge 1 commit intoids1024:masterfrom
lamco-admin:track-pressed-keys-buttons
Open

Track state of connections, seats, and devices#21
glamberson wants to merge 1 commit intoids1024:masterfrom
lamco-admin:track-pressed-keys-buttons

Conversation

@glamberson
Copy link
Copy Markdown

Implements the state tracking requested in #15: equivalents of
eis_client_state, ei_state, eis_seat_state, ei_seat_state,
eis_device_state, and ei_device_state from libei/libeis.

Changes

Three new enums in event.rs, re-exported from request.rs:

  • ConnectionStateConnected / Disconnected
  • SeatStateActive / Closed
  • DeviceStatePaused / Resumed / Closed

Each connection, seat, and device wrapper tracks its own state via
Mutex-guarded fields, updated automatically as protocol events arrive
(client side) or as methods are called (server side).

Client side (EiEventConverter)

  • Connection state set to Disconnected on EOF / disconnect.
  • Seat state set to Closed when the seat's Destroyed event fires.
  • Device state follows Resumed / Paused / Closed lifecycle.
  • Tracks pressed_keys, pressed_buttons, and down_touch_ids on each
    device, clearing them on pause (matching libei semantics).

Server side (EisRequestConverter)

  • Connection state derived from the existing AtomicBool.
  • Seat and device state tracked through add_seat / remove,
    resumed / paused / remove calls.
  • pressed_keys, pressed_buttons, and down_touch_ids tracked on
    each device, cleared on pause or remove.

Design notes

  • Consolidated into three enums rather than six, since the client and
    server perspectives share the same state values.
  • Input state (pressed keys/buttons/touches) included because libei ties
    this tracking to the pause/resume lifecycle -- they are inherently
    coupled.
  • All new public methods documented; # Panics sections added where
    .lock().unwrap() is used, per clippy missing_panics_doc.

Closes #15

Add lifecycle state enums (DeviceState, SeatState, ConnectionState)
with queryable accessors on the high-level Connection, Seat, and Device
wrappers in both the client-side event helpers and server-side request
helpers.

Track pressed keys, pressed buttons, and active touch IDs on both
client and server Device wrappers so consumers can query input state
at any point. All tracked state is cleared on device pause.

Closes ids1024#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track state of connections and devices in higher-level request/event helpers

2 participants