generated from thinkode/modelRepository
load and unload syntax
This commit is contained in:
@@ -22,6 +22,10 @@ const (
|
||||
PeripheralArrival PeripheralEvent = "PERIPHERAL_ARRIVAL"
|
||||
// PeripheralRemoval is triggered when a peripheral has been disconnected from the system
|
||||
PeripheralRemoval PeripheralEvent = "PERIPHERAL_REMOVAL"
|
||||
// PeripheralLoad is triggered when a peripheral is added to the project
|
||||
PeripheralLoad PeripheralEvent = "PERIPHERAL_LOAD"
|
||||
// PeripheralUnload is triggered when a peripheral is removed from the project
|
||||
PeripheralUnload PeripheralEvent = "PERIPHERAL_UNLOAD"
|
||||
// PeripheralStatusUpdated is triggered when a peripheral status has been updated (disconnected - connecting - deactivated - activated)
|
||||
PeripheralStatusUpdated PeripheralEvent = "PERIPHERAL_STATUS"
|
||||
// PeripheralEventEmitted is triggered when a peripheral event is emitted
|
||||
@@ -85,7 +89,7 @@ func (h *Manager) RegisterPeripheral(ctx context.Context, peripheralData Periphe
|
||||
}
|
||||
|
||||
// Emits the event in the hardware
|
||||
runtime.EventsEmit(ctx, "LOAD_PERIPHERAL", peripheralData)
|
||||
runtime.EventsEmit(ctx, string(PeripheralLoad), peripheralData)
|
||||
|
||||
return peripheralData.SerialNumber, nil
|
||||
}
|
||||
@@ -110,7 +114,7 @@ func (h *Manager) UnregisterPeripheral(ctx context.Context, peripheralData Perip
|
||||
}
|
||||
}
|
||||
delete(h.savedPeripherals, peripheralData.SerialNumber)
|
||||
runtime.EventsEmit(ctx, "UNLOAD_PERIPHERAL", peripheralData)
|
||||
runtime.EventsEmit(ctx, string(PeripheralUnload), peripheralData)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user