7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <concept id="GUID-3472798D-CEC5-5BA9-A3A7-D4245661DEDB" xml:lang="en"><title>pubsub: |
12 <concept id="GUID-3472798D-CEC5-5BA9-A3A7-D4245661DEDB" xml:lang="en"><title>pubsub: Using the Publish and Subscribe IPC Mechanism</title><shortdesc>This example demonstrates the Publish and Subscribe IPC |
13 Using the Publish and Subscribe IPC Mechanism</title><shortdesc>This example demonstrates the Publish and Subscribe IPC mechanisms |
13 mechanisms using the <codeph>RProperty</codeph> class. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
14 using the <codeph>RProperty</codeph> class. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
14 <section id="GUID-909438A0-5FCA-4FA3-96EF-2666A3C07227"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-b24148a4-d20f-4af6-a0d2-d404f1a5698e.zip" scope="external">pubsub.zip</xref>.</p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-b24148a4-d20f-4af6-a0d2-d404f1a5698e.html" scope="peer">browse</xref> to view the example code.</p> </section> |
15 <section id="GUID-909438A0-5FCA-4FA3-96EF-2666A3C07227"><title>Download</title> <p>Click |
15 <section id="GUID-20D6C064-50E0-52EE-8287-1D657C27FF75"><title>Description</title> <p>This example demonstrates three types of usage pattern for Publish |
16 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-b24148a4-d20f-4af6-a0d2-d404f1a5698e.zip" scope="external">pubsub.zip</xref>.</p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-b24148a4-d20f-4af6-a0d2-d404f1a5698e.html" scope="peer">browse</xref> to view the example code.</p> </section> |
16 and Subscribe: </p> <ul> |
17 <section id="GUID-20D6C064-50E0-52EE-8287-1D657C27FF75"><title>Description</title> <p>This |
17 <li id="GUID-12170122-3E04-5098-99C3-0C0C6B8C8914"><p>Standard State |
18 example demonstrates three types of usage pattern for Publish and Subscribe: </p> <ul> |
18 Publishing </p> <ul> |
19 <li id="GUID-12170122-3E04-5098-99C3-0C0C6B8C8914"><p>Standard State Publishing </p> <ul> |
19 <li id="GUID-DA65B928-6F46-5238-AED8-8CE062098621"><p> <b>Publisher:</b> The publisher defines a byte-array property and pre-allocates memory |
20 <li id="GUID-DA65B928-6F46-5238-AED8-8CE062098621"><p> <b>Publisher:</b> The |
20 to it. It interactively updates and re-publishes the value of the |
21 publisher defines a byte-array property and pre-allocates memory to it. It |
21 property. </p> </li> |
22 interactively updates and re-publishes the value of the property. </p> </li> |
22 <li id="GUID-0519A68F-E898-5FD7-95C1-A6AA79C5CAE1"><p> <b>Subscriber:</b> The subscriber gets the value of the property defined by the publisher |
23 <li id="GUID-0519A68F-E898-5FD7-95C1-A6AA79C5CAE1"><p> <b>Subscriber:</b> The |
23 by subscribing to it. It displays an error and stops running if it |
24 subscriber gets the value of the property defined by the publisher by subscribing |
24 fails to get the value of the property. </p> </li> |
25 to it. It displays an error and stops running if it fails to get the value |
|
26 of the property. </p> </li> |
|
27 </ul> </li> |
25 </ul> </li> |
28 <li id="GUID-FA0336A7-3402-58BF-A987-BC3273FFB687"><p>Pure Event Distribution </p> <ul> |
26 <li id="GUID-FA0336A7-3402-58BF-A987-BC3273FFB687"><p>Pure Event Distribution </p> <ul> |
29 <li id="GUID-03D5D3D0-23F5-5E75-840E-70DC8BB74388"><p> <b>Publisher:</b> The |
27 <li id="GUID-03D5D3D0-23F5-5E75-840E-70DC8BB74388"><p> <b>Publisher:</b> The publisher defines an integer property and publishes a random |
30 publisher defines an integer property and publishes a random integer value |
28 integer value periodically. This value has no significance to the |
31 periodically. This value has no significance to the subscriber. </p> </li> |
29 subscriber. </p> </li> |
32 <li id="GUID-4A3987D9-B916-584A-81C9-DC8079AA1270"><p> <b>Subscriber:</b> The |
30 <li id="GUID-4A3987D9-B916-584A-81C9-DC8079AA1270"><p> <b>Subscriber:</b> The subscriber gets a notification when the publisher publishes |
33 subscriber gets a notification when the publisher publishes a value. It exits |
31 a value. It exits when the property is deleted by the publisher. </p> </li> |
34 when the property is deleted by the publisher. </p> </li> |
|
35 </ul> </li> |
32 </ul> </li> |
36 <li id="GUID-FFBD46FD-D0FB-5C9A-98D8-ABA7B8C6E398"><p>Speculative Publishing </p> <ul> |
33 <li id="GUID-FFBD46FD-D0FB-5C9A-98D8-ABA7B8C6E398"><p>Speculative |
37 <li id="GUID-073BA0B9-1682-5642-8929-4B45738F28BD"><p> <b>Publisher:</b> The |
34 Publishing </p> <ul> |
38 publisher does not define the property. It ignores the <codeph>KErrNotFound</codeph> error |
35 <li id="GUID-073BA0B9-1682-5642-8929-4B45738F28BD"><p> <b>Publisher:</b> The publisher does not define the property. It ignores the <codeph>KErrNotFound</codeph> error when it publishes the value of the property. </p> </li> |
39 when it publishes the value of the property. </p> </li> |
36 <li id="GUID-78B22435-963F-5E5E-9A2B-AC582DD520D4"><p> <b>Subscriber:</b> The subscriber defines and subscribes to the property. It ignores |
40 <li id="GUID-78B22435-963F-5E5E-9A2B-AC582DD520D4"><p> <b>Subscriber:</b> The |
37 the <codeph>KErrAlreadyExists</codeph> error. </p> </li> |
41 subscriber defines and subscribes to the property. It ignores the <codeph>KErrAlreadyExists</codeph> error. </p> </li> |
|
42 </ul> </li> |
38 </ul> </li> |
43 </ul> </section> |
39 </ul> </section> |
44 <section id="GUID-63F559E8-36AB-41CD-9A2E-57080EA29601"><title>Class summary</title><ul> |
40 <section id="GUID-63F559E8-36AB-41CD-9A2E-57080EA29601"><title>Class |
45 <li><p><xref href="GUID-C4776034-D190-3FC4-AF45-C7F195093AC3.dita"><apiname>RProperty</apiname></xref> - User side interface to Publish & |
41 summary</title><ul> |
46 Subscribe.</p></li> |
42 <li><p><xref href="GUID-C4776034-D190-3FC4-AF45-C7F195093AC3.dita"><apiname>RProperty</apiname></xref> - User side interface to Publish |
47 <li><p><xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref> - The core class of the active object abstraction.</p></li> |
43 & Subscribe.</p></li> |
|
44 <li><p><xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref> - The core class of the active object |
|
45 abstraction.</p></li> |
48 </ul></section> |
46 </ul></section> |
49 <section id="GUID-43D665F1-BB55-5D5D-808E-3CBE18D2F6DA"><title>Build</title> <p><xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">The Symbian build process</xref> describes |
47 <section id="GUID-43D665F1-BB55-5D5D-808E-3CBE18D2F6DA"><title>Build</title> <p>The Symbian build process describes how to build this example. </p> <p>This example builds the following binaries in |
50 how to build this example. </p> <p>This example builds the following binaries |
48 the standard location (<filepath>\epoc32\release\winscw\<build_variant></filepath>) for Carbide.c++: </p> <ul> |
51 in the standard location (<filepath>\epoc32\release\winscw\<build_variant></filepath>) |
49 <li id="GUID-F06CD099-75C7-5070-89E9-015AAC1F0D9A"><p> <filepath>publishstd.exe</filepath>: The publisher process for the Standard State pattern. </p> </li> |
52 for Carbide.c++: </p> <ul> |
50 <li id="GUID-772A8A83-743C-5EE5-8D78-F1E8B60B070F"><p> <filepath>subscribestd.exe</filepath>: The subscriber process for the Standard State pattern. </p> </li> |
53 <li id="GUID-F06CD099-75C7-5070-89E9-015AAC1F0D9A"><p> <filepath>publishstd.exe</filepath>: |
51 <li id="GUID-19AD84BC-4618-518B-8F46-3DA1B1279B20"><p> <filepath>publishpe.exe</filepath>: The publisher process for the Pure Event Distribution pattern. </p> </li> |
54 The publisher process for the Standard State pattern. </p> </li> |
52 <li id="GUID-BDCCB376-3EE5-5F5B-A53D-43F52418E6AA"><p> <filepath>subscribepe.exe</filepath>: The subscriber process for the Pure Event Distribution pattern. </p> </li> |
55 <li id="GUID-772A8A83-743C-5EE5-8D78-F1E8B60B070F"><p> <filepath>subscribestd.exe</filepath>: |
53 <li id="GUID-9731BBF0-0C21-5739-A9C6-4894E78A6B41"><p> <filepath>publishspec.exe</filepath>: The publisher process for the Speculative Publishing pattern. </p> </li> |
56 The subscriber process for the Standard State pattern. </p> </li> |
54 <li id="GUID-0897C9AB-A30D-57A7-817C-80750877350C"><p> <filepath>subscribespec.exe</filepath>: The subscriber process for the Speculative Publishing pattern. </p> </li> |
57 <li id="GUID-19AD84BC-4618-518B-8F46-3DA1B1279B20"><p> <filepath>publishpe.exe</filepath>: |
|
58 The publisher process for the Pure Event Distribution pattern. </p> </li> |
|
59 <li id="GUID-BDCCB376-3EE5-5F5B-A53D-43F52418E6AA"><p> <filepath>subscribepe.exe</filepath>: |
|
60 The subscriber process for the Pure Event Distribution pattern. </p> </li> |
|
61 <li id="GUID-9731BBF0-0C21-5739-A9C6-4894E78A6B41"><p> <filepath>publishspec.exe</filepath>: |
|
62 The publisher process for the Speculative Publishing pattern. </p> </li> |
|
63 <li id="GUID-0897C9AB-A30D-57A7-817C-80750877350C"><p> <filepath>subscribespec.exe</filepath>: |
|
64 The subscriber process for the Speculative Publishing pattern. </p> </li> |
|
65 </ul> </section> |
55 </ul> </section> |
66 <section id="GUID-D8D0CB53-A319-55EA-8650-6F9A74DBDD6C"><title>Running the |
56 <section id="GUID-D8D0CB53-A319-55EA-8650-6F9A74DBDD6C"><title>Running |
67 example</title> <p>To run the example, perform the following steps on each |
57 the example</title> <p>To run the example, perform the following steps |
68 usage pattern: </p> <ol id="GUID-5BFB2C37-2036-542C-9CD4-672D9D18F25C"> |
58 on each usage pattern: </p> <ol id="GUID-5BFB2C37-2036-542C-9CD4-672D9D18F25C"> |
69 <li id="GUID-80B81388-C636-50A0-BCCC-8F6F609E410E"><p>Open two eshells. </p> </li> |
59 <li id="GUID-80B81388-C636-50A0-BCCC-8F6F609E410E"><p>Open two eshells. </p> </li> |
70 <li id="GUID-A1FF28F1-696E-593C-9FFA-54F5C96F32F2"><p>Run the publisher executable |
60 <li id="GUID-A1FF28F1-696E-593C-9FFA-54F5C96F32F2"><p>Run the publisher |
71 file in one eshell. </p> </li> |
61 executable file in one eshell. </p> </li> |
72 <li id="GUID-E3227D02-EB36-518A-8A25-59335A27F062"><p>Run the subscriber executable |
62 <li id="GUID-E3227D02-EB36-518A-8A25-59335A27F062"><p>Run the subscriber |
73 file in another eshell. </p> </li> |
63 executable file in another eshell. </p> </li> |
74 </ol> <p> <b>Note</b>: Switch between eshells by pressing <codeph>CTRL+ALT+SHIFT+T</codeph>. </p> </section> |
64 </ol> <p> <b>Note</b>: Switch between eshells by pressing <codeph>CTRL+ALT+SHIFT+T</codeph>. </p> </section> |
75 <section id="GUID-935115E3-FF46-5EC1-8F36-A6AE35356AD4"><title>See also</title> <p>For |
65 <section id="GUID-935115E3-FF46-5EC1-8F36-A6AE35356AD4"><title>See |
76 more information, see <xref href="GUID-A81C65CF-CF4E-571C-8080-9D387F46AAD6.dita">Publish |
66 also</title> <p>For more information, see <xref href="GUID-A81C65CF-CF4E-571C-8080-9D387F46AAD6.dita">Publish and Subscribe</xref> in <i>Using User Library (E32)</i>. </p> </section> |
77 and Subscribe</xref> in <i>Using User Library (E32)</i>. </p> </section> |
|
78 </conbody></concept> |
67 </conbody></concept> |