Symbian3/SDK/Source/GUID-E93EE459-8CF4-42A1-B06C-E78E56FD25A0.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Wed, 31 Mar 2010 11:11:55 +0100
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
permissions -rw-r--r--
Week 12 contribution of API Specs and fix SDK submission

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-E93EE459-8CF4-42A1-B06C-E78E56FD25A0" xml:lang="en"><title>Listening
for Property Changes</title><shortdesc>The sensor channel APIs enable the client applications to be notified
about the changes to properties associated with a sensor channel.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<prereq id="GUID-D1D22060-E453-4046-953D-10486D45885F"> Before listening for
the property changes of a sensor channel, you must <xref href="GUID-4B709839-8EEF-4AD2-9868-9AF0176B1E5B.dita#GUID-4B709839-8EEF-4AD2-9868-9AF0176B1E5B/GUID-FBBD3A8B-F240-4DC0-B516-3A51FDD86A88">open the sensor channel</xref>.         </prereq>
<context id="GUID-0D960123-7430-42B5-A84D-B63F2852DD7C"><p>The client applications
can use the property listener to monitor the property changes made by other
clients.</p></context>
<steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-8-1-9-1-1-6-1-4-1-4-1-8-1-3-3">
<step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-8-1-9-1-1-6-1-4-1-4-1-8-1-3-3-1"><cmd>Create a property
listener implementation for the <parmname>MSensrvPropertyListener</parmname> interface.</cmd>
<stepxmp><codeblock xml:space="preserve">class PropertyListener:public MSensrvPropertyListener
    {
    public:    
    void PropertyChanged(CSensrvChannel &amp;aChannel, const TSensrvProperty &amp;aChangedProperty)
        {
        ...
         //Implementation
        }
    void PropertyError(CSensrvChannel &amp;aChannel, TSensrvErrorSeverity aError)
        {
        ...
         //Implementation
        }
    void SetPropertySuccessIndicationChanged(TSetPropertySuccessIndicator aIndication)
        {
        ...
         //Implementation
        }
    void GetPropertyListenerInterfaceL(TUid aInterfaceUid, TAny *&amp;aInterface)
        {
        ...
         //Implementation
        }
    };</codeblock></stepxmp>
</step>
<step id="GUID-6AB619B9-0259-493A-BC40-CAF5BF337E04"><cmd>Start property listening
by passing an instance of property listener implementation using <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-4552066A-4FC1-3876-89AA-DC9B081B3814"><apiname>CSensrvChannel::SetPropertyListenerL()</apiname></xref>.</cmd>
<stepxmp><codeblock xml:space="preserve">//Instance of the property listener implementation
PropertyListener propListener;
...
CSensrvChannel* channel;
...
channel-&gt;SetPropertyListenerL(&amp;propListener);
...</codeblock></stepxmp>
<info>When a property change occurs, a <parmname>PropertyChanged()</parmname> notification
is delivered through the <parmname>MSensrvPropertyListener</parmname> callback
interface to the clients that are listening for property changes.<note> The
client that set the property is not notified.</note></info>
</step>
<step id="GUID-8AD85E3B-EBBC-41E4-A32C-AF2A52B018E6"><cmd>Once you get the
required property changes associated with the sensor channel, you can stop
property listening by passing a NULL parameter to the <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-4552066A-4FC1-3876-89AA-DC9B081B3814"><apiname>CSensrvChannel::SetPropertyListenerL()</apiname></xref> function.</cmd>
<stepxmp><codeblock xml:space="preserve">channel-&gt;SetPropertyListenerL();</codeblock></stepxmp>
</step>
</steps>
</taskbody></task>