Files
dmxconnect/hardware/interfaces.go

35 lines
1.8 KiB
Go
Raw Normal View History

2024-12-15 13:45:46 +01:00
package hardware
import "context"
// Peripheral represents the methods used to manage a peripheral (input or output hardware)
type Peripheral interface {
Connect(context.Context) error // Connect the peripheral
Disconnect(context.Context) error // Disconnect the peripheral
Activate(context.Context) error // Activate the peripheral
Deactivate(context.Context) error // Deactivate the peripheral
SetDeviceProperty(context.Context, uint32, uint32, byte) error // Update a device property
2024-12-15 13:45:46 +01:00
GetInfo() PeripheralInfo // Get the peripheral information
}
// PeripheralInfo represents a peripheral information
type PeripheralInfo struct {
2024-12-20 17:18:57 +01:00
Name string `yaml:"name"` // Name of the peripheral
SerialNumber string `yaml:"sn"` // S/N of the peripheral
ProtocolName string `yaml:"protocol"` // Protocol name of the peripheral
Settings []interface{} `yaml:"settings"` // Number of DMX universes handled by the peripheral
2024-12-15 13:45:46 +01:00
}
2025-01-04 00:36:29 +01:00
// PeripheralFinder represents how compatible peripheral drivers are implemented
type PeripheralFinder interface {
2024-12-23 17:22:37 +01:00
Initialize() error // Initializes the protocol
2025-01-04 00:36:29 +01:00
Start(context.Context) error // Start the detection
Stop() error // Stop the detection
ForceScan() // Explicitly scans for peripherals
CreatePeripheral(ctx context.Context) (Peripheral, error) // Creates a new peripheral
DeletePeripheral(serialNumber string) error // Removes a peripheral
2024-12-23 17:22:37 +01:00
GetName() string // Get the name of the finder
GetPeripheral(string) (Peripheral, bool) // Get the peripheral
2024-12-15 13:45:46 +01:00
}