generated from thinkode/modelRepository
59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
|
|
package hardware
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"github.com/rs/zerolog/log"
|
||
|
|
)
|
||
|
|
|
||
|
|
// MIDIPeripheral contains the data of a MIDI peripheral
|
||
|
|
type MIDIPeripheral struct {
|
||
|
|
name string // The name of the peripheral
|
||
|
|
location int // The location of the peripheral
|
||
|
|
serialNumber string // The S/N of the peripheral
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewMIDIPeripheral creates a new MIDI peripheral
|
||
|
|
func NewMIDIPeripheral(name string, location int, serialNumber string) *MIDIPeripheral {
|
||
|
|
log.Trace().Str("file", "MIDIPeripheral").Str("name", name).Str("s/n", serialNumber).Int("location", location).Msg("MIDI peripheral created")
|
||
|
|
return &MIDIPeripheral{
|
||
|
|
name: name,
|
||
|
|
location: location,
|
||
|
|
serialNumber: serialNumber,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Connect connects the MIDI peripheral
|
||
|
|
func (p *MIDIPeripheral) Connect(ctx context.Context) error {
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// Disconnect disconnects the MIDI peripheral
|
||
|
|
func (p *MIDIPeripheral) Disconnect(ctx context.Context) error {
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// Activate activates the MIDI peripheral
|
||
|
|
func (p *MIDIPeripheral) Activate(ctx context.Context) error {
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// Deactivate deactivates the MIDI peripheral
|
||
|
|
func (p *MIDIPeripheral) Deactivate(ctx context.Context) error {
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetDeviceProperty - not implemented for this kind of peripheral
|
||
|
|
func (p *MIDIPeripheral) SetDeviceProperty(context.Context, uint32, uint32, byte) error {
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// GetInfo gets the peripheral information
|
||
|
|
func (p *MIDIPeripheral) GetInfo() PeripheralInfo {
|
||
|
|
return PeripheralInfo{
|
||
|
|
Name: p.name,
|
||
|
|
ProtocolName: "MIDI",
|
||
|
|
SerialNumber: p.serialNumber,
|
||
|
|
}
|
||
|
|
}
|