screenwire

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: 8 Imported by: 0

Documentation

Overview

Package screenwire defines EPS2 bounded screen records, not authentication. Network records must pass the authenticated encryption layer before decoding. EPS1 remains a separate historical package and is never auto-detected here.

Index

Constants

View Source
const (
	HeaderSize       = 32
	MaxPayload       = 1024
	MaxRecord        = HeaderSize + MaxPayload
	StatusSize       = 48
	CapabilitiesSize = 40
)
View Source
const FeaturePackBits uint16 = 1 << 2 // Optional bounded PackBits DataPacked.
View Source
const FeatureRefreshPolicy uint16 = 1 << 3 // BeginRefresh with explicit cadence.
View Source
const FeatureRegion uint16 = 1 << 4 // BeginRegion with old/new pixel passes.
View Source
const HealthSize = 8
View Source
const HealthVersion uint8 = 1
View Source
const Mono1 uint8 = 1
View Source
const PanelStatusSize = 36
View Source
const RawFull uint16 = 3 // bit 0 raw mono1 encoding; bit 1 full refresh
View Source
const RegionBeginSize = 148

Variables

View Source
var ErrRecord = errors.New("screen wire: invalid EPS2 record")

Functions

func DecodeRefreshBegin

func DecodeRefreshBegin(b []byte) ([32]byte, refreshpolicy.Options, refreshpolicy.Policy, error)

func Encode

func Encode(dst []byte, r Record) (int, error)

Encode borrows Payload only during this call; it must not overlap dst.

func EncodeCapabilities

func EncodeCapabilities(dst []byte, c Capabilities) error

func EncodeHealth

func EncodeHealth(dst []byte, h HealthStatus) error

func EncodePanelStatus

func EncodePanelStatus(dst []byte, p PanelStatus) error

func EncodeRefreshBegin

func EncodeRefreshBegin(digest [32]byte, options refreshpolicy.Options, policy refreshpolicy.Policy) ([44]byte, error)

BeginRefresh extends Begin; Commit and Query keep the original digest identity. The receiver rejects consumed IDs regardless of options. Cadence is selected before staging and cannot be changed by replaying Begin or Commit.

func EncodeRegionBegin

func EncodeRegionBegin(r RegionBegin) ([RegionBeginSize]byte, error)

func EncodeStatus

func EncodeStatus(dst []byte, s Status) error

func Size

func Size(header []byte) (int, error)

Size rejects malformed header shapes before allocating/reading payload bytes.

Types

type BusySamples

type BusySamples struct{ Samples, LowSamples uint32 }

BusySamples counts actual reads, not edges or independently measured voltage.

type Capabilities

type Capabilities struct {
	Width, Height, Stride, MaxChunk uint16
	Passes, Format                  uint8
	Features                        uint16
	Profile                         uint32
	ProfileVersion                  uint16
	MinimumFullMS                   uint32
	DeviceID                        [16]byte
}

Capabilities are physical adapter properties, not remotely editable settings. New dimensions are valid only with a matching local panel implementation.

func DecodeCapabilities

func DecodeCapabilities(src []byte) (Capabilities, error)

type Code

type Code uint8
const (
	CodeOK Code = iota
	CodeRecord
	CodeLease
	CodeBusy
	CodeStale
	CodeConflict
	CodeCooldown
	CodeState
	CodeChunk
	CodeDigest
	CodeTimeout
	CodeHardware
	CodeConfig
)

type Diagnostic

type Diagnostic struct {
	Domain                     Domain
	Code, Phase, Step, Command uint8
	Offset                     int32
	BusyKnown, Busy            bool
}

Diagnostic carries only bounded numeric hardware evidence, never err.Error(). Panel-specific phase/step/code values belong to the negotiated profile.

type Domain

type Domain uint8
const (
	DomainNone Domain = iota
	DomainPanel
)

type HealthStatus

type HealthStatus struct {
	Version, State, LastFailure, Failures uint8
	UptimeSeconds                         uint32
}

HealthStatus is a source-free network snapshot, not a panel diagnostic. State and LastFailure use the frozen 0..7 values documented in docs/eps2-wire.md. Failures counts unexpected failed attempts in this boot, saturating at 255.

func DecodeHealth

func DecodeHealth(src []byte) (HealthStatus, error)

type Kind

type Kind uint8
const (
	Hello Kind = iota + 1
	Acquire
	Bind
	Begin
	Data
	Commit
	Query
	Abort
	Reply
	Health       // Additive request; Reply's existing wire value remains 9.
	DataPacked   // Negotiated PackBits; coordinates and progress are decoded bytes.
	PanelTrace   // Cached physical-cycle observation; no ownership or pixel proof.
	BeginRefresh // Negotiated per-transaction operator cadence, never a BUSY override.
	BeginRegion  // Old/new region contract; dispatch requires a capable physical adapter.
)

type PanelStatus

type PanelStatus struct {
	Version, State, Phase, Step uint8
	Cycle, ElapsedMS            uint32
	Waits                       [3]BusySamples
}

PanelStatus is a boot-local, cached last-cycle trace, never pixel proof. State: unavailable=0, active=1, completed=2, stopped/error=3. Phase/Step belong to the negotiated panel profile. Waits are power-on, refresh, power-off.

func DecodePanelStatus

func DecodePanelStatus(src []byte) (PanelStatus, error)

type Record

type Record struct {
	Kind      Kind
	Pass      uint8
	Epoch, ID uint64
	Offset    uint32
	Payload   []byte
}

func Decode

func Decode(src []byte) (Record, error)

Decode borrows src. Consume all fields before reusing the read buffer.

type RegionBegin

type RegionBegin struct {
	Baseline, Old, New       [32]byte
	Left, Top, Right, Bottom uint16
	Priority                 refreshpolicy.Priority
	Policy                   refreshpolicy.Policy
}

RegionBegin binds an old/new pixel pair to a confirmed transaction identity. Coordinates are half-open. Panel-specific minimum sizes remain adapter rules. See docs/eps2-region.md; this codec does not grant partial-refresh capability.

func DecodeRegionBegin

func DecodeRegionBegin(b []byte, width, height uint16) (RegionBegin, error)

type Response

type Response struct {
	Status       Status
	Capabilities Capabilities // populated only for Hello
	Health       HealthStatus // populated only for Health
	Panel        PanelStatus  // populated only for PanelTrace
}

func ParseReply

func ParseReply(reply, request Record) (Response, error)

ParseReply is mandatory after generic Decode on the client. It correlates the reply with the exact request, including operation-specific body length. The client must additionally bind boot/generation to its remembered lease.

type Status

type Status struct {
	Operation    Kind
	Code         Code
	State        streamrx.State
	Pass         uint8
	Offset       uint32
	CurrentImage bool
	Diagnostic   Diagnostic
	CooldownMS   uint32
	Generation   uint64
	Boot         [16]byte
}

func DecodeStatus

func DecodeStatus(src []byte) (Status, error)

Jump to

Keyboard shortcuts

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