interrupt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SensorSocket = "/tmp/pillow.sock"

SensorSocket is the default Unix domain socket path for the sensor daemon.

Variables

This section is empty.

Functions

func SensordRunning

func SensordRunning(socketPath string) bool

SensordRunning checks if the sensor daemon is accessible.

Types

type AccelClient

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

AccelClient connects to pillowsensord and emits slap interrupts.

func NewAccelClient

func NewAccelClient(socketPath string) *AccelClient

NewAccelClient creates a client for the sensor daemon.

func (*AccelClient) Run

func (a *AccelClient) Run(ctx context.Context, interrupts chan<- bus.Interrupt) error

Run connects to the sensor daemon and emits interrupts. It blocks until the context is cancelled.

type Handler

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

Handler processes interrupts and maps them to agent actions.

func NewHandler

func NewHandler(bridge *agent.Bridge, engine *narration.Engine) *Handler

NewHandler creates an interrupt handler.

func (*Handler) Run

func (h *Handler) Run(ctx context.Context, interrupts <-chan bus.Interrupt)

Run processes interrupts from the bus.

type KeyboardListener

type KeyboardListener struct{}

KeyboardListener listens for keyboard interrupt signals.

func NewKeyboardListener

func NewKeyboardListener() *KeyboardListener

NewKeyboardListener creates a keyboard interrupt listener.

func (*KeyboardListener) Run

func (k *KeyboardListener) Run(ctx context.Context, interrupts chan<- bus.Interrupt)

Run listens for SIGQUIT (Ctrl+\) and emits keyboard interrupts. SIGINT (Ctrl+C) is handled by the main process for clean shutdown.

type SensordConfig

type SensordConfig struct {
	Sensitivity float64 `json:"sensitivity"`
	CooldownMs  int     `json:"cooldown_ms"`
}

SensordConfig is sent from pillow to pillowsensord to adjust settings.

type SlapEvent

type SlapEvent struct {
	Type      string    `json:"type"`      // always "slap"
	Magnitude float64   `json:"magnitude"` // acceleration magnitude
	Timestamp time.Time `json:"timestamp"`
}

SlapEvent is sent from pillowsensord to pillow clients over the socket.

Jump to

Keyboard shortcuts

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