Involved Source Filesdevice.go goupnp is an implementation of a client for various UPnP services.
For most uses, it is recommended to use the code-generated packages under
github.com/huin/goupnp/dcps. Example use is shown at
http://godoc.org/github.com/huin/goupnp/example
A commonly used client is internetgateway1.WANPPPConnection1:
http://godoc.org/github.com/huin/goupnp/dcps/internetgateway1#WANPPPConnection1
Currently only a couple of schemas have code generated for them from the
UPnP example XML specifications. Not all methods will work on these clients,
because the generated stubs contain the full set of specified methods from
the XML specifications, and the discovered services will likely support a
subset of those methods.network.goservice_client.go
MaybeRootDevice contains either a RootDevice or an error. Any error encountered probing a discovered device. The address from which the device was discovered (if known - otherwise nil). 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. Set iff Err == nil. Identifier of the device. Note that this in combination with Location
uniquely identifies a result from DiscoverDevices.
func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error)
func DiscoverDevicesCtx(ctx context.Context, searchTarget string) ([]MaybeRootDevice, error)
Service is a service provided by a UPnP Device.ControlURLURLFieldEventSubURLURLFieldSCPDURLURLFieldServiceIdstringServiceTypestring(*Service) NewSOAPClient() *soap.SOAPClient RequestSCDP is for compatibility only, prefer RequestSCPD. This was a
misspelling of RequestSCDP. RequestSCPD is the legacy version of RequestSCPDCtx, but uses
context.Background() as the context. RequestSCPDCtx requests the SCPD (soap actions and state variables description)
for the service. SetURLBase sets the URLBase for the Service.(*Service) String() string
*Service : expvar.Var
*Service : fmt.Stringer
func (*Device).FindService(serviceType string) []*Service
DiscoverDevices is the legacy version of DiscoverDevicesCtx, but uses
context.Background() as the context.
DiscoverDevicesCtx attempts to find targets of the given type. This is
typically the entry-point for this package. searchTarget is typically a URN
in the form "urn:schemas-upnp-org:device:..." or
"urn:schemas-upnp-org:service:...". A single error is returned for errors
while attempting to send the query. An error or RootDevice is returned for
each discovered RootDevice.
NewServiceClients is the legacy version of NewServiceClientsCtx, but uses
context.Background() as the context.
NewServiceClientsByURL is the legacy version of NewServiceClientsByURLCtx, but uses
context.Background() as the context.
NewServiceClientsByURLCtx creates client(s) for the given service URN, for a
root device at the given URL.
NewServiceClientsCtx 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.
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).
Package-Level Variables (total 2)
CharsetReaderDefault specifies the charset reader used while decoding the output
from a UPnP server. It can be modified in an init function to allow for non-utf8 encodings,
but should not be changed after requesting clients.
HTTPClient specifies the http.Client object used when fetching the XML from the UPnP server.
HTTPClient defaults the http.DefaultClient. This may be overridden by the importing application.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.