// Code generated by "./generator ./session/org.lingmo.uadpagent1"; DO NOT EDIT.

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

import (
	"unsafe"

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

type UadpAgent interface {
	uadpagent // interface org.lingmo.UadpAgent1
	proxy.Object
}

type objectUadpAgent struct {
	interfaceUadpagent // interface org.lingmo.UadpAgent1
	proxy.ImplObject
}

func NewUadpAgent(conn *dbus.Conn) UadpAgent {
	obj := new(objectUadpAgent)
	obj.ImplObject.Init_(conn, "org.lingmo.UadpAgent1", "/org/lingmo/UadpAgent1")
	return obj
}

type uadpagent interface {
	GoSetDataKey(flags dbus.Flags, ch chan *dbus.Call, keyName string, dataKey string) *dbus.Call
	SetDataKey(flags dbus.Flags, keyName string, dataKey string) error
	GoGetDataKey(flags dbus.Flags, ch chan *dbus.Call, keyName string) *dbus.Call
	GetDataKey(flags dbus.Flags, keyName string) (string, error)
}

type interfaceUadpagent struct{}

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

func (*interfaceUadpagent) GetInterfaceName_() string {
	return "org.lingmo.UadpAgent1"
}

// method SetDataKey

func (v *interfaceUadpagent) GoSetDataKey(flags dbus.Flags, ch chan *dbus.Call, keyName string, dataKey string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".SetDataKey", flags, ch, keyName, dataKey)
}

func (v *interfaceUadpagent) SetDataKey(flags dbus.Flags, keyName string, dataKey string) error {
	return (<-v.GoSetDataKey(flags, make(chan *dbus.Call, 1), keyName, dataKey).Done).Err
}

// method GetDataKey

func (v *interfaceUadpagent) GoGetDataKey(flags dbus.Flags, ch chan *dbus.Call, keyName string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".GetDataKey", flags, ch, keyName)
}

func (*interfaceUadpagent) StoreGetDataKey(call *dbus.Call) (dataKey string, err error) {
	err = call.Store(&dataKey)
	return
}

func (v *interfaceUadpagent) GetDataKey(flags dbus.Flags, keyName string) (string, error) {
	return v.StoreGetDataKey(
		<-v.GoGetDataKey(flags, make(chan *dbus.Call, 1), keyName).Done)
}
