diff options
author | Felix Lange <fjl@twurst.com> | 2015-10-30 05:53:53 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-10-30 05:53:59 +0800 |
commit | bf11a47f22311a21639fa4f7794a41cf2f9b809e (patch) | |
tree | c40fd1ec6ecaba6d38dad67d0b72ee45c66bf500 /Godeps | |
parent | fc46cf337af614f4f9c96acd222089652fe7c76e (diff) | |
download | dexon-bf11a47f22311a21639fa4f7794a41cf2f9b809e.tar dexon-bf11a47f22311a21639fa4f7794a41cf2f9b809e.tar.gz dexon-bf11a47f22311a21639fa4f7794a41cf2f9b809e.tar.bz2 dexon-bf11a47f22311a21639fa4f7794a41cf2f9b809e.tar.lz dexon-bf11a47f22311a21639fa4f7794a41cf2f9b809e.tar.xz dexon-bf11a47f22311a21639fa4f7794a41cf2f9b809e.tar.zst dexon-bf11a47f22311a21639fa4f7794a41cf2f9b809e.zip |
Godeps: upgrade github.com/huin/goupnp to 90f71cb5
Diffstat (limited to 'Godeps')
15 files changed, 10216 insertions, 2234 deletions
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index ee77a1c76..9c7c67a49 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -34,7 +34,7 @@ }, { "ImportPath": "github.com/huin/goupnp", - "Rev": "5cff77a69fb22f5f1774c4451ea2aab63d4d2f20" + "Rev": "90f71cb5dd6d4606388666d2cda4ce2f563d2185" }, { "ImportPath": "github.com/jackpal/go-nat-pmp", diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/.gitignore b/Godeps/_workspace/src/github.com/huin/goupnp/.gitignore new file mode 100644 index 000000000..09ef375e8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/huin/goupnp/.gitignore @@ -0,0 +1 @@ +/gotasks/specs diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/README.md b/Godeps/_workspace/src/github.com/huin/goupnp/README.md index ea2c155a1..a228ccea6 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/README.md +++ b/Godeps/_workspace/src/github.com/huin/goupnp/README.md @@ -5,10 +5,40 @@ Installation Run `go get -u github.com/huin/goupnp`. +Documentation +------------- + +All doc links below are for ![GoDoc](https://godoc.org/github.com/huin/goupnp?status.svg). + +Supported DCPs (you probably want to start with one of these): +* [av1](https://godoc.org/github.com/huin/goupnp/dcps/av1) - Client for UPnP Device Control Protocol MediaServer v1 and MediaRenderer v1. +* [internetgateway1](https://godoc.org/github.com/huin/goupnp/dcps/internetgateway1) - Client for UPnP Device Control Protocol Internet Gateway Device v1. +* [internetgateway2](https://godoc.org/github.com/huin/goupnp/dcps/internetgateway2) - Client for UPnP Device Control Protocol Internet Gateway Device v2. + +Core components: +* [(goupnp)](https://godoc.org/github.com/huin/goupnp) core library - contains datastructures and utilities typically used by the implemented DCPs. +* [httpu](https://godoc.org/github.com/huin/goupnp/httpu) HTTPU implementation, underlies SSDP. +* [ssdp](https://godoc.org/github.com/huin/goupnp/ssdp) SSDP client implementation (simple service discovery protocol) - used to discover UPnP services on a network. +* [soap](https://godoc.org/github.com/huin/goupnp/soap) SOAP client implementation (simple object access protocol) - used to communicate with discovered services. + + Regenerating dcps generated source code: ---------------------------------------- 1. Install gotasks: `go get -u github.com/jingweno/gotask` 2. Change to the gotasks directory: `cd gotasks` -3. Download UPnP specification data (if not done already): `wget http://upnp.org/resources/upnpresources.zip` -4. Regenerate source code: `gotask specgen -s upnpresources.zip -o ../dcps` +3. Run specgen task: `gotask specgen` + +Supporting additional UPnP devices and services: +------------------------------------------------ + +Supporting additional services is, in the trivial case, simply a matter of +adding the service to the `dcpMetadata` whitelist in `gotasks/specgen_task.go`, +regenerating the source code (see above), and committing that source code. + +However, it would be helpful if anyone needing such a service could test the +service against the service they have, and then reporting any trouble +encountered as an [issue on this +project](https://github.com/huin/goupnp/issues/new). If it just works, then +please report at least minimal working functionality as an issue, and +optionally contribute the metadata upstream. diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_ssdp_registry/example_ssdp_registry.go b/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_ssdp_registry/example_ssdp_registry.go new file mode 100644 index 000000000..05f0df003 --- /dev/null +++ b/Godeps/_workspace/src/github.com/huin/goupnp/cmd/example_ssdp_registry/example_ssdp_registry.go @@ -0,0 +1,27 @@ +package main + +import ( + "log" + + "github.com/huin/goupnp/ssdp" +) + +func main() { + c := make(chan ssdp.Update) + srv, reg := ssdp.NewServerAndRegistry() + reg.AddListener(c) + go listener(c) + if err := srv.ListenAndServe(); err != nil { + log.Print("ListenAndServe failed: ", err) + } +} + +func listener(c <-chan ssdp.Update) { + for u := range c { + if u.Entry != nil { + log.Printf("Event: %v USN: %s Entry: %#v", u.EventType, u.USN, *u.Entry) + } else { + log.Printf("Event: %v USN: %s Entry: <nil>", u.EventType, u.USN) + } + } +} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/av1/av1.go b/Godeps/_workspace/src/github.com/huin/goupnp/dcps/av1/av1.go new file mode 100644 index 000000000..5f9683d1f --- /dev/null +++ b/Godeps/_workspace/src/github.com/huin/goupnp/dcps/av1/av1.go @@ -0,0 +1,8452 @@ +// Client for UPnP Device Control Protocol MediaServer v1 and MediaRenderer v1. +// +// This DCP is documented in detail at: http://upnp.org/specs/av/av1/ +// +// Typically, use one of the New* functions to create clients for services. +package av1 + +// Generated file - do not edit by hand. See README.md + +import ( + "net/url" + "time" + + "github.com/huin/goupnp" + "github.com/huin/goupnp/soap" +) + +// Hack to avoid Go complaining if time isn't used. +var _ time.Time + +// Device URNs: +const () + +// Service URNs: +const ( + URN_AVTransport_1 = "urn:schemas-upnp-org:service:AVTransport:1" + URN_AVTransport_2 = "urn:schemas-upnp-org:service:AVTransport:2" + URN_ConnectionManager_1 = "urn:schemas-upnp-org:service:ConnectionManager:1" + URN_ConnectionManager_2 = "urn:schemas-upnp-org:service:ConnectionManager:2" + URN_ContentDirectory_1 = "urn:schemas-upnp-org:service:ContentDirectory:1" + URN_ContentDirectory_2 = "urn:schemas-upnp-org:service:ContentDirectory:2" + URN_ContentDirectory_3 = "urn:schemas-upnp-org:service:ContentDirectory:3" + URN_RenderingControl_1 = "urn:schemas-upnp-org:service:RenderingControl:1" + URN_RenderingControl_2 = "urn:schemas-upnp-org:service:RenderingControl:2" + URN_ScheduledRecording_1 = "urn:schemas-upnp-org:service:ScheduledRecording:1" + URN_ScheduledRecording_2 = "urn:schemas-upnp-org:service:ScheduledRecording:2" +) + +// AVTransport1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:AVTransport:1". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type AVTransport1 struct { + goupnp.ServiceClient +} + +// NewAVTransport1Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewAVTransport1Clients() (clients []*AVTransport1, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_1); err != nil { + return + } + clients = newAVTransport1ClientsFromGenericClients(genericClients) + return +} + +// NewAVTransport1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewAVTransport1ClientsByURL(loc *url.URL) ([]*AVTransport1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_1) + if err != nil { + return nil, err + } + return newAVTransport1ClientsFromGenericClients(genericClients), nil +} + +// NewAVTransport1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewAVTransport1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*AVTransport1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_AVTransport_1) + if err != nil { + return nil, err + } + return newAVTransport1ClientsFromGenericClients(genericClients), nil +} + +func newAVTransport1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*AVTransport1 { + clients := make([]*AVTransport1, len(genericClients)) + for i := range genericClients { + clients[i] = &AVTransport1{genericClients[i]} + } + return clients +} + +func (client *AVTransport1) SetAVTransportURI(InstanceID uint32, CurrentURI string, CurrentURIMetaData string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + CurrentURI string + + CurrentURIMetaData string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.CurrentURI, err = soap.MarshalString(CurrentURI); err != nil { + return + } + if request.CurrentURIMetaData, err = soap.MarshalString(CurrentURIMetaData); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetAVTransportURI", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) SetNextAVTransportURI(InstanceID uint32, NextURI string, NextURIMetaData string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + NextURI string + + NextURIMetaData string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.NextURI, err = soap.MarshalString(NextURI); err != nil { + return + } + if request.NextURIMetaData, err = soap.MarshalString(NextURIMetaData); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetNextAVTransportURI", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * NrTracks: allowed value range: minimum=0 +func (client *AVTransport1) GetMediaInfo(InstanceID uint32) (NrTracks uint32, MediaDuration string, CurrentURI string, CurrentURIMetaData string, NextURI string, NextURIMetaData string, PlayMedium string, RecordMedium string, WriteStatus string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + NrTracks string + + MediaDuration string + + CurrentURI string + + CurrentURIMetaData string + + NextURI string + + NextURIMetaData string + + PlayMedium string + + RecordMedium string + + WriteStatus string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetMediaInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if NrTracks, err = soap.UnmarshalUi4(response.NrTracks); err != nil { + return + } + if MediaDuration, err = soap.UnmarshalString(response.MediaDuration); err != nil { + return + } + if CurrentURI, err = soap.UnmarshalString(response.CurrentURI); err != nil { + return + } + if CurrentURIMetaData, err = soap.UnmarshalString(response.CurrentURIMetaData); err != nil { + return + } + if NextURI, err = soap.UnmarshalString(response.NextURI); err != nil { + return + } + if NextURIMetaData, err = soap.UnmarshalString(response.NextURIMetaData); err != nil { + return + } + if PlayMedium, err = soap.UnmarshalString(response.PlayMedium); err != nil { + return + } + if RecordMedium, err = soap.UnmarshalString(response.RecordMedium); err != nil { + return + } + if WriteStatus, err = soap.UnmarshalString(response.WriteStatus); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentTransportState: allowed values: STOPPED, PLAYING +// +// * CurrentTransportStatus: allowed values: OK, ERROR_OCCURRED +// +// * CurrentSpeed: allowed values: 1 +func (client *AVTransport1) GetTransportInfo(InstanceID uint32) (CurrentTransportState string, CurrentTransportStatus string, CurrentSpeed string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentTransportState string + + CurrentTransportStatus string + + CurrentSpeed string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetTransportInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentTransportState, err = soap.UnmarshalString(response.CurrentTransportState); err != nil { + return + } + if CurrentTransportStatus, err = soap.UnmarshalString(response.CurrentTransportStatus); err != nil { + return + } + if CurrentSpeed, err = soap.UnmarshalString(response.CurrentSpeed); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * Track: allowed value range: minimum=0, step=1 +func (client *AVTransport1) GetPositionInfo(InstanceID uint32) (Track uint32, TrackDuration string, TrackMetaData string, TrackURI string, RelTime string, AbsTime string, RelCount int32, AbsCount int32, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Track string + + TrackDuration string + + TrackMetaData string + + TrackURI string + + RelTime string + + AbsTime string + + RelCount string + + AbsCount string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetPositionInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Track, err = soap.UnmarshalUi4(response.Track); err != nil { + return + } + if TrackDuration, err = soap.UnmarshalString(response.TrackDuration); err != nil { + return + } + if TrackMetaData, err = soap.UnmarshalString(response.TrackMetaData); err != nil { + return + } + if TrackURI, err = soap.UnmarshalString(response.TrackURI); err != nil { + return + } + if RelTime, err = soap.UnmarshalString(response.RelTime); err != nil { + return + } + if AbsTime, err = soap.UnmarshalString(response.AbsTime); err != nil { + return + } + if RelCount, err = soap.UnmarshalI4(response.RelCount); err != nil { + return + } + if AbsCount, err = soap.UnmarshalI4(response.AbsCount); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) GetDeviceCapabilities(InstanceID uint32) (PlayMedia string, RecMedia string, RecQualityModes string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PlayMedia string + + RecMedia string + + RecQualityModes string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetDeviceCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PlayMedia, err = soap.UnmarshalString(response.PlayMedia); err != nil { + return + } + if RecMedia, err = soap.UnmarshalString(response.RecMedia); err != nil { + return + } + if RecQualityModes, err = soap.UnmarshalString(response.RecQualityModes); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * PlayMode: allowed values: NORMAL +func (client *AVTransport1) GetTransportSettings(InstanceID uint32) (PlayMode string, RecQualityMode string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PlayMode string + + RecQualityMode string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetTransportSettings", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PlayMode, err = soap.UnmarshalString(response.PlayMode); err != nil { + return + } + if RecQualityMode, err = soap.UnmarshalString(response.RecQualityMode); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) Stop(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Stop", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Speed: allowed values: 1 + +func (client *AVTransport1) Play(InstanceID uint32, Speed string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Speed string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Speed, err = soap.MarshalString(Speed); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Play", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) Pause(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Pause", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) Record(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Record", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Unit: allowed values: TRACK_NR + +func (client *AVTransport1) Seek(InstanceID uint32, Unit string, Target string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Unit string + + Target string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Unit, err = soap.MarshalString(Unit); err != nil { + return + } + if request.Target, err = soap.MarshalString(Target); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Seek", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) Next(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Next", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) Previous(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "Previous", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * NewPlayMode: allowed values: NORMAL + +func (client *AVTransport1) SetPlayMode(InstanceID uint32, NewPlayMode string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + NewPlayMode string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.NewPlayMode, err = soap.MarshalString(NewPlayMode); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetPlayMode", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) SetRecordQualityMode(InstanceID uint32, NewRecordQualityMode string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + NewRecordQualityMode string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.NewRecordQualityMode, err = soap.MarshalString(NewRecordQualityMode); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "SetRecordQualityMode", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport1) GetCurrentTransportActions(InstanceID uint32) (Actions string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Actions string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_1, "GetCurrentTransportActions", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Actions, err = soap.UnmarshalString(response.Actions); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// AVTransport2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:AVTransport:2". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type AVTransport2 struct { + goupnp.ServiceClient +} + +// NewAVTransport2Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewAVTransport2Clients() (clients []*AVTransport2, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_2); err != nil { + return + } + clients = newAVTransport2ClientsFromGenericClients(genericClients) + return +} + +// NewAVTransport2ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewAVTransport2ClientsByURL(loc *url.URL) ([]*AVTransport2, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_2) + if err != nil { + return nil, err + } + return newAVTransport2ClientsFromGenericClients(genericClients), nil +} + +// NewAVTransport2ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewAVTransport2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*AVTransport2, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_AVTransport_2) + if err != nil { + return nil, err + } + return newAVTransport2ClientsFromGenericClients(genericClients), nil +} + +func newAVTransport2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*AVTransport2 { + clients := make([]*AVTransport2, len(genericClients)) + for i := range genericClients { + clients[i] = &AVTransport2{genericClients[i]} + } + return clients +} + +func (client *AVTransport2) SetAVTransportURI(InstanceID uint32, CurrentURI string, CurrentURIMetaData string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + CurrentURI string + + CurrentURIMetaData string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.CurrentURI, err = soap.MarshalString(CurrentURI); err != nil { + return + } + if request.CurrentURIMetaData, err = soap.MarshalString(CurrentURIMetaData); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetAVTransportURI", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) SetNextAVTransportURI(InstanceID uint32, NextURI string, NextURIMetaData string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + NextURI string + + NextURIMetaData string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.NextURI, err = soap.MarshalString(NextURI); err != nil { + return + } + if request.NextURIMetaData, err = soap.MarshalString(NextURIMetaData); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetNextAVTransportURI", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * NrTracks: allowed value range: minimum=0 +func (client *AVTransport2) GetMediaInfo(InstanceID uint32) (NrTracks uint32, MediaDuration string, CurrentURI string, CurrentURIMetaData string, NextURI string, NextURIMetaData string, PlayMedium string, RecordMedium string, WriteStatus string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + NrTracks string + + MediaDuration string + + CurrentURI string + + CurrentURIMetaData string + + NextURI string + + NextURIMetaData string + + PlayMedium string + + RecordMedium string + + WriteStatus string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetMediaInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if NrTracks, err = soap.UnmarshalUi4(response.NrTracks); err != nil { + return + } + if MediaDuration, err = soap.UnmarshalString(response.MediaDuration); err != nil { + return + } + if CurrentURI, err = soap.UnmarshalString(response.CurrentURI); err != nil { + return + } + if CurrentURIMetaData, err = soap.UnmarshalString(response.CurrentURIMetaData); err != nil { + return + } + if NextURI, err = soap.UnmarshalString(response.NextURI); err != nil { + return + } + if NextURIMetaData, err = soap.UnmarshalString(response.NextURIMetaData); err != nil { + return + } + if PlayMedium, err = soap.UnmarshalString(response.PlayMedium); err != nil { + return + } + if RecordMedium, err = soap.UnmarshalString(response.RecordMedium); err != nil { + return + } + if WriteStatus, err = soap.UnmarshalString(response.WriteStatus); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentType: allowed values: NO_MEDIA, TRACK_AWARE, TRACK_UNAWARE +// +// * NrTracks: allowed value range: minimum=0 +func (client *AVTransport2) GetMediaInfo_Ext(InstanceID uint32) (CurrentType string, NrTracks uint32, MediaDuration string, CurrentURI string, CurrentURIMetaData string, NextURI string, NextURIMetaData string, PlayMedium string, RecordMedium string, WriteStatus string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentType string + + NrTracks string + + MediaDuration string + + CurrentURI string + + CurrentURIMetaData string + + NextURI string + + NextURIMetaData string + + PlayMedium string + + RecordMedium string + + WriteStatus string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetMediaInfo_Ext", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentType, err = soap.UnmarshalString(response.CurrentType); err != nil { + return + } + if NrTracks, err = soap.UnmarshalUi4(response.NrTracks); err != nil { + return + } + if MediaDuration, err = soap.UnmarshalString(response.MediaDuration); err != nil { + return + } + if CurrentURI, err = soap.UnmarshalString(response.CurrentURI); err != nil { + return + } + if CurrentURIMetaData, err = soap.UnmarshalString(response.CurrentURIMetaData); err != nil { + return + } + if NextURI, err = soap.UnmarshalString(response.NextURI); err != nil { + return + } + if NextURIMetaData, err = soap.UnmarshalString(response.NextURIMetaData); err != nil { + return + } + if PlayMedium, err = soap.UnmarshalString(response.PlayMedium); err != nil { + return + } + if RecordMedium, err = soap.UnmarshalString(response.RecordMedium); err != nil { + return + } + if WriteStatus, err = soap.UnmarshalString(response.WriteStatus); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentTransportState: allowed values: STOPPED, PLAYING +// +// * CurrentTransportStatus: allowed values: OK, ERROR_OCCURRED +// +// * CurrentSpeed: allowed values: 1 +func (client *AVTransport2) GetTransportInfo(InstanceID uint32) (CurrentTransportState string, CurrentTransportStatus string, CurrentSpeed string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentTransportState string + + CurrentTransportStatus string + + CurrentSpeed string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetTransportInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentTransportState, err = soap.UnmarshalString(response.CurrentTransportState); err != nil { + return + } + if CurrentTransportStatus, err = soap.UnmarshalString(response.CurrentTransportStatus); err != nil { + return + } + if CurrentSpeed, err = soap.UnmarshalString(response.CurrentSpeed); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * Track: allowed value range: minimum=0, step=1 +func (client *AVTransport2) GetPositionInfo(InstanceID uint32) (Track uint32, TrackDuration string, TrackMetaData string, TrackURI string, RelTime string, AbsTime string, RelCount int32, AbsCount int32, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Track string + + TrackDuration string + + TrackMetaData string + + TrackURI string + + RelTime string + + AbsTime string + + RelCount string + + AbsCount string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetPositionInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Track, err = soap.UnmarshalUi4(response.Track); err != nil { + return + } + if TrackDuration, err = soap.UnmarshalString(response.TrackDuration); err != nil { + return + } + if TrackMetaData, err = soap.UnmarshalString(response.TrackMetaData); err != nil { + return + } + if TrackURI, err = soap.UnmarshalString(response.TrackURI); err != nil { + return + } + if RelTime, err = soap.UnmarshalString(response.RelTime); err != nil { + return + } + if AbsTime, err = soap.UnmarshalString(response.AbsTime); err != nil { + return + } + if RelCount, err = soap.UnmarshalI4(response.RelCount); err != nil { + return + } + if AbsCount, err = soap.UnmarshalI4(response.AbsCount); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) GetDeviceCapabilities(InstanceID uint32) (PlayMedia string, RecMedia string, RecQualityModes string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PlayMedia string + + RecMedia string + + RecQualityModes string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetDeviceCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PlayMedia, err = soap.UnmarshalString(response.PlayMedia); err != nil { + return + } + if RecMedia, err = soap.UnmarshalString(response.RecMedia); err != nil { + return + } + if RecQualityModes, err = soap.UnmarshalString(response.RecQualityModes); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * PlayMode: allowed values: NORMAL +func (client *AVTransport2) GetTransportSettings(InstanceID uint32) (PlayMode string, RecQualityMode string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PlayMode string + + RecQualityMode string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetTransportSettings", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PlayMode, err = soap.UnmarshalString(response.PlayMode); err != nil { + return + } + if RecQualityMode, err = soap.UnmarshalString(response.RecQualityMode); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) Stop(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Stop", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Speed: allowed values: 1 + +func (client *AVTransport2) Play(InstanceID uint32, Speed string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Speed string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Speed, err = soap.MarshalString(Speed); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Play", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) Pause(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Pause", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) Record(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Record", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Unit: allowed values: TRACK_NR + +func (client *AVTransport2) Seek(InstanceID uint32, Unit string, Target string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Unit string + + Target string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Unit, err = soap.MarshalString(Unit); err != nil { + return + } + if request.Target, err = soap.MarshalString(Target); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Seek", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) Next(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Next", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) Previous(InstanceID uint32) (err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "Previous", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * NewPlayMode: allowed values: NORMAL + +func (client *AVTransport2) SetPlayMode(InstanceID uint32, NewPlayMode string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + NewPlayMode string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.NewPlayMode, err = soap.MarshalString(NewPlayMode); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetPlayMode", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) SetRecordQualityMode(InstanceID uint32, NewRecordQualityMode string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + NewRecordQualityMode string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.NewRecordQualityMode, err = soap.MarshalString(NewRecordQualityMode); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetRecordQualityMode", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) GetCurrentTransportActions(InstanceID uint32) (Actions string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Actions string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetCurrentTransportActions", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Actions, err = soap.UnmarshalString(response.Actions); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentDRMState: allowed values: OK +func (client *AVTransport2) GetDRMState(InstanceID uint32) (CurrentDRMState string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentDRMState string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetDRMState", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentDRMState, err = soap.UnmarshalString(response.CurrentDRMState); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) GetStateVariables(InstanceID uint32, StateVariableList string) (StateVariableValuePairs string, err error) { + // Request structure. + request := &struct { + InstanceID string + + StateVariableList string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.StateVariableList, err = soap.MarshalString(StateVariableList); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + StateVariableValuePairs string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "GetStateVariables", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if StateVariableValuePairs, err = soap.UnmarshalString(response.StateVariableValuePairs); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *AVTransport2) SetStateVariables(InstanceID uint32, AVTransportUDN string, ServiceType string, ServiceId string, StateVariableValuePairs string) (StateVariableList string, err error) { + // Request structure. + request := &struct { + InstanceID string + + AVTransportUDN string + + ServiceType string + + ServiceId string + + StateVariableValuePairs string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.AVTransportUDN, err = soap.MarshalString(AVTransportUDN); err != nil { + return + } + if request.ServiceType, err = soap.MarshalString(ServiceType); err != nil { + return + } + if request.ServiceId, err = soap.MarshalString(ServiceId); err != nil { + return + } + if request.StateVariableValuePairs, err = soap.MarshalString(StateVariableValuePairs); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + StateVariableList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_AVTransport_2, "SetStateVariables", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if StateVariableList, err = soap.UnmarshalString(response.StateVariableList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// ConnectionManager1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ConnectionManager:1". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type ConnectionManager1 struct { + goupnp.ServiceClient +} + +// NewConnectionManager1Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewConnectionManager1Clients() (clients []*ConnectionManager1, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_1); err != nil { + return + } + clients = newConnectionManager1ClientsFromGenericClients(genericClients) + return +} + +// NewConnectionManager1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewConnectionManager1ClientsByURL(loc *url.URL) ([]*ConnectionManager1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_1) + if err != nil { + return nil, err + } + return newConnectionManager1ClientsFromGenericClients(genericClients), nil +} + +// NewConnectionManager1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewConnectionManager1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ConnectionManager1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ConnectionManager_1) + if err != nil { + return nil, err + } + return newConnectionManager1ClientsFromGenericClients(genericClients), nil +} + +func newConnectionManager1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ConnectionManager1 { + clients := make([]*ConnectionManager1, len(genericClients)) + for i := range genericClients { + clients[i] = &ConnectionManager1{genericClients[i]} + } + return clients +} + +func (client *ConnectionManager1) GetProtocolInfo() (Source string, Sink string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Source string + + Sink string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "GetProtocolInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Source, err = soap.UnmarshalString(response.Source); err != nil { + return + } + if Sink, err = soap.UnmarshalString(response.Sink); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Direction: allowed values: Input, Output + +func (client *ConnectionManager1) PrepareForConnection(RemoteProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string) (ConnectionID int32, AVTransportID int32, RcsID int32, err error) { + // Request structure. + request := &struct { + RemoteProtocolInfo string + + PeerConnectionManager string + + PeerConnectionID string + + Direction string + }{} + // BEGIN Marshal arguments into request. + + if request.RemoteProtocolInfo, err = soap.MarshalString(RemoteProtocolInfo); err != nil { + return + } + if request.PeerConnectionManager, err = soap.MarshalString(PeerConnectionManager); err != nil { + return + } + if request.PeerConnectionID, err = soap.MarshalI4(PeerConnectionID); err != nil { + return + } + if request.Direction, err = soap.MarshalString(Direction); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ConnectionID string + + AVTransportID string + + RcsID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "PrepareForConnection", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ConnectionID, err = soap.UnmarshalI4(response.ConnectionID); err != nil { + return + } + if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { + return + } + if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ConnectionManager1) ConnectionComplete(ConnectionID int32) (err error) { + // Request structure. + request := &struct { + ConnectionID string + }{} + // BEGIN Marshal arguments into request. + + if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "ConnectionComplete", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ConnectionManager1) GetCurrentConnectionIDs() (ConnectionIDs string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ConnectionIDs string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "GetCurrentConnectionIDs", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ConnectionIDs, err = soap.UnmarshalString(response.ConnectionIDs); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * Direction: allowed values: Input, Output +// +// * Status: allowed values: OK, ContentFormatMismatch, InsufficientBandwidth, UnreliableChannel, Unknown +func (client *ConnectionManager1) GetCurrentConnectionInfo(ConnectionID int32) (RcsID int32, AVTransportID int32, ProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string, Status string, err error) { + // Request structure. + request := &struct { + ConnectionID string + }{} + // BEGIN Marshal arguments into request. + + if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RcsID string + + AVTransportID string + + ProtocolInfo string + + PeerConnectionManager string + + PeerConnectionID string + + Direction string + + Status string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_1, "GetCurrentConnectionInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { + return + } + if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { + return + } + if ProtocolInfo, err = soap.UnmarshalString(response.ProtocolInfo); err != nil { + return + } + if PeerConnectionManager, err = soap.UnmarshalString(response.PeerConnectionManager); err != nil { + return + } + if PeerConnectionID, err = soap.UnmarshalI4(response.PeerConnectionID); err != nil { + return + } + if Direction, err = soap.UnmarshalString(response.Direction); err != nil { + return + } + if Status, err = soap.UnmarshalString(response.Status); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// ConnectionManager2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ConnectionManager:2". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type ConnectionManager2 struct { + goupnp.ServiceClient +} + +// NewConnectionManager2Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewConnectionManager2Clients() (clients []*ConnectionManager2, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_2); err != nil { + return + } + clients = newConnectionManager2ClientsFromGenericClients(genericClients) + return +} + +// NewConnectionManager2ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewConnectionManager2ClientsByURL(loc *url.URL) ([]*ConnectionManager2, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_2) + if err != nil { + return nil, err + } + return newConnectionManager2ClientsFromGenericClients(genericClients), nil +} + +// NewConnectionManager2ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewConnectionManager2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ConnectionManager2, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ConnectionManager_2) + if err != nil { + return nil, err + } + return newConnectionManager2ClientsFromGenericClients(genericClients), nil +} + +func newConnectionManager2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ConnectionManager2 { + clients := make([]*ConnectionManager2, len(genericClients)) + for i := range genericClients { + clients[i] = &ConnectionManager2{genericClients[i]} + } + return clients +} + +func (client *ConnectionManager2) GetProtocolInfo() (Source string, Sink string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Source string + + Sink string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "GetProtocolInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Source, err = soap.UnmarshalString(response.Source); err != nil { + return + } + if Sink, err = soap.UnmarshalString(response.Sink); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Direction: allowed values: Input, Output + +func (client *ConnectionManager2) PrepareForConnection(RemoteProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string) (ConnectionID int32, AVTransportID int32, RcsID int32, err error) { + // Request structure. + request := &struct { + RemoteProtocolInfo string + + PeerConnectionManager string + + PeerConnectionID string + + Direction string + }{} + // BEGIN Marshal arguments into request. + + if request.RemoteProtocolInfo, err = soap.MarshalString(RemoteProtocolInfo); err != nil { + return + } + if request.PeerConnectionManager, err = soap.MarshalString(PeerConnectionManager); err != nil { + return + } + if request.PeerConnectionID, err = soap.MarshalI4(PeerConnectionID); err != nil { + return + } + if request.Direction, err = soap.MarshalString(Direction); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ConnectionID string + + AVTransportID string + + RcsID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "PrepareForConnection", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ConnectionID, err = soap.UnmarshalI4(response.ConnectionID); err != nil { + return + } + if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { + return + } + if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ConnectionManager2) ConnectionComplete(ConnectionID int32) (err error) { + // Request structure. + request := &struct { + ConnectionID string + }{} + // BEGIN Marshal arguments into request. + + if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "ConnectionComplete", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ConnectionManager2) GetCurrentConnectionIDs() (ConnectionIDs string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ConnectionIDs string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "GetCurrentConnectionIDs", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ConnectionIDs, err = soap.UnmarshalString(response.ConnectionIDs); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * Direction: allowed values: Input, Output +// +// * Status: allowed values: OK, ContentFormatMismatch, InsufficientBandwidth, UnreliableChannel, Unknown +func (client *ConnectionManager2) GetCurrentConnectionInfo(ConnectionID int32) (RcsID int32, AVTransportID int32, ProtocolInfo string, PeerConnectionManager string, PeerConnectionID int32, Direction string, Status string, err error) { + // Request structure. + request := &struct { + ConnectionID string + }{} + // BEGIN Marshal arguments into request. + + if request.ConnectionID, err = soap.MarshalI4(ConnectionID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RcsID string + + AVTransportID string + + ProtocolInfo string + + PeerConnectionManager string + + PeerConnectionID string + + Direction string + + Status string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ConnectionManager_2, "GetCurrentConnectionInfo", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RcsID, err = soap.UnmarshalI4(response.RcsID); err != nil { + return + } + if AVTransportID, err = soap.UnmarshalI4(response.AVTransportID); err != nil { + return + } + if ProtocolInfo, err = soap.UnmarshalString(response.ProtocolInfo); err != nil { + return + } + if PeerConnectionManager, err = soap.UnmarshalString(response.PeerConnectionManager); err != nil { + return + } + if PeerConnectionID, err = soap.UnmarshalI4(response.PeerConnectionID); err != nil { + return + } + if Direction, err = soap.UnmarshalString(response.Direction); err != nil { + return + } + if Status, err = soap.UnmarshalString(response.Status); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// ContentDirectory1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ContentDirectory:1". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type ContentDirectory1 struct { + goupnp.ServiceClient +} + +// NewContentDirectory1Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewContentDirectory1Clients() (clients []*ContentDirectory1, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_1); err != nil { + return + } + clients = newContentDirectory1ClientsFromGenericClients(genericClients) + return +} + +// NewContentDirectory1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewContentDirectory1ClientsByURL(loc *url.URL) ([]*ContentDirectory1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_1) + if err != nil { + return nil, err + } + return newContentDirectory1ClientsFromGenericClients(genericClients), nil +} + +// NewContentDirectory1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewContentDirectory1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ContentDirectory1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ContentDirectory_1) + if err != nil { + return nil, err + } + return newContentDirectory1ClientsFromGenericClients(genericClients), nil +} + +func newContentDirectory1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ContentDirectory1 { + clients := make([]*ContentDirectory1, len(genericClients)) + for i := range genericClients { + clients[i] = &ContentDirectory1{genericClients[i]} + } + return clients +} + +func (client *ContentDirectory1) GetSearchCapabilities() (SearchCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SearchCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetSearchCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SearchCaps, err = soap.UnmarshalString(response.SearchCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) GetSortCapabilities() (SortCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SortCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetSortCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) GetSystemUpdateID() (Id uint32, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Id string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetSystemUpdateID", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Id, err = soap.UnmarshalUi4(response.Id); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * BrowseFlag: allowed values: BrowseMetadata, BrowseDirectChildren + +func (client *ContentDirectory1) Browse(ObjectID string, BrowseFlag string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + ObjectID string + + BrowseFlag string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.BrowseFlag, err = soap.MarshalString(BrowseFlag); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "Browse", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) Search(ContainerID string, SearchCriteria string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + ContainerID string + + SearchCriteria string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.SearchCriteria, err = soap.MarshalString(SearchCriteria); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "Search", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) CreateObject(ContainerID string, Elements string) (ObjectID string, Result string, err error) { + // Request structure. + request := &struct { + ContainerID string + + Elements string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.Elements, err = soap.MarshalString(Elements); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ObjectID string + + Result string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "CreateObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ObjectID, err = soap.UnmarshalString(response.ObjectID); err != nil { + return + } + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) DestroyObject(ObjectID string) (err error) { + // Request structure. + request := &struct { + ObjectID string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "DestroyObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) UpdateObject(ObjectID string, CurrentTagValue string, NewTagValue string) (err error) { + // Request structure. + request := &struct { + ObjectID string + + CurrentTagValue string + + NewTagValue string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.CurrentTagValue, err = soap.MarshalString(CurrentTagValue); err != nil { + return + } + if request.NewTagValue, err = soap.MarshalString(NewTagValue); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "UpdateObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) ImportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { + // Request structure. + request := &struct { + SourceURI string + + DestinationURI string + }{} + // BEGIN Marshal arguments into request. + + if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { + return + } + if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "ImportResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) ExportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { + // Request structure. + request := &struct { + SourceURI string + + DestinationURI string + }{} + // BEGIN Marshal arguments into request. + + if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { + return + } + if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "ExportResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) StopTransferResource(TransferID uint32) (err error) { + // Request structure. + request := &struct { + TransferID string + }{} + // BEGIN Marshal arguments into request. + + if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "StopTransferResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * TransferStatus: allowed values: COMPLETED, ERROR, IN_PROGRESS, STOPPED +func (client *ContentDirectory1) GetTransferProgress(TransferID uint32) (TransferStatus string, TransferLength string, TransferTotal string, err error) { + // Request structure. + request := &struct { + TransferID string + }{} + // BEGIN Marshal arguments into request. + + if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferStatus string + + TransferLength string + + TransferTotal string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "GetTransferProgress", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferStatus, err = soap.UnmarshalString(response.TransferStatus); err != nil { + return + } + if TransferLength, err = soap.UnmarshalString(response.TransferLength); err != nil { + return + } + if TransferTotal, err = soap.UnmarshalString(response.TransferTotal); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) DeleteResource(ResourceURI *url.URL) (err error) { + // Request structure. + request := &struct { + ResourceURI string + }{} + // BEGIN Marshal arguments into request. + + if request.ResourceURI, err = soap.MarshalURI(ResourceURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "DeleteResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory1) CreateReference(ContainerID string, ObjectID string) (NewID string, err error) { + // Request structure. + request := &struct { + ContainerID string + + ObjectID string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + NewID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_1, "CreateReference", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if NewID, err = soap.UnmarshalString(response.NewID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// ContentDirectory2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ContentDirectory:2". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type ContentDirectory2 struct { + goupnp.ServiceClient +} + +// NewContentDirectory2Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewContentDirectory2Clients() (clients []*ContentDirectory2, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_2); err != nil { + return + } + clients = newContentDirectory2ClientsFromGenericClients(genericClients) + return +} + +// NewContentDirectory2ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewContentDirectory2ClientsByURL(loc *url.URL) ([]*ContentDirectory2, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_2) + if err != nil { + return nil, err + } + return newContentDirectory2ClientsFromGenericClients(genericClients), nil +} + +// NewContentDirectory2ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewContentDirectory2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ContentDirectory2, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ContentDirectory_2) + if err != nil { + return nil, err + } + return newContentDirectory2ClientsFromGenericClients(genericClients), nil +} + +func newContentDirectory2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ContentDirectory2 { + clients := make([]*ContentDirectory2, len(genericClients)) + for i := range genericClients { + clients[i] = &ContentDirectory2{genericClients[i]} + } + return clients +} + +func (client *ContentDirectory2) GetSearchCapabilities() (SearchCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SearchCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSearchCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SearchCaps, err = soap.UnmarshalString(response.SearchCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) GetSortCapabilities() (SortCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SortCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSortCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) GetSortExtensionCapabilities() (SortExtensionCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SortExtensionCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSortExtensionCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SortExtensionCaps, err = soap.UnmarshalString(response.SortExtensionCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) GetFeatureList() (FeatureList string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + FeatureList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetFeatureList", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if FeatureList, err = soap.UnmarshalString(response.FeatureList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) GetSystemUpdateID() (Id uint32, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Id string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetSystemUpdateID", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Id, err = soap.UnmarshalUi4(response.Id); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * BrowseFlag: allowed values: BrowseMetadata, BrowseDirectChildren + +func (client *ContentDirectory2) Browse(ObjectID string, BrowseFlag string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + ObjectID string + + BrowseFlag string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.BrowseFlag, err = soap.MarshalString(BrowseFlag); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "Browse", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) Search(ContainerID string, SearchCriteria string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + ContainerID string + + SearchCriteria string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.SearchCriteria, err = soap.MarshalString(SearchCriteria); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "Search", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) CreateObject(ContainerID string, Elements string) (ObjectID string, Result string, err error) { + // Request structure. + request := &struct { + ContainerID string + + Elements string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.Elements, err = soap.MarshalString(Elements); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ObjectID string + + Result string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "CreateObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ObjectID, err = soap.UnmarshalString(response.ObjectID); err != nil { + return + } + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) DestroyObject(ObjectID string) (err error) { + // Request structure. + request := &struct { + ObjectID string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "DestroyObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) UpdateObject(ObjectID string, CurrentTagValue string, NewTagValue string) (err error) { + // Request structure. + request := &struct { + ObjectID string + + CurrentTagValue string + + NewTagValue string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.CurrentTagValue, err = soap.MarshalString(CurrentTagValue); err != nil { + return + } + if request.NewTagValue, err = soap.MarshalString(NewTagValue); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "UpdateObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) MoveObject(ObjectID string, NewParentID string) (NewObjectID string, err error) { + // Request structure. + request := &struct { + ObjectID string + + NewParentID string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.NewParentID, err = soap.MarshalString(NewParentID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + NewObjectID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "MoveObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if NewObjectID, err = soap.UnmarshalString(response.NewObjectID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) ImportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { + // Request structure. + request := &struct { + SourceURI string + + DestinationURI string + }{} + // BEGIN Marshal arguments into request. + + if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { + return + } + if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "ImportResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) ExportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { + // Request structure. + request := &struct { + SourceURI string + + DestinationURI string + }{} + // BEGIN Marshal arguments into request. + + if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { + return + } + if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "ExportResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) DeleteResource(ResourceURI *url.URL) (err error) { + // Request structure. + request := &struct { + ResourceURI string + }{} + // BEGIN Marshal arguments into request. + + if request.ResourceURI, err = soap.MarshalURI(ResourceURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "DeleteResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) StopTransferResource(TransferID uint32) (err error) { + // Request structure. + request := &struct { + TransferID string + }{} + // BEGIN Marshal arguments into request. + + if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "StopTransferResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * TransferStatus: allowed values: COMPLETED, ERROR, IN_PROGRESS, STOPPED +func (client *ContentDirectory2) GetTransferProgress(TransferID uint32) (TransferStatus string, TransferLength string, TransferTotal string, err error) { + // Request structure. + request := &struct { + TransferID string + }{} + // BEGIN Marshal arguments into request. + + if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferStatus string + + TransferLength string + + TransferTotal string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "GetTransferProgress", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferStatus, err = soap.UnmarshalString(response.TransferStatus); err != nil { + return + } + if TransferLength, err = soap.UnmarshalString(response.TransferLength); err != nil { + return + } + if TransferTotal, err = soap.UnmarshalString(response.TransferTotal); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory2) CreateReference(ContainerID string, ObjectID string) (NewID string, err error) { + // Request structure. + request := &struct { + ContainerID string + + ObjectID string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + NewID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_2, "CreateReference", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if NewID, err = soap.UnmarshalString(response.NewID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// ContentDirectory3 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ContentDirectory:3". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type ContentDirectory3 struct { + goupnp.ServiceClient +} + +// NewContentDirectory3Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewContentDirectory3Clients() (clients []*ContentDirectory3, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_3); err != nil { + return + } + clients = newContentDirectory3ClientsFromGenericClients(genericClients) + return +} + +// NewContentDirectory3ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewContentDirectory3ClientsByURL(loc *url.URL) ([]*ContentDirectory3, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_3) + if err != nil { + return nil, err + } + return newContentDirectory3ClientsFromGenericClients(genericClients), nil +} + +// NewContentDirectory3ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewContentDirectory3ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ContentDirectory3, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ContentDirectory_3) + if err != nil { + return nil, err + } + return newContentDirectory3ClientsFromGenericClients(genericClients), nil +} + +func newContentDirectory3ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ContentDirectory3 { + clients := make([]*ContentDirectory3, len(genericClients)) + for i := range genericClients { + clients[i] = &ContentDirectory3{genericClients[i]} + } + return clients +} + +func (client *ContentDirectory3) GetSearchCapabilities() (SearchCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SearchCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSearchCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SearchCaps, err = soap.UnmarshalString(response.SearchCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) GetSortCapabilities() (SortCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SortCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSortCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) GetSortExtensionCapabilities() (SortExtensionCaps string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SortExtensionCaps string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSortExtensionCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SortExtensionCaps, err = soap.UnmarshalString(response.SortExtensionCaps); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) GetFeatureList() (FeatureList string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + FeatureList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetFeatureList", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if FeatureList, err = soap.UnmarshalString(response.FeatureList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) GetSystemUpdateID() (Id uint32, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Id string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetSystemUpdateID", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Id, err = soap.UnmarshalUi4(response.Id); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) GetServiceResetToken() (ResetToken string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ResetToken string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetServiceResetToken", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ResetToken, err = soap.UnmarshalString(response.ResetToken); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * BrowseFlag: allowed values: BrowseMetadata, BrowseDirectChildren + +func (client *ContentDirectory3) Browse(ObjectID string, BrowseFlag string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + ObjectID string + + BrowseFlag string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.BrowseFlag, err = soap.MarshalString(BrowseFlag); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "Browse", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) Search(ContainerID string, SearchCriteria string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + ContainerID string + + SearchCriteria string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.SearchCriteria, err = soap.MarshalString(SearchCriteria); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "Search", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) CreateObject(ContainerID string, Elements string) (ObjectID string, Result string, err error) { + // Request structure. + request := &struct { + ContainerID string + + Elements string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.Elements, err = soap.MarshalString(Elements); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ObjectID string + + Result string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "CreateObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ObjectID, err = soap.UnmarshalString(response.ObjectID); err != nil { + return + } + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) DestroyObject(ObjectID string) (err error) { + // Request structure. + request := &struct { + ObjectID string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "DestroyObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) UpdateObject(ObjectID string, CurrentTagValue string, NewTagValue string) (err error) { + // Request structure. + request := &struct { + ObjectID string + + CurrentTagValue string + + NewTagValue string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.CurrentTagValue, err = soap.MarshalString(CurrentTagValue); err != nil { + return + } + if request.NewTagValue, err = soap.MarshalString(NewTagValue); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "UpdateObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) MoveObject(ObjectID string, NewParentID string) (NewObjectID string, err error) { + // Request structure. + request := &struct { + ObjectID string + + NewParentID string + }{} + // BEGIN Marshal arguments into request. + + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + if request.NewParentID, err = soap.MarshalString(NewParentID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + NewObjectID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "MoveObject", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if NewObjectID, err = soap.UnmarshalString(response.NewObjectID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) ImportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { + // Request structure. + request := &struct { + SourceURI string + + DestinationURI string + }{} + // BEGIN Marshal arguments into request. + + if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { + return + } + if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "ImportResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) ExportResource(SourceURI *url.URL, DestinationURI *url.URL) (TransferID uint32, err error) { + // Request structure. + request := &struct { + SourceURI string + + DestinationURI string + }{} + // BEGIN Marshal arguments into request. + + if request.SourceURI, err = soap.MarshalURI(SourceURI); err != nil { + return + } + if request.DestinationURI, err = soap.MarshalURI(DestinationURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "ExportResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferID, err = soap.UnmarshalUi4(response.TransferID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) DeleteResource(ResourceURI *url.URL) (err error) { + // Request structure. + request := &struct { + ResourceURI string + }{} + // BEGIN Marshal arguments into request. + + if request.ResourceURI, err = soap.MarshalURI(ResourceURI); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "DeleteResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) StopTransferResource(TransferID uint32) (err error) { + // Request structure. + request := &struct { + TransferID string + }{} + // BEGIN Marshal arguments into request. + + if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "StopTransferResource", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * TransferStatus: allowed values: COMPLETED, ERROR, IN_PROGRESS, STOPPED +func (client *ContentDirectory3) GetTransferProgress(TransferID uint32) (TransferStatus string, TransferLength string, TransferTotal string, err error) { + // Request structure. + request := &struct { + TransferID string + }{} + // BEGIN Marshal arguments into request. + + if request.TransferID, err = soap.MarshalUi4(TransferID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + TransferStatus string + + TransferLength string + + TransferTotal string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetTransferProgress", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if TransferStatus, err = soap.UnmarshalString(response.TransferStatus); err != nil { + return + } + if TransferLength, err = soap.UnmarshalString(response.TransferLength); err != nil { + return + } + if TransferTotal, err = soap.UnmarshalString(response.TransferTotal); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) CreateReference(ContainerID string, ObjectID string) (NewID string, err error) { + // Request structure. + request := &struct { + ContainerID string + + ObjectID string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.ObjectID, err = soap.MarshalString(ObjectID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + NewID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "CreateReference", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if NewID, err = soap.UnmarshalString(response.NewID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) FreeFormQuery(ContainerID string, CDSView uint32, QueryRequest string) (QueryResult string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + ContainerID string + + CDSView string + + QueryRequest string + }{} + // BEGIN Marshal arguments into request. + + if request.ContainerID, err = soap.MarshalString(ContainerID); err != nil { + return + } + if request.CDSView, err = soap.MarshalUi4(CDSView); err != nil { + return + } + if request.QueryRequest, err = soap.MarshalString(QueryRequest); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + QueryResult string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "FreeFormQuery", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if QueryResult, err = soap.UnmarshalString(response.QueryResult); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ContentDirectory3) GetFreeFormQueryCapabilities() (FFQCapabilities string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + FFQCapabilities string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ContentDirectory_3, "GetFreeFormQueryCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if FFQCapabilities, err = soap.UnmarshalString(response.FFQCapabilities); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// RenderingControl1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:RenderingControl:1". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type RenderingControl1 struct { + goupnp.ServiceClient +} + +// NewRenderingControl1Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewRenderingControl1Clients() (clients []*RenderingControl1, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_1); err != nil { + return + } + clients = newRenderingControl1ClientsFromGenericClients(genericClients) + return +} + +// NewRenderingControl1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewRenderingControl1ClientsByURL(loc *url.URL) ([]*RenderingControl1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_1) + if err != nil { + return nil, err + } + return newRenderingControl1ClientsFromGenericClients(genericClients), nil +} + +// NewRenderingControl1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewRenderingControl1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*RenderingControl1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_RenderingControl_1) + if err != nil { + return nil, err + } + return newRenderingControl1ClientsFromGenericClients(genericClients), nil +} + +func newRenderingControl1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*RenderingControl1 { + clients := make([]*RenderingControl1, len(genericClients)) + for i := range genericClients { + clients[i] = &RenderingControl1{genericClients[i]} + } + return clients +} + +func (client *RenderingControl1) ListPresets(InstanceID uint32) (CurrentPresetNameList string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentPresetNameList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "ListPresets", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentPresetNameList, err = soap.UnmarshalString(response.CurrentPresetNameList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * PresetName: allowed values: FactoryDefaults + +func (client *RenderingControl1) SelectPreset(InstanceID uint32, PresetName string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + PresetName string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.PresetName, err = soap.MarshalString(PresetName); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SelectPreset", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentBrightness: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetBrightness(InstanceID uint32) (CurrentBrightness uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentBrightness string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetBrightness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentBrightness, err = soap.UnmarshalUi2(response.CurrentBrightness); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredBrightness: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetBrightness(InstanceID uint32, DesiredBrightness uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredBrightness string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredBrightness, err = soap.MarshalUi2(DesiredBrightness); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetBrightness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentContrast: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetContrast(InstanceID uint32) (CurrentContrast uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentContrast string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetContrast", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentContrast, err = soap.UnmarshalUi2(response.CurrentContrast); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredContrast: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetContrast(InstanceID uint32, DesiredContrast uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredContrast string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredContrast, err = soap.MarshalUi2(DesiredContrast); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetContrast", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentSharpness: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetSharpness(InstanceID uint32) (CurrentSharpness uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentSharpness string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetSharpness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentSharpness, err = soap.UnmarshalUi2(response.CurrentSharpness); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredSharpness: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetSharpness(InstanceID uint32, DesiredSharpness uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredSharpness string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredSharpness, err = soap.MarshalUi2(DesiredSharpness); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetSharpness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *RenderingControl1) GetRedVideoGain(InstanceID uint32) (CurrentRedVideoGain uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentRedVideoGain string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetRedVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentRedVideoGain, err = soap.UnmarshalUi2(response.CurrentRedVideoGain); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *RenderingControl1) SetRedVideoGain(InstanceID uint32, DesiredRedVideoGain uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredRedVideoGain string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredRedVideoGain, err = soap.MarshalUi2(DesiredRedVideoGain); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetRedVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentGreenVideoGain: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetGreenVideoGain(InstanceID uint32) (CurrentGreenVideoGain uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentGreenVideoGain string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetGreenVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentGreenVideoGain, err = soap.UnmarshalUi2(response.CurrentGreenVideoGain); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredGreenVideoGain: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetGreenVideoGain(InstanceID uint32, DesiredGreenVideoGain uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredGreenVideoGain string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredGreenVideoGain, err = soap.MarshalUi2(DesiredGreenVideoGain); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetGreenVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentBlueVideoGain: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetBlueVideoGain(InstanceID uint32) (CurrentBlueVideoGain uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentBlueVideoGain string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetBlueVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentBlueVideoGain, err = soap.UnmarshalUi2(response.CurrentBlueVideoGain); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredBlueVideoGain: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetBlueVideoGain(InstanceID uint32, DesiredBlueVideoGain uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredBlueVideoGain string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredBlueVideoGain, err = soap.MarshalUi2(DesiredBlueVideoGain); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetBlueVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentRedVideoBlackLevel: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetRedVideoBlackLevel(InstanceID uint32) (CurrentRedVideoBlackLevel uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentRedVideoBlackLevel string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetRedVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentRedVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentRedVideoBlackLevel); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredRedVideoBlackLevel: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetRedVideoBlackLevel(InstanceID uint32, DesiredRedVideoBlackLevel uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredRedVideoBlackLevel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredRedVideoBlackLevel, err = soap.MarshalUi2(DesiredRedVideoBlackLevel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetRedVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentGreenVideoBlackLevel: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetGreenVideoBlackLevel(InstanceID uint32) (CurrentGreenVideoBlackLevel uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentGreenVideoBlackLevel string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetGreenVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentGreenVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentGreenVideoBlackLevel); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredGreenVideoBlackLevel: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetGreenVideoBlackLevel(InstanceID uint32, DesiredGreenVideoBlackLevel uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredGreenVideoBlackLevel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredGreenVideoBlackLevel, err = soap.MarshalUi2(DesiredGreenVideoBlackLevel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetGreenVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentBlueVideoBlackLevel: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetBlueVideoBlackLevel(InstanceID uint32) (CurrentBlueVideoBlackLevel uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentBlueVideoBlackLevel string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetBlueVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentBlueVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentBlueVideoBlackLevel); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredBlueVideoBlackLevel: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetBlueVideoBlackLevel(InstanceID uint32, DesiredBlueVideoBlackLevel uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredBlueVideoBlackLevel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredBlueVideoBlackLevel, err = soap.MarshalUi2(DesiredBlueVideoBlackLevel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetBlueVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentColorTemperature: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetColorTemperature(InstanceID uint32) (CurrentColorTemperature uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentColorTemperature string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetColorTemperature", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentColorTemperature, err = soap.UnmarshalUi2(response.CurrentColorTemperature); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredColorTemperature: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetColorTemperature(InstanceID uint32, DesiredColorTemperature uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredColorTemperature string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredColorTemperature, err = soap.MarshalUi2(DesiredColorTemperature); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetColorTemperature", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentHorizontalKeystone: allowed value range: step=1 +func (client *RenderingControl1) GetHorizontalKeystone(InstanceID uint32) (CurrentHorizontalKeystone int16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentHorizontalKeystone string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetHorizontalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentHorizontalKeystone, err = soap.UnmarshalI2(response.CurrentHorizontalKeystone); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredHorizontalKeystone: allowed value range: step=1 + +func (client *RenderingControl1) SetHorizontalKeystone(InstanceID uint32, DesiredHorizontalKeystone int16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredHorizontalKeystone string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredHorizontalKeystone, err = soap.MarshalI2(DesiredHorizontalKeystone); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetHorizontalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentVerticalKeystone: allowed value range: step=1 +func (client *RenderingControl1) GetVerticalKeystone(InstanceID uint32) (CurrentVerticalKeystone int16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentVerticalKeystone string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVerticalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentVerticalKeystone, err = soap.UnmarshalI2(response.CurrentVerticalKeystone); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredVerticalKeystone: allowed value range: step=1 + +func (client *RenderingControl1) SetVerticalKeystone(InstanceID uint32, DesiredVerticalKeystone int16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredVerticalKeystone string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredVerticalKeystone, err = soap.MarshalI2(DesiredVerticalKeystone); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetVerticalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl1) GetMute(InstanceID uint32, Channel string) (CurrentMute bool, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentMute string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetMute", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentMute, err = soap.UnmarshalBoolean(response.CurrentMute); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl1) SetMute(InstanceID uint32, Channel string, DesiredMute bool) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredMute string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredMute, err = soap.MarshalBoolean(DesiredMute); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetMute", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +// +// Return values: +// +// * CurrentVolume: allowed value range: minimum=0, step=1 +func (client *RenderingControl1) GetVolume(InstanceID uint32, Channel string) (CurrentVolume uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentVolume string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVolume", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentVolume, err = soap.UnmarshalUi2(response.CurrentVolume); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master +// +// * DesiredVolume: allowed value range: minimum=0, step=1 + +func (client *RenderingControl1) SetVolume(InstanceID uint32, Channel string, DesiredVolume uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredVolume string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredVolume, err = soap.MarshalUi2(DesiredVolume); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetVolume", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl1) GetVolumeDB(InstanceID uint32, Channel string) (CurrentVolume int16, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentVolume string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVolumeDB", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentVolume, err = soap.UnmarshalI2(response.CurrentVolume); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl1) SetVolumeDB(InstanceID uint32, Channel string, DesiredVolume int16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredVolume string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredVolume, err = soap.MarshalI2(DesiredVolume); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetVolumeDB", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl1) GetVolumeDBRange(InstanceID uint32, Channel string) (MinValue int16, MaxValue int16, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + MinValue string + + MaxValue string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetVolumeDBRange", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if MinValue, err = soap.UnmarshalI2(response.MinValue); err != nil { + return + } + if MaxValue, err = soap.UnmarshalI2(response.MaxValue); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl1) GetLoudness(InstanceID uint32, Channel string) (CurrentLoudness bool, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentLoudness string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "GetLoudness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentLoudness, err = soap.UnmarshalBoolean(response.CurrentLoudness); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl1) SetLoudness(InstanceID uint32, Channel string, DesiredLoudness bool) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredLoudness string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredLoudness, err = soap.MarshalBoolean(DesiredLoudness); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_1, "SetLoudness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// RenderingControl2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:RenderingControl:2". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type RenderingControl2 struct { + goupnp.ServiceClient +} + +// NewRenderingControl2Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewRenderingControl2Clients() (clients []*RenderingControl2, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_2); err != nil { + return + } + clients = newRenderingControl2ClientsFromGenericClients(genericClients) + return +} + +// NewRenderingControl2ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewRenderingControl2ClientsByURL(loc *url.URL) ([]*RenderingControl2, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_2) + if err != nil { + return nil, err + } + return newRenderingControl2ClientsFromGenericClients(genericClients), nil +} + +// NewRenderingControl2ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewRenderingControl2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*RenderingControl2, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_RenderingControl_2) + if err != nil { + return nil, err + } + return newRenderingControl2ClientsFromGenericClients(genericClients), nil +} + +func newRenderingControl2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*RenderingControl2 { + clients := make([]*RenderingControl2, len(genericClients)) + for i := range genericClients { + clients[i] = &RenderingControl2{genericClients[i]} + } + return clients +} + +func (client *RenderingControl2) ListPresets(InstanceID uint32) (CurrentPresetNameList string, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentPresetNameList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "ListPresets", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentPresetNameList, err = soap.UnmarshalString(response.CurrentPresetNameList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * PresetName: allowed values: FactoryDefaults + +func (client *RenderingControl2) SelectPreset(InstanceID uint32, PresetName string) (err error) { + // Request structure. + request := &struct { + InstanceID string + + PresetName string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.PresetName, err = soap.MarshalString(PresetName); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SelectPreset", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentBrightness: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetBrightness(InstanceID uint32) (CurrentBrightness uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentBrightness string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetBrightness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentBrightness, err = soap.UnmarshalUi2(response.CurrentBrightness); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredBrightness: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetBrightness(InstanceID uint32, DesiredBrightness uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredBrightness string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredBrightness, err = soap.MarshalUi2(DesiredBrightness); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetBrightness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentContrast: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetContrast(InstanceID uint32) (CurrentContrast uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentContrast string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetContrast", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentContrast, err = soap.UnmarshalUi2(response.CurrentContrast); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredContrast: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetContrast(InstanceID uint32, DesiredContrast uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredContrast string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredContrast, err = soap.MarshalUi2(DesiredContrast); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetContrast", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentSharpness: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetSharpness(InstanceID uint32) (CurrentSharpness uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentSharpness string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetSharpness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentSharpness, err = soap.UnmarshalUi2(response.CurrentSharpness); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredSharpness: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetSharpness(InstanceID uint32, DesiredSharpness uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredSharpness string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredSharpness, err = soap.MarshalUi2(DesiredSharpness); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetSharpness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentRedVideoGain: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetRedVideoGain(InstanceID uint32) (CurrentRedVideoGain uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentRedVideoGain string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetRedVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentRedVideoGain, err = soap.UnmarshalUi2(response.CurrentRedVideoGain); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredRedVideoGain: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetRedVideoGain(InstanceID uint32, DesiredRedVideoGain uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredRedVideoGain string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredRedVideoGain, err = soap.MarshalUi2(DesiredRedVideoGain); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetRedVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentGreenVideoGain: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetGreenVideoGain(InstanceID uint32) (CurrentGreenVideoGain uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentGreenVideoGain string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetGreenVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentGreenVideoGain, err = soap.UnmarshalUi2(response.CurrentGreenVideoGain); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredGreenVideoGain: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetGreenVideoGain(InstanceID uint32, DesiredGreenVideoGain uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredGreenVideoGain string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredGreenVideoGain, err = soap.MarshalUi2(DesiredGreenVideoGain); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetGreenVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentBlueVideoGain: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetBlueVideoGain(InstanceID uint32) (CurrentBlueVideoGain uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentBlueVideoGain string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetBlueVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentBlueVideoGain, err = soap.UnmarshalUi2(response.CurrentBlueVideoGain); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredBlueVideoGain: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetBlueVideoGain(InstanceID uint32, DesiredBlueVideoGain uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredBlueVideoGain string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredBlueVideoGain, err = soap.MarshalUi2(DesiredBlueVideoGain); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetBlueVideoGain", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentRedVideoBlackLevel: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetRedVideoBlackLevel(InstanceID uint32) (CurrentRedVideoBlackLevel uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentRedVideoBlackLevel string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetRedVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentRedVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentRedVideoBlackLevel); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredRedVideoBlackLevel: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetRedVideoBlackLevel(InstanceID uint32, DesiredRedVideoBlackLevel uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredRedVideoBlackLevel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredRedVideoBlackLevel, err = soap.MarshalUi2(DesiredRedVideoBlackLevel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetRedVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentGreenVideoBlackLevel: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetGreenVideoBlackLevel(InstanceID uint32) (CurrentGreenVideoBlackLevel uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentGreenVideoBlackLevel string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetGreenVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentGreenVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentGreenVideoBlackLevel); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredGreenVideoBlackLevel: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetGreenVideoBlackLevel(InstanceID uint32, DesiredGreenVideoBlackLevel uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredGreenVideoBlackLevel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredGreenVideoBlackLevel, err = soap.MarshalUi2(DesiredGreenVideoBlackLevel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetGreenVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentBlueVideoBlackLevel: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetBlueVideoBlackLevel(InstanceID uint32) (CurrentBlueVideoBlackLevel uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentBlueVideoBlackLevel string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetBlueVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentBlueVideoBlackLevel, err = soap.UnmarshalUi2(response.CurrentBlueVideoBlackLevel); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredBlueVideoBlackLevel: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetBlueVideoBlackLevel(InstanceID uint32, DesiredBlueVideoBlackLevel uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredBlueVideoBlackLevel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredBlueVideoBlackLevel, err = soap.MarshalUi2(DesiredBlueVideoBlackLevel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetBlueVideoBlackLevel", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentColorTemperature: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetColorTemperature(InstanceID uint32) (CurrentColorTemperature uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentColorTemperature string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetColorTemperature", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentColorTemperature, err = soap.UnmarshalUi2(response.CurrentColorTemperature); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredColorTemperature: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetColorTemperature(InstanceID uint32, DesiredColorTemperature uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredColorTemperature string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredColorTemperature, err = soap.MarshalUi2(DesiredColorTemperature); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetColorTemperature", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentHorizontalKeystone: allowed value range: step=1 +func (client *RenderingControl2) GetHorizontalKeystone(InstanceID uint32) (CurrentHorizontalKeystone int16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentHorizontalKeystone string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetHorizontalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentHorizontalKeystone, err = soap.UnmarshalI2(response.CurrentHorizontalKeystone); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredHorizontalKeystone: allowed value range: step=1 + +func (client *RenderingControl2) SetHorizontalKeystone(InstanceID uint32, DesiredHorizontalKeystone int16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredHorizontalKeystone string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredHorizontalKeystone, err = soap.MarshalI2(DesiredHorizontalKeystone); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetHorizontalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Return values: +// +// * CurrentVerticalKeystone: allowed value range: step=1 +func (client *RenderingControl2) GetVerticalKeystone(InstanceID uint32) (CurrentVerticalKeystone int16, err error) { + // Request structure. + request := &struct { + InstanceID string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentVerticalKeystone string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVerticalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentVerticalKeystone, err = soap.UnmarshalI2(response.CurrentVerticalKeystone); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DesiredVerticalKeystone: allowed value range: step=1 + +func (client *RenderingControl2) SetVerticalKeystone(InstanceID uint32, DesiredVerticalKeystone int16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + DesiredVerticalKeystone string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.DesiredVerticalKeystone, err = soap.MarshalI2(DesiredVerticalKeystone); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetVerticalKeystone", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl2) GetMute(InstanceID uint32, Channel string) (CurrentMute bool, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentMute string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetMute", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentMute, err = soap.UnmarshalBoolean(response.CurrentMute); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl2) SetMute(InstanceID uint32, Channel string, DesiredMute bool) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredMute string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredMute, err = soap.MarshalBoolean(DesiredMute); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetMute", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +// +// Return values: +// +// * CurrentVolume: allowed value range: minimum=0, step=1 +func (client *RenderingControl2) GetVolume(InstanceID uint32, Channel string) (CurrentVolume uint16, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentVolume string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVolume", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentVolume, err = soap.UnmarshalUi2(response.CurrentVolume); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master +// +// * DesiredVolume: allowed value range: minimum=0, step=1 + +func (client *RenderingControl2) SetVolume(InstanceID uint32, Channel string, DesiredVolume uint16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredVolume string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredVolume, err = soap.MarshalUi2(DesiredVolume); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetVolume", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl2) GetVolumeDB(InstanceID uint32, Channel string) (CurrentVolume int16, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentVolume string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVolumeDB", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentVolume, err = soap.UnmarshalI2(response.CurrentVolume); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl2) SetVolumeDB(InstanceID uint32, Channel string, DesiredVolume int16) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredVolume string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredVolume, err = soap.MarshalI2(DesiredVolume); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetVolumeDB", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl2) GetVolumeDBRange(InstanceID uint32, Channel string) (MinValue int16, MaxValue int16, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + MinValue string + + MaxValue string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetVolumeDBRange", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if MinValue, err = soap.UnmarshalI2(response.MinValue); err != nil { + return + } + if MaxValue, err = soap.UnmarshalI2(response.MaxValue); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl2) GetLoudness(InstanceID uint32, Channel string) (CurrentLoudness bool, err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + CurrentLoudness string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetLoudness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if CurrentLoudness, err = soap.UnmarshalBoolean(response.CurrentLoudness); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * Channel: allowed values: Master + +func (client *RenderingControl2) SetLoudness(InstanceID uint32, Channel string, DesiredLoudness bool) (err error) { + // Request structure. + request := &struct { + InstanceID string + + Channel string + + DesiredLoudness string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.Channel, err = soap.MarshalString(Channel); err != nil { + return + } + if request.DesiredLoudness, err = soap.MarshalBoolean(DesiredLoudness); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetLoudness", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *RenderingControl2) GetStateVariables(InstanceID uint32, StateVariableList string) (StateVariableValuePairs string, err error) { + // Request structure. + request := &struct { + InstanceID string + + StateVariableList string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.StateVariableList, err = soap.MarshalString(StateVariableList); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + StateVariableValuePairs string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetStateVariables", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if StateVariableValuePairs, err = soap.UnmarshalString(response.StateVariableValuePairs); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *RenderingControl2) SetStateVariables(InstanceID uint32, RenderingControlUDN string, ServiceType string, ServiceId string, StateVariableValuePairs string) (StateVariableList string, err error) { + // Request structure. + request := &struct { + InstanceID string + + RenderingControlUDN string + + ServiceType string + + ServiceId string + + StateVariableValuePairs string + }{} + // BEGIN Marshal arguments into request. + + if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil { + return + } + if request.RenderingControlUDN, err = soap.MarshalString(RenderingControlUDN); err != nil { + return + } + if request.ServiceType, err = soap.MarshalString(ServiceType); err != nil { + return + } + if request.ServiceId, err = soap.MarshalString(ServiceId); err != nil { + return + } + if request.StateVariableValuePairs, err = soap.MarshalString(StateVariableValuePairs); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + StateVariableList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "SetStateVariables", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if StateVariableList, err = soap.UnmarshalString(response.StateVariableList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// ScheduledRecording1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ScheduledRecording:1". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type ScheduledRecording1 struct { + goupnp.ServiceClient +} + +// NewScheduledRecording1Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewScheduledRecording1Clients() (clients []*ScheduledRecording1, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_1); err != nil { + return + } + clients = newScheduledRecording1ClientsFromGenericClients(genericClients) + return +} + +// NewScheduledRecording1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewScheduledRecording1ClientsByURL(loc *url.URL) ([]*ScheduledRecording1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_1) + if err != nil { + return nil, err + } + return newScheduledRecording1ClientsFromGenericClients(genericClients), nil +} + +// NewScheduledRecording1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewScheduledRecording1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ScheduledRecording1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ScheduledRecording_1) + if err != nil { + return nil, err + } + return newScheduledRecording1ClientsFromGenericClients(genericClients), nil +} + +func newScheduledRecording1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ScheduledRecording1 { + clients := make([]*ScheduledRecording1, len(genericClients)) + for i := range genericClients { + clients[i] = &ScheduledRecording1{genericClients[i]} + } + return clients +} + +func (client *ScheduledRecording1) GetSortCapabilities() (SortCaps string, SortLevelCap uint32, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SortCaps string + + SortLevelCap string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetSortCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { + return + } + if SortLevelCap, err = soap.UnmarshalUi4(response.SortLevelCap); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts + +func (client *ScheduledRecording1) GetPropertyList(DataTypeID string) (PropertyList string, err error) { + // Request structure. + request := &struct { + DataTypeID string + }{} + // BEGIN Marshal arguments into request. + + if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PropertyList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetPropertyList", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PropertyList, err = soap.UnmarshalString(response.PropertyList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts + +func (client *ScheduledRecording1) GetAllowedValues(DataTypeID string, Filter string) (PropertyInfo string, err error) { + // Request structure. + request := &struct { + DataTypeID string + + Filter string + }{} + // BEGIN Marshal arguments into request. + + if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PropertyInfo string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetAllowedValues", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PropertyInfo, err = soap.UnmarshalString(response.PropertyInfo); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) GetStateUpdateID() (Id uint32, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Id string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetStateUpdateID", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Id, err = soap.UnmarshalUi4(response.Id); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) BrowseRecordSchedules(Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "BrowseRecordSchedules", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) BrowseRecordTasks(RecordScheduleID string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordScheduleID string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "BrowseRecordTasks", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) CreateRecordSchedule(Elements string) (RecordScheduleID string, Result string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + Elements string + }{} + // BEGIN Marshal arguments into request. + + if request.Elements, err = soap.MarshalString(Elements); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RecordScheduleID string + + Result string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "CreateRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RecordScheduleID, err = soap.UnmarshalString(response.RecordScheduleID); err != nil { + return + } + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) DeleteRecordSchedule(RecordScheduleID string) (err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DeleteRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) GetRecordSchedule(RecordScheduleID string, Filter string) (Result string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordScheduleID string + + Filter string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) EnableRecordSchedule(RecordScheduleID string) (err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "EnableRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) DisableRecordSchedule(RecordScheduleID string) (err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DisableRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) DeleteRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DeleteRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) GetRecordTask(RecordTaskID string, Filter string) (Result string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordTaskID string + + Filter string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) EnableRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "EnableRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) DisableRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "DisableRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) ResetRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "ResetRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) GetRecordScheduleConflicts(RecordScheduleID string) (RecordScheduleConflictIDList string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RecordScheduleConflictIDList string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordScheduleConflicts", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RecordScheduleConflictIDList, err = soap.UnmarshalString(response.RecordScheduleConflictIDList); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording1) GetRecordTaskConflicts(RecordTaskID string) (RecordTaskConflictIDList string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RecordTaskConflictIDList string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_1, "GetRecordTaskConflicts", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RecordTaskConflictIDList, err = soap.UnmarshalString(response.RecordTaskConflictIDList); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// ScheduledRecording2 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:ScheduledRecording:2". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type ScheduledRecording2 struct { + goupnp.ServiceClient +} + +// NewScheduledRecording2Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewScheduledRecording2Clients() (clients []*ScheduledRecording2, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_2); err != nil { + return + } + clients = newScheduledRecording2ClientsFromGenericClients(genericClients) + return +} + +// NewScheduledRecording2ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewScheduledRecording2ClientsByURL(loc *url.URL) ([]*ScheduledRecording2, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_2) + if err != nil { + return nil, err + } + return newScheduledRecording2ClientsFromGenericClients(genericClients), nil +} + +// NewScheduledRecording2ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewScheduledRecording2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*ScheduledRecording2, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_ScheduledRecording_2) + if err != nil { + return nil, err + } + return newScheduledRecording2ClientsFromGenericClients(genericClients), nil +} + +func newScheduledRecording2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*ScheduledRecording2 { + clients := make([]*ScheduledRecording2, len(genericClients)) + for i := range genericClients { + clients[i] = &ScheduledRecording2{genericClients[i]} + } + return clients +} + +func (client *ScheduledRecording2) GetSortCapabilities() (SortCaps string, SortLevelCap uint32, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + SortCaps string + + SortLevelCap string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetSortCapabilities", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if SortCaps, err = soap.UnmarshalString(response.SortCaps); err != nil { + return + } + if SortLevelCap, err = soap.UnmarshalUi4(response.SortLevelCap); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts + +func (client *ScheduledRecording2) GetPropertyList(DataTypeID string) (PropertyList string, err error) { + // Request structure. + request := &struct { + DataTypeID string + }{} + // BEGIN Marshal arguments into request. + + if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PropertyList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetPropertyList", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PropertyList, err = soap.UnmarshalString(response.PropertyList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +// +// Arguments: +// +// * DataTypeID: allowed values: A_ARG_TYPE_RecordSchedule, A_ARG_TYPE_RecordTask, A_ARG_TYPE_RecordScheduleParts + +func (client *ScheduledRecording2) GetAllowedValues(DataTypeID string, Filter string) (PropertyInfo string, err error) { + // Request structure. + request := &struct { + DataTypeID string + + Filter string + }{} + // BEGIN Marshal arguments into request. + + if request.DataTypeID, err = soap.MarshalString(DataTypeID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + PropertyInfo string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetAllowedValues", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if PropertyInfo, err = soap.UnmarshalString(response.PropertyInfo); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) GetStateUpdateID() (Id uint32, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Id string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetStateUpdateID", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Id, err = soap.UnmarshalUi4(response.Id); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) BrowseRecordSchedules(Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "BrowseRecordSchedules", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) BrowseRecordTasks(RecordScheduleID string, Filter string, StartingIndex uint32, RequestedCount uint32, SortCriteria string) (Result string, NumberReturned uint32, TotalMatches uint32, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordScheduleID string + + Filter string + + StartingIndex string + + RequestedCount string + + SortCriteria string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + if request.StartingIndex, err = soap.MarshalUi4(StartingIndex); err != nil { + return + } + if request.RequestedCount, err = soap.MarshalUi4(RequestedCount); err != nil { + return + } + if request.SortCriteria, err = soap.MarshalString(SortCriteria); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + NumberReturned string + + TotalMatches string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "BrowseRecordTasks", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if NumberReturned, err = soap.UnmarshalUi4(response.NumberReturned); err != nil { + return + } + if TotalMatches, err = soap.UnmarshalUi4(response.TotalMatches); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) CreateRecordSchedule(Elements string) (RecordScheduleID string, Result string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + Elements string + }{} + // BEGIN Marshal arguments into request. + + if request.Elements, err = soap.MarshalString(Elements); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RecordScheduleID string + + Result string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "CreateRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RecordScheduleID, err = soap.UnmarshalString(response.RecordScheduleID); err != nil { + return + } + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) DeleteRecordSchedule(RecordScheduleID string) (err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DeleteRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) GetRecordSchedule(RecordScheduleID string, Filter string) (Result string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordScheduleID string + + Filter string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) EnableRecordSchedule(RecordScheduleID string) (err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "EnableRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) DisableRecordSchedule(RecordScheduleID string) (err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DisableRecordSchedule", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) DeleteRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DeleteRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) GetRecordTask(RecordTaskID string, Filter string) (Result string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordTaskID string + + Filter string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + if request.Filter, err = soap.MarshalString(Filter); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Result string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Result, err = soap.UnmarshalString(response.Result); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) EnableRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "EnableRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) DisableRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "DisableRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) ResetRecordTask(RecordTaskID string) (err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "ResetRecordTask", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) GetRecordScheduleConflicts(RecordScheduleID string) (RecordScheduleConflictIDList string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordScheduleID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordScheduleID, err = soap.MarshalString(RecordScheduleID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RecordScheduleConflictIDList string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordScheduleConflicts", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RecordScheduleConflictIDList, err = soap.UnmarshalString(response.RecordScheduleConflictIDList); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *ScheduledRecording2) GetRecordTaskConflicts(RecordTaskID string) (RecordTaskConflictIDList string, UpdateID uint32, err error) { + // Request structure. + request := &struct { + RecordTaskID string + }{} + // BEGIN Marshal arguments into request. + + if request.RecordTaskID, err = soap.MarshalString(RecordTaskID); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RecordTaskConflictIDList string + + UpdateID string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_ScheduledRecording_2, "GetRecordTaskConflicts", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RecordTaskConflictIDList, err = soap.UnmarshalString(response.RecordTaskConflictIDList); err != nil { + return + } + if UpdateID, err = soap.UnmarshalUi4(response.UpdateID); err != nil { + return + } + // END Unmarshal arguments from response. + return +} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go b/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go index be71855a9..1e0802cd4 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway1/internetgateway1.go @@ -2,13 +2,13 @@ // // 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. +// Typically, use one of the New* functions to create clients for services. package internetgateway1 // Generated file - do not edit by hand. See README.md import ( + "net/url" "time" "github.com/huin/goupnp" @@ -56,18 +56,48 @@ func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, if genericClients, errors, err = goupnp.NewServiceClients(URN_LANHostConfigManagement_1); err != nil { return } - clients = make([]*LANHostConfigManagement1, len(genericClients)) - for i := range genericClients { - clients[i] = &LANHostConfigManagement1{genericClients[i]} - } + clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewDHCPServerConfigurable: +// NewLANHostConfigManagement1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_LANHostConfigManagement_1) + if err != nil { + return nil, err + } + return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil +} + +// NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewLANHostConfigManagement1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*LANHostConfigManagement1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_LANHostConfigManagement_1) + if err != nil { + return nil, err + } + return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil +} + +func newLANHostConfigManagement1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*LANHostConfigManagement1 { + clients := make([]*LANHostConfigManagement1, len(genericClients)) + for i := range genericClients { + clients[i] = &LANHostConfigManagement1{genericClients[i]} + } + return clients +} + func (client *LANHostConfigManagement1) SetDHCPServerConfigurable(NewDHCPServerConfigurable bool) (err error) { // Request structure. request := &struct { @@ -94,11 +124,6 @@ func (client *LANHostConfigManagement1) SetDHCPServerConfigurable(NewDHCPServerC return } -// -// -// Return values: -// -// * NewDHCPServerConfigurable: func (client *LANHostConfigManagement1) GetDHCPServerConfigurable() (NewDHCPServerConfigurable bool, err error) { // Request structure. request := interface{}(nil) @@ -125,11 +150,6 @@ func (client *LANHostConfigManagement1) GetDHCPServerConfigurable() (NewDHCPServ return } -// Arguments: -// -// * NewDHCPRelay: -// -// func (client *LANHostConfigManagement1) SetDHCPRelay(NewDHCPRelay bool) (err error) { // Request structure. request := &struct { @@ -156,11 +176,6 @@ func (client *LANHostConfigManagement1) SetDHCPRelay(NewDHCPRelay bool) (err err return } -// -// -// Return values: -// -// * NewDHCPRelay: func (client *LANHostConfigManagement1) GetDHCPRelay() (NewDHCPRelay bool, err error) { // Request structure. request := interface{}(nil) @@ -187,11 +202,6 @@ func (client *LANHostConfigManagement1) GetDHCPRelay() (NewDHCPRelay bool, err e return } -// Arguments: -// -// * NewSubnetMask: -// -// func (client *LANHostConfigManagement1) SetSubnetMask(NewSubnetMask string) (err error) { // Request structure. request := &struct { @@ -218,11 +228,6 @@ func (client *LANHostConfigManagement1) SetSubnetMask(NewSubnetMask string) (err return } -// -// -// Return values: -// -// * NewSubnetMask: func (client *LANHostConfigManagement1) GetSubnetMask() (NewSubnetMask string, err error) { // Request structure. request := interface{}(nil) @@ -249,11 +254,6 @@ func (client *LANHostConfigManagement1) GetSubnetMask() (NewSubnetMask string, e return } -// Arguments: -// -// * NewIPRouters: -// -// func (client *LANHostConfigManagement1) SetIPRouter(NewIPRouters string) (err error) { // Request structure. request := &struct { @@ -280,11 +280,6 @@ func (client *LANHostConfigManagement1) SetIPRouter(NewIPRouters string) (err er return } -// Arguments: -// -// * NewIPRouters: -// -// func (client *LANHostConfigManagement1) DeleteIPRouter(NewIPRouters string) (err error) { // Request structure. request := &struct { @@ -311,11 +306,6 @@ func (client *LANHostConfigManagement1) DeleteIPRouter(NewIPRouters string) (err return } -// -// -// Return values: -// -// * NewIPRouters: func (client *LANHostConfigManagement1) GetIPRoutersList() (NewIPRouters string, err error) { // Request structure. request := interface{}(nil) @@ -342,11 +332,6 @@ func (client *LANHostConfigManagement1) GetIPRoutersList() (NewIPRouters string, return } -// Arguments: -// -// * NewDomainName: -// -// func (client *LANHostConfigManagement1) SetDomainName(NewDomainName string) (err error) { // Request structure. request := &struct { @@ -373,11 +358,6 @@ func (client *LANHostConfigManagement1) SetDomainName(NewDomainName string) (err return } -// -// -// Return values: -// -// * NewDomainName: func (client *LANHostConfigManagement1) GetDomainName() (NewDomainName string, err error) { // Request structure. request := interface{}(nil) @@ -404,13 +384,6 @@ func (client *LANHostConfigManagement1) GetDomainName() (NewDomainName string, e return } -// Arguments: -// -// * NewMinAddress: -// -// * NewMaxAddress: -// -// func (client *LANHostConfigManagement1) SetAddressRange(NewMinAddress string, NewMaxAddress string) (err error) { // Request structure. request := &struct { @@ -442,13 +415,6 @@ func (client *LANHostConfigManagement1) SetAddressRange(NewMinAddress string, Ne return } -// -// -// Return values: -// -// * NewMinAddress: -// -// * NewMaxAddress: func (client *LANHostConfigManagement1) GetAddressRange() (NewMinAddress string, NewMaxAddress string, err error) { // Request structure. request := interface{}(nil) @@ -480,11 +446,6 @@ func (client *LANHostConfigManagement1) GetAddressRange() (NewMinAddress string, return } -// Arguments: -// -// * NewReservedAddresses: -// -// func (client *LANHostConfigManagement1) SetReservedAddress(NewReservedAddresses string) (err error) { // Request structure. request := &struct { @@ -511,11 +472,6 @@ func (client *LANHostConfigManagement1) SetReservedAddress(NewReservedAddresses return } -// Arguments: -// -// * NewReservedAddresses: -// -// func (client *LANHostConfigManagement1) DeleteReservedAddress(NewReservedAddresses string) (err error) { // Request structure. request := &struct { @@ -542,11 +498,6 @@ func (client *LANHostConfigManagement1) DeleteReservedAddress(NewReservedAddress return } -// -// -// Return values: -// -// * NewReservedAddresses: func (client *LANHostConfigManagement1) GetReservedAddresses() (NewReservedAddresses string, err error) { // Request structure. request := interface{}(nil) @@ -573,11 +524,6 @@ func (client *LANHostConfigManagement1) GetReservedAddresses() (NewReservedAddre return } -// Arguments: -// -// * NewDNSServers: -// -// func (client *LANHostConfigManagement1) SetDNSServer(NewDNSServers string) (err error) { // Request structure. request := &struct { @@ -604,11 +550,6 @@ func (client *LANHostConfigManagement1) SetDNSServer(NewDNSServers string) (err return } -// Arguments: -// -// * NewDNSServers: -// -// func (client *LANHostConfigManagement1) DeleteDNSServer(NewDNSServers string) (err error) { // Request structure. request := &struct { @@ -635,11 +576,6 @@ func (client *LANHostConfigManagement1) DeleteDNSServer(NewDNSServers string) (e return } -// -// -// Return values: -// -// * NewDNSServers: func (client *LANHostConfigManagement1) GetDNSServers() (NewDNSServers string, err error) { // Request structure. request := interface{}(nil) @@ -684,18 +620,48 @@ func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error if genericClients, errors, err = goupnp.NewServiceClients(URN_Layer3Forwarding_1); err != nil { return } - clients = make([]*Layer3Forwarding1, len(genericClients)) - for i := range genericClients { - clients[i] = &Layer3Forwarding1{genericClients[i]} - } + clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewDefaultConnectionService: +// NewLayer3Forwarding1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_Layer3Forwarding_1) + if err != nil { + return nil, err + } + return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil +} + +// NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewLayer3Forwarding1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*Layer3Forwarding1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_Layer3Forwarding_1) + if err != nil { + return nil, err + } + return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil +} + +func newLayer3Forwarding1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*Layer3Forwarding1 { + clients := make([]*Layer3Forwarding1, len(genericClients)) + for i := range genericClients { + clients[i] = &Layer3Forwarding1{genericClients[i]} + } + return clients +} + func (client *Layer3Forwarding1) SetDefaultConnectionService(NewDefaultConnectionService string) (err error) { // Request structure. request := &struct { @@ -722,11 +688,6 @@ func (client *Layer3Forwarding1) SetDefaultConnectionService(NewDefaultConnectio return } -// -// -// Return values: -// -// * NewDefaultConnectionService: func (client *Layer3Forwarding1) GetDefaultConnectionService() (NewDefaultConnectionService string, err error) { // Request structure. request := interface{}(nil) @@ -771,15 +732,49 @@ func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []e if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCableLinkConfig_1); err != nil { return } - clients = make([]*WANCableLinkConfig1, len(genericClients)) + clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients) + return +} + +// NewWANCableLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCableLinkConfig_1) + if err != nil { + return nil, err + } + return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANCableLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANCableLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANCableLinkConfig_1) + if err != nil { + return nil, err + } + return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANCableLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANCableLinkConfig1 { + clients := make([]*WANCableLinkConfig1, len(genericClients)) for i := range genericClients { clients[i] = &WANCableLinkConfig1{genericClients[i]} } - return + return clients } // -// // Return values: // // * NewCableLinkConfigState: allowed values: notReady, dsSyncComplete, usParamAcquired, rangingComplete, ipComplete, todEstablished, paramTransferComplete, registrationComplete, operational, accessDenied @@ -816,11 +811,6 @@ func (client *WANCableLinkConfig1) GetCableLinkConfigInfo() (NewCableLinkConfigS return } -// -// -// Return values: -// -// * NewDownstreamFrequency: func (client *WANCableLinkConfig1) GetDownstreamFrequency() (NewDownstreamFrequency uint32, err error) { // Request structure. request := interface{}(nil) @@ -848,7 +838,6 @@ func (client *WANCableLinkConfig1) GetDownstreamFrequency() (NewDownstreamFreque } // -// // Return values: // // * NewDownstreamModulation: allowed values: 64QAM, 256QAM @@ -878,11 +867,6 @@ func (client *WANCableLinkConfig1) GetDownstreamModulation() (NewDownstreamModul return } -// -// -// Return values: -// -// * NewUpstreamFrequency: func (client *WANCableLinkConfig1) GetUpstreamFrequency() (NewUpstreamFrequency uint32, err error) { // Request structure. request := interface{}(nil) @@ -910,7 +894,6 @@ func (client *WANCableLinkConfig1) GetUpstreamFrequency() (NewUpstreamFrequency } // -// // Return values: // // * NewUpstreamModulation: allowed values: QPSK, 16QAM @@ -940,11 +923,6 @@ func (client *WANCableLinkConfig1) GetUpstreamModulation() (NewUpstreamModulatio return } -// -// -// Return values: -// -// * NewUpstreamChannelID: func (client *WANCableLinkConfig1) GetUpstreamChannelID() (NewUpstreamChannelID uint32, err error) { // Request structure. request := interface{}(nil) @@ -971,11 +949,6 @@ func (client *WANCableLinkConfig1) GetUpstreamChannelID() (NewUpstreamChannelID return } -// -// -// Return values: -// -// * NewUpstreamPowerLevel: func (client *WANCableLinkConfig1) GetUpstreamPowerLevel() (NewUpstreamPowerLevel uint32, err error) { // Request structure. request := interface{}(nil) @@ -1002,11 +975,6 @@ func (client *WANCableLinkConfig1) GetUpstreamPowerLevel() (NewUpstreamPowerLeve return } -// -// -// Return values: -// -// * NewBPIEncryptionEnabled: func (client *WANCableLinkConfig1) GetBPIEncryptionEnabled() (NewBPIEncryptionEnabled bool, err error) { // Request structure. request := interface{}(nil) @@ -1033,11 +1001,6 @@ func (client *WANCableLinkConfig1) GetBPIEncryptionEnabled() (NewBPIEncryptionEn return } -// -// -// Return values: -// -// * NewConfigFile: func (client *WANCableLinkConfig1) GetConfigFile() (NewConfigFile string, err error) { // Request structure. request := interface{}(nil) @@ -1064,11 +1027,6 @@ func (client *WANCableLinkConfig1) GetConfigFile() (NewConfigFile string, err er return } -// -// -// Return values: -// -// * NewTFTPServer: func (client *WANCableLinkConfig1) GetTFTPServer() (NewTFTPServer string, err error) { // Request structure. request := interface{}(nil) @@ -1113,18 +1071,48 @@ func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1 if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCommonInterfaceConfig_1); err != nil { return } - clients = make([]*WANCommonInterfaceConfig1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANCommonInterfaceConfig1{genericClients[i]} - } + clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewEnabledForInternet: +// NewWANCommonInterfaceConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCommonInterfaceConfig_1) + if err != nil { + return nil, err + } + return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANCommonInterfaceConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANCommonInterfaceConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANCommonInterfaceConfig_1) + if err != nil { + return nil, err + } + return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANCommonInterfaceConfig1 { + clients := make([]*WANCommonInterfaceConfig1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANCommonInterfaceConfig1{genericClients[i]} + } + return clients +} + func (client *WANCommonInterfaceConfig1) SetEnabledForInternet(NewEnabledForInternet bool) (err error) { // Request structure. request := &struct { @@ -1151,11 +1139,6 @@ func (client *WANCommonInterfaceConfig1) SetEnabledForInternet(NewEnabledForInte return } -// -// -// Return values: -// -// * NewEnabledForInternet: func (client *WANCommonInterfaceConfig1) GetEnabledForInternet() (NewEnabledForInternet bool, err error) { // Request structure. request := interface{}(nil) @@ -1183,15 +1166,10 @@ func (client *WANCommonInterfaceConfig1) GetEnabledForInternet() (NewEnabledForI } // -// // Return values: // // * NewWANAccessType: allowed values: DSL, POTS, Cable, Ethernet // -// * NewLayer1UpstreamMaxBitRate: -// -// * NewLayer1DownstreamMaxBitRate: -// // * NewPhysicalLinkStatus: allowed values: Up, Down func (client *WANCommonInterfaceConfig1) GetCommonLinkProperties() (NewWANAccessType string, NewLayer1UpstreamMaxBitRate uint32, NewLayer1DownstreamMaxBitRate uint32, NewPhysicalLinkStatus string, err error) { // Request structure. @@ -1234,11 +1212,6 @@ func (client *WANCommonInterfaceConfig1) GetCommonLinkProperties() (NewWANAccess return } -// -// -// Return values: -// -// * NewWANAccessProvider: func (client *WANCommonInterfaceConfig1) GetWANAccessProvider() (NewWANAccessProvider string, err error) { // Request structure. request := interface{}(nil) @@ -1266,7 +1239,6 @@ func (client *WANCommonInterfaceConfig1) GetWANAccessProvider() (NewWANAccessPro } // -// // Return values: // // * NewMaximumActiveConnections: allowed value range: minimum=1, step=1 @@ -1296,11 +1268,6 @@ func (client *WANCommonInterfaceConfig1) GetMaximumActiveConnections() (NewMaxim return } -// -// -// Return values: -// -// * NewTotalBytesSent: func (client *WANCommonInterfaceConfig1) GetTotalBytesSent() (NewTotalBytesSent uint32, err error) { // Request structure. request := interface{}(nil) @@ -1327,11 +1294,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalBytesSent() (NewTotalBytesSent return } -// -// -// Return values: -// -// * NewTotalBytesReceived: func (client *WANCommonInterfaceConfig1) GetTotalBytesReceived() (NewTotalBytesReceived uint32, err error) { // Request structure. request := interface{}(nil) @@ -1358,11 +1320,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalBytesReceived() (NewTotalBytesR return } -// -// -// Return values: -// -// * NewTotalPacketsSent: func (client *WANCommonInterfaceConfig1) GetTotalPacketsSent() (NewTotalPacketsSent uint32, err error) { // Request structure. request := interface{}(nil) @@ -1389,11 +1346,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalPacketsSent() (NewTotalPacketsS return } -// -// -// Return values: -// -// * NewTotalPacketsReceived: func (client *WANCommonInterfaceConfig1) GetTotalPacketsReceived() (NewTotalPacketsReceived uint32, err error) { // Request structure. request := interface{}(nil) @@ -1420,15 +1372,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalPacketsReceived() (NewTotalPack return } -// Arguments: -// -// * NewActiveConnectionIndex: -// -// Return values: -// -// * NewActiveConnDeviceContainer: -// -// * NewActiveConnectionServiceID: func (client *WANCommonInterfaceConfig1) GetActiveConnection(NewActiveConnectionIndex uint16) (NewActiveConnDeviceContainer string, NewActiveConnectionServiceID string, err error) { // Request structure. request := &struct { @@ -1483,18 +1426,48 @@ func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error if genericClients, errors, err = goupnp.NewServiceClients(URN_WANDSLLinkConfig_1); err != nil { return } - clients = make([]*WANDSLLinkConfig1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANDSLLinkConfig1{genericClients[i]} - } + clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewLinkType: +// NewWANDSLLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANDSLLinkConfig_1) + if err != nil { + return nil, err + } + return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANDSLLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANDSLLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANDSLLinkConfig_1) + if err != nil { + return nil, err + } + return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANDSLLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANDSLLinkConfig1 { + clients := make([]*WANDSLLinkConfig1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANDSLLinkConfig1{genericClients[i]} + } + return clients +} + func (client *WANDSLLinkConfig1) SetDSLLinkType(NewLinkType string) (err error) { // Request structure. request := &struct { @@ -1522,11 +1495,8 @@ func (client *WANDSLLinkConfig1) SetDSLLinkType(NewLinkType string) (err error) } // -// // Return values: // -// * NewLinkType: -// // * NewLinkStatus: allowed values: Up, Down func (client *WANDSLLinkConfig1) GetDSLLinkInfo() (NewLinkType string, NewLinkStatus string, err error) { // Request structure. @@ -1559,11 +1529,6 @@ func (client *WANDSLLinkConfig1) GetDSLLinkInfo() (NewLinkType string, NewLinkSt return } -// -// -// Return values: -// -// * NewAutoConfig: func (client *WANDSLLinkConfig1) GetAutoConfig() (NewAutoConfig bool, err error) { // Request structure. request := interface{}(nil) @@ -1590,11 +1555,6 @@ func (client *WANDSLLinkConfig1) GetAutoConfig() (NewAutoConfig bool, err error) return } -// -// -// Return values: -// -// * NewModulationType: func (client *WANDSLLinkConfig1) GetModulationType() (NewModulationType string, err error) { // Request structure. request := interface{}(nil) @@ -1621,11 +1581,6 @@ func (client *WANDSLLinkConfig1) GetModulationType() (NewModulationType string, return } -// Arguments: -// -// * NewDestinationAddress: -// -// func (client *WANDSLLinkConfig1) SetDestinationAddress(NewDestinationAddress string) (err error) { // Request structure. request := &struct { @@ -1652,11 +1607,6 @@ func (client *WANDSLLinkConfig1) SetDestinationAddress(NewDestinationAddress str return } -// -// -// Return values: -// -// * NewDestinationAddress: func (client *WANDSLLinkConfig1) GetDestinationAddress() (NewDestinationAddress string, err error) { // Request structure. request := interface{}(nil) @@ -1683,11 +1633,6 @@ func (client *WANDSLLinkConfig1) GetDestinationAddress() (NewDestinationAddress return } -// Arguments: -// -// * NewATMEncapsulation: -// -// func (client *WANDSLLinkConfig1) SetATMEncapsulation(NewATMEncapsulation string) (err error) { // Request structure. request := &struct { @@ -1714,11 +1659,6 @@ func (client *WANDSLLinkConfig1) SetATMEncapsulation(NewATMEncapsulation string) return } -// -// -// Return values: -// -// * NewATMEncapsulation: func (client *WANDSLLinkConfig1) GetATMEncapsulation() (NewATMEncapsulation string, err error) { // Request structure. request := interface{}(nil) @@ -1745,11 +1685,6 @@ func (client *WANDSLLinkConfig1) GetATMEncapsulation() (NewATMEncapsulation stri return } -// Arguments: -// -// * NewFCSPreserved: -// -// func (client *WANDSLLinkConfig1) SetFCSPreserved(NewFCSPreserved bool) (err error) { // Request structure. request := &struct { @@ -1776,11 +1711,6 @@ func (client *WANDSLLinkConfig1) SetFCSPreserved(NewFCSPreserved bool) (err erro return } -// -// -// Return values: -// -// * NewFCSPreserved: func (client *WANDSLLinkConfig1) GetFCSPreserved() (NewFCSPreserved bool, err error) { // Request structure. request := interface{}(nil) @@ -1825,15 +1755,49 @@ func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, erro if genericClients, errors, err = goupnp.NewServiceClients(URN_WANEthernetLinkConfig_1); err != nil { return } - clients = make([]*WANEthernetLinkConfig1, len(genericClients)) + clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients) + return +} + +// NewWANEthernetLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANEthernetLinkConfig_1) + if err != nil { + return nil, err + } + return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANEthernetLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANEthernetLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANEthernetLinkConfig_1) + if err != nil { + return nil, err + } + return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANEthernetLinkConfig1 { + clients := make([]*WANEthernetLinkConfig1, len(genericClients)) for i := range genericClients { clients[i] = &WANEthernetLinkConfig1{genericClients[i]} } - return + return clients } // -// // Return values: // // * NewEthernetLinkStatus: allowed values: Up, Down @@ -1881,18 +1845,48 @@ func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_1); err != nil { return } - clients = make([]*WANIPConnection1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANIPConnection1{genericClients[i]} - } + clients = newWANIPConnection1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewConnectionType: +// NewWANIPConnection1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_1) + if err != nil { + return nil, err + } + return newWANIPConnection1ClientsFromGenericClients(genericClients), nil +} + +// NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANIPConnection1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANIPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANIPConnection_1) + if err != nil { + return nil, err + } + return newWANIPConnection1ClientsFromGenericClients(genericClients), nil +} + +func newWANIPConnection1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANIPConnection1 { + clients := make([]*WANIPConnection1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANIPConnection1{genericClients[i]} + } + return clients +} + func (client *WANIPConnection1) SetConnectionType(NewConnectionType string) (err error) { // Request structure. request := &struct { @@ -1920,11 +1914,8 @@ func (client *WANIPConnection1) SetConnectionType(NewConnectionType string) (err } // -// // Return values: // -// * NewConnectionType: -// // * NewPossibleConnectionTypes: allowed values: Unconfigured, IP_Routed, IP_Bridged func (client *WANIPConnection1) GetConnectionTypeInfo() (NewConnectionType string, NewPossibleConnectionTypes string, err error) { // Request structure. @@ -1957,9 +1948,6 @@ func (client *WANIPConnection1) GetConnectionTypeInfo() (NewConnectionType strin return } -// -// -// func (client *WANIPConnection1) RequestConnection() (err error) { // Request structure. request := interface{}(nil) @@ -1981,9 +1969,6 @@ func (client *WANIPConnection1) RequestConnection() (err error) { return } -// -// -// func (client *WANIPConnection1) RequestTermination() (err error) { // Request structure. request := interface{}(nil) @@ -2005,9 +1990,6 @@ func (client *WANIPConnection1) RequestTermination() (err error) { return } -// -// -// func (client *WANIPConnection1) ForceTermination() (err error) { // Request structure. request := interface{}(nil) @@ -2029,11 +2011,6 @@ func (client *WANIPConnection1) ForceTermination() (err error) { return } -// Arguments: -// -// * NewAutoDisconnectTime: -// -// func (client *WANIPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -2060,11 +2037,6 @@ func (client *WANIPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uint return } -// Arguments: -// -// * NewIdleDisconnectTime: -// -// func (client *WANIPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -2091,11 +2063,6 @@ func (client *WANIPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uint return } -// Arguments: -// -// * NewWarnDisconnectDelay: -// -// func (client *WANIPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay uint32) (err error) { // Request structure. request := &struct { @@ -2123,14 +2090,11 @@ func (client *WANIPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay ui } // -// // Return values: // // * NewConnectionStatus: allowed values: Unconfigured, Connected, Disconnected // // * NewLastConnectionError: allowed values: ERROR_NONE -// -// * NewUptime: func (client *WANIPConnection1) GetStatusInfo() (NewConnectionStatus string, NewLastConnectionError string, NewUptime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2167,11 +2131,6 @@ func (client *WANIPConnection1) GetStatusInfo() (NewConnectionStatus string, New return } -// -// -// Return values: -// -// * NewAutoDisconnectTime: func (client *WANIPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2198,11 +2157,6 @@ func (client *WANIPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime u return } -// -// -// Return values: -// -// * NewIdleDisconnectTime: func (client *WANIPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2229,11 +2183,6 @@ func (client *WANIPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime u return } -// -// -// Return values: -// -// * NewWarnDisconnectDelay: func (client *WANIPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDelay uint32, err error) { // Request structure. request := interface{}(nil) @@ -2260,13 +2209,6 @@ func (client *WANIPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDelay return } -// -// -// Return values: -// -// * NewRSIPAvailable: -// -// * NewNATEnabled: func (client *WANIPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNATEnabled bool, err error) { // Request structure. request := interface{}(nil) @@ -2298,27 +2240,10 @@ func (client *WANIPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNA return } -// Arguments: -// -// * NewPortMappingIndex: // // Return values: // -// * NewRemoteHost: -// -// * NewExternalPort: -// // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: func (client *WANIPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex uint16) (NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -2385,25 +2310,11 @@ func (client *WANIPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex u return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// Return values: -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: + func (client *WANIPConnection1) GetSpecificPortMappingEntry(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -2465,25 +2376,11 @@ func (client *WANIPConnection1) GetSpecificPortMappingEntry(NewRemoteHost string return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: -// -// + func (client *WANIPConnection1) AddPortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32) (err error) { // Request structure. request := &struct { @@ -2545,15 +2442,11 @@ func (client *WANIPConnection1) AddPortMapping(NewRemoteHost string, NewExternal return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// + func (client *WANIPConnection1) DeletePortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (err error) { // Request structure. request := &struct { @@ -2590,11 +2483,6 @@ func (client *WANIPConnection1) DeletePortMapping(NewRemoteHost string, NewExter return } -// -// -// Return values: -// -// * NewExternalIPAddress: func (client *WANIPConnection1) GetExternalIPAddress() (NewExternalIPAddress string, err error) { // Request structure. request := interface{}(nil) @@ -2639,22 +2527,53 @@ func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []err if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPOTSLinkConfig_1); err != nil { return } - clients = make([]*WANPOTSLinkConfig1, len(genericClients)) + clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients) + return +} + +// NewWANPOTSLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPOTSLinkConfig_1) + if err != nil { + return nil, err + } + return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANPOTSLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANPOTSLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANPOTSLinkConfig_1) + if err != nil { + return nil, err + } + return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANPOTSLinkConfig1 { + clients := make([]*WANPOTSLinkConfig1, len(genericClients)) for i := range genericClients { clients[i] = &WANPOTSLinkConfig1{genericClients[i]} } - return + return clients } -// Arguments: // -// * NewISPPhoneNumber: -// -// * NewISPInfo: +// Arguments: // // * NewLinkType: allowed values: PPP_Dialup -// -// + func (client *WANPOTSLinkConfig1) SetISPInfo(NewISPPhoneNumber string, NewISPInfo string, NewLinkType string) (err error) { // Request structure. request := &struct { @@ -2691,13 +2610,6 @@ func (client *WANPOTSLinkConfig1) SetISPInfo(NewISPPhoneNumber string, NewISPInf return } -// Arguments: -// -// * NewNumberOfRetries: -// -// * NewDelayBetweenRetries: -// -// func (client *WANPOTSLinkConfig1) SetCallRetryInfo(NewNumberOfRetries uint32, NewDelayBetweenRetries uint32) (err error) { // Request structure. request := &struct { @@ -2730,13 +2642,8 @@ func (client *WANPOTSLinkConfig1) SetCallRetryInfo(NewNumberOfRetries uint32, Ne } // -// // Return values: // -// * NewISPPhoneNumber: -// -// * NewISPInfo: -// // * NewLinkType: allowed values: PPP_Dialup func (client *WANPOTSLinkConfig1) GetISPInfo() (NewISPPhoneNumber string, NewISPInfo string, NewLinkType string, err error) { // Request structure. @@ -2774,13 +2681,6 @@ func (client *WANPOTSLinkConfig1) GetISPInfo() (NewISPPhoneNumber string, NewISP return } -// -// -// Return values: -// -// * NewNumberOfRetries: -// -// * NewDelayBetweenRetries: func (client *WANPOTSLinkConfig1) GetCallRetryInfo() (NewNumberOfRetries uint32, NewDelayBetweenRetries uint32, err error) { // Request structure. request := interface{}(nil) @@ -2812,11 +2712,6 @@ func (client *WANPOTSLinkConfig1) GetCallRetryInfo() (NewNumberOfRetries uint32, return } -// -// -// Return values: -// -// * NewFclass: func (client *WANPOTSLinkConfig1) GetFclass() (NewFclass string, err error) { // Request structure. request := interface{}(nil) @@ -2843,11 +2738,6 @@ func (client *WANPOTSLinkConfig1) GetFclass() (NewFclass string, err error) { return } -// -// -// Return values: -// -// * NewDataModulationSupported: func (client *WANPOTSLinkConfig1) GetDataModulationSupported() (NewDataModulationSupported string, err error) { // Request structure. request := interface{}(nil) @@ -2874,11 +2764,6 @@ func (client *WANPOTSLinkConfig1) GetDataModulationSupported() (NewDataModulatio return } -// -// -// Return values: -// -// * NewDataProtocol: func (client *WANPOTSLinkConfig1) GetDataProtocol() (NewDataProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -2905,11 +2790,6 @@ func (client *WANPOTSLinkConfig1) GetDataProtocol() (NewDataProtocol string, err return } -// -// -// Return values: -// -// * NewDataCompression: func (client *WANPOTSLinkConfig1) GetDataCompression() (NewDataCompression string, err error) { // Request structure. request := interface{}(nil) @@ -2936,11 +2816,6 @@ func (client *WANPOTSLinkConfig1) GetDataCompression() (NewDataCompression strin return } -// -// -// Return values: -// -// * NewPlusVTRCommandSupported: func (client *WANPOTSLinkConfig1) GetPlusVTRCommandSupported() (NewPlusVTRCommandSupported bool, err error) { // Request structure. request := interface{}(nil) @@ -2985,18 +2860,48 @@ func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPPPConnection_1); err != nil { return } - clients = make([]*WANPPPConnection1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANPPPConnection1{genericClients[i]} - } + clients = newWANPPPConnection1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewConnectionType: +// NewWANPPPConnection1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPPPConnection_1) + if err != nil { + return nil, err + } + return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil +} + +// NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANPPPConnection1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANPPPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANPPPConnection_1) + if err != nil { + return nil, err + } + return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil +} + +func newWANPPPConnection1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANPPPConnection1 { + clients := make([]*WANPPPConnection1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANPPPConnection1{genericClients[i]} + } + return clients +} + func (client *WANPPPConnection1) SetConnectionType(NewConnectionType string) (err error) { // Request structure. request := &struct { @@ -3024,11 +2929,8 @@ func (client *WANPPPConnection1) SetConnectionType(NewConnectionType string) (er } // -// // Return values: // -// * NewConnectionType: -// // * NewPossibleConnectionTypes: allowed values: Unconfigured, IP_Routed, DHCP_Spoofed, PPPoE_Bridged, PPTP_Relay, L2TP_Relay, PPPoE_Relay func (client *WANPPPConnection1) GetConnectionTypeInfo() (NewConnectionType string, NewPossibleConnectionTypes string, err error) { // Request structure. @@ -3061,13 +2963,6 @@ func (client *WANPPPConnection1) GetConnectionTypeInfo() (NewConnectionType stri return } -// Arguments: -// -// * NewUserName: -// -// * NewPassword: -// -// func (client *WANPPPConnection1) ConfigureConnection(NewUserName string, NewPassword string) (err error) { // Request structure. request := &struct { @@ -3099,9 +2994,6 @@ func (client *WANPPPConnection1) ConfigureConnection(NewUserName string, NewPass return } -// -// -// func (client *WANPPPConnection1) RequestConnection() (err error) { // Request structure. request := interface{}(nil) @@ -3123,9 +3015,6 @@ func (client *WANPPPConnection1) RequestConnection() (err error) { return } -// -// -// func (client *WANPPPConnection1) RequestTermination() (err error) { // Request structure. request := interface{}(nil) @@ -3147,9 +3036,6 @@ func (client *WANPPPConnection1) RequestTermination() (err error) { return } -// -// -// func (client *WANPPPConnection1) ForceTermination() (err error) { // Request structure. request := interface{}(nil) @@ -3171,11 +3057,6 @@ func (client *WANPPPConnection1) ForceTermination() (err error) { return } -// Arguments: -// -// * NewAutoDisconnectTime: -// -// func (client *WANPPPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -3202,11 +3083,6 @@ func (client *WANPPPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uin return } -// Arguments: -// -// * NewIdleDisconnectTime: -// -// func (client *WANPPPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -3233,11 +3109,6 @@ func (client *WANPPPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uin return } -// Arguments: -// -// * NewWarnDisconnectDelay: -// -// func (client *WANPPPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay uint32) (err error) { // Request structure. request := &struct { @@ -3265,14 +3136,11 @@ func (client *WANPPPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay u } // -// // Return values: // // * NewConnectionStatus: allowed values: Unconfigured, Connected, Disconnected // // * NewLastConnectionError: allowed values: ERROR_NONE -// -// * NewUptime: func (client *WANPPPConnection1) GetStatusInfo() (NewConnectionStatus string, NewLastConnectionError string, NewUptime uint32, err error) { // Request structure. request := interface{}(nil) @@ -3309,13 +3177,6 @@ func (client *WANPPPConnection1) GetStatusInfo() (NewConnectionStatus string, Ne return } -// -// -// Return values: -// -// * NewUpstreamMaxBitRate: -// -// * NewDownstreamMaxBitRate: func (client *WANPPPConnection1) GetLinkLayerMaxBitRates() (NewUpstreamMaxBitRate uint32, NewDownstreamMaxBitRate uint32, err error) { // Request structure. request := interface{}(nil) @@ -3347,11 +3208,6 @@ func (client *WANPPPConnection1) GetLinkLayerMaxBitRates() (NewUpstreamMaxBitRat return } -// -// -// Return values: -// -// * NewPPPEncryptionProtocol: func (client *WANPPPConnection1) GetPPPEncryptionProtocol() (NewPPPEncryptionProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -3378,11 +3234,6 @@ func (client *WANPPPConnection1) GetPPPEncryptionProtocol() (NewPPPEncryptionPro return } -// -// -// Return values: -// -// * NewPPPCompressionProtocol: func (client *WANPPPConnection1) GetPPPCompressionProtocol() (NewPPPCompressionProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -3409,11 +3260,6 @@ func (client *WANPPPConnection1) GetPPPCompressionProtocol() (NewPPPCompressionP return } -// -// -// Return values: -// -// * NewPPPAuthenticationProtocol: func (client *WANPPPConnection1) GetPPPAuthenticationProtocol() (NewPPPAuthenticationProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -3440,11 +3286,6 @@ func (client *WANPPPConnection1) GetPPPAuthenticationProtocol() (NewPPPAuthentic return } -// -// -// Return values: -// -// * NewUserName: func (client *WANPPPConnection1) GetUserName() (NewUserName string, err error) { // Request structure. request := interface{}(nil) @@ -3471,11 +3312,6 @@ func (client *WANPPPConnection1) GetUserName() (NewUserName string, err error) { return } -// -// -// Return values: -// -// * NewPassword: func (client *WANPPPConnection1) GetPassword() (NewPassword string, err error) { // Request structure. request := interface{}(nil) @@ -3502,11 +3338,6 @@ func (client *WANPPPConnection1) GetPassword() (NewPassword string, err error) { return } -// -// -// Return values: -// -// * NewAutoDisconnectTime: func (client *WANPPPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -3533,11 +3364,6 @@ func (client *WANPPPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime return } -// -// -// Return values: -// -// * NewIdleDisconnectTime: func (client *WANPPPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -3564,11 +3390,6 @@ func (client *WANPPPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime return } -// -// -// Return values: -// -// * NewWarnDisconnectDelay: func (client *WANPPPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDelay uint32, err error) { // Request structure. request := interface{}(nil) @@ -3595,13 +3416,6 @@ func (client *WANPPPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDela return } -// -// -// Return values: -// -// * NewRSIPAvailable: -// -// * NewNATEnabled: func (client *WANPPPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNATEnabled bool, err error) { // Request structure. request := interface{}(nil) @@ -3633,27 +3447,10 @@ func (client *WANPPPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewN return } -// Arguments: -// -// * NewPortMappingIndex: // // Return values: // -// * NewRemoteHost: -// -// * NewExternalPort: -// // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: func (client *WANPPPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex uint16) (NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -3720,25 +3517,11 @@ func (client *WANPPPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// Return values: -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: + func (client *WANPPPConnection1) GetSpecificPortMappingEntry(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -3800,25 +3583,11 @@ func (client *WANPPPConnection1) GetSpecificPortMappingEntry(NewRemoteHost strin return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: -// -// + func (client *WANPPPConnection1) AddPortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32) (err error) { // Request structure. request := &struct { @@ -3880,15 +3649,11 @@ func (client *WANPPPConnection1) AddPortMapping(NewRemoteHost string, NewExterna return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// + func (client *WANPPPConnection1) DeletePortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (err error) { // Request structure. request := &struct { @@ -3925,11 +3690,6 @@ func (client *WANPPPConnection1) DeletePortMapping(NewRemoteHost string, NewExte return } -// -// -// Return values: -// -// * NewExternalIPAddress: func (client *WANPPPConnection1) GetExternalIPAddress() (NewExternalIPAddress string, err error) { // Request structure. request := interface{}(nil) diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go b/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go index a5892288e..2d67a4a2e 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/dcps/internetgateway2/internetgateway2.go @@ -2,13 +2,13 @@ // // 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. +// Typically, use one of the New* functions to create clients for services. package internetgateway2 // Generated file - do not edit by hand. See README.md import ( + "net/url" "time" "github.com/huin/goupnp" @@ -29,6 +29,7 @@ const ( // Service URNs: const ( + URN_DeviceProtection_1 = "urn:schemas-upnp-org:service:DeviceProtection:1" URN_LANHostConfigManagement_1 = "urn:schemas-upnp-org:service:LANHostConfigManagement:1" URN_Layer3Forwarding_1 = "urn:schemas-upnp-org:service:Layer3Forwarding:1" URN_WANCableLinkConfig_1 = "urn:schemas-upnp-org:service:WANCableLinkConfig:1" @@ -42,6 +43,484 @@ const ( URN_WANPPPConnection_1 = "urn:schemas-upnp-org:service:WANPPPConnection:1" ) +// DeviceProtection1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:DeviceProtection:1". See +// goupnp.ServiceClient, which contains RootDevice and Service attributes which +// are provided for informational value. +type DeviceProtection1 struct { + goupnp.ServiceClient +} + +// NewDeviceProtection1Clients discovers instances of the service on the network, +// and returns clients to any that are found. errors will contain an error for +// any devices that replied but which could not be queried, and err will be set +// if the discovery process failed outright. +// +// This is a typical entry calling point into this package. +func NewDeviceProtection1Clients() (clients []*DeviceProtection1, errors []error, err error) { + var genericClients []goupnp.ServiceClient + if genericClients, errors, err = goupnp.NewServiceClients(URN_DeviceProtection_1); err != nil { + return + } + clients = newDeviceProtection1ClientsFromGenericClients(genericClients) + return +} + +// NewDeviceProtection1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewDeviceProtection1ClientsByURL(loc *url.URL) ([]*DeviceProtection1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_DeviceProtection_1) + if err != nil { + return nil, err + } + return newDeviceProtection1ClientsFromGenericClients(genericClients), nil +} + +// NewDeviceProtection1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewDeviceProtection1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*DeviceProtection1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_DeviceProtection_1) + if err != nil { + return nil, err + } + return newDeviceProtection1ClientsFromGenericClients(genericClients), nil +} + +func newDeviceProtection1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*DeviceProtection1 { + clients := make([]*DeviceProtection1, len(genericClients)) + for i := range genericClients { + clients[i] = &DeviceProtection1{genericClients[i]} + } + return clients +} + +func (client *DeviceProtection1) SendSetupMessage(ProtocolType string, InMessage []byte) (OutMessage []byte, err error) { + // Request structure. + request := &struct { + ProtocolType string + + InMessage string + }{} + // BEGIN Marshal arguments into request. + + if request.ProtocolType, err = soap.MarshalString(ProtocolType); err != nil { + return + } + if request.InMessage, err = soap.MarshalBinBase64(InMessage); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + OutMessage string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "SendSetupMessage", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if OutMessage, err = soap.UnmarshalBinBase64(response.OutMessage); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) GetSupportedProtocols() (ProtocolList string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ProtocolList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "GetSupportedProtocols", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ProtocolList, err = soap.UnmarshalString(response.ProtocolList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) GetAssignedRoles() (RoleList string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RoleList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "GetAssignedRoles", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RoleList, err = soap.UnmarshalString(response.RoleList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) GetRolesForAction(DeviceUDN string, ServiceId string, ActionName string) (RoleList string, RestrictedRoleList string, err error) { + // Request structure. + request := &struct { + DeviceUDN string + + ServiceId string + + ActionName string + }{} + // BEGIN Marshal arguments into request. + + if request.DeviceUDN, err = soap.MarshalString(DeviceUDN); err != nil { + return + } + if request.ServiceId, err = soap.MarshalString(ServiceId); err != nil { + return + } + if request.ActionName, err = soap.MarshalString(ActionName); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + RoleList string + + RestrictedRoleList string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "GetRolesForAction", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if RoleList, err = soap.UnmarshalString(response.RoleList); err != nil { + return + } + if RestrictedRoleList, err = soap.UnmarshalString(response.RestrictedRoleList); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) GetUserLoginChallenge(ProtocolType string, Name string) (Salt []byte, Challenge []byte, err error) { + // Request structure. + request := &struct { + ProtocolType string + + Name string + }{} + // BEGIN Marshal arguments into request. + + if request.ProtocolType, err = soap.MarshalString(ProtocolType); err != nil { + return + } + if request.Name, err = soap.MarshalString(Name); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + Salt string + + Challenge string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "GetUserLoginChallenge", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if Salt, err = soap.UnmarshalBinBase64(response.Salt); err != nil { + return + } + if Challenge, err = soap.UnmarshalBinBase64(response.Challenge); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) UserLogin(ProtocolType string, Challenge []byte, Authenticator []byte) (err error) { + // Request structure. + request := &struct { + ProtocolType string + + Challenge string + + Authenticator string + }{} + // BEGIN Marshal arguments into request. + + if request.ProtocolType, err = soap.MarshalString(ProtocolType); err != nil { + return + } + if request.Challenge, err = soap.MarshalBinBase64(Challenge); err != nil { + return + } + if request.Authenticator, err = soap.MarshalBinBase64(Authenticator); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "UserLogin", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) UserLogout() (err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "UserLogout", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) GetACLData() (ACL string, err error) { + // Request structure. + request := interface{}(nil) + // BEGIN Marshal arguments into request. + + // END Marshal arguments into request. + + // Response structure. + response := &struct { + ACL string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "GetACLData", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if ACL, err = soap.UnmarshalString(response.ACL); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) AddIdentityList(IdentityList string) (IdentityListResult string, err error) { + // Request structure. + request := &struct { + IdentityList string + }{} + // BEGIN Marshal arguments into request. + + if request.IdentityList, err = soap.MarshalString(IdentityList); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := &struct { + IdentityListResult string + }{} + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "AddIdentityList", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + if IdentityListResult, err = soap.UnmarshalString(response.IdentityListResult); err != nil { + return + } + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) RemoveIdentity(Identity string) (err error) { + // Request structure. + request := &struct { + Identity string + }{} + // BEGIN Marshal arguments into request. + + if request.Identity, err = soap.MarshalString(Identity); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "RemoveIdentity", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) SetUserLoginPassword(ProtocolType string, Name string, Stored []byte, Salt []byte) (err error) { + // Request structure. + request := &struct { + ProtocolType string + + Name string + + Stored string + + Salt string + }{} + // BEGIN Marshal arguments into request. + + if request.ProtocolType, err = soap.MarshalString(ProtocolType); err != nil { + return + } + if request.Name, err = soap.MarshalString(Name); err != nil { + return + } + if request.Stored, err = soap.MarshalBinBase64(Stored); err != nil { + return + } + if request.Salt, err = soap.MarshalBinBase64(Salt); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "SetUserLoginPassword", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) AddRolesForIdentity(Identity string, RoleList string) (err error) { + // Request structure. + request := &struct { + Identity string + + RoleList string + }{} + // BEGIN Marshal arguments into request. + + if request.Identity, err = soap.MarshalString(Identity); err != nil { + return + } + if request.RoleList, err = soap.MarshalString(RoleList); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "AddRolesForIdentity", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + +func (client *DeviceProtection1) RemoveRolesForIdentity(Identity string, RoleList string) (err error) { + // Request structure. + request := &struct { + Identity string + + RoleList string + }{} + // BEGIN Marshal arguments into request. + + if request.Identity, err = soap.MarshalString(Identity); err != nil { + return + } + if request.RoleList, err = soap.MarshalString(RoleList); err != nil { + return + } + // END Marshal arguments into request. + + // Response structure. + response := interface{}(nil) + + // Perform the SOAP call. + if err = client.SOAPClient.PerformAction(URN_DeviceProtection_1, "RemoveRolesForIdentity", request, response); err != nil { + return + } + + // BEGIN Unmarshal arguments from response. + + // END Unmarshal arguments from response. + return +} + // LANHostConfigManagement1 is a client for UPnP SOAP service with URN "urn:schemas-upnp-org:service:LANHostConfigManagement:1". See // goupnp.ServiceClient, which contains RootDevice and Service attributes which // are provided for informational value. @@ -60,18 +539,48 @@ func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, if genericClients, errors, err = goupnp.NewServiceClients(URN_LANHostConfigManagement_1); err != nil { return } - clients = make([]*LANHostConfigManagement1, len(genericClients)) - for i := range genericClients { - clients[i] = &LANHostConfigManagement1{genericClients[i]} - } + clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewDHCPServerConfigurable: +// NewLANHostConfigManagement1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_LANHostConfigManagement_1) + if err != nil { + return nil, err + } + return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil +} + +// NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewLANHostConfigManagement1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*LANHostConfigManagement1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_LANHostConfigManagement_1) + if err != nil { + return nil, err + } + return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil +} + +func newLANHostConfigManagement1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*LANHostConfigManagement1 { + clients := make([]*LANHostConfigManagement1, len(genericClients)) + for i := range genericClients { + clients[i] = &LANHostConfigManagement1{genericClients[i]} + } + return clients +} + func (client *LANHostConfigManagement1) SetDHCPServerConfigurable(NewDHCPServerConfigurable bool) (err error) { // Request structure. request := &struct { @@ -98,11 +607,6 @@ func (client *LANHostConfigManagement1) SetDHCPServerConfigurable(NewDHCPServerC return } -// -// -// Return values: -// -// * NewDHCPServerConfigurable: func (client *LANHostConfigManagement1) GetDHCPServerConfigurable() (NewDHCPServerConfigurable bool, err error) { // Request structure. request := interface{}(nil) @@ -129,11 +633,6 @@ func (client *LANHostConfigManagement1) GetDHCPServerConfigurable() (NewDHCPServ return } -// Arguments: -// -// * NewDHCPRelay: -// -// func (client *LANHostConfigManagement1) SetDHCPRelay(NewDHCPRelay bool) (err error) { // Request structure. request := &struct { @@ -160,11 +659,6 @@ func (client *LANHostConfigManagement1) SetDHCPRelay(NewDHCPRelay bool) (err err return } -// -// -// Return values: -// -// * NewDHCPRelay: func (client *LANHostConfigManagement1) GetDHCPRelay() (NewDHCPRelay bool, err error) { // Request structure. request := interface{}(nil) @@ -191,11 +685,6 @@ func (client *LANHostConfigManagement1) GetDHCPRelay() (NewDHCPRelay bool, err e return } -// Arguments: -// -// * NewSubnetMask: -// -// func (client *LANHostConfigManagement1) SetSubnetMask(NewSubnetMask string) (err error) { // Request structure. request := &struct { @@ -222,11 +711,6 @@ func (client *LANHostConfigManagement1) SetSubnetMask(NewSubnetMask string) (err return } -// -// -// Return values: -// -// * NewSubnetMask: func (client *LANHostConfigManagement1) GetSubnetMask() (NewSubnetMask string, err error) { // Request structure. request := interface{}(nil) @@ -253,11 +737,6 @@ func (client *LANHostConfigManagement1) GetSubnetMask() (NewSubnetMask string, e return } -// Arguments: -// -// * NewIPRouters: -// -// func (client *LANHostConfigManagement1) SetIPRouter(NewIPRouters string) (err error) { // Request structure. request := &struct { @@ -284,11 +763,6 @@ func (client *LANHostConfigManagement1) SetIPRouter(NewIPRouters string) (err er return } -// Arguments: -// -// * NewIPRouters: -// -// func (client *LANHostConfigManagement1) DeleteIPRouter(NewIPRouters string) (err error) { // Request structure. request := &struct { @@ -315,11 +789,6 @@ func (client *LANHostConfigManagement1) DeleteIPRouter(NewIPRouters string) (err return } -// -// -// Return values: -// -// * NewIPRouters: func (client *LANHostConfigManagement1) GetIPRoutersList() (NewIPRouters string, err error) { // Request structure. request := interface{}(nil) @@ -346,11 +815,6 @@ func (client *LANHostConfigManagement1) GetIPRoutersList() (NewIPRouters string, return } -// Arguments: -// -// * NewDomainName: -// -// func (client *LANHostConfigManagement1) SetDomainName(NewDomainName string) (err error) { // Request structure. request := &struct { @@ -377,11 +841,6 @@ func (client *LANHostConfigManagement1) SetDomainName(NewDomainName string) (err return } -// -// -// Return values: -// -// * NewDomainName: func (client *LANHostConfigManagement1) GetDomainName() (NewDomainName string, err error) { // Request structure. request := interface{}(nil) @@ -408,13 +867,6 @@ func (client *LANHostConfigManagement1) GetDomainName() (NewDomainName string, e return } -// Arguments: -// -// * NewMinAddress: -// -// * NewMaxAddress: -// -// func (client *LANHostConfigManagement1) SetAddressRange(NewMinAddress string, NewMaxAddress string) (err error) { // Request structure. request := &struct { @@ -446,13 +898,6 @@ func (client *LANHostConfigManagement1) SetAddressRange(NewMinAddress string, Ne return } -// -// -// Return values: -// -// * NewMinAddress: -// -// * NewMaxAddress: func (client *LANHostConfigManagement1) GetAddressRange() (NewMinAddress string, NewMaxAddress string, err error) { // Request structure. request := interface{}(nil) @@ -484,11 +929,6 @@ func (client *LANHostConfigManagement1) GetAddressRange() (NewMinAddress string, return } -// Arguments: -// -// * NewReservedAddresses: -// -// func (client *LANHostConfigManagement1) SetReservedAddress(NewReservedAddresses string) (err error) { // Request structure. request := &struct { @@ -515,11 +955,6 @@ func (client *LANHostConfigManagement1) SetReservedAddress(NewReservedAddresses return } -// Arguments: -// -// * NewReservedAddresses: -// -// func (client *LANHostConfigManagement1) DeleteReservedAddress(NewReservedAddresses string) (err error) { // Request structure. request := &struct { @@ -546,11 +981,6 @@ func (client *LANHostConfigManagement1) DeleteReservedAddress(NewReservedAddress return } -// -// -// Return values: -// -// * NewReservedAddresses: func (client *LANHostConfigManagement1) GetReservedAddresses() (NewReservedAddresses string, err error) { // Request structure. request := interface{}(nil) @@ -577,11 +1007,6 @@ func (client *LANHostConfigManagement1) GetReservedAddresses() (NewReservedAddre return } -// Arguments: -// -// * NewDNSServers: -// -// func (client *LANHostConfigManagement1) SetDNSServer(NewDNSServers string) (err error) { // Request structure. request := &struct { @@ -608,11 +1033,6 @@ func (client *LANHostConfigManagement1) SetDNSServer(NewDNSServers string) (err return } -// Arguments: -// -// * NewDNSServers: -// -// func (client *LANHostConfigManagement1) DeleteDNSServer(NewDNSServers string) (err error) { // Request structure. request := &struct { @@ -639,11 +1059,6 @@ func (client *LANHostConfigManagement1) DeleteDNSServer(NewDNSServers string) (e return } -// -// -// Return values: -// -// * NewDNSServers: func (client *LANHostConfigManagement1) GetDNSServers() (NewDNSServers string, err error) { // Request structure. request := interface{}(nil) @@ -688,18 +1103,48 @@ func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error if genericClients, errors, err = goupnp.NewServiceClients(URN_Layer3Forwarding_1); err != nil { return } - clients = make([]*Layer3Forwarding1, len(genericClients)) - for i := range genericClients { - clients[i] = &Layer3Forwarding1{genericClients[i]} - } + clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewDefaultConnectionService: +// NewLayer3Forwarding1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_Layer3Forwarding_1) + if err != nil { + return nil, err + } + return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil +} + +// NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewLayer3Forwarding1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*Layer3Forwarding1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_Layer3Forwarding_1) + if err != nil { + return nil, err + } + return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil +} + +func newLayer3Forwarding1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*Layer3Forwarding1 { + clients := make([]*Layer3Forwarding1, len(genericClients)) + for i := range genericClients { + clients[i] = &Layer3Forwarding1{genericClients[i]} + } + return clients +} + func (client *Layer3Forwarding1) SetDefaultConnectionService(NewDefaultConnectionService string) (err error) { // Request structure. request := &struct { @@ -726,11 +1171,6 @@ func (client *Layer3Forwarding1) SetDefaultConnectionService(NewDefaultConnectio return } -// -// -// Return values: -// -// * NewDefaultConnectionService: func (client *Layer3Forwarding1) GetDefaultConnectionService() (NewDefaultConnectionService string, err error) { // Request structure. request := interface{}(nil) @@ -775,15 +1215,49 @@ func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []e if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCableLinkConfig_1); err != nil { return } - clients = make([]*WANCableLinkConfig1, len(genericClients)) + clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients) + return +} + +// NewWANCableLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCableLinkConfig_1) + if err != nil { + return nil, err + } + return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANCableLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANCableLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANCableLinkConfig_1) + if err != nil { + return nil, err + } + return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANCableLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANCableLinkConfig1 { + clients := make([]*WANCableLinkConfig1, len(genericClients)) for i := range genericClients { clients[i] = &WANCableLinkConfig1{genericClients[i]} } - return + return clients } // -// // Return values: // // * NewCableLinkConfigState: allowed values: notReady, dsSyncComplete, usParamAcquired, rangingComplete, ipComplete, todEstablished, paramTransferComplete, registrationComplete, operational, accessDenied @@ -820,11 +1294,6 @@ func (client *WANCableLinkConfig1) GetCableLinkConfigInfo() (NewCableLinkConfigS return } -// -// -// Return values: -// -// * NewDownstreamFrequency: func (client *WANCableLinkConfig1) GetDownstreamFrequency() (NewDownstreamFrequency uint32, err error) { // Request structure. request := interface{}(nil) @@ -852,7 +1321,6 @@ func (client *WANCableLinkConfig1) GetDownstreamFrequency() (NewDownstreamFreque } // -// // Return values: // // * NewDownstreamModulation: allowed values: 64QAM, 256QAM @@ -882,11 +1350,6 @@ func (client *WANCableLinkConfig1) GetDownstreamModulation() (NewDownstreamModul return } -// -// -// Return values: -// -// * NewUpstreamFrequency: func (client *WANCableLinkConfig1) GetUpstreamFrequency() (NewUpstreamFrequency uint32, err error) { // Request structure. request := interface{}(nil) @@ -914,7 +1377,6 @@ func (client *WANCableLinkConfig1) GetUpstreamFrequency() (NewUpstreamFrequency } // -// // Return values: // // * NewUpstreamModulation: allowed values: QPSK, 16QAM @@ -944,11 +1406,6 @@ func (client *WANCableLinkConfig1) GetUpstreamModulation() (NewUpstreamModulatio return } -// -// -// Return values: -// -// * NewUpstreamChannelID: func (client *WANCableLinkConfig1) GetUpstreamChannelID() (NewUpstreamChannelID uint32, err error) { // Request structure. request := interface{}(nil) @@ -975,11 +1432,6 @@ func (client *WANCableLinkConfig1) GetUpstreamChannelID() (NewUpstreamChannelID return } -// -// -// Return values: -// -// * NewUpstreamPowerLevel: func (client *WANCableLinkConfig1) GetUpstreamPowerLevel() (NewUpstreamPowerLevel uint32, err error) { // Request structure. request := interface{}(nil) @@ -1006,11 +1458,6 @@ func (client *WANCableLinkConfig1) GetUpstreamPowerLevel() (NewUpstreamPowerLeve return } -// -// -// Return values: -// -// * NewBPIEncryptionEnabled: func (client *WANCableLinkConfig1) GetBPIEncryptionEnabled() (NewBPIEncryptionEnabled bool, err error) { // Request structure. request := interface{}(nil) @@ -1037,11 +1484,6 @@ func (client *WANCableLinkConfig1) GetBPIEncryptionEnabled() (NewBPIEncryptionEn return } -// -// -// Return values: -// -// * NewConfigFile: func (client *WANCableLinkConfig1) GetConfigFile() (NewConfigFile string, err error) { // Request structure. request := interface{}(nil) @@ -1068,11 +1510,6 @@ func (client *WANCableLinkConfig1) GetConfigFile() (NewConfigFile string, err er return } -// -// -// Return values: -// -// * NewTFTPServer: func (client *WANCableLinkConfig1) GetTFTPServer() (NewTFTPServer string, err error) { // Request structure. request := interface{}(nil) @@ -1117,18 +1554,48 @@ func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1 if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCommonInterfaceConfig_1); err != nil { return } - clients = make([]*WANCommonInterfaceConfig1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANCommonInterfaceConfig1{genericClients[i]} - } + clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewEnabledForInternet: +// NewWANCommonInterfaceConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCommonInterfaceConfig_1) + if err != nil { + return nil, err + } + return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANCommonInterfaceConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANCommonInterfaceConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANCommonInterfaceConfig_1) + if err != nil { + return nil, err + } + return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANCommonInterfaceConfig1 { + clients := make([]*WANCommonInterfaceConfig1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANCommonInterfaceConfig1{genericClients[i]} + } + return clients +} + func (client *WANCommonInterfaceConfig1) SetEnabledForInternet(NewEnabledForInternet bool) (err error) { // Request structure. request := &struct { @@ -1155,11 +1622,6 @@ func (client *WANCommonInterfaceConfig1) SetEnabledForInternet(NewEnabledForInte return } -// -// -// Return values: -// -// * NewEnabledForInternet: func (client *WANCommonInterfaceConfig1) GetEnabledForInternet() (NewEnabledForInternet bool, err error) { // Request structure. request := interface{}(nil) @@ -1187,15 +1649,10 @@ func (client *WANCommonInterfaceConfig1) GetEnabledForInternet() (NewEnabledForI } // -// // Return values: // // * NewWANAccessType: allowed values: DSL, POTS, Cable, Ethernet // -// * NewLayer1UpstreamMaxBitRate: -// -// * NewLayer1DownstreamMaxBitRate: -// // * NewPhysicalLinkStatus: allowed values: Up, Down func (client *WANCommonInterfaceConfig1) GetCommonLinkProperties() (NewWANAccessType string, NewLayer1UpstreamMaxBitRate uint32, NewLayer1DownstreamMaxBitRate uint32, NewPhysicalLinkStatus string, err error) { // Request structure. @@ -1238,11 +1695,6 @@ func (client *WANCommonInterfaceConfig1) GetCommonLinkProperties() (NewWANAccess return } -// -// -// Return values: -// -// * NewWANAccessProvider: func (client *WANCommonInterfaceConfig1) GetWANAccessProvider() (NewWANAccessProvider string, err error) { // Request structure. request := interface{}(nil) @@ -1270,7 +1722,6 @@ func (client *WANCommonInterfaceConfig1) GetWANAccessProvider() (NewWANAccessPro } // -// // Return values: // // * NewMaximumActiveConnections: allowed value range: minimum=1, step=1 @@ -1300,11 +1751,6 @@ func (client *WANCommonInterfaceConfig1) GetMaximumActiveConnections() (NewMaxim return } -// -// -// Return values: -// -// * NewTotalBytesSent: func (client *WANCommonInterfaceConfig1) GetTotalBytesSent() (NewTotalBytesSent uint32, err error) { // Request structure. request := interface{}(nil) @@ -1331,11 +1777,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalBytesSent() (NewTotalBytesSent return } -// -// -// Return values: -// -// * NewTotalBytesReceived: func (client *WANCommonInterfaceConfig1) GetTotalBytesReceived() (NewTotalBytesReceived uint32, err error) { // Request structure. request := interface{}(nil) @@ -1362,11 +1803,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalBytesReceived() (NewTotalBytesR return } -// -// -// Return values: -// -// * NewTotalPacketsSent: func (client *WANCommonInterfaceConfig1) GetTotalPacketsSent() (NewTotalPacketsSent uint32, err error) { // Request structure. request := interface{}(nil) @@ -1393,11 +1829,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalPacketsSent() (NewTotalPacketsS return } -// -// -// Return values: -// -// * NewTotalPacketsReceived: func (client *WANCommonInterfaceConfig1) GetTotalPacketsReceived() (NewTotalPacketsReceived uint32, err error) { // Request structure. request := interface{}(nil) @@ -1424,15 +1855,6 @@ func (client *WANCommonInterfaceConfig1) GetTotalPacketsReceived() (NewTotalPack return } -// Arguments: -// -// * NewActiveConnectionIndex: -// -// Return values: -// -// * NewActiveConnDeviceContainer: -// -// * NewActiveConnectionServiceID: func (client *WANCommonInterfaceConfig1) GetActiveConnection(NewActiveConnectionIndex uint16) (NewActiveConnDeviceContainer string, NewActiveConnectionServiceID string, err error) { // Request structure. request := &struct { @@ -1487,18 +1909,48 @@ func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error if genericClients, errors, err = goupnp.NewServiceClients(URN_WANDSLLinkConfig_1); err != nil { return } - clients = make([]*WANDSLLinkConfig1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANDSLLinkConfig1{genericClients[i]} - } + clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewLinkType: +// NewWANDSLLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANDSLLinkConfig_1) + if err != nil { + return nil, err + } + return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANDSLLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANDSLLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANDSLLinkConfig_1) + if err != nil { + return nil, err + } + return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANDSLLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANDSLLinkConfig1 { + clients := make([]*WANDSLLinkConfig1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANDSLLinkConfig1{genericClients[i]} + } + return clients +} + func (client *WANDSLLinkConfig1) SetDSLLinkType(NewLinkType string) (err error) { // Request structure. request := &struct { @@ -1526,11 +1978,8 @@ func (client *WANDSLLinkConfig1) SetDSLLinkType(NewLinkType string) (err error) } // -// // Return values: // -// * NewLinkType: -// // * NewLinkStatus: allowed values: Up, Down func (client *WANDSLLinkConfig1) GetDSLLinkInfo() (NewLinkType string, NewLinkStatus string, err error) { // Request structure. @@ -1563,11 +2012,6 @@ func (client *WANDSLLinkConfig1) GetDSLLinkInfo() (NewLinkType string, NewLinkSt return } -// -// -// Return values: -// -// * NewAutoConfig: func (client *WANDSLLinkConfig1) GetAutoConfig() (NewAutoConfig bool, err error) { // Request structure. request := interface{}(nil) @@ -1594,11 +2038,6 @@ func (client *WANDSLLinkConfig1) GetAutoConfig() (NewAutoConfig bool, err error) return } -// -// -// Return values: -// -// * NewModulationType: func (client *WANDSLLinkConfig1) GetModulationType() (NewModulationType string, err error) { // Request structure. request := interface{}(nil) @@ -1625,11 +2064,6 @@ func (client *WANDSLLinkConfig1) GetModulationType() (NewModulationType string, return } -// Arguments: -// -// * NewDestinationAddress: -// -// func (client *WANDSLLinkConfig1) SetDestinationAddress(NewDestinationAddress string) (err error) { // Request structure. request := &struct { @@ -1656,11 +2090,6 @@ func (client *WANDSLLinkConfig1) SetDestinationAddress(NewDestinationAddress str return } -// -// -// Return values: -// -// * NewDestinationAddress: func (client *WANDSLLinkConfig1) GetDestinationAddress() (NewDestinationAddress string, err error) { // Request structure. request := interface{}(nil) @@ -1687,11 +2116,6 @@ func (client *WANDSLLinkConfig1) GetDestinationAddress() (NewDestinationAddress return } -// Arguments: -// -// * NewATMEncapsulation: -// -// func (client *WANDSLLinkConfig1) SetATMEncapsulation(NewATMEncapsulation string) (err error) { // Request structure. request := &struct { @@ -1718,11 +2142,6 @@ func (client *WANDSLLinkConfig1) SetATMEncapsulation(NewATMEncapsulation string) return } -// -// -// Return values: -// -// * NewATMEncapsulation: func (client *WANDSLLinkConfig1) GetATMEncapsulation() (NewATMEncapsulation string, err error) { // Request structure. request := interface{}(nil) @@ -1749,11 +2168,6 @@ func (client *WANDSLLinkConfig1) GetATMEncapsulation() (NewATMEncapsulation stri return } -// Arguments: -// -// * NewFCSPreserved: -// -// func (client *WANDSLLinkConfig1) SetFCSPreserved(NewFCSPreserved bool) (err error) { // Request structure. request := &struct { @@ -1780,11 +2194,6 @@ func (client *WANDSLLinkConfig1) SetFCSPreserved(NewFCSPreserved bool) (err erro return } -// -// -// Return values: -// -// * NewFCSPreserved: func (client *WANDSLLinkConfig1) GetFCSPreserved() (NewFCSPreserved bool, err error) { // Request structure. request := interface{}(nil) @@ -1829,15 +2238,49 @@ func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, erro if genericClients, errors, err = goupnp.NewServiceClients(URN_WANEthernetLinkConfig_1); err != nil { return } - clients = make([]*WANEthernetLinkConfig1, len(genericClients)) + clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients) + return +} + +// NewWANEthernetLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANEthernetLinkConfig_1) + if err != nil { + return nil, err + } + return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANEthernetLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANEthernetLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANEthernetLinkConfig_1) + if err != nil { + return nil, err + } + return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANEthernetLinkConfig1 { + clients := make([]*WANEthernetLinkConfig1, len(genericClients)) for i := range genericClients { clients[i] = &WANEthernetLinkConfig1{genericClients[i]} } - return + return clients } // -// // Return values: // // * NewEthernetLinkStatus: allowed values: Up, Down @@ -1885,18 +2328,48 @@ func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_1); err != nil { return } - clients = make([]*WANIPConnection1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANIPConnection1{genericClients[i]} - } + clients = newWANIPConnection1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewConnectionType: +// NewWANIPConnection1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_1) + if err != nil { + return nil, err + } + return newWANIPConnection1ClientsFromGenericClients(genericClients), nil +} + +// NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANIPConnection1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANIPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANIPConnection_1) + if err != nil { + return nil, err + } + return newWANIPConnection1ClientsFromGenericClients(genericClients), nil +} + +func newWANIPConnection1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANIPConnection1 { + clients := make([]*WANIPConnection1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANIPConnection1{genericClients[i]} + } + return clients +} + func (client *WANIPConnection1) SetConnectionType(NewConnectionType string) (err error) { // Request structure. request := &struct { @@ -1924,11 +2397,8 @@ func (client *WANIPConnection1) SetConnectionType(NewConnectionType string) (err } // -// // Return values: // -// * NewConnectionType: -// // * NewPossibleConnectionTypes: allowed values: Unconfigured, IP_Routed, IP_Bridged func (client *WANIPConnection1) GetConnectionTypeInfo() (NewConnectionType string, NewPossibleConnectionTypes string, err error) { // Request structure. @@ -1961,9 +2431,6 @@ func (client *WANIPConnection1) GetConnectionTypeInfo() (NewConnectionType strin return } -// -// -// func (client *WANIPConnection1) RequestConnection() (err error) { // Request structure. request := interface{}(nil) @@ -1985,9 +2452,6 @@ func (client *WANIPConnection1) RequestConnection() (err error) { return } -// -// -// func (client *WANIPConnection1) RequestTermination() (err error) { // Request structure. request := interface{}(nil) @@ -2009,9 +2473,6 @@ func (client *WANIPConnection1) RequestTermination() (err error) { return } -// -// -// func (client *WANIPConnection1) ForceTermination() (err error) { // Request structure. request := interface{}(nil) @@ -2033,11 +2494,6 @@ func (client *WANIPConnection1) ForceTermination() (err error) { return } -// Arguments: -// -// * NewAutoDisconnectTime: -// -// func (client *WANIPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -2064,11 +2520,6 @@ func (client *WANIPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uint return } -// Arguments: -// -// * NewIdleDisconnectTime: -// -// func (client *WANIPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -2095,11 +2546,6 @@ func (client *WANIPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uint return } -// Arguments: -// -// * NewWarnDisconnectDelay: -// -// func (client *WANIPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay uint32) (err error) { // Request structure. request := &struct { @@ -2127,14 +2573,11 @@ func (client *WANIPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay ui } // -// // Return values: // // * NewConnectionStatus: allowed values: Unconfigured, Connected, Disconnected // // * NewLastConnectionError: allowed values: ERROR_NONE -// -// * NewUptime: func (client *WANIPConnection1) GetStatusInfo() (NewConnectionStatus string, NewLastConnectionError string, NewUptime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2171,11 +2614,6 @@ func (client *WANIPConnection1) GetStatusInfo() (NewConnectionStatus string, New return } -// -// -// Return values: -// -// * NewAutoDisconnectTime: func (client *WANIPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2202,11 +2640,6 @@ func (client *WANIPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime u return } -// -// -// Return values: -// -// * NewIdleDisconnectTime: func (client *WANIPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2233,11 +2666,6 @@ func (client *WANIPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime u return } -// -// -// Return values: -// -// * NewWarnDisconnectDelay: func (client *WANIPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDelay uint32, err error) { // Request structure. request := interface{}(nil) @@ -2264,13 +2692,6 @@ func (client *WANIPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDelay return } -// -// -// Return values: -// -// * NewRSIPAvailable: -// -// * NewNATEnabled: func (client *WANIPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNATEnabled bool, err error) { // Request structure. request := interface{}(nil) @@ -2302,27 +2723,10 @@ func (client *WANIPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNA return } -// Arguments: -// -// * NewPortMappingIndex: // // Return values: // -// * NewRemoteHost: -// -// * NewExternalPort: -// // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: func (client *WANIPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex uint16) (NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -2389,25 +2793,11 @@ func (client *WANIPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex u return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// Return values: -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: + func (client *WANIPConnection1) GetSpecificPortMappingEntry(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -2469,25 +2859,11 @@ func (client *WANIPConnection1) GetSpecificPortMappingEntry(NewRemoteHost string return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: -// -// + func (client *WANIPConnection1) AddPortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32) (err error) { // Request structure. request := &struct { @@ -2549,15 +2925,11 @@ func (client *WANIPConnection1) AddPortMapping(NewRemoteHost string, NewExternal return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// + func (client *WANIPConnection1) DeletePortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (err error) { // Request structure. request := &struct { @@ -2594,11 +2966,6 @@ func (client *WANIPConnection1) DeletePortMapping(NewRemoteHost string, NewExter return } -// -// -// Return values: -// -// * NewExternalIPAddress: func (client *WANIPConnection1) GetExternalIPAddress() (NewExternalIPAddress string, err error) { // Request structure. request := interface{}(nil) @@ -2643,18 +3010,48 @@ func NewWANIPConnection2Clients() (clients []*WANIPConnection2, errors []error, if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_2); err != nil { return } - clients = make([]*WANIPConnection2, len(genericClients)) - for i := range genericClients { - clients[i] = &WANIPConnection2{genericClients[i]} - } + clients = newWANIPConnection2ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewConnectionType: allowed values: Unconfigured, IP_Routed, IP_Bridged +// NewWANIPConnection2ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANIPConnection2ClientsByURL(loc *url.URL) ([]*WANIPConnection2, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_2) + if err != nil { + return nil, err + } + return newWANIPConnection2ClientsFromGenericClients(genericClients), nil +} + +// NewWANIPConnection2ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANIPConnection2ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANIPConnection2, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANIPConnection_2) + if err != nil { + return nil, err + } + return newWANIPConnection2ClientsFromGenericClients(genericClients), nil +} + +func newWANIPConnection2ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANIPConnection2 { + clients := make([]*WANIPConnection2, len(genericClients)) + for i := range genericClients { + clients[i] = &WANIPConnection2{genericClients[i]} + } + return clients +} + func (client *WANIPConnection2) SetConnectionType(NewConnectionType string) (err error) { // Request structure. request := &struct { @@ -2681,13 +3078,6 @@ func (client *WANIPConnection2) SetConnectionType(NewConnectionType string) (err return } -// -// -// Return values: -// -// * NewConnectionType: allowed values: Unconfigured, IP_Routed, IP_Bridged -// -// * NewPossibleConnectionTypes: func (client *WANIPConnection2) GetConnectionTypeInfo() (NewConnectionType string, NewPossibleConnectionTypes string, err error) { // Request structure. request := interface{}(nil) @@ -2719,9 +3109,6 @@ func (client *WANIPConnection2) GetConnectionTypeInfo() (NewConnectionType strin return } -// -// -// func (client *WANIPConnection2) RequestConnection() (err error) { // Request structure. request := interface{}(nil) @@ -2743,9 +3130,6 @@ func (client *WANIPConnection2) RequestConnection() (err error) { return } -// -// -// func (client *WANIPConnection2) RequestTermination() (err error) { // Request structure. request := interface{}(nil) @@ -2767,9 +3151,6 @@ func (client *WANIPConnection2) RequestTermination() (err error) { return } -// -// -// func (client *WANIPConnection2) ForceTermination() (err error) { // Request structure. request := interface{}(nil) @@ -2791,11 +3172,6 @@ func (client *WANIPConnection2) ForceTermination() (err error) { return } -// Arguments: -// -// * NewAutoDisconnectTime: -// -// func (client *WANIPConnection2) SetAutoDisconnectTime(NewAutoDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -2822,11 +3198,6 @@ func (client *WANIPConnection2) SetAutoDisconnectTime(NewAutoDisconnectTime uint return } -// Arguments: -// -// * NewIdleDisconnectTime: -// -// func (client *WANIPConnection2) SetIdleDisconnectTime(NewIdleDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -2853,11 +3224,6 @@ func (client *WANIPConnection2) SetIdleDisconnectTime(NewIdleDisconnectTime uint return } -// Arguments: -// -// * NewWarnDisconnectDelay: -// -// func (client *WANIPConnection2) SetWarnDisconnectDelay(NewWarnDisconnectDelay uint32) (err error) { // Request structure. request := &struct { @@ -2885,14 +3251,11 @@ func (client *WANIPConnection2) SetWarnDisconnectDelay(NewWarnDisconnectDelay ui } // -// // Return values: // -// * NewConnectionStatus: allowed values: Unconfigured, Connected, Disconnected -// -// * NewLastConnectionError: allowed values: ERROR_NONE +// * NewConnectionStatus: allowed values: Unconfigured, Connecting, Connected, PendingDisconnect, Disconnecting, Disconnected // -// * NewUptime: +// * NewLastConnectionError: allowed values: ERROR_NONE, ERROR_COMMAND_ABORTED, ERROR_NOT_ENABLED_FOR_INTERNET, ERROR_USER_DISCONNECT, ERROR_ISP_DISCONNECT, ERROR_IDLE_DISCONNECT, ERROR_FORCED_DISCONNECT, ERROR_NO_CARRIER, ERROR_IP_CONFIGURATION, ERROR_UNKNOWN func (client *WANIPConnection2) GetStatusInfo() (NewConnectionStatus string, NewLastConnectionError string, NewUptime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2929,11 +3292,6 @@ func (client *WANIPConnection2) GetStatusInfo() (NewConnectionStatus string, New return } -// -// -// Return values: -// -// * NewAutoDisconnectTime: func (client *WANIPConnection2) GetAutoDisconnectTime() (NewAutoDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2960,11 +3318,6 @@ func (client *WANIPConnection2) GetAutoDisconnectTime() (NewAutoDisconnectTime u return } -// -// -// Return values: -// -// * NewIdleDisconnectTime: func (client *WANIPConnection2) GetIdleDisconnectTime() (NewIdleDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -2991,11 +3344,6 @@ func (client *WANIPConnection2) GetIdleDisconnectTime() (NewIdleDisconnectTime u return } -// -// -// Return values: -// -// * NewWarnDisconnectDelay: func (client *WANIPConnection2) GetWarnDisconnectDelay() (NewWarnDisconnectDelay uint32, err error) { // Request structure. request := interface{}(nil) @@ -3022,13 +3370,6 @@ func (client *WANIPConnection2) GetWarnDisconnectDelay() (NewWarnDisconnectDelay return } -// -// -// Return values: -// -// * NewRSIPAvailable: -// -// * NewNATEnabled: func (client *WANIPConnection2) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNATEnabled bool, err error) { // Request structure. request := interface{}(nil) @@ -3060,27 +3401,10 @@ func (client *WANIPConnection2) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNA return } -// Arguments: -// -// * NewPortMappingIndex: // // Return values: // -// * NewRemoteHost: -// -// * NewExternalPort: -// // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: allowed value range: minimum=1, maximum=65535 -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: allowed value range: minimum=0, maximum=604800 func (client *WANIPConnection2) GetGenericPortMappingEntry(NewPortMappingIndex uint16) (NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -3147,25 +3471,11 @@ func (client *WANIPConnection2) GetGenericPortMappingEntry(NewPortMappingIndex u return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// Return values: -// -// * NewInternalPort: allowed value range: minimum=1, maximum=65535 -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: allowed value range: minimum=0, maximum=604800 + func (client *WANIPConnection2) GetSpecificPortMappingEntry(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -3227,25 +3537,11 @@ func (client *WANIPConnection2) GetSpecificPortMappingEntry(NewRemoteHost string return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: allowed value range: minimum=1, maximum=65535 -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: allowed value range: minimum=0, maximum=604800 -// -// + func (client *WANIPConnection2) AddPortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32) (err error) { // Request structure. request := &struct { @@ -3307,15 +3603,11 @@ func (client *WANIPConnection2) AddPortMapping(NewRemoteHost string, NewExternal return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// + func (client *WANIPConnection2) DeletePortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (err error) { // Request structure. request := &struct { @@ -3352,17 +3644,11 @@ func (client *WANIPConnection2) DeletePortMapping(NewRemoteHost string, NewExter return } -// Arguments: // -// * NewStartPort: -// -// * NewEndPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewManage: -// -// + func (client *WANIPConnection2) DeletePortMappingRange(NewStartPort uint16, NewEndPort uint16, NewProtocol string, NewManage bool) (err error) { // Request structure. request := &struct { @@ -3404,11 +3690,6 @@ func (client *WANIPConnection2) DeletePortMappingRange(NewStartPort uint16, NewE return } -// -// -// Return values: -// -// * NewExternalIPAddress: func (client *WANIPConnection2) GetExternalIPAddress() (NewExternalIPAddress string, err error) { // Request structure. request := interface{}(nil) @@ -3435,21 +3716,11 @@ func (client *WANIPConnection2) GetExternalIPAddress() (NewExternalIPAddress str return } -// Arguments: // -// * NewStartPort: -// -// * NewEndPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewManage: -// -// * NewNumberOfPorts: -// -// Return values: -// -// * NewPortListing: + func (client *WANIPConnection2) GetListOfPortMappings(NewStartPort uint16, NewEndPort uint16, NewProtocol string, NewManage bool, NewNumberOfPorts uint16) (NewPortListing string, err error) { // Request structure. request := &struct { @@ -3501,27 +3772,11 @@ func (client *WANIPConnection2) GetListOfPortMappings(NewStartPort uint16, NewEn return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: allowed value range: minimum=1, maximum=65535 -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: allowed value range: minimum=0, maximum=604800 -// -// Return values: -// -// * NewReservedPort: + func (client *WANIPConnection2) AddAnyPortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32) (NewReservedPort uint16, err error) { // Request structure. request := &struct { @@ -3606,20 +3861,48 @@ func NewWANIPv6FirewallControl1Clients() (clients []*WANIPv6FirewallControl1, er if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPv6FirewallControl_1); err != nil { return } - clients = make([]*WANIPv6FirewallControl1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANIPv6FirewallControl1{genericClients[i]} - } + clients = newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients) return } +// NewWANIPv6FirewallControl1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANIPv6FirewallControl1ClientsByURL(loc *url.URL) ([]*WANIPv6FirewallControl1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPv6FirewallControl_1) + if err != nil { + return nil, err + } + return newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients), nil +} + +// NewWANIPv6FirewallControl1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // -// Return values: -// -// * FirewallEnabled: -// -// * InboundPinholeAllowed: +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANIPv6FirewallControl1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANIPv6FirewallControl1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANIPv6FirewallControl_1) + if err != nil { + return nil, err + } + return newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients), nil +} + +func newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANIPv6FirewallControl1 { + clients := make([]*WANIPv6FirewallControl1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANIPv6FirewallControl1{genericClients[i]} + } + return clients +} + func (client *WANIPv6FirewallControl1) GetFirewallStatus() (FirewallEnabled bool, InboundPinholeAllowed bool, err error) { // Request structure. request := interface{}(nil) @@ -3651,21 +3934,6 @@ func (client *WANIPv6FirewallControl1) GetFirewallStatus() (FirewallEnabled bool return } -// Arguments: -// -// * RemoteHost: -// -// * RemotePort: -// -// * InternalClient: -// -// * InternalPort: -// -// * Protocol: -// -// Return values: -// -// * OutboundPinholeTimeout: func (client *WANIPv6FirewallControl1) GetOutboundPinholeTimeout(RemoteHost string, RemotePort uint16, InternalClient string, InternalPort uint16, Protocol uint16) (OutboundPinholeTimeout uint32, err error) { // Request structure. request := &struct { @@ -3717,23 +3985,11 @@ func (client *WANIPv6FirewallControl1) GetOutboundPinholeTimeout(RemoteHost stri return } -// Arguments: -// -// * RemoteHost: -// -// * RemotePort: -// -// * InternalClient: -// -// * InternalPort: // -// * Protocol: +// Arguments: // // * LeaseTime: allowed value range: minimum=1, maximum=86400 -// -// Return values: -// -// * UniqueID: + func (client *WANIPv6FirewallControl1) AddPinhole(RemoteHost string, RemotePort uint16, InternalClient string, InternalPort uint16, Protocol uint16, LeaseTime uint32) (UniqueID uint16, err error) { // Request structure. request := &struct { @@ -3790,13 +4046,11 @@ func (client *WANIPv6FirewallControl1) AddPinhole(RemoteHost string, RemotePort return } -// Arguments: // -// * UniqueID: +// Arguments: // // * NewLeaseTime: allowed value range: minimum=1, maximum=86400 -// -// + func (client *WANIPv6FirewallControl1) UpdatePinhole(UniqueID uint16, NewLeaseTime uint32) (err error) { // Request structure. request := &struct { @@ -3828,11 +4082,6 @@ func (client *WANIPv6FirewallControl1) UpdatePinhole(UniqueID uint16, NewLeaseTi return } -// Arguments: -// -// * UniqueID: -// -// func (client *WANIPv6FirewallControl1) DeletePinhole(UniqueID uint16) (err error) { // Request structure. request := &struct { @@ -3859,13 +4108,6 @@ func (client *WANIPv6FirewallControl1) DeletePinhole(UniqueID uint16) (err error return } -// Arguments: -// -// * UniqueID: -// -// Return values: -// -// * PinholePackets: func (client *WANIPv6FirewallControl1) GetPinholePackets(UniqueID uint16) (PinholePackets uint32, err error) { // Request structure. request := &struct { @@ -3897,13 +4139,6 @@ func (client *WANIPv6FirewallControl1) GetPinholePackets(UniqueID uint16) (Pinho return } -// Arguments: -// -// * UniqueID: -// -// Return values: -// -// * IsWorking: func (client *WANIPv6FirewallControl1) CheckPinholeWorking(UniqueID uint16) (IsWorking bool, err error) { // Request structure. request := &struct { @@ -3953,22 +4188,53 @@ func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []err if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPOTSLinkConfig_1); err != nil { return } - clients = make([]*WANPOTSLinkConfig1, len(genericClients)) + clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients) + return +} + +// NewWANPOTSLinkConfig1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPOTSLinkConfig_1) + if err != nil { + return nil, err + } + return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +// NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANPOTSLinkConfig1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANPOTSLinkConfig1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANPOTSLinkConfig_1) + if err != nil { + return nil, err + } + return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil +} + +func newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANPOTSLinkConfig1 { + clients := make([]*WANPOTSLinkConfig1, len(genericClients)) for i := range genericClients { clients[i] = &WANPOTSLinkConfig1{genericClients[i]} } - return + return clients } -// Arguments: // -// * NewISPPhoneNumber: -// -// * NewISPInfo: +// Arguments: // // * NewLinkType: allowed values: PPP_Dialup -// -// + func (client *WANPOTSLinkConfig1) SetISPInfo(NewISPPhoneNumber string, NewISPInfo string, NewLinkType string) (err error) { // Request structure. request := &struct { @@ -4005,13 +4271,6 @@ func (client *WANPOTSLinkConfig1) SetISPInfo(NewISPPhoneNumber string, NewISPInf return } -// Arguments: -// -// * NewNumberOfRetries: -// -// * NewDelayBetweenRetries: -// -// func (client *WANPOTSLinkConfig1) SetCallRetryInfo(NewNumberOfRetries uint32, NewDelayBetweenRetries uint32) (err error) { // Request structure. request := &struct { @@ -4044,13 +4303,8 @@ func (client *WANPOTSLinkConfig1) SetCallRetryInfo(NewNumberOfRetries uint32, Ne } // -// // Return values: // -// * NewISPPhoneNumber: -// -// * NewISPInfo: -// // * NewLinkType: allowed values: PPP_Dialup func (client *WANPOTSLinkConfig1) GetISPInfo() (NewISPPhoneNumber string, NewISPInfo string, NewLinkType string, err error) { // Request structure. @@ -4088,13 +4342,6 @@ func (client *WANPOTSLinkConfig1) GetISPInfo() (NewISPPhoneNumber string, NewISP return } -// -// -// Return values: -// -// * NewNumberOfRetries: -// -// * NewDelayBetweenRetries: func (client *WANPOTSLinkConfig1) GetCallRetryInfo() (NewNumberOfRetries uint32, NewDelayBetweenRetries uint32, err error) { // Request structure. request := interface{}(nil) @@ -4126,11 +4373,6 @@ func (client *WANPOTSLinkConfig1) GetCallRetryInfo() (NewNumberOfRetries uint32, return } -// -// -// Return values: -// -// * NewFclass: func (client *WANPOTSLinkConfig1) GetFclass() (NewFclass string, err error) { // Request structure. request := interface{}(nil) @@ -4157,11 +4399,6 @@ func (client *WANPOTSLinkConfig1) GetFclass() (NewFclass string, err error) { return } -// -// -// Return values: -// -// * NewDataModulationSupported: func (client *WANPOTSLinkConfig1) GetDataModulationSupported() (NewDataModulationSupported string, err error) { // Request structure. request := interface{}(nil) @@ -4188,11 +4425,6 @@ func (client *WANPOTSLinkConfig1) GetDataModulationSupported() (NewDataModulatio return } -// -// -// Return values: -// -// * NewDataProtocol: func (client *WANPOTSLinkConfig1) GetDataProtocol() (NewDataProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -4219,11 +4451,6 @@ func (client *WANPOTSLinkConfig1) GetDataProtocol() (NewDataProtocol string, err return } -// -// -// Return values: -// -// * NewDataCompression: func (client *WANPOTSLinkConfig1) GetDataCompression() (NewDataCompression string, err error) { // Request structure. request := interface{}(nil) @@ -4250,11 +4477,6 @@ func (client *WANPOTSLinkConfig1) GetDataCompression() (NewDataCompression strin return } -// -// -// Return values: -// -// * NewPlusVTRCommandSupported: func (client *WANPOTSLinkConfig1) GetPlusVTRCommandSupported() (NewPlusVTRCommandSupported bool, err error) { // Request structure. request := interface{}(nil) @@ -4299,18 +4521,48 @@ func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPPPConnection_1); err != nil { return } - clients = make([]*WANPPPConnection1, len(genericClients)) - for i := range genericClients { - clients[i] = &WANPPPConnection1{genericClients[i]} - } + clients = newWANPPPConnection1ClientsFromGenericClients(genericClients) return } -// Arguments: -// -// * NewConnectionType: +// NewWANPPPConnection1ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. // +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPPPConnection_1) + if err != nil { + return nil, err + } + return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil +} + +// NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). // +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func NewWANPPPConnection1ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*WANPPPConnection1, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, URN_WANPPPConnection_1) + if err != nil { + return nil, err + } + return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil +} + +func newWANPPPConnection1ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*WANPPPConnection1 { + clients := make([]*WANPPPConnection1, len(genericClients)) + for i := range genericClients { + clients[i] = &WANPPPConnection1{genericClients[i]} + } + return clients +} + func (client *WANPPPConnection1) SetConnectionType(NewConnectionType string) (err error) { // Request structure. request := &struct { @@ -4338,11 +4590,8 @@ func (client *WANPPPConnection1) SetConnectionType(NewConnectionType string) (er } // -// // Return values: // -// * NewConnectionType: -// // * NewPossibleConnectionTypes: allowed values: Unconfigured, IP_Routed, DHCP_Spoofed, PPPoE_Bridged, PPTP_Relay, L2TP_Relay, PPPoE_Relay func (client *WANPPPConnection1) GetConnectionTypeInfo() (NewConnectionType string, NewPossibleConnectionTypes string, err error) { // Request structure. @@ -4375,13 +4624,6 @@ func (client *WANPPPConnection1) GetConnectionTypeInfo() (NewConnectionType stri return } -// Arguments: -// -// * NewUserName: -// -// * NewPassword: -// -// func (client *WANPPPConnection1) ConfigureConnection(NewUserName string, NewPassword string) (err error) { // Request structure. request := &struct { @@ -4413,9 +4655,6 @@ func (client *WANPPPConnection1) ConfigureConnection(NewUserName string, NewPass return } -// -// -// func (client *WANPPPConnection1) RequestConnection() (err error) { // Request structure. request := interface{}(nil) @@ -4437,9 +4676,6 @@ func (client *WANPPPConnection1) RequestConnection() (err error) { return } -// -// -// func (client *WANPPPConnection1) RequestTermination() (err error) { // Request structure. request := interface{}(nil) @@ -4461,9 +4697,6 @@ func (client *WANPPPConnection1) RequestTermination() (err error) { return } -// -// -// func (client *WANPPPConnection1) ForceTermination() (err error) { // Request structure. request := interface{}(nil) @@ -4485,11 +4718,6 @@ func (client *WANPPPConnection1) ForceTermination() (err error) { return } -// Arguments: -// -// * NewAutoDisconnectTime: -// -// func (client *WANPPPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -4516,11 +4744,6 @@ func (client *WANPPPConnection1) SetAutoDisconnectTime(NewAutoDisconnectTime uin return } -// Arguments: -// -// * NewIdleDisconnectTime: -// -// func (client *WANPPPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uint32) (err error) { // Request structure. request := &struct { @@ -4547,11 +4770,6 @@ func (client *WANPPPConnection1) SetIdleDisconnectTime(NewIdleDisconnectTime uin return } -// Arguments: -// -// * NewWarnDisconnectDelay: -// -// func (client *WANPPPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay uint32) (err error) { // Request structure. request := &struct { @@ -4579,14 +4797,11 @@ func (client *WANPPPConnection1) SetWarnDisconnectDelay(NewWarnDisconnectDelay u } // -// // Return values: // // * NewConnectionStatus: allowed values: Unconfigured, Connected, Disconnected // // * NewLastConnectionError: allowed values: ERROR_NONE -// -// * NewUptime: func (client *WANPPPConnection1) GetStatusInfo() (NewConnectionStatus string, NewLastConnectionError string, NewUptime uint32, err error) { // Request structure. request := interface{}(nil) @@ -4623,13 +4838,6 @@ func (client *WANPPPConnection1) GetStatusInfo() (NewConnectionStatus string, Ne return } -// -// -// Return values: -// -// * NewUpstreamMaxBitRate: -// -// * NewDownstreamMaxBitRate: func (client *WANPPPConnection1) GetLinkLayerMaxBitRates() (NewUpstreamMaxBitRate uint32, NewDownstreamMaxBitRate uint32, err error) { // Request structure. request := interface{}(nil) @@ -4661,11 +4869,6 @@ func (client *WANPPPConnection1) GetLinkLayerMaxBitRates() (NewUpstreamMaxBitRat return } -// -// -// Return values: -// -// * NewPPPEncryptionProtocol: func (client *WANPPPConnection1) GetPPPEncryptionProtocol() (NewPPPEncryptionProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -4692,11 +4895,6 @@ func (client *WANPPPConnection1) GetPPPEncryptionProtocol() (NewPPPEncryptionPro return } -// -// -// Return values: -// -// * NewPPPCompressionProtocol: func (client *WANPPPConnection1) GetPPPCompressionProtocol() (NewPPPCompressionProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -4723,11 +4921,6 @@ func (client *WANPPPConnection1) GetPPPCompressionProtocol() (NewPPPCompressionP return } -// -// -// Return values: -// -// * NewPPPAuthenticationProtocol: func (client *WANPPPConnection1) GetPPPAuthenticationProtocol() (NewPPPAuthenticationProtocol string, err error) { // Request structure. request := interface{}(nil) @@ -4754,11 +4947,6 @@ func (client *WANPPPConnection1) GetPPPAuthenticationProtocol() (NewPPPAuthentic return } -// -// -// Return values: -// -// * NewUserName: func (client *WANPPPConnection1) GetUserName() (NewUserName string, err error) { // Request structure. request := interface{}(nil) @@ -4785,11 +4973,6 @@ func (client *WANPPPConnection1) GetUserName() (NewUserName string, err error) { return } -// -// -// Return values: -// -// * NewPassword: func (client *WANPPPConnection1) GetPassword() (NewPassword string, err error) { // Request structure. request := interface{}(nil) @@ -4816,11 +4999,6 @@ func (client *WANPPPConnection1) GetPassword() (NewPassword string, err error) { return } -// -// -// Return values: -// -// * NewAutoDisconnectTime: func (client *WANPPPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -4847,11 +5025,6 @@ func (client *WANPPPConnection1) GetAutoDisconnectTime() (NewAutoDisconnectTime return } -// -// -// Return values: -// -// * NewIdleDisconnectTime: func (client *WANPPPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime uint32, err error) { // Request structure. request := interface{}(nil) @@ -4878,11 +5051,6 @@ func (client *WANPPPConnection1) GetIdleDisconnectTime() (NewIdleDisconnectTime return } -// -// -// Return values: -// -// * NewWarnDisconnectDelay: func (client *WANPPPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDelay uint32, err error) { // Request structure. request := interface{}(nil) @@ -4909,13 +5077,6 @@ func (client *WANPPPConnection1) GetWarnDisconnectDelay() (NewWarnDisconnectDela return } -// -// -// Return values: -// -// * NewRSIPAvailable: -// -// * NewNATEnabled: func (client *WANPPPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewNATEnabled bool, err error) { // Request structure. request := interface{}(nil) @@ -4947,27 +5108,10 @@ func (client *WANPPPConnection1) GetNATRSIPStatus() (NewRSIPAvailable bool, NewN return } -// Arguments: -// -// * NewPortMappingIndex: // // Return values: // -// * NewRemoteHost: -// -// * NewExternalPort: -// // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: func (client *WANPPPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex uint16) (NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -5034,25 +5178,11 @@ func (client *WANPPPConnection1) GetGenericPortMappingEntry(NewPortMappingIndex return } -// Arguments: // -// * NewRemoteHost: -// -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// Return values: -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: + func (client *WANPPPConnection1) GetSpecificPortMappingEntry(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32, err error) { // Request structure. request := &struct { @@ -5114,25 +5244,11 @@ func (client *WANPPPConnection1) GetSpecificPortMappingEntry(NewRemoteHost strin return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// * NewInternalPort: -// -// * NewInternalClient: -// -// * NewEnabled: -// -// * NewPortMappingDescription: -// -// * NewLeaseDuration: -// -// + func (client *WANPPPConnection1) AddPortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string, NewInternalPort uint16, NewInternalClient string, NewEnabled bool, NewPortMappingDescription string, NewLeaseDuration uint32) (err error) { // Request structure. request := &struct { @@ -5194,15 +5310,11 @@ func (client *WANPPPConnection1) AddPortMapping(NewRemoteHost string, NewExterna return } -// Arguments: -// -// * NewRemoteHost: // -// * NewExternalPort: +// Arguments: // // * NewProtocol: allowed values: TCP, UDP -// -// + func (client *WANPPPConnection1) DeletePortMapping(NewRemoteHost string, NewExternalPort uint16, NewProtocol string) (err error) { // Request structure. request := &struct { @@ -5239,11 +5351,6 @@ func (client *WANPPPConnection1) DeletePortMapping(NewRemoteHost string, NewExte return } -// -// -// Return values: -// -// * NewExternalIPAddress: func (client *WANPPPConnection1) GetExternalIPAddress() (NewExternalIPAddress string, err error) { // Request structure. request := interface{}(nil) diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/example/example_test.go b/Godeps/_workspace/src/github.com/huin/goupnp/example/example_test.go deleted file mode 100644 index 1f3667df7..000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/example/example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package example_test - -import ( - "fmt" - "os" - - "github.com/huin/goupnp" - "github.com/huin/goupnp/dcps/internetgateway1" -) - -// Use discovered WANPPPConnection1 services to find external IP addresses. -func Example_WANPPPConnection1_GetExternalIPAddress() { - clients, errors, err := internetgateway1.NewWANPPPConnection1Clients() - extIPClients := make([]GetExternalIPAddresser, len(clients)) - for i, client := range clients { - extIPClients[i] = client - } - DisplayExternalIPResults(extIPClients, errors, err) - // Output: -} - -// Use discovered WANIPConnection services to find external IP addresses. -func Example_WANIPConnection_GetExternalIPAddress() { - clients, errors, err := internetgateway1.NewWANIPConnection1Clients() - extIPClients := make([]GetExternalIPAddresser, len(clients)) - for i, client := range clients { - extIPClients[i] = client - } - DisplayExternalIPResults(extIPClients, errors, err) - // Output: -} - -type GetExternalIPAddresser interface { - GetExternalIPAddress() (NewExternalIPAddress string, err error) - GetServiceClient() *goupnp.ServiceClient -} - -func DisplayExternalIPResults(clients []GetExternalIPAddresser, errors []error, err error) { - if err != nil { - fmt.Fprintln(os.Stderr, "Error discovering service with UPnP: ", err) - return - } - - if len(errors) > 0 { - fmt.Fprintf(os.Stderr, "Error discovering %d services:\n", len(errors)) - for _, err := range errors { - fmt.Println(" ", err) - } - } - - fmt.Fprintf(os.Stderr, "Successfully discovered %d services:\n", len(clients)) - for _, client := range clients { - device := &client.GetServiceClient().RootDevice.Device - - fmt.Fprintln(os.Stderr, " Device:", device.FriendlyName) - if addr, err := client.GetExternalIPAddress(); err != nil { - fmt.Fprintf(os.Stderr, " Failed to get external IP address: %v\n", err) - } else { - fmt.Fprintf(os.Stderr, " External IP address: %v\n", addr) - } - } -} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/gotasks/specgen_task.go b/Godeps/_workspace/src/github.com/huin/goupnp/gotasks/specgen_task.go index 0ac1d4ff3..921e8c857 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/gotasks/specgen_task.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/gotasks/specgen_task.go @@ -4,12 +4,11 @@ package gotasks import ( "archive/zip" - "bytes" "encoding/xml" "fmt" "io" - "io/ioutil" "log" + "net/http" "os" "path" "path/filepath" @@ -28,6 +27,53 @@ var ( serviceURNPrefix = "urn:schemas-upnp-org:service:" ) +// DCP contains extra metadata to use when generating DCP source files. +type DCPMetadata struct { + 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. + XMLSpecURL string // Where to download the XML spec from. + // Any special-case functions to run against the DCP before writing it out. + Hacks []DCPHackFn +} + +var dcpMetadata = []DCPMetadata{ + { + Name: "internetgateway1", + OfficialName: "Internet Gateway Device v1", + DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf", + XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-TestFiles-20010921.zip", + }, + { + Name: "internetgateway2", + OfficialName: "Internet Gateway Device v2", + DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v2-Device.pdf", + XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-Testfiles-20110224.zip", + Hacks: []DCPHackFn{ + func(dcp *DCP) error { + missingURN := "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1" + if _, ok := dcp.ServiceTypes[missingURN]; ok { + return nil + } + urnParts, err := extractURNParts(missingURN, serviceURNPrefix) + if err != nil { + return err + } + dcp.ServiceTypes[missingURN] = urnParts + return nil + }, + }, + }, + { + Name: "av1", + OfficialName: "MediaServer v1 and MediaRenderer v1", + DocURL: "http://upnp.org/specs/av/av1/", + XMLSpecURL: "http://upnp.org/specs/av/UPnP-av-TestFiles-20070927.zip", + }, +} + +type DCPHackFn func(*DCP) error + // NAME // specgen - generates Go code from the UPnP specification files. // @@ -35,104 +81,90 @@ var ( // The specification is available for download from: // // OPTIONS -// -s, --spec_filename=<upnpresources.zip> -// Path to the specification file, available from http://upnp.org/resources/upnpresources.zip +// -s, --specs_dir=<spec directory> +// Path to the specification storage directory. This is used to find (and download if not present) the specification ZIP files. Defaults to 'specs' // -o, --out_dir=<output directory> -// Path to the output directory. This is is where the DCP source files will be placed. Should normally correspond to the directory for github.com/huin/goupnp/dcps +// Path to the output directory. This is is where the DCP source files will be placed. Should normally correspond to the directory for github.com/huin/goupnp/dcps. Defaults to '../dcps' // --nogofmt // Disable passing the output through gofmt. Do this if debugging code output problems and needing to see the generated code prior to being passed through gofmt. func TaskSpecgen(t *tasking.T) { - specFilename := t.Flags.String("spec-filename") - if specFilename == "" { - specFilename = t.Flags.String("s") - } - if specFilename == "" { - t.Fatal("--spec_filename is required") - } - outDir := t.Flags.String("out-dir") - if outDir == "" { - outDir = t.Flags.String("o") - } - if outDir == "" { - log.Fatal("--out_dir is required") + specsDir := fallbackStrValue("specs", t.Flags.String("specs_dir"), t.Flags.String("s")) + if err := os.MkdirAll(specsDir, os.ModePerm); err != nil { + t.Fatalf("Could not create specs-dir %q: %v\n", specsDir, err) } + outDir := fallbackStrValue("../dcps", t.Flags.String("out_dir"), t.Flags.String("o")) useGofmt := !t.Flags.Bool("nogofmt") - specArchive, err := openZipfile(specFilename) - if err != nil { - t.Fatalf("Error opening spec file: %v", err) - } - defer specArchive.Close() - - dcpCol := newDcpsCollection() - for _, f := range globFiles("standardizeddcps/*/*.zip", specArchive.Reader) { - dirName := strings.TrimPrefix(f.Name, "standardizeddcps/") - slashIndex := strings.Index(dirName, "/") - if slashIndex == -1 { - // Should not happen. - t.Logf("Could not find / in %q", dirName) - return +NEXT_DCP: + for _, d := range dcpMetadata { + specFilename := filepath.Join(specsDir, d.Name+".zip") + err := acquireFile(specFilename, d.XMLSpecURL) + if err != nil { + t.Logf("Could not acquire spec for %s, skipping: %v\n", d.Name, err) + continue NEXT_DCP } - dirName = dirName[:slashIndex] - - dcp := dcpCol.dcpForDir(dirName) - if dcp == nil { - t.Logf("No alias defined for directory %q: skipping %s\n", dirName, f.Name) - continue - } else { - t.Logf("Alias found for directory %q: processing %s\n", dirName, f.Name) + dcp := newDCP(d) + if err := dcp.processZipFile(specFilename); err != nil { + log.Printf("Error processing spec for %s in file %q: %v", d.Name, specFilename, err) + continue NEXT_DCP } - - dcp.processZipFile(f) - } - - for _, dcp := range dcpCol.dcpByAlias { + for i, hack := range d.Hacks { + if err := hack(dcp); err != nil { + log.Printf("Error with Hack[%d] for %s: %v", i, d.Name, err) + continue NEXT_DCP + } + } + dcp.writePackage(outDir, useGofmt) if err := dcp.writePackage(outDir, useGofmt); err != nil { log.Printf("Error writing package %q: %v", dcp.Metadata.Name, err) + continue NEXT_DCP } } } -// DCP contains extra metadata to use when generating DCP source files. -type DCPMetadata struct { - 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. +func fallbackStrValue(defaultValue string, values ...string) string { + for _, v := range values { + if v != "" { + return v + } + } + return defaultValue } -var dcpMetadataByDir = map[string]DCPMetadata{ - "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", - }, -} +func acquireFile(specFilename string, xmlSpecURL string) error { + if f, err := os.Open(specFilename); err != nil { + if !os.IsNotExist(err) { + return err + } + } else { + f.Close() + return nil + } -type dcpCollection struct { - dcpByAlias map[string]*DCP -} + resp, err := http.Get(xmlSpecURL) + if err != nil { + return err + } + defer resp.Body.Close() -func newDcpsCollection() *dcpCollection { - c := &dcpCollection{ - dcpByAlias: make(map[string]*DCP), + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("could not download spec %q from %q: ", + specFilename, xmlSpecURL, resp.Status) } - for _, metadata := range dcpMetadataByDir { - c.dcpByAlias[metadata.Name] = newDCP(metadata) + + tmpFilename := specFilename + ".download" + w, err := os.Create(tmpFilename) + if err != nil { + return err } - return c -} + defer w.Close() -func (c *dcpCollection) dcpForDir(dirName string) *DCP { - metadata, ok := dcpMetadataByDir[dirName] - if !ok { - return nil + _, err = io.Copy(w, resp.Body) + if err != nil { + return err } - return c.dcpByAlias[metadata.Name] + + return os.Rename(tmpFilename, specFilename) } // DCP collects together information about a UPnP Device Control Protocol. @@ -151,33 +183,37 @@ func newDCP(metadata DCPMetadata) *DCP { } } -func (dcp *DCP) processZipFile(file *zip.File) { - archive, err := openChildZip(file) +func (dcp *DCP) processZipFile(filename string) error { + archive, err := zip.OpenReader(filename) if err != nil { - log.Println("Error reading child zip file:", err) - return + return fmt.Errorf("error reading zip file %q: %v", filename, err) } + defer archive.Close() for _, deviceFile := range globFiles("*/device/*.xml", archive) { - dcp.processDeviceFile(deviceFile) + if err := dcp.processDeviceFile(deviceFile); err != nil { + return err + } } for _, scpdFile := range globFiles("*/service/*.xml", archive) { - dcp.processSCPDFile(scpdFile) + if err := dcp.processSCPDFile(scpdFile); err != nil { + return err + } } + return nil } -func (dcp *DCP) processDeviceFile(file *zip.File) { +func (dcp *DCP) processDeviceFile(file *zip.File) error { var device goupnp.Device if err := unmarshalXmlFile(file, &device); err != nil { - log.Printf("Error decoding device XML from file %q: %v", file.Name, err) - return + return fmt.Errorf("error decoding device XML from file %q: %v", file.Name, err) } + var mainErr error device.VisitDevices(func(d *goupnp.Device) { t := strings.TrimSpace(d.DeviceType) if t != "" { u, err := extractURNParts(t, deviceURNPrefix) if err != nil { - log.Println(err) - return + mainErr = err } dcp.DeviceTypes[t] = u } @@ -185,11 +221,11 @@ func (dcp *DCP) processDeviceFile(file *zip.File) { device.VisitServices(func(s *goupnp.Service) { u, err := extractURNParts(s.ServiceType, serviceURNPrefix) if err != nil { - log.Println(err) - return + mainErr = err } dcp.ServiceTypes[s.ServiceType] = u }) + return mainErr } func (dcp *DCP) writePackage(outDir string, useGofmt bool) error { @@ -217,22 +253,21 @@ func (dcp *DCP) writePackage(outDir string, useGofmt bool) error { return output.Close() } -func (dcp *DCP) processSCPDFile(file *zip.File) { +func (dcp *DCP) processSCPDFile(file *zip.File) error { scpd := new(scpd.SCPD) if err := unmarshalXmlFile(file, scpd); err != nil { - log.Printf("Error decoding SCPD XML from file %q: %v", file.Name, err) - return + return fmt.Errorf("error decoding SCPD XML from file %q: %v", file.Name, err) } scpd.Clean() urnParts, err := urnPartsFromSCPDFilename(file.Name) if err != nil { - log.Printf("Could not recognize SCPD filename %q: %v", file.Name, err) - return + return fmt.Errorf("could not recognize SCPD filename %q: %v", file.Name, err) } dcp.Services = append(dcp.Services, SCPDWithURN{ URNParts: urnParts, SCPD: scpd, }) + return nil } type SCPDWithURN struct { @@ -240,7 +275,19 @@ type SCPDWithURN struct { SCPD *scpd.SCPD } -func (s *SCPDWithURN) WrapArgument(arg scpd.Argument) (*argumentWrapper, error) { +func (s *SCPDWithURN) WrapArguments(args []*scpd.Argument) (argumentWrapperList, error) { + wrappedArgs := make(argumentWrapperList, len(args)) + for i, arg := range args { + wa, err := s.wrapArgument(arg) + if err != nil { + return nil, err + } + wrappedArgs[i] = wa + } + return wrappedArgs, nil +} + +func (s *SCPDWithURN) wrapArgument(arg *scpd.Argument) (*argumentWrapper, error) { relVar := s.SCPD.GetStateVariable(arg.RelatedStateVariable) if relVar == nil { return nil, fmt.Errorf("no such state variable: %q, for argument %q", arg.RelatedStateVariable, arg.Name) @@ -250,7 +297,7 @@ func (s *SCPDWithURN) WrapArgument(arg scpd.Argument) (*argumentWrapper, error) return nil, fmt.Errorf("unknown data type: %q, for state variable %q, for argument %q", relVar.DataType.Type, arg.RelatedStateVariable, arg.Name) } return &argumentWrapper{ - Argument: arg, + Argument: *arg, relVar: relVar, conv: cnv, }, nil @@ -266,6 +313,12 @@ func (arg *argumentWrapper) AsParameter() string { return fmt.Sprintf("%s %s", arg.Name, arg.conv.ExtType) } +func (arg *argumentWrapper) HasDoc() bool { + rng := arg.relVar.AllowedValueRange + return ((rng != nil && (rng.Minimum != "" || rng.Maximum != "" || rng.Step != "")) || + len(arg.relVar.AllowedValues) > 0) +} + func (arg *argumentWrapper) Document() string { relVar := arg.relVar if rng := relVar.AllowedValueRange; rng != nil { @@ -295,6 +348,17 @@ func (arg *argumentWrapper) Unmarshal(objVar string) string { return fmt.Sprintf("soap.Unmarshal%s(%s.%s)", arg.conv.FuncSuffix, objVar, arg.Name) } +type argumentWrapperList []*argumentWrapper + +func (args argumentWrapperList) HasDoc() bool { + for _, arg := range args { + if arg.HasDoc() { + return true + } + } + return false +} + type conv struct { FuncSuffix string ExtType string @@ -325,49 +389,10 @@ var typeConvs = map[string]conv{ "boolean": conv{"Boolean", "bool"}, "bin.base64": conv{"BinBase64", "[]byte"}, "bin.hex": conv{"BinHex", "[]byte"}, + "uri": conv{"URI", "*url.URL"}, } -type closeableZipReader struct { - io.Closer - *zip.Reader -} - -func openZipfile(filename string) (*closeableZipReader, error) { - file, err := os.Open(filename) - if err != nil { - return nil, err - } - fi, err := file.Stat() - if err != nil { - return nil, err - } - archive, err := zip.NewReader(file, fi.Size()) - if err != nil { - return nil, err - } - return &closeableZipReader{ - Closer: file, - Reader: archive, - }, nil -} - -// openChildZip opens a zip file within another zip file. -func openChildZip(file *zip.File) (*zip.Reader, error) { - zipFile, err := file.Open() - if err != nil { - return nil, err - } - defer zipFile.Close() - - zipBytes, err := ioutil.ReadAll(zipFile) - if err != nil { - return nil, err - } - - return zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes))) -} - -func globFiles(pattern string, archive *zip.Reader) []*zip.File { +func globFiles(pattern string, archive *zip.ReadCloser) []*zip.File { var files []*zip.File for _, f := range archive.File { if matched, err := path.Match(pattern, f.Name); err != nil { @@ -435,14 +460,14 @@ var packageTmpl = template.Must(template.New("package").Parse(`{{$name := .Metad // {{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. +// Typically, use one of the New* functions to create clients for services. package {{$name}} // Generated file - do not edit by hand. See README.md import ( + "net/url" "time" "github.com/huin/goupnp" @@ -484,38 +509,77 @@ func New{{$srvIdent}}Clients() (clients []*{{$srvIdent}}, errors []error, err er if genericClients, errors, err = goupnp.NewServiceClients({{$srv.Const}}); err != nil { return } - clients = make([]*{{$srvIdent}}, len(genericClients)) + clients = new{{$srvIdent}}ClientsFromGenericClients(genericClients) + return +} + +// New{{$srvIdent}}ClientsByURL discovers instances of the service at the given +// URL, and returns clients to any that are found. An error is returned if +// there was an error probing the service. +// +// This is a typical entry calling point into this package when reusing an +// previously discovered service URL. +func New{{$srvIdent}}ClientsByURL(loc *url.URL) ([]*{{$srvIdent}}, error) { + genericClients, err := goupnp.NewServiceClientsByURL(loc, {{$srv.Const}}) + if err != nil { + return nil, err + } + return new{{$srvIdent}}ClientsFromGenericClients(genericClients), nil +} + +// New{{$srvIdent}}ClientsFromRootDevice discovers instances of the service in +// a given root device, and returns clients to any that are found. An error is +// returned if there was not at least one instance of the service within the +// device. The location parameter is simply assigned to the Location attribute +// of the wrapped ServiceClient(s). +// +// This is a typical entry calling point into this package when reusing an +// previously discovered root device. +func New{{$srvIdent}}ClientsFromRootDevice(rootDevice *goupnp.RootDevice, loc *url.URL) ([]*{{$srvIdent}}, error) { + genericClients, err := goupnp.NewServiceClientsFromRootDevice(rootDevice, loc, {{$srv.Const}}) + if err != nil { + return nil, err + } + return new{{$srvIdent}}ClientsFromGenericClients(genericClients), nil +} + +func new{{$srvIdent}}ClientsFromGenericClients(genericClients []goupnp.ServiceClient) []*{{$srvIdent}} { + clients := make([]*{{$srvIdent}}, len(genericClients)) for i := range genericClients { clients[i] = &{{$srvIdent}}{genericClients[i]} } - return + return clients } {{range .SCPD.Actions}}{{/* loops over *SCPDWithURN values */}} -{{$inargs := .InputArguments}}{{$outargs := .OutputArguments}} -// {{if $inargs}}Arguments:{{range $inargs}}{{$argWrap := $srv.WrapArgument .}} +{{$winargs := $srv.WrapArguments .InputArguments}} +{{$woutargs := $srv.WrapArguments .OutputArguments}} +{{if $winargs.HasDoc}} +// +// Arguments:{{range $winargs}}{{if .HasDoc}} // -// * {{.Name}}: {{$argWrap.Document}}{{end}}{{end}} +// * {{.Name}}: {{.Document}}{{end}}{{end}}{{end}} +{{if $woutargs.HasDoc}} // -// {{if $outargs}}Return values:{{range $outargs}}{{$argWrap := $srv.WrapArgument .}} +// Return values:{{range $woutargs}}{{if .HasDoc}} // -// * {{.Name}}: {{$argWrap.Document}}{{end}}{{end}} -func (client *{{$srvIdent}}) {{.Name}}({{range $inargs}}{{/* -*/}}{{$argWrap := $srv.WrapArgument .}}{{$argWrap.AsParameter}}, {{end}}{{/* -*/}}) ({{range $outargs}}{{/* -*/}}{{$argWrap := $srv.WrapArgument .}}{{$argWrap.AsParameter}}, {{end}} err error) { +// * {{.Name}}: {{.Document}}{{end}}{{end}}{{end}} +func (client *{{$srvIdent}}) {{.Name}}({{range $winargs}}{{/* +*/}}{{.AsParameter}}, {{end}}{{/* +*/}}) ({{range $woutargs}}{{/* +*/}}{{.AsParameter}}, {{end}} err error) { // Request structure. - request := {{if $inargs}}&{{template "argstruct" $inargs}}{{"{}"}}{{else}}{{"interface{}(nil)"}}{{end}} + request := {{if $winargs}}&{{template "argstruct" $winargs}}{{"{}"}}{{else}}{{"interface{}(nil)"}}{{end}} // BEGIN Marshal arguments into request. -{{range $inargs}}{{$argWrap := $srv.WrapArgument .}} - if request.{{.Name}}, err = {{$argWrap.Marshal}}; err != nil { +{{range $winargs}} + if request.{{.Name}}, err = {{.Marshal}}; err != nil { return }{{end}} // END Marshal arguments into request. // Response structure. - response := {{if $outargs}}&{{template "argstruct" $outargs}}{{"{}"}}{{else}}{{"interface{}(nil)"}}{{end}} + response := {{if $woutargs}}&{{template "argstruct" $woutargs}}{{"{}"}}{{else}}{{"interface{}(nil)"}}{{end}} // Perform the SOAP call. if err = client.SOAPClient.PerformAction({{$srv.URNParts.Const}}, "{{.Name}}", request, response); err != nil { @@ -523,8 +587,8 @@ func (client *{{$srvIdent}}) {{.Name}}({{range $inargs}}{{/* } // BEGIN Unmarshal arguments from response. -{{range $outargs}}{{$argWrap := $srv.WrapArgument .}} - if {{.Name}}, err = {{$argWrap.Unmarshal "response"}}; err != nil { +{{range $woutargs}} + if {{.Name}}, err = {{.Unmarshal "response"}}; err != nil { return }{{end}} // END Unmarshal arguments from response. diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go b/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go index 7799a32ce..fcb8dcd23 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go @@ -20,6 +20,7 @@ import ( "net/http" "net/url" "time" + "golang.org/x/net/html/charset" "github.com/huin/goupnp/httpu" @@ -38,8 +39,16 @@ func (err ContextError) Error() string { // MaybeRootDevice contains either a RootDevice or an error. type MaybeRootDevice struct { + // Set iff Err == nil. Root *RootDevice - Err error + + // The location the device was discovered at. This can be used with + // DeviceByURL, assuming the device is still present. A location represents + // the discovery of a device, regardless of if there was an error probing it. + Location *url.URL + + // Any error encountered probing a discovered device. + Err error } // DiscoverDevices attempts to find targets of the given type. This is @@ -67,30 +76,37 @@ func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) { maybe.Err = ContextError{"unexpected bad location from search", err} continue } - locStr := loc.String() - root := new(RootDevice) - if err := requestXml(locStr, DeviceXMLNamespace, root); err != nil { - maybe.Err = ContextError{fmt.Sprintf("error requesting root device details from %q", locStr), err} - continue - } - var urlBaseStr string - if root.URLBaseStr != "" { - urlBaseStr = root.URLBaseStr + maybe.Location = loc + if root, err := DeviceByURL(loc); err != nil { + maybe.Err = err } else { - urlBaseStr = locStr - } - urlBase, err := url.Parse(urlBaseStr) - if err != nil { - maybe.Err = ContextError{fmt.Sprintf("error parsing location URL %q", locStr), err} - continue + maybe.Root = root } - root.SetURLBase(urlBase) - maybe.Root = root } return results, nil } +func DeviceByURL(loc *url.URL) (*RootDevice, error) { + locStr := loc.String() + root := new(RootDevice) + if err := requestXml(locStr, DeviceXMLNamespace, root); err != nil { + return nil, ContextError{fmt.Sprintf("error requesting root device details from %q", locStr), err} + } + var urlBaseStr string + if root.URLBaseStr != "" { + urlBaseStr = root.URLBaseStr + } else { + urlBaseStr = locStr + } + urlBase, err := url.Parse(urlBaseStr) + if err != nil { + return nil, ContextError{fmt.Sprintf("error parsing location URL %q", locStr), err} + } + root.SetURLBase(urlBase) + return root, nil +} + func requestXml(url string, defaultSpace string, doc interface{}) error { timeout := time.Duration(3 * time.Second) client := http.Client{ diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/service_client.go b/Godeps/_workspace/src/github.com/huin/goupnp/service_client.go index c0d16ce2a..9111c93cb 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/service_client.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/service_client.go @@ -2,18 +2,26 @@ package goupnp import ( "fmt" + "net/url" + "github.com/huin/goupnp/soap" ) // ServiceClient is a SOAP client, root device and the service for the SOAP -// client rolled into one value. The root device and service are intended to be -// informational. +// client rolled into one value. The root device, location, and service are +// intended to be informational. Location can be used to later recreate a +// ServiceClient with NewServiceClientByURL if the service is still present; +// bypassing the discovery process. type ServiceClient struct { SOAPClient *soap.SOAPClient RootDevice *RootDevice + Location *url.URL Service *Service } +// NewServiceClients discovers services, and returns clients for them. err will +// report any error with the discovery process (blocking any device/service +// discovery), errors reports errors on a per-root-device basis. func NewServiceClients(searchTarget string) (clients []ServiceClient, errors []error, err error) { var maybeRootDevices []MaybeRootDevice if maybeRootDevices, err = DiscoverDevices(searchTarget); err != nil { @@ -28,26 +36,50 @@ func NewServiceClients(searchTarget string) (clients []ServiceClient, errors []e continue } - device := &maybeRootDevice.Root.Device - srvs := device.FindService(searchTarget) - if len(srvs) == 0 { - errors = append(errors, fmt.Errorf("goupnp: service %q not found within device %q (UDN=%q)", - searchTarget, device.FriendlyName, device.UDN)) + deviceClients, err := NewServiceClientsFromRootDevice(maybeRootDevice.Root, maybeRootDevice.Location, searchTarget) + if err != nil { + errors = append(errors, err) continue } - - for _, srv := range srvs { - clients = append(clients, ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: maybeRootDevice.Root, - Service: srv, - }) - } + clients = append(clients, deviceClients...) } return } +// NewServiceClientsByURL creates client(s) for the given service URN, for a +// root device at the given URL. +func NewServiceClientsByURL(loc *url.URL, searchTarget string) ([]ServiceClient, error) { + rootDevice, err := DeviceByURL(loc) + if err != nil { + return nil, err + } + return NewServiceClientsFromRootDevice(rootDevice, loc, searchTarget) +} + +// NewServiceClientsFromDevice creates client(s) for the given service URN, in +// a given root device. The loc parameter is simply assigned to the +// Location attribute of the returned ServiceClient(s). +func NewServiceClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL, searchTarget string) ([]ServiceClient, error) { + device := &rootDevice.Device + srvs := device.FindService(searchTarget) + if len(srvs) == 0 { + return nil, fmt.Errorf("goupnp: service %q not found within device %q (UDN=%q)", + searchTarget, device.FriendlyName, device.UDN) + } + + clients := make([]ServiceClient, 0, len(srvs)) + for _, srv := range srvs { + clients = append(clients, ServiceClient{ + SOAPClient: srv.NewSOAPClient(), + RootDevice: rootDevice, + Location: loc, + Service: srv, + }) + } + return clients, nil +} + // GetServiceClient returns the ServiceClient itself. This is provided so that the // service client attributes can be accessed via an interface method on a // wrapping type. diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap_test.go b/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap_test.go deleted file mode 100644 index 75dbbdbf1..000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package soap - -import ( - "bytes" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" -) - -type capturingRoundTripper struct { - err error - resp *http.Response - capturedReq *http.Request -} - -func (rt *capturingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - rt.capturedReq = req - return rt.resp, rt.err -} - -func TestActionInputs(t *testing.T) { - url, err := url.Parse("http://example.com/soap") - if err != nil { - t.Fatal(err) - } - rt := &capturingRoundTripper{ - err: nil, - resp: &http.Response{ - StatusCode: 200, - Body: ioutil.NopCloser(bytes.NewBufferString(` - <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> - <s:Body> - <u:myactionResponse xmlns:u="mynamespace"> - <A>valueA</A> - <B>valueB</B> - </u:myactionResponse> - </s:Body> - </s:Envelope> - `)), - }, - } - client := SOAPClient{ - EndpointURL: *url, - HTTPClient: http.Client{ - Transport: rt, - }, - } - - type In struct { - Foo string - Bar string `soap:"bar"` - } - type Out struct { - A string - B string - } - in := In{"foo", "bar"} - gotOut := Out{} - err = client.PerformAction("mynamespace", "myaction", &in, &gotOut) - if err != nil { - t.Fatal(err) - } - - wantBody := (soapPrefix + - `<u:myaction xmlns:u="mynamespace">` + - `<Foo>foo</Foo>` + - `<bar>bar</bar>` + - `</u:myaction>` + - soapSuffix) - body, err := ioutil.ReadAll(rt.capturedReq.Body) - if err != nil { - t.Fatal(err) - } - gotBody := string(body) - if wantBody != gotBody { - t.Errorf("Bad request body\nwant: %q\n got: %q", wantBody, gotBody) - } - - wantOut := Out{"valueA", "valueB"} - if !reflect.DeepEqual(wantOut, gotOut) { - t.Errorf("Bad output\nwant: %+v\n got: %+v", wantOut, gotOut) - } -} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/types.go b/Godeps/_workspace/src/github.com/huin/goupnp/soap/types.go index cd16510e3..fdbeec8d4 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/soap/types.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/soap/types.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "errors" "fmt" + "net/url" "regexp" "strconv" "strings" @@ -506,3 +507,13 @@ func MarshalBinHex(v []byte) (string, error) { func UnmarshalBinHex(s string) ([]byte, error) { return hex.DecodeString(s) } + +// MarshalURI marshals *url.URL to SOAP "uri" type. +func MarshalURI(v *url.URL) (string, error) { + return v.String(), nil +} + +// UnmarshalURI unmarshals *url.URL from the SOAP "uri" type. +func UnmarshalURI(s string) (*url.URL, error) { + return url.Parse(s) +} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/types_test.go b/Godeps/_workspace/src/github.com/huin/goupnp/soap/types_test.go deleted file mode 100644 index da6816190..000000000 --- a/Godeps/_workspace/src/github.com/huin/goupnp/soap/types_test.go +++ /dev/null @@ -1,481 +0,0 @@ -package soap - -import ( - "bytes" - "math" - "testing" - "time" -) - -type convTest interface { - Marshal() (string, error) - Unmarshal(string) (interface{}, error) - Equal(result interface{}) bool -} - -// duper is an interface that convTest values may optionally also implement to -// generate another convTest for a value in an otherwise identical testCase. -type duper interface { - Dupe(tag string) []convTest -} - -type testCase struct { - value convTest - str string - wantMarshalErr bool - wantUnmarshalErr bool - noMarshal bool - noUnMarshal bool - tag string -} - -type Ui1Test uint8 - -func (v Ui1Test) Marshal() (string, error) { - return MarshalUi1(uint8(v)) -} -func (v Ui1Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalUi1(s) -} -func (v Ui1Test) Equal(result interface{}) bool { - return uint8(v) == result.(uint8) -} -func (v Ui1Test) Dupe(tag string) []convTest { - if tag == "dupe" { - return []convTest{ - Ui2Test(v), - Ui4Test(v), - } - } - return nil -} - -type Ui2Test uint16 - -func (v Ui2Test) Marshal() (string, error) { - return MarshalUi2(uint16(v)) -} -func (v Ui2Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalUi2(s) -} -func (v Ui2Test) Equal(result interface{}) bool { - return uint16(v) == result.(uint16) -} - -type Ui4Test uint32 - -func (v Ui4Test) Marshal() (string, error) { - return MarshalUi4(uint32(v)) -} -func (v Ui4Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalUi4(s) -} -func (v Ui4Test) Equal(result interface{}) bool { - return uint32(v) == result.(uint32) -} - -type I1Test int8 - -func (v I1Test) Marshal() (string, error) { - return MarshalI1(int8(v)) -} -func (v I1Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalI1(s) -} -func (v I1Test) Equal(result interface{}) bool { - return int8(v) == result.(int8) -} -func (v I1Test) Dupe(tag string) []convTest { - if tag == "dupe" { - return []convTest{ - I2Test(v), - I4Test(v), - } - } - return nil -} - -type I2Test int16 - -func (v I2Test) Marshal() (string, error) { - return MarshalI2(int16(v)) -} -func (v I2Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalI2(s) -} -func (v I2Test) Equal(result interface{}) bool { - return int16(v) == result.(int16) -} - -type I4Test int32 - -func (v I4Test) Marshal() (string, error) { - return MarshalI4(int32(v)) -} -func (v I4Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalI4(s) -} -func (v I4Test) Equal(result interface{}) bool { - return int32(v) == result.(int32) -} - -type IntTest int64 - -func (v IntTest) Marshal() (string, error) { - return MarshalInt(int64(v)) -} -func (v IntTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalInt(s) -} -func (v IntTest) Equal(result interface{}) bool { - return int64(v) == result.(int64) -} - -type Fixed14_4Test float64 - -func (v Fixed14_4Test) Marshal() (string, error) { - return MarshalFixed14_4(float64(v)) -} -func (v Fixed14_4Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalFixed14_4(s) -} -func (v Fixed14_4Test) Equal(result interface{}) bool { - return math.Abs(float64(v)-result.(float64)) < 0.001 -} - -type CharTest rune - -func (v CharTest) Marshal() (string, error) { - return MarshalChar(rune(v)) -} -func (v CharTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalChar(s) -} -func (v CharTest) Equal(result interface{}) bool { - return rune(v) == result.(rune) -} - -type DateTest struct{ time.Time } - -func (v DateTest) Marshal() (string, error) { - return MarshalDate(time.Time(v.Time)) -} -func (v DateTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalDate(s) -} -func (v DateTest) Equal(result interface{}) bool { - return v.Time.Equal(result.(time.Time)) -} -func (v DateTest) Dupe(tag string) []convTest { - if tag != "no:dateTime" { - return []convTest{DateTimeTest{v.Time}} - } - return nil -} - -type TimeOfDayTest struct { - TimeOfDay -} - -func (v TimeOfDayTest) Marshal() (string, error) { - return MarshalTimeOfDay(v.TimeOfDay) -} -func (v TimeOfDayTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalTimeOfDay(s) -} -func (v TimeOfDayTest) Equal(result interface{}) bool { - return v.TimeOfDay == result.(TimeOfDay) -} -func (v TimeOfDayTest) Dupe(tag string) []convTest { - if tag != "no:time.tz" { - return []convTest{TimeOfDayTzTest{v.TimeOfDay}} - } - return nil -} - -type TimeOfDayTzTest struct { - TimeOfDay -} - -func (v TimeOfDayTzTest) Marshal() (string, error) { - return MarshalTimeOfDayTz(v.TimeOfDay) -} -func (v TimeOfDayTzTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalTimeOfDayTz(s) -} -func (v TimeOfDayTzTest) Equal(result interface{}) bool { - return v.TimeOfDay == result.(TimeOfDay) -} - -type DateTimeTest struct{ time.Time } - -func (v DateTimeTest) Marshal() (string, error) { - return MarshalDateTime(time.Time(v.Time)) -} -func (v DateTimeTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalDateTime(s) -} -func (v DateTimeTest) Equal(result interface{}) bool { - return v.Time.Equal(result.(time.Time)) -} -func (v DateTimeTest) Dupe(tag string) []convTest { - if tag != "no:dateTime.tz" { - return []convTest{DateTimeTzTest{v.Time}} - } - return nil -} - -type DateTimeTzTest struct{ time.Time } - -func (v DateTimeTzTest) Marshal() (string, error) { - return MarshalDateTimeTz(time.Time(v.Time)) -} -func (v DateTimeTzTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalDateTimeTz(s) -} -func (v DateTimeTzTest) Equal(result interface{}) bool { - return v.Time.Equal(result.(time.Time)) -} - -type BooleanTest bool - -func (v BooleanTest) Marshal() (string, error) { - return MarshalBoolean(bool(v)) -} -func (v BooleanTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalBoolean(s) -} -func (v BooleanTest) Equal(result interface{}) bool { - return bool(v) == result.(bool) -} - -type BinBase64Test []byte - -func (v BinBase64Test) Marshal() (string, error) { - return MarshalBinBase64([]byte(v)) -} -func (v BinBase64Test) Unmarshal(s string) (interface{}, error) { - return UnmarshalBinBase64(s) -} -func (v BinBase64Test) Equal(result interface{}) bool { - return bytes.Equal([]byte(v), result.([]byte)) -} - -type BinHexTest []byte - -func (v BinHexTest) Marshal() (string, error) { - return MarshalBinHex([]byte(v)) -} -func (v BinHexTest) Unmarshal(s string) (interface{}, error) { - return UnmarshalBinHex(s) -} -func (v BinHexTest) Equal(result interface{}) bool { - return bytes.Equal([]byte(v), result.([]byte)) -} - -func Test(t *testing.T) { - const time010203 time.Duration = (1*3600 + 2*60 + 3) * time.Second - const time0102 time.Duration = (1*3600 + 2*60) * time.Second - const time01 time.Duration = (1 * 3600) * time.Second - const time235959 time.Duration = (23*3600 + 59*60 + 59) * time.Second - - // Fake out the local time for the implementation. - localLoc = time.FixedZone("Fake/Local", 6*3600) - defer func() { - localLoc = time.Local - }() - - tests := []testCase{ - // ui1 - {str: "", value: Ui1Test(0), wantUnmarshalErr: true, noMarshal: true, tag: "dupe"}, - {str: " ", value: Ui1Test(0), wantUnmarshalErr: true, noMarshal: true, tag: "dupe"}, - {str: "abc", value: Ui1Test(0), wantUnmarshalErr: true, noMarshal: true, tag: "dupe"}, - {str: "-1", value: Ui1Test(0), wantUnmarshalErr: true, noMarshal: true, tag: "dupe"}, - {str: "0", value: Ui1Test(0), tag: "dupe"}, - {str: "1", value: Ui1Test(1), tag: "dupe"}, - {str: "255", value: Ui1Test(255), tag: "dupe"}, - {str: "256", value: Ui1Test(0), wantUnmarshalErr: true, noMarshal: true}, - - // ui2 - {str: "65535", value: Ui2Test(65535)}, - {str: "65536", value: Ui2Test(0), wantUnmarshalErr: true, noMarshal: true}, - - // ui4 - {str: "4294967295", value: Ui4Test(4294967295)}, - {str: "4294967296", value: Ui4Test(0), wantUnmarshalErr: true, noMarshal: true}, - - // i1 - {str: "", value: I1Test(0), wantUnmarshalErr: true, noMarshal: true, tag: "dupe"}, - {str: " ", value: I1Test(0), wantUnmarshalErr: true, noMarshal: true, tag: "dupe"}, - {str: "abc", value: I1Test(0), wantUnmarshalErr: true, noMarshal: true, tag: "dupe"}, - {str: "0", value: I1Test(0), tag: "dupe"}, - {str: "-1", value: I1Test(-1), tag: "dupe"}, - {str: "127", value: I1Test(127), tag: "dupe"}, - {str: "-128", value: I1Test(-128), tag: "dupe"}, - {str: "128", value: I1Test(0), wantUnmarshalErr: true, noMarshal: true}, - {str: "-129", value: I1Test(0), wantUnmarshalErr: true, noMarshal: true}, - - // i2 - {str: "32767", value: I2Test(32767)}, - {str: "-32768", value: I2Test(-32768)}, - {str: "32768", value: I2Test(0), wantUnmarshalErr: true, noMarshal: true}, - {str: "-32769", value: I2Test(0), wantUnmarshalErr: true, noMarshal: true}, - - // i4 - {str: "2147483647", value: I4Test(2147483647)}, - {str: "-2147483648", value: I4Test(-2147483648)}, - {str: "2147483648", value: I4Test(0), wantUnmarshalErr: true, noMarshal: true}, - {str: "-2147483649", value: I4Test(0), wantUnmarshalErr: true, noMarshal: true}, - - // int - {str: "9223372036854775807", value: IntTest(9223372036854775807)}, - {str: "-9223372036854775808", value: IntTest(-9223372036854775808)}, - {str: "9223372036854775808", value: IntTest(0), wantUnmarshalErr: true, noMarshal: true}, - {str: "-9223372036854775809", value: IntTest(0), wantUnmarshalErr: true, noMarshal: true}, - - // fixed.14.4 - {str: "0.0000", value: Fixed14_4Test(0)}, - {str: "1.0000", value: Fixed14_4Test(1)}, - {str: "1.2346", value: Fixed14_4Test(1.23456)}, - {str: "-1.0000", value: Fixed14_4Test(-1)}, - {str: "-1.2346", value: Fixed14_4Test(-1.23456)}, - {str: "10000000000000.0000", value: Fixed14_4Test(1e13)}, - {str: "100000000000000.0000", value: Fixed14_4Test(1e14), wantMarshalErr: true, wantUnmarshalErr: true}, - {str: "-10000000000000.0000", value: Fixed14_4Test(-1e13)}, - {str: "-100000000000000.0000", value: Fixed14_4Test(-1e14), wantMarshalErr: true, wantUnmarshalErr: true}, - - // char - {str: "a", value: CharTest('a')}, - {str: "z", value: CharTest('z')}, - {str: "\u1234", value: CharTest(0x1234)}, - {str: "aa", value: CharTest(0), wantMarshalErr: true, wantUnmarshalErr: true}, - {str: "", value: CharTest(0), wantMarshalErr: true, wantUnmarshalErr: true}, - - // date - {str: "2013-10-08", value: DateTest{time.Date(2013, 10, 8, 0, 0, 0, 0, localLoc)}, tag: "no:dateTime"}, - {str: "20131008", value: DateTest{time.Date(2013, 10, 8, 0, 0, 0, 0, localLoc)}, noMarshal: true, tag: "no:dateTime"}, - {str: "2013-10-08T10:30:50", value: DateTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime"}, - {str: "2013-10-08T10:30:50Z", value: DateTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime"}, - {str: "", value: DateTest{}, wantMarshalErr: true, wantUnmarshalErr: true, noMarshal: true}, - {str: "-1", value: DateTest{}, wantUnmarshalErr: true, noMarshal: true}, - - // time - {str: "00:00:00", value: TimeOfDayTest{TimeOfDay{FromMidnight: 0}}}, - {str: "000000", value: TimeOfDayTest{TimeOfDay{FromMidnight: 0}}, noMarshal: true}, - {str: "24:00:00", value: TimeOfDayTest{TimeOfDay{FromMidnight: 24 * time.Hour}}, noMarshal: true}, // ISO8601 special case - {str: "24:01:00", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true}, - {str: "24:00:01", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true}, - {str: "25:00:00", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true}, - {str: "00:60:00", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true}, - {str: "00:00:60", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true}, - {str: "01:02:03", value: TimeOfDayTest{TimeOfDay{FromMidnight: time010203}}}, - {str: "010203", value: TimeOfDayTest{TimeOfDay{FromMidnight: time010203}}, noMarshal: true}, - {str: "23:59:59", value: TimeOfDayTest{TimeOfDay{FromMidnight: time235959}}}, - {str: "235959", value: TimeOfDayTest{TimeOfDay{FromMidnight: time235959}}, noMarshal: true}, - {str: "01:02", value: TimeOfDayTest{TimeOfDay{FromMidnight: time0102}}, noMarshal: true}, - {str: "0102", value: TimeOfDayTest{TimeOfDay{FromMidnight: time0102}}, noMarshal: true}, - {str: "01", value: TimeOfDayTest{TimeOfDay{FromMidnight: time01}}, noMarshal: true}, - {str: "foo 01:02:03", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "foo\n01:02:03", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03 foo", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03\nfoo", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03Z", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03+01", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03+01:23", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03+0123", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03-01", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03-01:23", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - {str: "01:02:03-0123", value: TimeOfDayTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:time.tz"}, - - // time.tz - {str: "24:00:01", value: TimeOfDayTzTest{}, wantUnmarshalErr: true, noMarshal: true}, - {str: "01Z", value: TimeOfDayTzTest{TimeOfDay{time01, true, 0}}, noMarshal: true}, - {str: "01:02:03Z", value: TimeOfDayTzTest{TimeOfDay{time010203, true, 0}}}, - {str: "01+01", value: TimeOfDayTzTest{TimeOfDay{time01, true, 3600}}, noMarshal: true}, - {str: "01:02:03+01", value: TimeOfDayTzTest{TimeOfDay{time010203, true, 3600}}, noMarshal: true}, - {str: "01:02:03+01:23", value: TimeOfDayTzTest{TimeOfDay{time010203, true, 3600 + 23*60}}}, - {str: "01:02:03+0123", value: TimeOfDayTzTest{TimeOfDay{time010203, true, 3600 + 23*60}}, noMarshal: true}, - {str: "01:02:03-01", value: TimeOfDayTzTest{TimeOfDay{time010203, true, -3600}}, noMarshal: true}, - {str: "01:02:03-01:23", value: TimeOfDayTzTest{TimeOfDay{time010203, true, -(3600 + 23*60)}}}, - {str: "01:02:03-0123", value: TimeOfDayTzTest{TimeOfDay{time010203, true, -(3600 + 23*60)}}, noMarshal: true}, - - // dateTime - {str: "2013-10-08T00:00:00", value: DateTimeTest{time.Date(2013, 10, 8, 0, 0, 0, 0, localLoc)}, tag: "no:dateTime.tz"}, - {str: "20131008", value: DateTimeTest{time.Date(2013, 10, 8, 0, 0, 0, 0, localLoc)}, noMarshal: true}, - {str: "2013-10-08T10:30:50", value: DateTimeTest{time.Date(2013, 10, 8, 10, 30, 50, 0, localLoc)}, tag: "no:dateTime.tz"}, - {str: "2013-10-08T10:30:50T", value: DateTimeTest{}, wantUnmarshalErr: true, noMarshal: true}, - {str: "2013-10-08T10:30:50+01", value: DateTimeTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime.tz"}, - {str: "2013-10-08T10:30:50+01:23", value: DateTimeTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime.tz"}, - {str: "2013-10-08T10:30:50+0123", value: DateTimeTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime.tz"}, - {str: "2013-10-08T10:30:50-01", value: DateTimeTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime.tz"}, - {str: "2013-10-08T10:30:50-01:23", value: DateTimeTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime.tz"}, - {str: "2013-10-08T10:30:50-0123", value: DateTimeTest{}, wantUnmarshalErr: true, noMarshal: true, tag: "no:dateTime.tz"}, - - // dateTime.tz - {str: "2013-10-08T10:30:50", value: DateTimeTzTest{time.Date(2013, 10, 8, 10, 30, 50, 0, localLoc)}, noMarshal: true}, - {str: "2013-10-08T10:30:50+01", value: DateTimeTzTest{time.Date(2013, 10, 8, 10, 30, 50, 0, time.FixedZone("+01:00", 3600))}, noMarshal: true}, - {str: "2013-10-08T10:30:50+01:23", value: DateTimeTzTest{time.Date(2013, 10, 8, 10, 30, 50, 0, time.FixedZone("+01:23", 3600+23*60))}}, - {str: "2013-10-08T10:30:50+0123", value: DateTimeTzTest{time.Date(2013, 10, 8, 10, 30, 50, 0, time.FixedZone("+01:23", 3600+23*60))}, noMarshal: true}, - {str: "2013-10-08T10:30:50-01", value: DateTimeTzTest{time.Date(2013, 10, 8, 10, 30, 50, 0, time.FixedZone("-01:00", -3600))}, noMarshal: true}, - {str: "2013-10-08T10:30:50-01:23", value: DateTimeTzTest{time.Date(2013, 10, 8, 10, 30, 50, 0, time.FixedZone("-01:23", -(3600+23*60)))}}, - {str: "2013-10-08T10:30:50-0123", value: DateTimeTzTest{time.Date(2013, 10, 8, 10, 30, 50, 0, time.FixedZone("-01:23", -(3600+23*60)))}, noMarshal: true}, - - // boolean - {str: "0", value: BooleanTest(false)}, - {str: "1", value: BooleanTest(true)}, - {str: "false", value: BooleanTest(false), noMarshal: true}, - {str: "true", value: BooleanTest(true), noMarshal: true}, - {str: "no", value: BooleanTest(false), noMarshal: true}, - {str: "yes", value: BooleanTest(true), noMarshal: true}, - {str: "", value: BooleanTest(false), noMarshal: true, wantUnmarshalErr: true}, - {str: "other", value: BooleanTest(false), noMarshal: true, wantUnmarshalErr: true}, - {str: "2", value: BooleanTest(false), noMarshal: true, wantUnmarshalErr: true}, - {str: "-1", value: BooleanTest(false), noMarshal: true, wantUnmarshalErr: true}, - - // bin.base64 - {str: "", value: BinBase64Test{}}, - {str: "YQ==", value: BinBase64Test("a")}, - {str: "TG9uZ2VyIFN0cmluZy4=", value: BinBase64Test("Longer String.")}, - {str: "TG9uZ2VyIEFsaWduZWQu", value: BinBase64Test("Longer Aligned.")}, - - // bin.hex - {str: "", value: BinHexTest{}}, - {str: "61", value: BinHexTest("a")}, - {str: "4c6f6e67657220537472696e672e", value: BinHexTest("Longer String.")}, - {str: "4C6F6E67657220537472696E672E", value: BinHexTest("Longer String."), noMarshal: true}, - } - - // Generate extra test cases from convTests that implement duper. - var extras []testCase - for i := range tests { - if duper, ok := tests[i].value.(duper); ok { - dupes := duper.Dupe(tests[i].tag) - for _, duped := range dupes { - dupedCase := testCase(tests[i]) - dupedCase.value = duped - extras = append(extras, dupedCase) - } - } - } - tests = append(tests, extras...) - - for _, test := range tests { - if test.noMarshal { - } else if resultStr, err := test.value.Marshal(); err != nil && !test.wantMarshalErr { - t.Errorf("For %T marshal %v, want %q, got error: %v", test.value, test.value, test.str, err) - } else if err == nil && test.wantMarshalErr { - t.Errorf("For %T marshal %v, want error, got %q", test.value, test.value, resultStr) - } else if err == nil && resultStr != test.str { - t.Errorf("For %T marshal %v, want %q, got %q", test.value, test.value, test.str, resultStr) - } - - if test.noUnMarshal { - } else if resultValue, err := test.value.Unmarshal(test.str); err != nil && !test.wantUnmarshalErr { - t.Errorf("For %T unmarshal %q, want %v, got error: %v", test.value, test.str, test.value, err) - } else if err == nil && test.wantUnmarshalErr { - t.Errorf("For %T unmarshal %q, want error, got %v", test.value, test.str, resultValue) - } else if err == nil && !test.value.Equal(resultValue) { - t.Errorf("For %T unmarshal %q, want %v, got %v", test.value, test.str, test.value, resultValue) - } - } -} diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/registry.go b/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/registry.go index 38d10203f..2f84beaae 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/registry.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/registry.go @@ -21,6 +21,40 @@ var ( maxAgeRx = regexp.MustCompile("max-age=([0-9]+)") ) +const ( + EventAlive = EventType(iota) + EventUpdate + EventByeBye +) + +type EventType int8 + +func (et EventType) String() string { + switch et { + case EventAlive: + return "EventAlive" + case EventUpdate: + return "EventUpdate" + case EventByeBye: + return "EventByeBye" + default: + return fmt.Sprintf("EventUnknown(%d)", int8(et)) + } +} + +type Update struct { + // The USN of the service. + USN string + // What happened. + EventType EventType + // The entry, which is nil if the service was not known and + // EventType==EventByeBye. The contents of this must not be modified as it is + // shared with the registry and other listeners. Once created, the Registry + // does not modify the Entry value - any updates are replaced with a new + // Entry value. + Entry *Entry +} + type Entry struct { // The address that the entry data was actually received from. RemoteAddr string @@ -32,7 +66,7 @@ type Entry struct { Server string Host string // Location of the UPnP root device description. - Location *url.URL + Location url.URL // Despite BOOTID,CONFIGID being required fields, apparently they are not // always set by devices. Set to -1 if not present. @@ -83,7 +117,7 @@ func newEntryFromRequest(r *http.Request) (*Entry, error) { NT: r.Header.Get("NT"), Server: r.Header.Get("SERVER"), Host: r.Header.Get("HOST"), - Location: loc, + Location: *loc, BootID: bootID, ConfigID: configID, SearchPort: uint16(searchPort), @@ -125,15 +159,71 @@ func parseUpnpIntHeader(headers http.Header, headerName string, def int32) (int3 var _ httpu.Handler = new(Registry) // Registry maintains knowledge of discovered devices and services. +// +// NOTE: the interface for this is experimental and may change, or go away +// entirely. type Registry struct { lock sync.Mutex byUSN map[string]*Entry + + listenersLock sync.RWMutex + listeners map[chan<- Update]struct{} } func NewRegistry() *Registry { return &Registry{ - byUSN: make(map[string]*Entry), + byUSN: make(map[string]*Entry), + listeners: make(map[chan<- Update]struct{}), + } +} + +// NewServerAndRegistry is a convenience function to create a registry, and an +// httpu server to pass it messages. Call ListenAndServe on the server for +// messages to be processed. +func NewServerAndRegistry() (*httpu.Server, *Registry) { + reg := NewRegistry() + srv := &httpu.Server{ + Addr: ssdpUDP4Addr, + Multicast: true, + Handler: reg, + } + return srv, reg +} + +func (reg *Registry) AddListener(c chan<- Update) { + reg.listenersLock.Lock() + defer reg.listenersLock.Unlock() + reg.listeners[c] = struct{}{} +} + +func (reg *Registry) RemoveListener(c chan<- Update) { + reg.listenersLock.Lock() + defer reg.listenersLock.Unlock() + delete(reg.listeners, c) +} + +func (reg *Registry) sendUpdate(u Update) { + reg.listenersLock.RLock() + defer reg.listenersLock.RUnlock() + for c := range reg.listeners { + c <- u + } +} + +// GetService returns known service (or device) entries for the given service +// URN. +func (reg *Registry) GetService(serviceURN string) []*Entry { + // Currently assumes that the map is small, so we do a linear search rather + // than indexed to avoid maintaining two maps. + var results []*Entry + reg.lock.Lock() + defer reg.lock.Unlock() + for _, entry := range reg.byUSN { + if entry.NT == serviceURN { + results = append(results, entry) + } } + return results } // ServeMessage implements httpu.Handler, and uses SSDP NOTIFY requests to @@ -156,7 +246,9 @@ func (reg *Registry) ServeMessage(r *http.Request) { default: err = fmt.Errorf("unknown NTS value: %q", nts) } - log.Printf("In %s request from %s: %v", nts, r.RemoteAddr, err) + if err != nil { + log.Printf("goupnp/ssdp: failed to handle %s message from %s: %v", nts, r.RemoteAddr, err) + } } func (reg *Registry) handleNTSAlive(r *http.Request) error { @@ -166,9 +258,14 @@ func (reg *Registry) handleNTSAlive(r *http.Request) error { } reg.lock.Lock() - defer reg.lock.Unlock() - reg.byUSN[entry.USN] = entry + reg.lock.Unlock() + + reg.sendUpdate(Update{ + USN: entry.USN, + EventType: EventAlive, + Entry: entry, + }) return nil } @@ -185,18 +282,31 @@ func (reg *Registry) handleNTSUpdate(r *http.Request) error { entry.BootID = nextBootID reg.lock.Lock() - defer reg.lock.Unlock() - reg.byUSN[entry.USN] = entry + reg.lock.Unlock() + + reg.sendUpdate(Update{ + USN: entry.USN, + EventType: EventUpdate, + Entry: entry, + }) return nil } func (reg *Registry) handleNTSByebye(r *http.Request) error { - reg.lock.Lock() - defer reg.lock.Unlock() + usn := r.Header.Get("USN") - delete(reg.byUSN, r.Header.Get("USN")) + reg.lock.Lock() + entry := reg.byUSN[usn] + delete(reg.byUSN, usn) + reg.lock.Unlock() + + reg.sendUpdate(Update{ + USN: usn, + EventType: EventByeBye, + Entry: entry, + }) return nil } |