Documentation ¶
Overview ¶
Package events implements eventing for state variables. It covers multicast and subscription- based eventing
Index ¶
- func ParseTimeout(t string) (dur time.Duration, err error)
- func ParseURLs(callback string) (urls []*url.URL, err error)
- type Eventing
- func (me *Eventing) AddSub(dur time.Duration, urls []*url.URL, svs []StateVar) (sid uuid.UUID)
- func (me *Eventing) Listen(ctx context.Context)
- func (me *Eventing) RemoveAllSubs()
- func (me *Eventing) RemoveSub(sid uuid.UUID) (err error)
- func (me *Eventing) RenewSub(sid uuid.UUID, dur time.Duration) (err error)
- func (me *Eventing) Run()
- func (me *Eventing) Stop()
- type StateVar
- type Subscription
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 Eventing ¶ added in v0.2.1
type Eventing struct { Listener chan StateVar // contains filtered or unexported fields }
Eventing implements multicast and subscription based eventing as specified in the UPnP device architecture 2.0
func NewEventing ¶ added in v0.2.1
NewEventing creates an Eventing 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
func (*Eventing) Listen ¶ added in v0.2.1
Listen listens to changes for state variables and stores them in me.changes
func (*Eventing) RemoveAllSubs ¶ added in v0.2.1
func (me *Eventing) RemoveAllSubs()
RemoveAllSubs remove all subscriptions
func (*Eventing) RemoveSub ¶ added in v0.2.1
RemoveSub removes the subscription with the ID sid. In case there's no subscription with that ID, an error is returned
func (*Eventing) RenewSub ¶ added in v0.2.1
RenewSub renews the subscription with ID sid. In case there's no subscription with that ID, an error is returned
type StateVar ¶
type StateVar interface { Name() string String() string ServiceType() string ServiceVersion() string DeviceUDN() string ServiceID() string ToBeEvented() bool ToBeMulticasted() bool }
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