Track state of connections, seats, and devices#21
Open
glamberson wants to merge 1 commit intoids1024:masterfrom
Open
Track state of connections, seats, and devices#21glamberson wants to merge 1 commit intoids1024:masterfrom
glamberson wants to merge 1 commit intoids1024:masterfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the state tracking requested in #15: equivalents of
eis_client_state,ei_state,eis_seat_state,ei_seat_state,eis_device_state, andei_device_statefrom libei/libeis.Changes
Three new enums in
event.rs, re-exported fromrequest.rs:ConnectionState—Connected/DisconnectedSeatState—Active/ClosedDeviceState—Paused/Resumed/ClosedEach 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)Disconnectedon EOF / disconnect.Closedwhen the seat'sDestroyedevent fires.Resumed/Paused/Closedlifecycle.pressed_keys,pressed_buttons, anddown_touch_idson eachdevice, clearing them on pause (matching libei semantics).
Server side (
EisRequestConverter)AtomicBool.add_seat/remove,resumed/paused/removecalls.pressed_keys,pressed_buttons, anddown_touch_idstracked oneach device, cleared on pause or remove.
Design notes
server perspectives share the same state values.
this tracking to the pause/resume lifecycle -- they are inherently
coupled.
# Panicssections added where.lock().unwrap()is used, per clippymissing_panics_doc.Closes #15