generated from thinkode/modelRepository
corrected events
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -52,6 +53,9 @@ func (f *FTDIFinder) RegisterPeripheral(ctx context.Context, peripheralData Peri
|
||||
f.registeredPeripherals[peripheralData.SerialNumber] = ftdiPeripheral
|
||||
log.Trace().Any("periph", &ftdiPeripheral).Str("file", "FTDIFinder").Str("peripheralName", peripheralData.Name).Msg("FTDI peripheral has been created")
|
||||
|
||||
// Emit the event to the front
|
||||
runtime.EventsEmit(ctx, "LOAD_PERIPHERAL", peripheralData)
|
||||
|
||||
// Peripheral created, connect it
|
||||
err = ftdiPeripheral.Connect(ctx)
|
||||
if err != nil {
|
||||
@@ -80,8 +84,12 @@ func (f *FTDIFinder) UnregisterPeripheral(ctx context.Context, peripheralID stri
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(f.registeredPeripherals, peripheralID)
|
||||
|
||||
// Emit the event to the front
|
||||
runtime.EventsEmit(ctx, "UNLOAD_PERIPHERAL", peripheral.info)
|
||||
}
|
||||
delete(f.registeredPeripherals, peripheralID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user