Documentation ¶
Overview ¶
Package events implements eventing for state variables. It covers multicast and subscription- based eventing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseTimeout ¶
ParseTimeout parses the timeout string that the recipient submitted as part of the subscription request. If the string is not according to the required format an error is returned. As defined in UPnP Device Architecture 2.0, the required format is Second-<number>, where <number> is requested timeout in seconds
func ParseURLs ¶
ParseURLs parses the callback string that the recipient submitted as part of the subscription request. If the string is not according to the required format an error is returned. As defined in UPnP Device Architecture 2.0, the required format is <url_1><url_2>...<url_n>, where url_x must be a valid url for x=1, ..., n
Types ¶
type Multicast ¶
type Multicast struct { Listener chan StateVar // contains filtered or unexported fields }
Multicast implements event mutlicasting
func NewMulticast ¶
NewMulticast creates a Multicast instance. wanted contains the list of network interfaces that where configured, booID is a function that returns the current BootID. if no interfaces are configured, all interfaces are used
type StateVar ¶
type StateVar interface { Name() string String() string ServiceType() string ServiceVersion() string DeviceUDN() string ServiceID() string }
StateVar represents a state variable for eventing (i.e. the functions that are required for eventing)
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription represents the subscription of one recipient to all evented state variables
func (Subscription) Run ¶
func (me Subscription) Run()
Run implements the main eventing loop: Each eventInterval seconds an event for all state variables is sent until a stop request is received
func (Subscription) Stop ¶
func (me Subscription) Stop()
Stop stops the main event loop for the subscription
type Subscriptions ¶
type Subscriptions map[uuid.UUID]*Subscription
Subscriptions maps subscription ID's to the corresponding subscription
func NewSubscriptionMap ¶
func NewSubscriptionMap() Subscriptions
NewSubscriptionMap does what the name suggests
func (Subscriptions) Remove ¶
func (me Subscriptions) Remove(sid uuid.UUID) (err error)
Remove removes the subscription with the ID sid. In case there's no subscription with that ID, en error is returned
func (Subscriptions) RemoveAll ¶
func (me Subscriptions) RemoveAll()
RemoveAll remove all subscriptions