coherence.upnp.core.variable (module) — Cohen3 0.8.0 documentation

# coherence.upnp.core.variable (module)

## `StateVariable`

The `StateVariable` implements an UPnP variable with the ability to emmit changes via EventDispatcher whenever some class variable changes.

class `StateVariable`(upnp_service, name, implementation, instance, send_events, data_type, allowed_values)

  Bases: `eventdispatcher.eventdispatcher.EventDispatcher`, `coherence.log.LogAble`

  Represents a UPnP variable. It has the ability to dispatch changes whenever some class variable changes.

  Changed in version 0.9.0:

  - Migrated from louie/dispatcher to EventDispatcher

  - Added two more class variables:

    > - `StateVariable.dispatch_targets`
    > - `StateVariable.dispatch_events`

  - The emitted events changed:

    > - Coherence.UPnP.StateVariable.changed => state_variable_changed
    > - Coherence.UPnP.StateVariable.{var name}.changed => state_variable_{var name}_changed

  `logCategory` = 'variable'
  `dispatch_events` = []
  `dispatch_targets` = []
  `as_tuples`()
  `set_default_value`(value)
  `set_allowed_values`(values)
  `set_allowed_value_range`(**kwargs)
  `get_allowed_values`()
  `set_never_evented`(value)
  `update`(value)
  `subscribe`(callback)
  `notify`()