|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <e32svr.h> |
|
20 #include "HWRMVibra.h" |
|
21 #include "HWRMVibraImpl.h" |
|
22 #include "HWRMtrace.h" |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // LOCAL CONSTANTS AND MACROS |
|
33 |
|
34 // MODULE DATA STRUCTURES |
|
35 |
|
36 // LOCAL FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 // ============================= LOCAL FUNCTIONS =============================== |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CHWRMVibra::NewL |
|
46 // Two-phased constructor. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CHWRMVibra* CHWRMVibra::NewL() |
|
50 { |
|
51 CHWRMVibra* impl = NewLC(); |
|
52 |
|
53 CleanupStack::Pop(); |
|
54 |
|
55 return impl; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CHWRMVibra::NewLC |
|
60 // Two-phased constructor. Leaves instance to CleanupStack. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C CHWRMVibra* CHWRMVibra::NewLC() |
|
64 { |
|
65 COMPONENT_TRACE1(_L("HWRM VibraClient - CHWRMVibra::NewLC()")); |
|
66 |
|
67 CHWRMVibraImpl* impl = new( ELeave ) CHWRMVibraImpl(); |
|
68 |
|
69 CleanupStack::PushL( impl ); |
|
70 impl->ConstructL(NULL); |
|
71 |
|
72 COMPONENT_TRACE2(_L( "HWRM VibraClient - CHWRMVibra::NewLC - return 0x%x" ), impl ); |
|
73 |
|
74 return static_cast<CHWRMVibra*>(impl); |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CHWRMVibra::NewL |
|
79 // Two-phased constructor for creating a vibra client with callbacks. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 EXPORT_C CHWRMVibra* CHWRMVibra::NewL(MHWRMVibraObserver* aCallback) |
|
83 { |
|
84 CHWRMVibra* impl = NewLC(aCallback); |
|
85 |
|
86 CleanupStack::Pop(); |
|
87 |
|
88 return impl; |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CHWRMVibra::NewLC |
|
93 // Two-phased constructor for creating a vibra client with callbacks. |
|
94 // Leaves instance to CleanupStack. |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C CHWRMVibra* CHWRMVibra::NewLC(MHWRMVibraObserver* aCallback) |
|
98 { |
|
99 COMPONENT_TRACE2(_L( "HWRM VibraClient - CHWRMVibra::NewLC(0x%x)" ), aCallback ); |
|
100 |
|
101 // Check that reference is not NULL |
|
102 if ( !aCallback ) |
|
103 { |
|
104 User::Leave(KErrBadHandle); |
|
105 } |
|
106 |
|
107 CHWRMVibraImpl* impl = new( ELeave ) CHWRMVibraImpl(); |
|
108 |
|
109 CleanupStack::PushL( impl ); |
|
110 impl->ConstructL(aCallback); |
|
111 |
|
112 COMPONENT_TRACE2(_L( "HWRM VibraClient - CHWRMVibra::NewLC - return 0x%x" ), impl); |
|
113 |
|
114 return static_cast<CHWRMVibra*>(impl); |
|
115 } |
|
116 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
117 |
|
118 // End of File |