修复投影仪控制

This commit is contained in:
2025-03-05 11:03:19 +08:00
parent 363047c078
commit c71e8bc13d
18 changed files with 598 additions and 399 deletions

View File

@@ -0,0 +1,35 @@
package standby
import (
"context"
"fmt"
"game-driver/config/wait"
"game-driver/internal/schema"
"game-driver/pkg/pjlink"
"go.uber.org/zap"
)
func PJLink(_ schema.WaitItemModel) func(c context.Context) error {
return func(c context.Context) error {
cfg := (wait.C).(wait.PJLink)
pjc := pjlink.NewClient(cfg.Ip, cfg.Port, cfg.Password, cfg.Id)
zap.S().Infoln("打开待机投影仪")
resp, err := pjc.PowerOn()
if err != nil {
return fmt.Errorf("打开投影仪异常: %w", err)
}
zap.S().Infoln("投影仪返回报文:", resp)
<-c.Done()
zap.S().Infoln("关闭待机投影仪")
resp, err = pjc.PowerOff()
if err != nil {
return fmt.Errorf("关闭投影仪异常: %w", err)
}
zap.S().Infoln("投影仪返回报文:", resp)
return nil
}
}