Symbian3/SDK/Source/GUID-CD87FAF6-A11D-4260-9472-CABA18BF86B1.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-CD87FAF6-A11D-4260-9472-CABA18BF86B1.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,49 @@
+<?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-CD87FAF6-A11D-4260-9472-CABA18BF86B1" xml:lang="en"><title>Creating
+a light instance</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
+<context>       <p>Create an instance of <codeph>CHWRMLight</codeph> instance
+using <codeph>NewL()</codeph> or <codeph>NewLC()</codeph> methods. After creating
+the instance, lights can be directly controlled via the provided class methods.</p><p><b>Without
+notify handling</b></p><p>Create an instance of the <codeph>CHWRMLight</codeph> implementation
+class using the <codeph>NewL()</codeph> or <codeph>NewLC()</codeph> constructor
+without a parameter.</p><p>The following code snippet demonstrates how to
+create an instance without notify handling to control the lights of the device:</p><codeblock xml:space="preserve">CHWRMLight* light = CHWRMLight::NewLC(); // No callbacks</codeblock><p><b>With notify handling </b></p><p>Derive a class from the <codeph>MHWRMLightObserver</codeph> interface
+and implement the <codeph>LightStatusChanged()</codeph> method.</p><p>The
+following code snippet is an example of the header of the class implemented
+by the client:</p><codeblock xml:space="preserve">// INCLUDES
+#include HWRMLight.h // Link against HWRMLightClient.lib.
+class CLightStatusObserver : public CBase,
+                             public MHWRMLightObserver
+    {
+    public:
+        CLightStatusObserver();
+        ~CLightStatusObserver();
+        void ConstructL();
+        static CLightStatusObserver* NewL();
+        //from MHWRMLightObserver
+        virtual void LightStatusChanged( TInt aTarget,
+                                         CHWRMLight::TLightStatus aStatus );
+    private:
+        CHWRMLight* iLight;
+    };</codeblock><p>Create an instance of the <codeph>CHWRMLight</codeph> implementation
+class using the <codeph>NewL()</codeph> or <codeph>NewLC()</codeph> constructor
+with a parameter. This parameter is a pointer to an object that is derived
+from <codeph>MHWRMLightObserver</codeph>. After this, lights can be directly
+controlled through the provided class methods. Every light status change causes
+a notification using <codeph>MHWRMLightObserver::LightStatusChanged()</codeph>.</p><p>The
+following code snippet demonstrates how to create an instance with notify
+handling to control the lights of the device:</p><codeblock xml:space="preserve">void CLightStatusObserver::ConstructL()
+    {
+    iLight = CHWRMLight::NewL( this )
+    }</codeblock></context>
+</taskbody></task>
\ No newline at end of file