device

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package device is the class-neutral vocabulary the broker speaks: a Device is "one allocatable thing" and a Controller is "how to discover/boot that class of thing." iOS simulators (internal/simctl) and, later, Android emulators (internal/avd) each provide a Controller; the broker never learns the per-platform details (xcrun JSON vs adb plaintext, UDID vs AVD name).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class string

Class names a family of devices the broker can allocate independently (each with its own capacity). Today: iOS simulators and Android emulators.

const (
	ClassIOS     Class = "ios"
	ClassAndroid Class = "android"
)

func (Class) Known

func (c Class) Known() bool

Known reports whether c is a class the broker understands.

type Controller

type Controller interface {
	// Class identifies which family this controller serves.
	Class() Class
	// ListAvailable returns every currently-allocatable device of this class,
	// each tagged with Class. Discovery is read-only.
	ListAvailable(ctx context.Context) ([]Device, error)
	// Boot powers on a device by ID. Best-effort and opt-in (claim --boot); the
	// broker never makes allocation depend on it.
	Boot(ctx context.Context, id string) error
}

Controller is the broker's single seam onto a device platform: discover what exists, and (best-effort, opt-in) boot one. Implementations live in internal/simctl (iOS) and internal/avd (Android).

type Device

type Device struct {
	ID      string `json:"udid"` // opaque identity; JSON key kept as "udid" for back-compat
	Name    string `json:"name"`
	Class   Class  `json:"class"`
	OS      string `json:"os"`      // "iOS" | "Android"
	Version string `json:"version"` // human form, e.g. "26.4.0" (iOS) or "35" (Android API)
	State   string `json:"state"`   // platform state word, e.g. "Booted" | "device" | "offline"
	Booted  bool   `json:"booted"`  // normalized: is the device up (or coming up)?
}

Device is one allocatable device, flattened to a class-neutral shape.

ID is the *stable* opaque identity used as the allocation key: an iOS UDID, or an Android AVD name. (For Android the runtime "emulator-5554" serial is NOT the identity — it's a transient console port — so it deliberately does not live here.) The broker treats ID as an opaque string and never interprets it.

Jump to

Keyboard shortcuts

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