upnp

package
Version: v0.0.0-...-56e7ff9 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2015 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidActionErrorCode        = 401
	ArgumentValueInvalidErrorCode = 600
)

Variables

This section is empty.

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
	IconList     []Icon    `xml:"iconList>icon"`
	ServiceList  []Service `xml:"serviceList>service"`
}

type DeviceDesc

type DeviceDesc struct {
	XMLName     xml.Name    `xml:"urn:schemas-upnp-org:device-1-0 root"`
	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"`
}
var (
	InvalidActionError Error = Error{
		Code: 401,
		Desc: "Invalid Action",
	}
	ArgumentValueInvalidError = Error{
		Code: 600,
		Desc: "The argument value is invalid",
	}
)

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 {
	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, ok bool)

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL