diff --git a/Device.go b/Device.go index f257722..e74f86d 100644 --- a/Device.go +++ b/Device.go @@ -9,6 +9,7 @@ import ( const ( DeviceInterface = NetworkManagerInterface + ".Device" + DevicePropertyUdi = DeviceInterface + ".Udi" DevicePropertyInterface = DeviceInterface + ".Interface" DevicePropertyIpInterface = DeviceInterface + ".IpInterface" DevicePropertyState = DeviceInterface + ".State" @@ -35,6 +36,19 @@ func DeviceFactory(objectPath dbus.ObjectPath) (Device, error) { type Device interface { 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) // interface. GetInterface() string @@ -79,6 +93,10 @@ func (d *device) GetPath() dbus.ObjectPath { return d.obj.Path() } +func (d *device) GetUdi() string { + return d.getStringProperty(DevicePropertyUdi) +} + func (d *device) GetInterface() string { return d.getStringProperty(DevicePropertyInterface) }