diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-3472798D-CEC5-5BA9-A3A7-D4245661DEDB.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-3472798D-CEC5-5BA9-A3A7-D4245661DEDB.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,78 @@ + + + + + +pubsub: +Using the Publish and Subscribe IPC MechanismThis example demonstrates the Publish and Subscribe IPC mechanisms +using the RProperty class. +
Download

Click on the following link to download +the example: pubsub.zip.

Click: browse to view the example code.

+
Description

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

      +
    • Publisher: The +publisher defines an integer property and publishes a random integer value +periodically. This value has no significance to the subscriber.

    • +
    • Subscriber: The +subscriber gets a notification when the publisher publishes a value. It exits +when the property is deleted by the publisher.

    • +
  • +
  • Speculative Publishing

      +
    • Publisher: The +publisher does not define the property. It ignores the KErrNotFound error +when it publishes the value of the property.

    • +
    • Subscriber: The +subscriber defines and subscribes to the property. It ignores the KErrAlreadyExists error.

    • +
  • +
+
Class summary
    +
  • RProperty - User side interface to Publish & +Subscribe.

  • +
  • CActive - The core class of the active object abstraction.

  • +
+
Build

The Symbian OS 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.

  • +
+
Running the +example

To run the example, perform the following steps on each +usage pattern:

    +
  1. Open two eshells.

  2. +
  3. Run the publisher executable +file in one eshell.

  4. +
  5. Run the subscriber executable +file in another eshell.

  6. +

Note: Switch between eshells by pressing CTRL+ALT+SHIFT+T.

+
See also

For +more information, see Publish +and Subscribe in Using User Library (E32).

+
\ No newline at end of file