upnp

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2023 License: BSD-3-Clause Imports: 11 Imported by: 10

Documentation

Index

Constants

View Source
const (
	InvalidActionErrorCode        = 401
	ActionFailedErrorCode         = 501
	ArgumentValueInvalidErrorCode = 600
)

Variables

View Source
var (
	InvalidActionError        = Errorf(401, "Invalid Action")
	ArgumentValueInvalidError = Errorf(600, "The argument value is invalid")
)

Functions

func FormatUUID

func FormatUUID(buf []byte) string

func ParseCallbackURLs

func ParseCallbackURLs(callback string) (ret []*url.URL)

Parse the CALLBACK HTTP header in an event subscription request. See UPnP Device Architecture 4.1.2.

Types

type Action

type Action struct {
	Name      string
	Arguments []Argument
}

type Argument

type Argument struct {
	Name            string
	Direction       string
	RelatedStateVar string
}

type Device

type Device struct {
	DeviceType      string `xml:"deviceType"`
	FriendlyName    string `xml:"friendlyName"`
	Manufacturer    string `xml:"manufacturer"`
	ModelName       string `xml:"modelName"`
	UDN             string
	VendorXML       string    `xml:",innerxml"`
	IconList        []Icon    `xml:"iconList>icon"`
	ServiceList     []Service `xml:"serviceList>service"`
	PresentationURL string    `xml:"presentationURL,omitempty"`
}

type DeviceDesc

type DeviceDesc struct {
	XMLName     xml.Name    `xml:"urn:schemas-upnp-org:device-1-0 root"`
	NSDLNA      string      `xml:"xmlns:dlna,attr"`
	NSSEC       string      `xml:"xmlns:sec,attr"`
	SpecVersion SpecVersion `xml:"specVersion"`
	Device      Device      `xml:"device"`
}

type Error

type Error struct {
	XMLName xml.Name `xml:"urn:schemas-upnp-org:control-1-0 UPnPError"`
	Code    uint     `xml:"errorCode"`
	Desc    string   `xml:"errorDescription"`
}

func ConvertError

func ConvertError(err error) *Error

ConvertError converts any error to an UPNP error

func Errorf

func Errorf(code uint, tpl string, args ...interface{}) *Error

Errorf creates an UPNP error from the given code and description

func (*Error) Error

func (e *Error) Error() string

type Eventing

type Eventing struct {
	// contains filtered or unexported fields
}

Intended to eventually be an embeddable implementation for managing eventing for a service. Not complete.

func (*Eventing) Subscribe

func (me *Eventing) Subscribe(callback []*url.URL, timeoutSeconds int) (sid string, actualTimeout int, err error)

func (*Eventing) Unsubscribe

func (me *Eventing) Unsubscribe(sid string) error

type Icon

type Icon struct {
	Mimetype string `xml:"mimetype"`
	Width    int    `xml:"width"`
	Height   int    `xml:"height"`
	Depth    int    `xml:"depth"`
	URL      string `xml:"url"`
}

type Property

type Property struct {
	XMLName  struct{} `xml:"e:property"`
	Variable Variable
}

propertys provide namespacing to the contained variables.

type PropertySet

type PropertySet struct {
	XMLName    struct{} `xml:"e:propertyset"`
	Properties []Property
	// This should be set to `"urn:schemas-upnp-org:event-1-0"`.
	Space string `xml:"xmlns:e,attr"`
}

propertyset is the root element sent in an event callback.

type SCPD

type SCPD struct {
	XMLName           xml.Name        `xml:"urn:schemas-upnp-org:service-1-0 scpd"`
	SpecVersion       SpecVersion     `xml:"specVersion"`
	ActionList        []Action        `xml:"actionList>action"`
	ServiceStateTable []StateVariable `xml:"serviceStateTable>stateVariable"`
}

type Service

type Service struct {
	XMLName     xml.Name `xml:"service"`
	ServiceType string   `xml:"serviceType"`
	ServiceId   string   `xml:"serviceId"`
	SCPDURL     string
	ControlURL  string `xml:"controlURL"`
	EventSubURL string `xml:"eventSubURL"`
}

type ServiceURN

type ServiceURN struct {
	Auth    string
	Type    string
	Version uint64
}

func ParseServiceType

func ParseServiceType(s string) (ret ServiceURN, err error)

func (ServiceURN) String

func (me ServiceURN) String() string

type SoapAction

type SoapAction struct {
	ServiceURN
	Action string
}

func ParseActionHTTPHeader

func ParseActionHTTPHeader(s string) (ret SoapAction, err error)

type SpecVersion

type SpecVersion struct {
	Major int `xml:"major"`
	Minor int `xml:"minor"`
}

type StateVariable

type StateVariable struct {
	SendEvents    string    `xml:"sendEvents,attr"`
	Name          string    `xml:"name"`
	DataType      string    `xml:"dataType"`
	AllowedValues *[]string `xml:"allowedValueList>allowedValue,omitempty"`
}

type Variable

type Variable struct {
	XMLName xml.Name
	Value   string `xml:",chardata"`
}

Represents an evented state variable that has sendEvents="yes" in its service spec.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL