MIDI device start of implementation

This commit is contained in:
2025-11-16 21:44:48 +01:00
parent 19ec0bec74
commit 76b705012c
4 changed files with 43 additions and 12 deletions

View File

@@ -2,6 +2,21 @@ package hardware
import "context"
// MappingInfo is the configuration for each device
type MappingInfo struct {
DeviceInfo struct {
Name string `yaml:"name"`
Manufacturer string `yaml:"manufacturer"`
Type string `yaml:"type"`
} `yaml:"device"`
Features map[string]any `yaml:"features"`
}
// Device represents the methods used to manage a device (logic element include in a Peripheral)
type Device interface {
Configure() error // Load the mapping for the device
}
// Peripheral represents the methods used to manage a peripheral (input or output hardware)
type Peripheral interface {
Connect(context.Context) error // Connect the peripheral
@@ -9,12 +24,15 @@ type Peripheral interface {
Disconnect(context.Context) error // Disconnect the peripheral
Activate(context.Context) error // Activate the peripheral
Deactivate(context.Context) error // Deactivate the peripheral
AddDevice(Device) error // Add a device to the peripheral
RemoveDevice(Device) error // Remove a device to the peripheral
GetSettings() map[string]any // Get the peripheral settings
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]any // Get the peripheral settings
GetInfo() PeripheralInfo // Get the peripheral information
}
// PeripheralInfo represents a peripheral information