generated from thinkode/modelRepository
fixed: create peripheral
This commit is contained in:
@@ -27,8 +27,8 @@ type FTDIFinder 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
|
||||
}
|
||||
|
||||
// NewFTDIFinder creates a new FTDI finder
|
||||
@@ -41,7 +41,7 @@ func NewFTDIFinder(scanEvery time.Duration) *FTDIFinder {
|
||||
}
|
||||
|
||||
// OnArrival is the callback function when a new peripheral arrives
|
||||
func (f *FTDIFinder) OnArrival(cb func(context.Context, Peripheral, bool)) {
|
||||
func (f *FTDIFinder) OnArrival(cb func(context.Context, Peripheral)) {
|
||||
f.onArrival = cb
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ func (f *FTDIFinder) Initialize() error {
|
||||
}
|
||||
|
||||
// Create creates a new peripheral, based on the peripheral information (manually created)
|
||||
func (f *FTDIFinder) Create(ctx context.Context, peripheralInfo PeripheralInfo) error {
|
||||
return nil
|
||||
func (f *FTDIFinder) Create(ctx context.Context, peripheralInfo PeripheralInfo) (PeripheralInfo, error) {
|
||||
return PeripheralInfo{}, nil
|
||||
}
|
||||
|
||||
// Remove removes an existing peripheral (manually created)
|
||||
@@ -147,7 +147,7 @@ func (f *FTDIFinder) scanPeripherals(ctx context.Context) error {
|
||||
peripheral := NewFTDIPeripheral(peripheralData)
|
||||
|
||||
if f.onArrival != nil {
|
||||
f.onArrival(ctx, peripheral, false)
|
||||
f.onArrival(ctx, peripheral)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user