feat: 加入打点支持

This commit is contained in:
余泓铮
2024-09-20 10:49:38 +08:00
parent 4fb9baf5a8
commit 029bfa05b4
3 changed files with 25 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ type HarmonyDevice struct {
d *ghdc.Device
ConnectKey string `json:"connect_key,omitempty" yaml:"connect_key,omitempty"`
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
}
type HarmonyDeviceOption func(*HarmonyDevice)
@@ -29,6 +30,18 @@ func WithConnectKey(connectKey string) HarmonyDeviceOption {
}
}
func WithIgnorePopup(ignorePopup bool) HarmonyDeviceOption {
return func(device *HarmonyDevice) {
device.IgnorePopup = ignorePopup
}
}
func WithLogOn(logOn bool) HarmonyDeviceOption {
return func(device *HarmonyDevice) {
device.LogOn = logOn
}
}
func NewHarmonyDevice(options ...HarmonyDeviceOption) (device *HarmonyDevice, err error) {
device = &HarmonyDevice{}
for _, option := range options {
@@ -101,7 +114,7 @@ func (dev *HarmonyDevice) UUID() string {
}
func (dev *HarmonyDevice) LogEnabled() bool {
return false
return dev.LogOn
}
func (dev *HarmonyDevice) NewDriver(options ...DriverOption) (driverExt *DriverExt, err error) {