generated from thinkode/modelRepository
34-midi (#35)
Closes #34 Implement MIDI peripherals Implement device concept Cleaning project Reviewed-on: #35
This commit was merged in pull request #35.
This commit is contained in:
28
app.go
28
app.go
@@ -3,6 +3,9 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"dmxconnect/hardware"
|
||||
genericmidi "dmxconnect/hardware/genericMIDI"
|
||||
"dmxconnect/hardware/genericftdi"
|
||||
"dmxconnect/hardware/os2l"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
@@ -20,24 +23,25 @@ type App struct {
|
||||
cancelFunc context.CancelFunc
|
||||
wait sync.WaitGroup
|
||||
|
||||
hardwareManager *hardware.HardwareManager // For managing all the hardware
|
||||
wmiMutex sync.Mutex // Avoid some WMI operations at the same time
|
||||
projectInfo ProjectInfo // The project information structure
|
||||
projectSave string // The file name of the project
|
||||
hardwareManager *hardware.Manager // For managing all the hardware
|
||||
wmiMutex sync.Mutex // Avoid some WMI operations at the same time
|
||||
projectInfo ProjectInfo // The project information structure
|
||||
projectSave string // The file name of the project
|
||||
}
|
||||
|
||||
// NewApp creates a new App application struct
|
||||
func NewApp() *App {
|
||||
// Create a new hadware manager
|
||||
hardwareManager := hardware.NewHardwareManager()
|
||||
// hardwareManager.RegisterFinder(hardware.NewMIDIFinder(5 * time.Second))
|
||||
hardwareManager.RegisterFinder(hardware.NewFTDIFinder(5 * time.Second))
|
||||
hardwareManager.RegisterFinder(hardware.NewOS2LFinder())
|
||||
hardwareManager := hardware.NewManager()
|
||||
// Register all the providers to use as hardware scanners
|
||||
hardwareManager.RegisterProvider(genericftdi.NewProvider(3 * time.Second))
|
||||
hardwareManager.RegisterProvider(os2l.NewProvider())
|
||||
hardwareManager.RegisterProvider(genericmidi.NewProvider(3 * time.Second))
|
||||
return &App{
|
||||
hardwareManager: hardwareManager,
|
||||
projectSave: "",
|
||||
projectInfo: ProjectInfo{
|
||||
PeripheralsInfo: make(map[string]hardware.PeripheralInfo),
|
||||
EndpointsInfo: make(map[string]hardware.EndpointInfo),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -60,12 +64,12 @@ func (a *App) onStartup(ctx context.Context) {
|
||||
}
|
||||
|
||||
// onReady is called when the DOM is ready
|
||||
// We get the current peripherals connected
|
||||
// We get the current endpoints connected
|
||||
func (a *App) onReady(ctx context.Context) {
|
||||
// log.Debug().Str("file", "peripherals").Msg("getting peripherals...")
|
||||
// log.Debug().Str("file", "endpoints").Msg("getting endpoints...")
|
||||
// err := a.hardwareManager.Scan()
|
||||
// if err != nil {
|
||||
// log.Err(err).Str("file", "app").Msg("unable to get the peripherals")
|
||||
// log.Err(err).Str("file", "app").Msg("unable to get the endpoints")
|
||||
// }
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user