generated from thinkode/modelRepository
resolved created peripheral
This commit is contained in:
@@ -7,6 +7,12 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// CreatePeripheral creates a new peripheral from the hardware manager
|
||||
func (a *App) CreatePeripheral(peripheralData hardware.PeripheralInfo) (string, error) {
|
||||
a.hardwareManager.CreatePeripheral(a.ctx, peripheralData)
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// AddPeripheral adds a peripheral to the project
|
||||
func (a *App) AddPeripheral(peripheralData hardware.PeripheralInfo) (string, error) {
|
||||
// Register this new peripheral
|
||||
@@ -29,17 +35,6 @@ func (a *App) AddPeripheral(peripheralData hardware.PeripheralInfo) (string, err
|
||||
return peripheralData.SerialNumber, nil
|
||||
}
|
||||
|
||||
// CreatePeripheral creates a new peripheral
|
||||
func (a *App) CreatePeripheral(peripheralData hardware.PeripheralInfo) (string, error) {
|
||||
// Get the appropriate finder to create the device
|
||||
finder, err := a.hardwareManager.GetFinder(peripheralData.ProtocolName)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to find the appropriate finder (%s): %w", peripheralData.ProtocolName, err)
|
||||
}
|
||||
// Manually create the peripheral from its finder
|
||||
return finder.Create(a.ctx, peripheralData)
|
||||
}
|
||||
|
||||
// GetPeripheralSettings gets the peripheral settings
|
||||
func (a *App) GetPeripheralSettings(protocolName, peripheralSN string) (map[string]any, error) {
|
||||
return a.hardwareManager.GetPeripheralSettings(peripheralSN)
|
||||
|
||||
Reference in New Issue
Block a user