/
auto.go
205 lines (162 loc) · 6.15 KB
/
auto.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// Code generated by "./generator ./system/com.deepin.daemon.authenticate.ukey"; DO NOT EDIT.
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
package ukey
import "errors"
import "fmt"
import "github.com/godbus/dbus/v5"
import "github.com/linuxdeepin/go-lib/dbusutil"
import "github.com/linuxdeepin/go-lib/dbusutil/proxy"
import "unsafe"
type UKey interface {
ukey // interface com.deepin.daemon.Authenticate.UKey.Device
proxy.Object
}
type objectUKey struct {
interfaceUkey // interface com.deepin.daemon.Authenticate.UKey.Device
proxy.ImplObject
}
func NewUKey(conn *dbus.Conn, serviceName string, path dbus.ObjectPath) (UKey, error) {
if !path.IsValid() {
return nil, errors.New("path is invalid")
}
obj := new(objectUKey)
obj.ImplObject.Init_(conn, serviceName, path)
return obj, nil
}
type ukey interface {
SetInterfaceName_(name string)
GoGetPINLength(flags dbus.Flags, ch chan *dbus.Call, uuid string) *dbus.Call
GetPINLength(flags dbus.Flags, uuid string) (int32, error)
GoGetUserList(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
GetUserList(flags dbus.Flags) ([]string, error)
GoSetPin(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string, pin string) *dbus.Call
SetPin(flags dbus.Flags, uuid string, gid string, pin string) error
GoSetSessionPath(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string, path string) *dbus.Call
SetSessionPath(flags dbus.Flags, uuid string, gid string, path string) error
GoStopVerify(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string) *dbus.Call
StopVerify(flags dbus.Flags, uuid string, gid string) error
GoVerify(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string) *dbus.Call
Verify(flags dbus.Flags, uuid string, gid string) error
ConnectVerifyResult(cb func(id string, msg string)) (dbusutil.SignalHandlerId, error)
Name() proxy.PropString
State() proxy.PropInt32
Type() proxy.PropInt32
Capability() proxy.PropInt32
}
type interfaceUkey struct{}
func (v *interfaceUkey) GetObject_() *proxy.ImplObject {
return (*proxy.ImplObject)(unsafe.Pointer(v))
}
func (v *interfaceUkey) SetInterfaceName_(name string) {
v.GetObject_().SetExtra("customIfc", name)
}
func (v *interfaceUkey) GetInterfaceName_() string {
ifcName, _ := v.GetObject_().GetExtra("customIfc")
ifcNameStr, _ := ifcName.(string)
return ifcNameStr
}
// method GetPINLength
func (v *interfaceUkey) GoGetPINLength(flags dbus.Flags, ch chan *dbus.Call, uuid string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".GetPINLength", flags, ch, uuid)
}
func (*interfaceUkey) StoreGetPINLength(call *dbus.Call) (length int32, err error) {
err = call.Store(&length)
return
}
func (v *interfaceUkey) GetPINLength(flags dbus.Flags, uuid string) (int32, error) {
return v.StoreGetPINLength(
<-v.GoGetPINLength(flags, make(chan *dbus.Call, 1), uuid).Done)
}
// method GetUserList
func (v *interfaceUkey) GoGetUserList(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".GetUserList", flags, ch)
}
func (*interfaceUkey) StoreGetUserList(call *dbus.Call) (users []string, err error) {
err = call.Store(&users)
return
}
func (v *interfaceUkey) GetUserList(flags dbus.Flags) ([]string, error) {
return v.StoreGetUserList(
<-v.GoGetUserList(flags, make(chan *dbus.Call, 1)).Done)
}
// method SetPin
func (v *interfaceUkey) GoSetPin(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string, pin string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".SetPin", flags, ch, uuid, gid, pin)
}
func (v *interfaceUkey) SetPin(flags dbus.Flags, uuid string, gid string, pin string) error {
return (<-v.GoSetPin(flags, make(chan *dbus.Call, 1), uuid, gid, pin).Done).Err
}
// method SetSessionPath
func (v *interfaceUkey) GoSetSessionPath(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string, path string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".SetSessionPath", flags, ch, uuid, gid, path)
}
func (v *interfaceUkey) SetSessionPath(flags dbus.Flags, uuid string, gid string, path string) error {
return (<-v.GoSetSessionPath(flags, make(chan *dbus.Call, 1), uuid, gid, path).Done).Err
}
// method StopVerify
func (v *interfaceUkey) GoStopVerify(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".StopVerify", flags, ch, uuid, gid)
}
func (v *interfaceUkey) StopVerify(flags dbus.Flags, uuid string, gid string) error {
return (<-v.GoStopVerify(flags, make(chan *dbus.Call, 1), uuid, gid).Done).Err
}
// method Verify
func (v *interfaceUkey) GoVerify(flags dbus.Flags, ch chan *dbus.Call, uuid string, gid string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Verify", flags, ch, uuid, gid)
}
func (v *interfaceUkey) Verify(flags dbus.Flags, uuid string, gid string) error {
return (<-v.GoVerify(flags, make(chan *dbus.Call, 1), uuid, gid).Done).Err
}
// signal VerifyResult
func (v *interfaceUkey) ConnectVerifyResult(cb func(id string, msg string)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "VerifyResult", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".VerifyResult",
}
handlerFunc := func(sig *dbus.Signal) {
var id string
var msg string
err := dbus.Store(sig.Body, &id, &msg)
if err == nil {
cb(id, msg)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}
// property Name s
func (v *interfaceUkey) Name() proxy.PropString {
return &proxy.ImplPropString{
Impl: v,
Name: "Name",
}
}
// property State i
func (v *interfaceUkey) State() proxy.PropInt32 {
return &proxy.ImplPropInt32{
Impl: v,
Name: "State",
}
}
// property Type i
func (v *interfaceUkey) Type() proxy.PropInt32 {
return &proxy.ImplPropInt32{
Impl: v,
Name: "Type",
}
}
// property Capability i
func (v *interfaceUkey) Capability() proxy.PropInt32 {
return &proxy.ImplPropInt32{
Impl: v,
Name: "Capability",
}
}