Implements the OS2L feature (tested with Virtual DJ).
Graphics improvements.

Reviewed-on: #32
This commit was merged in pull request #32.
This commit is contained in:
2025-11-14 10:46:24 +00:00
parent 121a14ac61
commit 932c288a9c
18 changed files with 560 additions and 245 deletions

View File

@@ -5,39 +5,37 @@ 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
IsConnected() bool // Return if the peripheral is connected or not
Disconnect() error // Disconnect the peripheral
SetEventCallback(func(any)) // Callback is called when an event is emitted from the peripheral
Disconnect(context.Context) error // Disconnect the peripheral
Activate(context.Context) error // Activate the peripheral
Deactivate(context.Context) error // Deactivate the peripheral
SetSettings(map[string]interface{}) error // Set a peripheral setting
SetSettings(context.Context, map[string]any) error // Set a peripheral setting
SetDeviceProperty(context.Context, uint32, byte) error // Update a device property
WaitStop() error // Properly close the peripheral
GetInfo() PeripheralInfo // Get the peripheral information
GetSettings() map[string]interface{} // Get the peripheral settings
GetInfo() PeripheralInfo // Get the peripheral information
GetSettings() map[string]any // Get the peripheral settings
}
// PeripheralInfo represents a peripheral information
type PeripheralInfo struct {
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
// IsConnected bool // If the peripheral is connected to the system
// IsActivated bool // If the peripheral is activated in the project
// IsDetected bool // If the peripheral is detected by the system
Settings map[string]interface{} `yaml:"settings"` // Peripheral settings
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 map[string]any `yaml:"settings"` // Peripheral settings
}
// PeripheralFinder represents how compatible peripheral drivers are implemented
type PeripheralFinder interface {
Initialize() error // Initializes the protocol
OnArrival(cb func(p PeripheralInfo)) // Callback function when a peripheral arrives
OnRemoval(cb func(p PeripheralInfo)) // Callback function when a peripheral goes away
Start(context.Context) error // Start the detection
WaitStop() error // Waiting for finder to close
ForceScan() // Explicitly scans for peripherals
RegisterPeripheral(context.Context, PeripheralInfo) (string, error) // Registers a new peripheral data
UnregisterPeripheral(context.Context, PeripheralInfo) error // Unregisters an existing peripheral
GetPeripheralSettings(string) (map[string]interface{}, error) // Gets the peripheral settings
SetPeripheralSettings(string, map[string]interface{}) error // Sets the peripheral settings
GetName() string // Get the name of the finder
Initialize() error // Initializes the protocol
OnArrival(cb func(p PeripheralInfo)) // Callback function when a peripheral arrives
OnRemoval(cb func(p PeripheralInfo)) // Callback function when a peripheral goes away
Start(context.Context) error // Start the detection
WaitStop() error // Waiting for finder to close
ForceScan() // Explicitly scans for peripherals
RegisterPeripheral(context.Context, PeripheralInfo) (string, error) // Registers a new peripheral data
UnregisterPeripheral(context.Context, PeripheralInfo) error // Unregisters an existing peripheral
GetPeripheralSettings(string) (map[string]any, error) // Gets the peripheral settings
SetPeripheralSettings(context.Context, string, map[string]any) error // Sets the peripheral settings
GetName() string // Get the name of the finder
}