fritzbox_upnp

package
v0.0.0-...-846e73f Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 11 Imported by: 7

Documentation

Overview

Package fritzbox_upnp Query UPNP variables from Fritz!Box devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name        string               `xml:"name"`
	Arguments   []*Argument          `xml:"argumentList>argument"`
	ArgumentMap map[string]*Argument // Map of arguments indexed by .Name
	// contains filtered or unexported fields
}

Action an UPNP action on a service

func (*Action) Call

func (a *Action) Call(actionArg *ActionArgument) (Result, error)

Call an action with argument if given

func (*Action) IsGetOnly

func (a *Action) IsGetOnly() bool

IsGetOnly Returns if the action seems to be a query for information. This is determined by checking if the action has no input arguments and at least one output argument.

type ActionArgument

type ActionArgument struct {
	Name  string
	Value interface{}
}

ActionArgument an Inüut Argument to pass to an action

type Argument

type Argument struct {
	Name                 string `xml:"name"`
	Direction            string `xml:"direction"`
	RelatedStateVariable string `xml:"relatedStateVariable"`
	StateVariable        *StateVariable
}

An Argument to an action

type Device

type Device struct {
	DeviceType       string `xml:"deviceType"`
	FriendlyName     string `xml:"friendlyName"`
	Manufacturer     string `xml:"manufacturer"`
	ManufacturerURL  string `xml:"manufacturerURL"`
	ModelDescription string `xml:"modelDescription"`
	ModelName        string `xml:"modelName"`
	ModelNumber      string `xml:"modelNumber"`
	ModelURL         string `xml:"modelURL"`
	UDN              string `xml:"UDN"`

	Services []*Service `xml:"serviceList>service"` // Service of the device
	Devices  []*Device  `xml:"deviceList>device"`   // Sub-Devices of the device

	PresentationURL string `xml:"presentationURL"`
	// contains filtered or unexported fields
}

Device an UPNP device

type FaultDetail

type FaultDetail struct {
	UpnpError UpnpError `xml:"UPnPError"`
}

FaultDetail struct

type Result

type Result map[string]interface{}

Result The result of a Call() contains all output arguments of the call. The map is indexed by the name of the state variable. The type of the value is string, uint64 or bool depending of the DataType of the variable.

type Root

type Root struct {
	BaseURL  string
	Username string
	Password string
	Device   Device              `xml:"device"`
	Services map[string]*Service // Map of all services indexed by .ServiceType
}

Root of the UPNP tree

func LoadServices

func LoadServices(baseurl string, username string, password string, verifyTls bool) (*Root, error)

LoadServices loads the services tree from an device.

type Service

type Service struct {
	Device *Device

	ServiceType string `xml:"serviceType"`
	ServiceID   string `xml:"serviceId"`
	ControlURL  string `xml:"controlURL"`
	EventSubURL string `xml:"eventSubURL"`
	SCPDUrl     string `xml:"SCPDURL"`

	Actions        map[string]*Action // All actions available on the service
	StateVariables []*StateVariable   // All state variables available on the service
}

Service an UPNP Service

type SoapBody

type SoapBody struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
	Fault   SoapFault
}

SoapBody struct

type SoapEnvelope

type SoapEnvelope struct {
	XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
	Body    SoapBody
}

SoapEnvelope struct to unmarshal SOAP faults

type SoapFault

type SoapFault struct {
	XMLName     xml.Name    `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"`
	FaultCode   string      `xml:"faultcode"`
	FaultString string      `xml:"faultstring"`
	Detail      FaultDetail `xml:"detail"`
}

SoapFault struct

type StateVariable

type StateVariable struct {
	Name         string `xml:"name"`
	DataType     string `xml:"dataType"`
	DefaultValue string `xml:"defaultValue"`
}

StateVariable a state variable that can be manipulated through actions

type UpnpError

type UpnpError struct {
	ErrorCode        int    `xml:"errorCode"`
	ErrorDescription string `xml:"errorDescription"`
}

UpnpError struct

Jump to

Keyboard shortcuts

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