MCPcopy Create free account
hub / github.com/godbus/dbus / SetProperty

Method SetProperty

object.go:155–171  ·  view source on GitHub ↗

SetProperty calls org.freedesktop.DBus.Properties.Set on the given object. The property name must be given in interface.member notation. Panics if v is not a valid Variant type.

(p string, v any)

Source from the content-addressed store, hash-verified

153// object. The property name must be given in interface.member notation.
154// Panics if v is not a valid Variant type.
155func (o *Object) SetProperty(p string, v any) error {
156 // v might already be a variant...
157 variant, ok := v.(Variant)
158 if !ok {
159 // Otherwise, make it into one.
160 variant = MakeVariant(v)
161 }
162 idx := strings.LastIndex(p, ".")
163 if idx == -1 || idx+1 == len(p) {
164 return errors.New("dbus: invalid property " + p)
165 }
166
167 iface := p[:idx]
168 prop := p[idx+1:]
169
170 return o.Call("org.freedesktop.DBus.Properties.Set", 0, iface, prop, variant).Err
171}
172
173// Destination returns the destination that calls on (o *Object) are sent to.
174func (o *Object) Destination() string {

Callers

nothing calls this directly

Calls 2

CallMethod · 0.95
MakeVariantFunction · 0.85

Tested by

no test coverage detected