// Code generated by "./generator ./system/org.lingmo.backlighthelper1"; DO NOT EDIT.

// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
package backlighthelper1

import (
	"unsafe"

	"github.com/godbus/dbus/v5"
	"github.com/LingmoOS/golang-github-lingmo-go-lib/dbusutil/proxy"
)

type Backlight interface {
	backlight // interface org.lingmo.BacklightHelper1
	proxy.Object
}

type objectBacklight struct {
	interfaceBacklight // interface org.lingmo.BacklightHelper1
	proxy.ImplObject
}

func NewBacklight(conn *dbus.Conn) Backlight {
	obj := new(objectBacklight)
	obj.ImplObject.Init_(conn, "org.lingmo.BacklightHelper1", "/org/lingmo/BacklightHelper1")
	return obj
}

type backlight interface {
	GoSetBrightness(flags dbus.Flags, ch chan *dbus.Call, type0 uint8, name string, value int32) *dbus.Call
	SetBrightness(flags dbus.Flags, type0 uint8, name string, value int32) error
	GoCheckCfgSupport(flags dbus.Flags, ch chan *dbus.Call, name string) *dbus.Call
	CheckCfgSupport(flags dbus.Flags, name string) (bool, error)
}

type interfaceBacklight struct{}

func (v *interfaceBacklight) GetObject_() *proxy.ImplObject {
	return (*proxy.ImplObject)(unsafe.Pointer(v))
}

func (*interfaceBacklight) GetInterfaceName_() string {
	return "org.lingmo.BacklightHelper1"
}

// method SetBrightness

func (v *interfaceBacklight) GoSetBrightness(flags dbus.Flags, ch chan *dbus.Call, type0 uint8, name string, value int32) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".SetBrightness", flags, ch, type0, name, value)
}

func (v *interfaceBacklight) SetBrightness(flags dbus.Flags, type0 uint8, name string, value int32) error {
	return (<-v.GoSetBrightness(flags, make(chan *dbus.Call, 1), type0, name, value).Done).Err
}

// method CheckCfgSupport

func (v *interfaceBacklight) GoCheckCfgSupport(flags dbus.Flags, ch chan *dbus.Call, name string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".CheckCfgSupport", flags, ch, name)
}

func (*interfaceBacklight) StoreCheckCfgSupport(call *dbus.Call) (value bool, err error) {
	err = call.Store(&value)
	return
}

func (v *interfaceBacklight) CheckCfgSupport(flags dbus.Flags, name string) (bool, error) {
	return v.StoreCheckCfgSupport(
		<-v.GoCheckCfgSupport(flags, make(chan *dbus.Call, 1), name).Done)
}

type DDCCI interface {
	ddcci // interface org.lingmo.BacklightHelper1.DDCCI
	proxy.Object
}

type objectDDCCI struct {
	interfaceDdcci // interface org.lingmo.BacklightHelper1.DDCCI
	proxy.ImplObject
}

func NewDDCCI(conn *dbus.Conn) DDCCI {
	obj := new(objectDDCCI)
	obj.ImplObject.Init_(conn, "org.lingmo.BacklightHelper1", "/org/lingmo/BacklightHelper1/DDCCI")
	return obj
}

type ddcci interface {
	GoCheckSupport(flags dbus.Flags, ch chan *dbus.Call, edidChecksum string) *dbus.Call
	CheckSupport(flags dbus.Flags, edidChecksum string) (bool, error)
	GoGetBrightness(flags dbus.Flags, ch chan *dbus.Call, edidChecksum string) *dbus.Call
	GetBrightness(flags dbus.Flags, edidChecksum string) (int32, error)
	GoSetBrightness(flags dbus.Flags, ch chan *dbus.Call, edidChecksum string, value int32) *dbus.Call
	SetBrightness(flags dbus.Flags, edidChecksum string, value int32) error
	GoRefreshDisplays(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	RefreshDisplays(flags dbus.Flags) error
}

type interfaceDdcci struct{}

func (v *interfaceDdcci) GetObject_() *proxy.ImplObject {
	return (*proxy.ImplObject)(unsafe.Pointer(v))
}

func (*interfaceDdcci) GetInterfaceName_() string {
	return "org.lingmo.BacklightHelper1.DDCCI"
}

// method CheckSupport

func (v *interfaceDdcci) GoCheckSupport(flags dbus.Flags, ch chan *dbus.Call, edidChecksum string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".CheckSupport", flags, ch, edidChecksum)
}

func (*interfaceDdcci) StoreCheckSupport(call *dbus.Call) (support bool, err error) {
	err = call.Store(&support)
	return
}

func (v *interfaceDdcci) CheckSupport(flags dbus.Flags, edidChecksum string) (bool, error) {
	return v.StoreCheckSupport(
		<-v.GoCheckSupport(flags, make(chan *dbus.Call, 1), edidChecksum).Done)
}

// method GetBrightness

func (v *interfaceDdcci) GoGetBrightness(flags dbus.Flags, ch chan *dbus.Call, edidChecksum string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".GetBrightness", flags, ch, edidChecksum)
}

func (*interfaceDdcci) StoreGetBrightness(call *dbus.Call) (value int32, err error) {
	err = call.Store(&value)
	return
}

func (v *interfaceDdcci) GetBrightness(flags dbus.Flags, edidChecksum string) (int32, error) {
	return v.StoreGetBrightness(
		<-v.GoGetBrightness(flags, make(chan *dbus.Call, 1), edidChecksum).Done)
}

// method SetBrightness

func (v *interfaceDdcci) GoSetBrightness(flags dbus.Flags, ch chan *dbus.Call, edidChecksum string, value int32) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".SetBrightness", flags, ch, edidChecksum, value)
}

func (v *interfaceDdcci) SetBrightness(flags dbus.Flags, edidChecksum string, value int32) error {
	return (<-v.GoSetBrightness(flags, make(chan *dbus.Call, 1), edidChecksum, value).Done).Err
}

// method RefreshDisplays

func (v *interfaceDdcci) GoRefreshDisplays(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".RefreshDisplays", flags, ch)
}

func (v *interfaceDdcci) RefreshDisplays(flags dbus.Flags) error {
	return (<-v.GoRefreshDisplays(flags, make(chan *dbus.Call, 1)).Done).Err
}
