|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Methods for USB UI notifiers. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <EikNotApi.h> |
|
20 #include <eikenv.h> |
|
21 |
|
22 #include "usbuincableconnectednotifier.h" |
|
23 #include "usbuinqueriesnotifier.h" |
|
24 #include "usbuinotifdebug.h" |
|
25 |
|
26 // CONSTANTS |
|
27 const TInt KUSBUINotifierArrayIncrement = 1; |
|
28 |
|
29 |
|
30 // ================= EXPORTED FUNCTIONS ======================================= |
|
31 |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 // Instantiate notifiers |
|
35 // |
|
36 // ---------------------------------------------------------------------------- |
|
37 |
|
38 LOCAL_C void CreateUSBUINotifiersL( |
|
39 CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers ) |
|
40 { |
|
41 FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL")); |
|
42 |
|
43 CUSBUICableConnectedNotifier* cableConnectedNotifier = |
|
44 CUSBUICableConnectedNotifier::NewL(); |
|
45 CleanupStack::PushL( cableConnectedNotifier ); |
|
46 aNotifiers->AppendL( cableConnectedNotifier ); |
|
47 CleanupStack::Pop( cableConnectedNotifier ); |
|
48 |
|
49 |
|
50 FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL completed")); |
|
51 } |
|
52 |
|
53 // ---------------------------------------------------------------------------- |
|
54 // |
|
55 // Lib main entry point: Creates a notifiers array. |
|
56 // |
|
57 // ---------------------------------------------------------------------------- |
|
58 |
|
59 EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray() |
|
60 { |
|
61 FLOG(_L("[USBUINOTIF]\t NotifierArray")); |
|
62 |
|
63 CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = NULL; |
|
64 |
|
65 TRAPD( err, notifiers = |
|
66 new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>( |
|
67 KUSBUINotifierArrayIncrement )); |
|
68 |
|
69 if ( err == KErrNone ) |
|
70 { |
|
71 if( notifiers ) |
|
72 { |
|
73 TRAPD( errCreate, CreateUSBUINotifiersL( notifiers )); |
|
74 if( errCreate ) |
|
75 { |
|
76 TInt count = notifiers->Count(); |
|
77 while(count--) |
|
78 { |
|
79 (*notifiers)[count]->Release(); |
|
80 } |
|
81 delete notifiers; |
|
82 notifiers = NULL; |
|
83 } |
|
84 |
|
85 FLOG(_L("[USBUINOTIF]\t NotifierArray completed")); |
|
86 } |
|
87 } |
|
88 else |
|
89 { |
|
90 FLOG(_L("[USBUINOTIF]\t NotifierArray Failed!!!")); |
|
91 } |
|
92 |
|
93 return notifiers; |
|
94 } |
|
95 |
|
96 // End of File |