Symbian3/SDK/Source/GUID-3472798D-CEC5-5BA9-A3A7-D4245661DEDB.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-3472798D-CEC5-5BA9-A3A7-D4245661DEDB" xml:lang="en"><title>pubsub:
       
    13 Using the Publish and Subscribe IPC Mechanism</title><shortdesc>This example demonstrates the Publish and Subscribe IPC mechanisms
       
    14 using the <apiname>RProperty</apiname> class. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <section id="GUID-909438A0-5FCA-4FA3-96EF-2666A3C07227"><title>Download</title> <p>Click on the following link to download
       
    16 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>
       
    17 <section id="GUID-20D6C064-50E0-52EE-8287-1D657C27FF75"><title>Description</title> <p>This
       
    18 example demonstrates three types of usage pattern for Publish and Subscribe: </p> <ul>
       
    19 <li id="GUID-12170122-3E04-5098-99C3-0C0C6B8C8914"><p>Standard State Publishing </p> <ul>
       
    20 <li id="GUID-DA65B928-6F46-5238-AED8-8CE062098621"><p> <b>Publisher:</b> The
       
    21 publisher defines a byte-array property and pre-allocates memory to it. It
       
    22 interactively updates and re-publishes the value of the property. </p> </li>
       
    23 <li id="GUID-0519A68F-E898-5FD7-95C1-A6AA79C5CAE1"><p> <b>Subscriber:</b> The
       
    24 subscriber gets the value of the property defined by the publisher by subscribing
       
    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>
       
    28 <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
       
    30 publisher defines an integer property and publishes a random integer value
       
    31 periodically. This value has no significance to the subscriber. </p> </li>
       
    32 <li id="GUID-4A3987D9-B916-584A-81C9-DC8079AA1270"><p> <b>Subscriber:</b> The
       
    33 subscriber gets a notification when the publisher publishes a value. It exits
       
    34 when the property is deleted by the publisher. </p> </li>
       
    35 </ul> </li>
       
    36 <li id="GUID-FFBD46FD-D0FB-5C9A-98D8-ABA7B8C6E398"><p>Speculative Publishing </p> <ul>
       
    37 <li id="GUID-073BA0B9-1682-5642-8929-4B45738F28BD"><p> <b>Publisher:</b> The
       
    38 publisher does not define the property. It ignores the <codeph>KErrNotFound</codeph> error
       
    39 when it publishes the value of the property. </p> </li>
       
    40 <li id="GUID-78B22435-963F-5E5E-9A2B-AC582DD520D4"><p> <b>Subscriber:</b> The
       
    41 subscriber defines and subscribes to the property. It ignores the <codeph>KErrAlreadyExists</codeph> error. </p> </li>
       
    42 </ul> </li>
       
    43 </ul> </section>
       
    44 <section id="GUID-63F559E8-36AB-41CD-9A2E-57080EA29601"><title>Class summary</title><ul>
       
    45 <li><p><xref href="GUID-C4776034-D190-3FC4-AF45-C7F195093AC3.dita"><apiname>RProperty</apiname></xref> - User side interface to Publish &amp;
       
    46 Subscribe.</p></li>
       
    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>
       
    48 </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 OS build process</xref> describes
       
    50 how to build this example. </p> <p>This example builds the following binaries
       
    51 in the standard location (<filepath>\epoc32\release\winscw\&lt;build_variant&gt;</filepath>)
       
    52 for Carbide.c++: </p> <ul>
       
    53 <li id="GUID-F06CD099-75C7-5070-89E9-015AAC1F0D9A"><p> <filepath>publishstd.exe</filepath>:
       
    54 The publisher process for the Standard State pattern. </p> </li>
       
    55 <li id="GUID-772A8A83-743C-5EE5-8D78-F1E8B60B070F"><p> <filepath>subscribestd.exe</filepath>:
       
    56 The subscriber process for the Standard State 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>
       
    66 <section id="GUID-D8D0CB53-A319-55EA-8650-6F9A74DBDD6C"><title>Running the
       
    67 example</title> <p>To run the example, perform the following steps on each
       
    68 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>
       
    70 <li id="GUID-A1FF28F1-696E-593C-9FFA-54F5C96F32F2"><p>Run the publisher executable
       
    71 file in one eshell. </p> </li>
       
    72 <li id="GUID-E3227D02-EB36-518A-8A25-59335A27F062"><p>Run the subscriber executable
       
    73 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>
       
    75 <section id="GUID-935115E3-FF46-5EC1-8F36-A6AE35356AD4"><title>See also</title> <p>For
       
    76 more information, see <xref href="GUID-A81C65CF-CF4E-571C-8080-9D387F46AAD6.dita">Publish
       
    77 and Subscribe</xref> in <i>Using User Library (E32)</i>. </p> </section>
       
    78 </conbody></concept>