doesnt look as cool, but for sure feels simpler
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"esdi/cdashdisplay"
|
||||
"esdi/peripheral"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type CDashService struct {
|
||||
Logger *slog.Logger
|
||||
CDash *cdashdisplay.CDashDisplay
|
||||
DevClerk *peripheral.PeripheralDeviceClerk
|
||||
Messages chan string
|
||||
}
|
||||
|
||||
func NewCDashService(logger *slog.Logger) *CDashService {
|
||||
return &CDashService{
|
||||
Logger: logger,
|
||||
CDash: nil,
|
||||
DevClerk: peripheral.NewPeripheralDeviceClerk(),
|
||||
Messages: make(chan string, 10),
|
||||
}
|
||||
}
|
||||
|
||||
func (cds *CDashService) FindDevice() {
|
||||
cds.Messages <- "looking for cdash display...\n"
|
||||
cds.Logger.Info("Looking for CDashDisplay")
|
||||
|
||||
cdashdisplay.SetLogger(cds.Logger.With("[device]", "cdashdisplay"))
|
||||
|
||||
display, err := cdashdisplay.NewCDashDisplay()
|
||||
if err != nil {
|
||||
cds.Logger.Info("didn't find cdashdisplay")
|
||||
cds.Messages <- "didn't find cdash display\n"
|
||||
return
|
||||
}
|
||||
|
||||
cds.CDash = display
|
||||
cds.Logger.Info("found cdashdisplay on: " + display.WT.Cfg.Name)
|
||||
cds.Messages <- "found cdashdisplay on: " + display.WT.Cfg.Name + "\n"
|
||||
}
|
||||
Reference in New Issue
Block a user