screenclient

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package screenclient sends prepared pixels using EPS2 over USB or an already authenticated encrypted stream. Retain one Client across reconnects; never log its private acquisition claim. It has no automatic physical-update retry.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResync     = errors.New("screen client: boot or ownership changed; full resynchronization required")
	ErrPending    = errors.New("screen client: reconcile pending update before sending")
	ErrConnection = errors.New("screen client: connection not bound")
)
View Source
var ErrUnsupportedRefresh = errors.New("screen client: requested refresh policy unsupported")

Functions

func ReadHealth

func ReadHealth(stream io.ReadWriter) (screenwire.Response, error)

ReadHealth performs exactly one read-only exchange: no Hello, Acquire, Bind, transaction or retry. The caller serializes and bounds the borrowed stream; network input must already be authenticated. It does not alter another Client.

func ReadPanelTrace

func ReadPanelTrace(stream io.ReadWriter) (screenwire.Response, error)

ReadPanelTrace borrows a serialized, bounded, already-trusted stream for one read-only exchange. No retry, lease acquisition, or panel operation occurs.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(random io.Reader) (*Client, error)

New requires cryptographic randomness in production (normally crypto/rand.Reader).

func NewWithMaxChunk

func NewWithMaxChunk(random io.Reader, maxChunk uint16) (*Client, error)

NewWithMaxChunk additionally bounds decoded data bytes per request, independently of the negotiated device capabilities. The limit is fixed across reconnects. Account for screenwire.HeaderSize in the transport RX budget. Packed encoding never enlarges a request; region control requires 180 bytes including headers.

func (*Client) Baseline

func (c *Client) Baseline() [32]byte

Baseline is the last confirmed transaction identity, not necessarily a pixel hash. Zero means unavailable; the caller owns the corresponding pixel snapshot.

func (*Client) Connect

func (c *Client) Connect(stream io.ReadWriter) (screenwire.Capabilities, error)

Connect borrows a deadline-bounded stream. The caller must close the previous transport first. A changed boot/lease is explicit ErrResync; use a fresh Client only after invalidating the manager's unproven pixel baseline.

func (*Client) Pending

func (c *Client) Pending() bool

func (*Client) Probe

func (c *Client) Probe() error

Probe checks a remembered connection using read-only Hello. It cannot adopt ownership, reconcile an unknown update, or perform a physical refresh. The single client owner must reconcile pending identity before an idle probe.

func (*Client) Rebind

func (c *Client) Rebind() error

Rebind renews only a remembered lease on a still-open, idle USB-UART stream. Unlike read-only Probe it sends Bind, but never Acquire, pixels or Refresh. Use after an adapter's logical idle disconnect, with no concurrent I/O. An unknown update must use Connect/Reconcile instead; it is never replayed here.

func (*Client) Reconcile

func (c *Client) Reconcile() (Reconciliation, error)

Reconcile never refreshes. Confirmed proves the pending physical operation; false requires baseline invalidation and a new complete Send at a new ID. Receiving/Ready staging is explicitly aborted before releasing the identity.

func (*Client) Send

func (c *Client) Send(frame display.Frame) error

Send borrows immutable pixels until return. A failure retains its identity but no pixel slice; Reconcile must resolve it before another Send is allowed.

func (*Client) SendRegion

func (c *Client) SendRegion(region screenwire.RegionBegin, old, next []byte) error

SendRegion borrows immutable canonical old/new region pixels until return. No refresh is retried. An admitted failure must be resolved by Reconcile.

func (*Client) SendWithOptions

func (c *Client) SendWithOptions(frame display.Frame, options refreshpolicy.Options, policy refreshpolicy.Policy) error

SendWithOptions requires explicit peer advertisement. No fallback can turn an urgent or partial request into a different operation without the caller knowing.

type Reconciliation

type Reconciliation struct {
	Confirmed bool
	Status    screenwire.Status
}

type RemoteError

type RemoteError struct{ Status screenwire.Status }

RemoteError carries only typed numeric diagnostics, never device error text.

func (RemoteError) Error

func (e RemoteError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL