From ca8dc4faf58bc15321e5ea8fc61835a2544229fe Mon Sep 17 00:00:00 2001 From: John Beisley Date: Sat, 7 Jun 2014 21:24:11 +0100 Subject: [PATCH] Add additional header docs to generated DCP packages. --- dcps/internetgateway1/internetgateway1.go | 6 ++++++ dcps/internetgateway2/internetgateway2.go | 6 ++++++ gotasks/specgen_task.go | 24 +++++++++++++++++++---- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/dcps/internetgateway1/internetgateway1.go b/dcps/internetgateway1/internetgateway1.go index 65b011d..be71855 100644 --- a/dcps/internetgateway1/internetgateway1.go +++ b/dcps/internetgateway1/internetgateway1.go @@ -1,3 +1,9 @@ +// Client for UPnP Device Control Protocol Internet Gateway Device v1. +// +// This DCP is documented in detail at: http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf +// +// Typically, use one of the New* functions to discover services on the local +// network. package internetgateway1 // Generated file - do not edit by hand. See README.md diff --git a/dcps/internetgateway2/internetgateway2.go b/dcps/internetgateway2/internetgateway2.go index 757e714..a589228 100644 --- a/dcps/internetgateway2/internetgateway2.go +++ b/dcps/internetgateway2/internetgateway2.go @@ -1,3 +1,9 @@ +// Client for UPnP Device Control Protocol Internet Gateway Device v2. +// +// This DCP is documented in detail at: http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v2-Device.pdf +// +// Typically, use one of the New* functions to discover services on the local +// network. package internetgateway2 // Generated file - do not edit by hand. See README.md diff --git a/gotasks/specgen_task.go b/gotasks/specgen_task.go index 33c8b0d..0ac1d4f 100644 --- a/gotasks/specgen_task.go +++ b/gotasks/specgen_task.go @@ -93,13 +93,24 @@ func TaskSpecgen(t *tasking.T) { } } +// DCP contains extra metadata to use when generating DCP source files. type DCPMetadata struct { - Name string + Name string // What to name the Go DCP package. + OfficialName string // Official name for the DCP. + DocURL string // Optional - URL for futher documentation about the DCP. } var dcpMetadataByDir = map[string]DCPMetadata{ - "Internet Gateway_1": {"internetgateway1"}, - "Internet Gateway_2": {"internetgateway2"}, + "Internet Gateway_1": { + Name: "internetgateway1", + OfficialName: "Internet Gateway Device v1", + DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf", + }, + "Internet Gateway_2": { + Name: "internetgateway2", + OfficialName: "Internet Gateway Device v2", + DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v2-Device.pdf", + }, } type dcpCollection struct { @@ -420,7 +431,12 @@ func urnPartsFromSCPDFilename(filename string) (*URNParts, error) { } var packageTmpl = template.Must(template.New("package").Parse(`{{$name := .Metadata.Name}} - +// Client for UPnP Device Control Protocol {{.Metadata.OfficialName}}. +// {{if .Metadata.DocURL}} +// This DCP is documented in detail at: {{.Metadata.DocURL}}{{end}} +// +// Typically, use one of the New* functions to discover services on the local +// network. package {{$name}} // Generated file - do not edit by hand. See README.md