Publishing

To publish to a PPS object, a publisher simply calls open() for the object file with O_WRONLY to publish only, or O_RDWR to publish and subscribe. The publisher can then call write() to modify the object's attributes. This operation is non-blocking.

Creating, modifying and deleting

You can create, modify, and delete objects and attributes:

To create a new object:
Create a file with the name of the object. The new object will come into existence with no attributes. You can then write attributes to the object, as required.
To delete an object:
Delete the object file.
To create a new attribute:
Write the attribute to the object file.
To modify an attribute:
Write the new attribute value to the object file.
To delete all existing attributes:
Open the object with O_TRUNC.
To delete one attribute:
Prefix its name with a minus sign, then call write(). For example:
sprintf( ppsobj, "-url\n" ); // Delete the "url" attribute
write( ppsobj-fd, ppsobj, strlen( ppsobj ) );

Caution: Note the following about deleting attributes:
  • Calling ftruncate() on an object file will delete all the object's attributes, whatever the value of the length argument.
  • A simple Bourne shell redirection instruction (such as echo attr::hello > /fs/pps/object) entered from the commandline will open an object with O_TRUNC and delete all attributes.

Multiple publishers

PPS supports multiple publishers that publish to the same PPS object. This capability is required because different publishers may have access to data which applies to different attributes for the same object.

In a multimedia system, for instance, io-media may be the source of a time::value attribute, while the HMI may be the source of a duration::value attribute. A publisher that changes only the time attribute will update only that attribute when it writes to the object. It will leave the other attributes unchanged. For example, in the following pseudocode:

write()
  PlayCurrent::1.24