Documentation
¶
Index ¶
Constants ¶
const ( // ActionUnmapped disables an input binding. ActionUnmapped = "unmapped" // ActionButton assigns the next free gamepad button. ActionButton = "button" // ActionWheelUp emits one upward wheel tick. ActionWheelUp = "wheel_up" // ActionWheelDown emits one downward wheel tick. ActionWheelDown = "wheel_down" // ActionHWheelLeft emits one leftward wheel tick. ActionHWheelLeft = "hwheel_left" // ActionHWheelRight emits one rightward wheel tick. ActionHWheelRight = "hwheel_right" // ActionAxisX drives the X axis. ActionAxisX = "axis_x" // ActionAxisY drives the Y axis. ActionAxisY = "axis_y" // ActionAxisZ drives the Z axis. ActionAxisZ = "axis_z" // ActionAxisRX drives the rotational X axis. ActionAxisRX = "axis_rx" // ActionAxisRY drives the rotational Y axis. ActionAxisRY = "axis_ry" // ActionAxisRZ drives the rotational Z axis. ActionAxisRZ = "axis_rz" // ActionSlider0 drives the first slider axis. ActionSlider0 = "axis_slider0" // ActionSlider1 drives the second slider axis. ActionSlider1 = "axis_slider1" // ActionWheel converts analog deflection to vertical scrolling. ActionWheel = "wheel" // ActionHWheel converts analog deflection to horizontal scrolling. ActionHWheel = "hwheel" )
Action names are stable values shared by configuration and producers.
Variables ¶
This section is empty.
Functions ¶
func ActionButtonN ¶
ActionButtonN formats a pinned-button action. Action accepts values from ActionButtonN(1) through ActionButtonN(79).
func ActionNames ¶
func ActionNames() []string
ActionNames returns every fixed action name, sorted. The dynamic "button<N>" forms are accepted by Action but not enumerated here.
Types ¶
type ActionObj ¶
type ActionObj struct {
// Kind is the target control category.
Kind ControlKind
// Usage identifies the target axis, wheel, or button.
Usage Usage
// Press is the active discrete value or wheel direction.
Press int32
// Continuous reports whether the action requires an analog source.
Continuous bool
}
ActionObj describes how an output action is realized on the device: the control Kind and Usage to declare, and the value emitted when a discrete source is active (Press) or the scroll direction for a continuous wheel.
type ControlKind ¶
type ControlKind uint8
ControlKind selects how a control reaches the operating system.
const ( // KindButton emits a digital joystick or gamepad button. KindButton ControlKind = iota // KindAxis emits an absolute axis value. KindAxis // KindRelative emits a relative pointer delta such as a wheel tick. KindRelative )
type ControlObj ¶
type ControlObj struct {
// Handle is the caller-defined identifier passed to Interface.Set.
Handle uint16
// Kind selects the OS event category.
Kind ControlKind
// Usage selects the axis, wheel, or pinned button number.
Usage Usage
// Min is the lower KindAxis bound.
Min int32
// Max is the upper KindAxis bound.
Max int32
}
ControlObj declares one control of a virtual device. Handle is a stable, caller-chosen identifier later passed to Interface.Set; it is independent of declaration order. Min/Max bound KindAxis values and are ignored otherwise.
type Interface ¶
type Interface interface {
// Set applies a value to the control with the given handle:
// - KindButton: value != 0 presses, value == 0 releases.
// - KindAxis: value is clamped to the control's [Min, Max].
// - KindRelative: value is the delta emitted for this frame.
Set(handle uint16, value int32) error
// Sync commits everything emitted since the previous Sync.
Sync() error
// Close releases the operating-system device and its resources.
Close() error
}
Interface is an OS-level virtual input device. Implementations are not safe for concurrent use; the caller owns serialization.
type SpecObj ¶
type SpecObj struct {
// Name is the user-visible device name on platforms that support it.
Name string
// VendorID is the USB vendor identifier on platforms that support it.
VendorID uint16
// ProductID is the USB product identifier on platforms that support it.
ProductID uint16
// Controls declares every addressable device control.
Controls []ControlObj
}
SpecObj describes a virtual device to create. The package knows nothing about DJI: any producer can define a device through it.
type Usage ¶
type Usage uint16
Usage names a semantic axis or wheel. KindButton reuses it as a plain 1-based gamepad button number (0 auto-assigns the next free one).
const ( // UsageX selects the X axis. UsageX Usage = iota // UsageY selects the Y axis. UsageY // UsageZ selects the Z axis. UsageZ // UsageRX selects the rotational X axis. UsageRX // UsageRY selects the rotational Y axis. UsageRY // UsageRZ selects the rotational Z axis. UsageRZ // UsageSlider0 selects the first slider axis. UsageSlider0 // UsageSlider1 selects the second slider axis. UsageSlider1 // UsageWheel selects the vertical mouse wheel. UsageWheel // UsageHWheel selects the horizontal mouse wheel. UsageHWheel // UsageAuto assigns the next canonical axis to KindAxis. UsageAuto )