Remove some pointer indirections in device.go.
This commit is contained in:
parent
a7fffcafdc
commit
69d76cd5e4
@ -30,8 +30,8 @@ func displayDevice(indent indentLevel, device *goupnp.Device) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, subdev := range device.Devices {
|
for i := range device.Devices {
|
||||||
displayDevice(indent+1, subdev)
|
displayDevice(indent+1, &device.Devices[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ func main() {
|
|||||||
if maybeRootDevice.Err != nil {
|
if maybeRootDevice.Err != nil {
|
||||||
fmt.Println(maybeRootDevice.Err)
|
fmt.Println(maybeRootDevice.Err)
|
||||||
} else {
|
} else {
|
||||||
displayDevice(0, maybeRootDevice.Root.Device)
|
displayDevice(0, &maybeRootDevice.Root.Device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
device.go
30
device.go
@ -23,7 +23,7 @@ type RootDevice struct {
|
|||||||
SpecVersion SpecVersion `xml:"specVersion"`
|
SpecVersion SpecVersion `xml:"specVersion"`
|
||||||
URLBase url.URL `xml:"-"`
|
URLBase url.URL `xml:"-"`
|
||||||
URLBaseStr string `xml:"URLBase"`
|
URLBaseStr string `xml:"URLBase"`
|
||||||
Device *Device `xml:"device"`
|
Device Device `xml:"device"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (root *RootDevice) SetURLBase(urlBase *url.URL) {
|
func (root *RootDevice) SetURLBase(urlBase *url.URL) {
|
||||||
@ -38,20 +38,20 @@ type SpecVersion struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Device struct {
|
type Device struct {
|
||||||
DeviceType string `xml:"deviceType"`
|
DeviceType string `xml:"deviceType"`
|
||||||
FriendlyName string `xml:"friendlyName"`
|
FriendlyName string `xml:"friendlyName"`
|
||||||
Manufacturer string `xml:"manufacturer"`
|
Manufacturer string `xml:"manufacturer"`
|
||||||
ManufacturerURL URLField `xml:"manufacturerURL"`
|
ManufacturerURL URLField `xml:"manufacturerURL"`
|
||||||
ModelDescription string `xml:"modelDescription"`
|
ModelDescription string `xml:"modelDescription"`
|
||||||
ModelName string `xml:"modelName"`
|
ModelName string `xml:"modelName"`
|
||||||
ModelNumber string `xml:"modelNumber"`
|
ModelNumber string `xml:"modelNumber"`
|
||||||
ModelURL URLField `xml:"modelURL"`
|
ModelURL URLField `xml:"modelURL"`
|
||||||
SerialNumber string `xml:"serialNumber"`
|
SerialNumber string `xml:"serialNumber"`
|
||||||
UDN string `xml:"UDN"`
|
UDN string `xml:"UDN"`
|
||||||
UPC string `xml:"UPC,omitempty"`
|
UPC string `xml:"UPC,omitempty"`
|
||||||
Icons []*Icon `xml:"iconList>icon,omitempty"`
|
Icons []Icon `xml:"iconList>icon,omitempty"`
|
||||||
Services []*Service `xml:"serviceList>service,omitempty"`
|
Services []Service `xml:"serviceList>service,omitempty"`
|
||||||
Devices []*Device `xml:"deviceList>device,omitempty"`
|
Devices []Device `xml:"deviceList>device,omitempty"`
|
||||||
|
|
||||||
// Extra observed elements:
|
// Extra observed elements:
|
||||||
PresentationURL URLField `xml:"presentationURL"`
|
PresentationURL URLField `xml:"presentationURL"`
|
||||||
|
Loading…
Reference in New Issue
Block a user