ValueSpacePublisher QML Type

The ValueSpacePublisher allows application to publish values to Value Space. More...

Properties

Detailed Description

ValueSpacePublishers are constructed with a fixed path which cannot be changed. And you should set the path property before publishing any values. If you need to publish within multiple different paths, you will need multiple publishers.

For the keys within the path chosen, if the key names to be published are alphanumeric, they can be accessed through dynamic properties by setting the keys list.

Example:

 ValueSpacePublisher {
     id: battery
     path: "/power/battery"
     keys: ["charge", "charging"]
 }

 MouseArea {
     onClicked: {
         battery.charge = 50
         battery.charging = true
     }
 }

Alternatively, for key names that can't be mapped to properties, or for key names shadowed by existing properties (like "value" or "path"), you can also access the value property of the publisher itself.

 ValueSpacePublisher {
     id: nonalpha
     path: "/something/with a space/value"
 }

 MouseArea {
     onClicked: {
         nonalpha.value = "example"
     }
 }

Property Documentation

hasSubscribers : bool

This property is true if there are subscribers currently subscribed to the ValueSpace path being published by this Publisher.

This property is read only.


keys : QStringList

Setting this property creates a set of dynamic properties allowing easy access to set the values of keys under this Publisher's path.


path : string

This property holds the base path of the publisher, and it should be written before publishing any data. Note it can only be written once, and further writing has no effects.


value : QVariant

This property publishes a new value to the ValueSpace at the path given through the path property. This property is write only.