ssdp

package
v0.0.0-...-241c36b Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2015 License: BSD-2-Clause Imports: 12 Imported by: 1

Documentation

Overview

A client implementation of the SSDP protocol.

mgr := ssdp.MakeManager()
mgr.Discover("eth0", "13104", false)
qry := ssdp.ServiceQueryTerms{
	ssdp.ServiceKey("schemas-upnp-org-MusicServices"): -1,
}
result := mgr.QueryServices(qry)
if device_list, has := result["schemas-upnp-org-MusicServices"]; has {
	for _, device := range device_list {
		...
	}
}
mgr.Close()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device interface {
	// The product name (e.g. "Sonos")
	Product() string
	// The device name (e.h. "ZonePlayer")
	Name() string
	// A URI that can be queried for device capabilities
	Location() Location
	// The device's Universally Unique ID
	UUID() UUID
	// Search for a service in the device's capabilities; same
	// return semantics as querying a map
	Service(key ServiceKey) (service Service, has bool)
}

An abstraction of an SSDP leaf device

type DeviceMap

type DeviceMap map[UUID]Device

Indexes leaf devices by UUID

type Location

type Location string

Type protection for a device URI

type Manager

type Manager interface {
	// Initiates SSDP discovery, where port gives a free port on that network
	// device to listen for responses, and the subscribe flag (currrently unimplemented)
	// determines whether to listen to asynchronous updates after the
	// initial query is complete.
	Discover(port int, subscribe bool) error
	// After discovery is complete searches for devices implementing
	// the services specified in query.
	QueryServices(query ServiceQueryTerms) ServiceMap
	// Return the list of devices that were found during discovery
	Devices() DeviceMap
	// Shuts down asynchronous subscriptions to device state
	Close() error
}

Encapsulates SSDP discovery, handles updates, and stores results

func MakeManager

func MakeManager() Manager

Returns an empty manager ready for SSDP discovery

type Service

type Service interface {
	// The version of the service
	Version() int64
}

An abstraction of an SSDP service

type ServiceKey

type ServiceKey string

Type protection for a SSDP service key

type ServiceMap

type ServiceMap map[ServiceKey]DeviceMap

Discovered devices sorted by supported service

type ServiceQueryTerms

type ServiceQueryTerms map[ServiceKey]int64

A map of service key to minimum required version

type UUID

type UUID string

Type protection for a Universally Unique ID

Jump to

Keyboard shortcuts

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