generated from thinkode/modelRepository
fixed: create peripheral
This commit is contained in:
@@ -22,8 +22,8 @@ type MIDIFinder struct {
|
||||
|
||||
scanEvery time.Duration // Scans peripherals periodically
|
||||
|
||||
onArrival func(context.Context, Peripheral, bool) // When a peripheral arrives
|
||||
onRemoval func(context.Context, Peripheral) // When a peripheral goes away
|
||||
onArrival func(context.Context, Peripheral) // When a peripheral arrives
|
||||
onRemoval func(context.Context, Peripheral) // When a peripheral goes away
|
||||
}
|
||||
|
||||
// NewMIDIFinder creates a new MIDI finder
|
||||
@@ -36,7 +36,7 @@ func NewMIDIFinder(scanEvery time.Duration) *MIDIFinder {
|
||||
}
|
||||
|
||||
// OnArrival is the callback function when a new peripheral arrives
|
||||
func (f *MIDIFinder) OnArrival(cb func(context.Context, Peripheral, bool)) {
|
||||
func (f *MIDIFinder) OnArrival(cb func(context.Context, Peripheral)) {
|
||||
f.onArrival = cb
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ func (f *MIDIFinder) Initialize() error {
|
||||
}
|
||||
|
||||
// Create creates a new peripheral, based on the peripheral information (manually created)
|
||||
func (f *MIDIFinder) Create(ctx context.Context, peripheralInfo PeripheralInfo) error {
|
||||
return nil
|
||||
func (f *MIDIFinder) Create(ctx context.Context, peripheralInfo PeripheralInfo) (PeripheralInfo, error) {
|
||||
return PeripheralInfo{}, nil
|
||||
}
|
||||
|
||||
// Remove removes an existing peripheral (manually created)
|
||||
@@ -201,7 +201,7 @@ func (f *MIDIFinder) scanPeripherals(ctx context.Context) error {
|
||||
f.detected[sn] = peripheral
|
||||
|
||||
if f.onArrival != nil {
|
||||
f.onArrival(ctx, discovery, false)
|
||||
f.onArrival(ctx, discovery)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user