nativeinspection

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nativeinspection collects explicit native read observations without playback, storage, retries, device discovery or handle ownership of its own.

Index

Constants

View Source
const (
	LiveNative = "live-native"
	NonAtomic  = "sequential-best-effort-not-atomic"
)
View Source
const (
	Contract = "nb1-native-inspection/experimental-v1"
	RAM      = "ram"
	Playback = "playback"
)
View Source
const MaxResponseBytes = 64 << 10

Variables

View Source
var (
	ErrInvalid     = errors.New("invalid native inspection request")
	ErrUnsupported = errors.New("native inspection unavailable")
)

Functions

func MarshalResult

func MarshalResult(value Result, serial string, request Request) ([]byte, error)

MarshalResult is a bounded final wire check, useful for HTTP and fixtures.

func ValidateResult

func ValidateResult(value Result, serial string, request Request) error

ValidateResult verifies the public envelope independently from private SDK types. It is not authentication of a real device, firmware or source evidence.

Types

type ErrorInfo

type ErrorInfo struct {
	Code                       string  `json:"code"`
	Message                    string  `json:"message"`
	MessageTruncated           bool    `json:"message_truncated"`
	MessageUTF8Replaced        bool    `json:"message_utf8_replaced"`
	NativePlatform             *string `json:"native_platform"`
	NativeCode                 *string `json:"native_code"`
	NativePlatformTruncated    bool    `json:"native_platform_truncated"`
	NativePlatformUTF8Replaced bool    `json:"native_platform_utf8_replaced"`
}

type Identity

type Identity struct {
	Serial         string `json:"serial"`
	Product        string `json:"product"`
	Firmware       int    `json:"firmware"`
	FirmwareSource string `json:"firmware_source"`
}

type LineRead

type LineRead struct {
	Position      int
	RGB8          *[3]byte
	DurationTicks *uint16
	LEDCode       *byte
	Reply         Reply
}

type PlaybackRead

type PlaybackRead struct {
	Fields devicesequence.PlaybackFields
	Reply  Reply
}

type PlaybackResult

type PlaybackResult struct {
	Fields          devicesequence.PlaybackFields `json:"raw_fields"`
	Report          Report                        `json:"report"`
	ConfiguredRange *devicesequence.Range         `json:"configured_range"`
	DecodingStatus  string                        `json:"decoding_status"`
	ProfileDigest   string                        `json:"profile_digest"`
	Issues          []devicesequence.Issue        `json:"issues"`
	Deployable      bool                          `json:"deployable"`
	Error           *ErrorInfo                    `json:"error"`
}

type Profile

type Profile struct {
	SDKModel               string                         `json:"sdk_model"`
	SDKReferenceFirmware   *int                           `json:"sdk_reference_firmware"`
	SDKApplicability       string                         `json:"sdk_applicability"`
	RAMLines               *int                           `json:"ram_lines"`
	ReadReference          ReadReference                  `json:"read_reference"`
	OperationQualification string                         `json:"operation_qualification"`
	PlaybackProfile        devicesequence.PlaybackProfile `json:"-"`
}

Profile is trusted adapter input; HTTP/CLI/MCP callers cannot supply it. SDK reference facts remain distinct from version-specific read interpretation.

func (Profile) Clone

func (value Profile) Clone() Profile

type RAMResult

type RAMResult struct {
	RequestedRange  devicesequence.Range     `json:"requested_range"`
	Rows            []Row                    `json:"rows"`
	UnreadPositions []int                    `json:"unread_positions"`
	Sequence        *devicesequence.Sequence `json:"sequence"`
	SequenceDigest  *string                  `json:"sequence_digest"`
	DecodingStatus  string                   `json:"decoding_status"`
	Issues          []devicesequence.Issue   `json:"issues"`
	Deployable      bool                     `json:"deployable"`
}

type ReadReference

type ReadReference struct {
	Firmware            int      `json:"firmware"`
	Applicability       string   `json:"applicability"`
	Sources             []string `json:"sources"`
	RowsDecodable       bool     `json:"rows_decodable"`
	PlaybackEndEncoding string   `json:"playback_end_encoding"`
}

type Reader

type Reader interface {
	ReadLine(position int) (LineRead, error)
	ReadPlayback() (PlaybackRead, error)
}

Reader is called synchronously by the owning worker only. Cancellation cannot forcibly interrupt an in-flight native operation or close its handle.

type Reply

type Reply struct {
	RequestedReportID byte
	BufferLength      int
	ReadAttempted     bool
	ReturnedLength    int
	LengthValid       bool
	Bytes             []byte
}

Reply is an adapter's in-memory observation, never default-marshaled to wire.

type Report

type Report struct {
	Layout            string `json:"layout"`
	RequestedReportID byte   `json:"requested_report_id"`
	BufferLength      int    `json:"buffer_length"`
	ReadAttempted     bool   `json:"read_attempted"`
	ReturnedLength    int    `json:"returned_length"`
	LengthValid       bool   `json:"length_valid"`
	PrefixTrusted     bool   `json:"prefix_trusted"`
	RawHex            string `json:"raw_hex"`
	UnknownTailHex    string `json:"unknown_tail_hex"`
}

Report exports bytes as hexadecimal, including only the returned prefix. This is the SDK/GID buffer boundary, not a physical USB transaction capture.

type Request

type Request struct {
	Kind  string
	Range *devicesequence.Range
}

func (Request) Clone

func (r Request) Clone() Request

func (Request) Validate

func (r Request) Validate() error

Validate never queries a device. RAM ranges are explicit, without sentinels.

type Result

type Result struct {
	Contract         string          `json:"contract"`
	Kind             string          `json:"kind"`
	DaemonInstanceID string          `json:"daemon_instance_id"`
	DeviceSessionID  string          `json:"device_session_id"`
	Device           Identity        `json:"device"`
	Source           string          `json:"source"`
	Consistency      string          `json:"consistency"`
	StartedAt        time.Time       `json:"started_at"`
	FinishedAt       time.Time       `json:"finished_at"`
	DurationNS       int64           `json:"duration_ns"`
	Status           string          `json:"status"`
	Complete         bool            `json:"complete"`
	Profile          Profile         `json:"profile"`
	RAM              *RAMResult      `json:"ram"`
	Playback         *PlaybackResult `json:"playback"`
	Error            *ErrorInfo      `json:"error"`
}

func Collect

func Collect(ctx context.Context, reader Reader, request Request, identity Identity, profile Profile) (Result, error)

Collect is called by the owner of an already-open reader. It neither opens nor closes it. It stops a batch on its first error and never retries or manufactures missing rows. Cancellation is checked between synchronous calls.

func DecodeResult

func DecodeResult(data []byte, serial string, request Request) (Result, error)

DecodeResult accepts the complete nullable read-side shape. Existing request decoders intentionally forbid null and must not be reused for observations. Every field is explicit; omission is never filled with a plausible zero.

func (Result) Clone

func (value Result) Clone() Result

Clone keeps worker, transport and caller-owned buffers and nullable fields independent. It does not marshal through JSON or discard private profile data.

type Row

type Row struct {
	Position      int        `json:"position"`
	RGB8          *[3]byte   `json:"rgb8"`
	DurationTicks *uint16    `json:"duration_ticks"`
	LEDCode       *byte      `json:"led_code"`
	Report        Report     `json:"report"`
	Error         *ErrorInfo `json:"error"`
}

Directories

Path Synopsis
Command testfixturegen emits synthetic protocol vectors.
Command testfixturegen emits synthetic protocol vectors.

Jump to

Keyboard shortcuts

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