Add Device.Udi
This commit is contained in:
parent
517b97cad2
commit
98bb278033
1 changed files with 18 additions and 0 deletions
18
Device.go
18
Device.go
|
@ -9,6 +9,7 @@ import (
|
||||||
const (
|
const (
|
||||||
DeviceInterface = NetworkManagerInterface + ".Device"
|
DeviceInterface = NetworkManagerInterface + ".Device"
|
||||||
|
|
||||||
|
DevicePropertyUdi = DeviceInterface + ".Udi"
|
||||||
DevicePropertyInterface = DeviceInterface + ".Interface"
|
DevicePropertyInterface = DeviceInterface + ".Interface"
|
||||||
DevicePropertyIpInterface = DeviceInterface + ".IpInterface"
|
DevicePropertyIpInterface = DeviceInterface + ".IpInterface"
|
||||||
DevicePropertyState = DeviceInterface + ".State"
|
DevicePropertyState = DeviceInterface + ".State"
|
||||||
|
@ -35,6 +36,19 @@ func DeviceFactory(objectPath dbus.ObjectPath) (Device, error) {
|
||||||
type Device interface {
|
type Device interface {
|
||||||
GetPath() dbus.ObjectPath
|
GetPath() dbus.ObjectPath
|
||||||
|
|
||||||
|
// Operating-system specific transient device hardware identifier. This is an
|
||||||
|
// opaque string representing the underlying hardware for the device, and
|
||||||
|
// shouldn't be used to keep track of individual devices. For some device types
|
||||||
|
// (Bluetooth, Modems) it is an identifier used by the hardware service
|
||||||
|
// (ie bluez or ModemManager) to refer to that device, and client programs use
|
||||||
|
// it get additional information from those services which NM does not provide.
|
||||||
|
// The Udi is not guaranteed to be consistent across reboots or hotplugs of the
|
||||||
|
// hardware. If you're looking for a way to uniquely track each device in your
|
||||||
|
// application, use the object path. If you're looking for a way to track a
|
||||||
|
// specific piece of hardware across reboot or hotplug, use a MAC address or
|
||||||
|
// USB serial number.
|
||||||
|
GetUdi() string
|
||||||
|
|
||||||
// GetInterface gets the name of the device's control (and often data)
|
// GetInterface gets the name of the device's control (and often data)
|
||||||
// interface.
|
// interface.
|
||||||
GetInterface() string
|
GetInterface() string
|
||||||
|
@ -79,6 +93,10 @@ func (d *device) GetPath() dbus.ObjectPath {
|
||||||
return d.obj.Path()
|
return d.obj.Path()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *device) GetUdi() string {
|
||||||
|
return d.getStringProperty(DevicePropertyUdi)
|
||||||
|
}
|
||||||
|
|
||||||
func (d *device) GetInterface() string {
|
func (d *device) GetInterface() string {
|
||||||
return d.getStringProperty(DevicePropertyInterface)
|
return d.getStringProperty(DevicePropertyInterface)
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue