|
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 task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-74ACD63A-F45B-4F64-963B-0DCF0842A13B" xml:lang="en"><title>Creating |
|
13 an instance</title><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
14 <context><p>Create a new instance of Extended Light API is using <codeph>NewL()</codeph> or <codeph>NewLC()</codeph> method. |
|
15 If the instance require the status feedback from the lights, derive the instance |
|
16 of the API from the <codeph>MHWRMExtendedLight</codeph>.</p><p>The following |
|
17 code demonstrates how to create an instance of Extended Light API:</p><codeblock xml:space="preserve">#include HWRMExtendedLight.h //Link against HWRMExtendedLightClient.lib. |
|
18 class CNewApp : public CBase, |
|
19 public MHWRMExtendedLightObserver |
|
20 { |
|
21 public: |
|
22 CNewApp(); |
|
23 ~CNewApp(); |
|
24 void ConstructL(); |
|
25 static CNewApp* NewL(); |
|
26 // from MHWRMExtendedLightObserver |
|
27 virtual void LightStatusChanged( TInt aTarget, |
|
28 CHWRMExtendedLight::TLightStatus aStatus ); |
|
29 private: |
|
30 CHWRMExtendedLight* iLight; |
|
31 }; |
|
32 </codeblock><p>Without a notification, the instance can be derived from <codeph>CBase</codeph> and |
|
33 created using <codeph>NewL()</codeph> or <codeph>NewLC()</codeph>.</p><codeblock xml:space="preserve">CHWRMExtendedLight* light = CHWRMExtendedLight::NewLC(); // No callbacks</codeblock></context> |
|
34 </taskbody></task> |