feat: add archer ax50

This commit is contained in:
2023-07-02 19:50:59 +02:00
parent 55ed1c1b36
commit cc9c9354bc
4 changed files with 101 additions and 7 deletions

View File

@@ -8,13 +8,13 @@ import (
"github.com/go-rod/rod"
)
type switcher struct {
type Switcher struct {
Browser *rod.Browser
Page *rod.Page
config *cfg.Config
}
func NewSwitcher(remoteControlBrowserUrl string, config *cfg.Config) switcher {
func NewSwitcher(remoteControlBrowserUrl string, config *cfg.Config) Switcher {
browser := rod.New().
ControlURL(remoteControlBrowserUrl).
MustConnect().
@@ -22,14 +22,14 @@ func NewSwitcher(remoteControlBrowserUrl string, config *cfg.Config) switcher {
page := browser.MustPage(config.Page)
return switcher{
return Switcher{
Browser: browser,
Page: page,
config: config,
}
}
func (s switcher) SwitchWIFI(prv provider.ProviderIface) error {
func (s Switcher) SwitchWIFI(prv provider.ProviderIface) error {
defer s.Browser.MustClose()
defer s.Page.Close()