show event signal on the interface

This commit is contained in:
2025-11-13 13:01:06 +01:00
parent d730cf4f1c
commit 18a3a716ef
8 changed files with 69 additions and 16 deletions

View File

@@ -57,10 +57,16 @@ func (f *OS2LFinder) RegisterPeripheral(ctx context.Context, peripheralData Peri
peripheralData.SerialNumber = strings.ToUpper(fmt.Sprintf("%08x", rand.Intn(1<<32)))
}
// Create a new OS2L peripheral
peripheral, err := NewOS2LPeripheral(peripheralData)
if err != nil {
return "", fmt.Errorf("unable to create the OS2L peripheral: %v", err)
}
// Set the event callback
peripheral.SetEventCallback(func(event any) {
runtime.EventsEmit(ctx, string(PeripheralEventEmitted), peripheralData.SerialNumber, event)
})
f.saved[peripheralData.SerialNumber] = peripheral
log.Trace().Str("file", "OS2LFinder").Str("serialNumber", peripheralData.SerialNumber).Msg("OS2L peripheral created")