eventing

package
v0.0.0-...-904a803 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCAST_EVENT_ADDR = "239.255.255.246"
	MCAST_EVENT_PORT = 7900
)
View Source
const (
	DEFAULT_SUBSCRIPTION_DURATION = 30 * time.Minute
	MIN_SUBSCRIPTION_DURATION     = 1 * time.Second
)

Variables

View Source
var Logger *log.Logger

Functions

func ListenMulticastEvents

func ListenMulticastEvents(ch chan<- *Event) error

func NewEventData

func NewEventData() *eventData

func SendMulticastEvent

func SendMulticastEvent(h *EventHeader, r *[]Result, laddr *net.UDPAddr) error

Types

type Event

type Event struct {
	EventHeader
	EventData
}

type EventData

type EventData struct {
	XMLName    xml.Name   `xml:"propertyset"`
	Properties []Property `xml:"property"`
}

type EventHeader

type EventHeader struct {
	NT  string
	NTS string
	SID string
	SEQ int

	// multicast event headers
	USN    string
	SVCID  string
	LVL    string
	BootId int
}

type Property

type Property struct {
	XMLName xml.Name `xml:"property"`
	Result  Result   `xml:",any"`
}

type Result

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

type SubscriptionManager

type SubscriptionManager struct {
	URL      *url.URL
	SID      string
	Lifetime time.Duration
	// contains filtered or unexported fields
}

func NewSubscriptionManager

func NewSubscriptionManager(url *url.URL, exp time.Duration) (*SubscriptionManager, error)

FIXME - url may become invalid if device we're subscribing to restarts and the subscription url changes. Change this to the service name we want to subscribe to, and deal with the discovery and url building internally otherwise our subscription loops may crash when it attempts to resubscribe to a dead endpoint Provide ability to filter discovery/description data, in case more than 1 is found?

  • description.DiscoverDeviceDescription() only returns the 1st discovered device, so either we modify that behavior, or we just go with it, and assume our service name is targeted enough to find the right one

func (*SubscriptionManager) EventLoop

func (m *SubscriptionManager) EventLoop(ch chan<- map[string]string)

func (*SubscriptionManager) Unsubscribe

func (m *SubscriptionManager) Unsubscribe() error

Jump to

Keyboard shortcuts

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