This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.
gonetworkmanager/DeviceDummy.go
Christian Müller 0e793812a6 Add DeviceDummy
2019-06-11 17:17:36 +02:00

39 lines
765 B
Go

package gonetworkmanager
import (
"encoding/json"
"github.com/godbus/dbus"
)
const (
DeviceDummyInterface = DeviceInterface + ".Dummy"
DeviceDummyPropertyHwAddress = DeviceDummyInterface + ".HwAddress" // readable s
)
type DeviceDummy interface {
Device
// Hardware address of the device.
GetHwAddress() string
}
func NewDeviceDummy(objectPath dbus.ObjectPath) (DeviceDummy, error) {
var d deviceDummy
return &d, d.init(NetworkManagerInterface, objectPath)
}
type deviceDummy struct {
device
}
func (d *deviceDummy) GetHwAddress() string {
return d.getStringProperty(DeviceDummyPropertyHwAddress)
}
func (d *deviceDummy) MarshalJSON() ([]byte, error) {
m := d.device.marshalMap()
m["HwAddress"] = d.GetHwAddress()
return json.Marshal(m)
}