This example demonstrates the Publish and Subscribe IPC
mechanisms using the RProperty
class.
Click on the following link to download the example: pubsub.zip.
Click: browse to view the example code.
This example demonstrates three types of usage pattern for Publish and Subscribe:
Standard State Publishing
Publisher: The publisher defines a byte-array property and pre-allocates memory to it. It interactively updates and re-publishes the value of the property.
Subscriber: The subscriber gets the value of the property defined by the publisher by subscribing to it. It displays an error and stops running if it fails to get the value of the property.
Pure Event Distribution
Speculative Publishing
The Symbian build process describes how to build this example.
This example builds the following binaries in
the standard location (\epoc32\release\winscw\<build_variant>
) for Carbide.c++:
publishstd.exe
: The publisher process for the Standard State pattern.
subscribestd.exe
: The subscriber process for the Standard State pattern.
publishpe.exe
: The publisher process for the Pure Event Distribution pattern.
subscribepe.exe
: The subscriber process for the Pure Event Distribution pattern.
publishspec.exe
: The publisher process for the Speculative Publishing pattern.
subscribespec.exe
: The subscriber process for the Speculative Publishing pattern.
To run the example, perform the following steps on each usage pattern:
Open two eshells.
Run the publisher executable file in one eshell.
Run the subscriber executable file in another eshell.
Note: Switch between eshells by pressing CTRL+ALT+SHIFT+T
.
For more information, see Publish and Subscribe in Using User Library (E32).