|
1 /* |
|
2 * Copyright (c) 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: Implementation of CCDSYEventManager class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <doseventmanager.h> |
|
23 #include "CDSYEventManager.h" |
|
24 #include "CDSYMessage.h" |
|
25 #include "CDSYController.h" |
|
26 #include "CDSYMessageIDs.h" |
|
27 #include "CDSYMessageStructures.h" |
|
28 #include "CDSYFactory.h" |
|
29 #include "commondsy_debug.h" |
|
30 |
|
31 |
|
32 |
|
33 // EXTERNAL DATA STRUCTURES |
|
34 // EXTERNAL FUNCTION PROTOTYPES |
|
35 // CONSTANTS |
|
36 // MACROS |
|
37 // LOCAL CONSTANTS AND MACROS |
|
38 // MODULE DATA STRUCTURES |
|
39 // LOCAL FUNCTION PROTOTYPES |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 |
|
43 |
|
44 // ============================= LOCAL FUNCTIONS =============================== |
|
45 |
|
46 |
|
47 |
|
48 // ============================ MEMBER FUNCTIONS =============================== |
|
49 |
|
50 |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CCDSYEventManager::CCDSYEventManager |
|
54 // ----------------------------------------------------------------------------- |
|
55 CCDSYEventManager::CCDSYEventManager( CCDSYController& aCDSYController, CCDSYFactory& aCDSYFactory ) |
|
56 : iCDSYController( aCDSYController ) |
|
57 , iCDSYFactory( aCDSYFactory ) |
|
58 { |
|
59 COM_TRACE_2( "CDSY - CCDSYEventManager::CCDSYEventManager(0x%x, 0x%x)", &aCDSYController, &aCDSYFactory ); |
|
60 |
|
61 COM_TRACE_( "CDSY - CCDSYEventManager::CCDSYEventManager - return void" ); |
|
62 } |
|
63 |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CCDSYEventManager::~CCDSYEventManager |
|
68 // ----------------------------------------------------------------------------- |
|
69 CCDSYEventManager::~CCDSYEventManager() |
|
70 { |
|
71 COM_TRACE_( "CDSY - CCDSYEventManager::~CCDSYEventManager()" ); |
|
72 iCDSYController.UnregisterServiceLogic( KCDSYMsgGroup, KCDSYEventGeneral, this ); |
|
73 COM_TRACE_( "CDSY - CCDSYEventManager::~CCDSYEventManager - return void" ); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CCDSYEventManager::ConstructL |
|
78 // ----------------------------------------------------------------------------- |
|
79 void CCDSYEventManager::ConstructL() |
|
80 { |
|
81 COM_TRACE_( "CDSY - CCDSYEventManager::ConstructL()" ); |
|
82 iCDSYController.RegisterServiceLogicL( KCDSYMsgGroup, KCDSYEventGeneral, this ); |
|
83 COM_TRACE_( "CDSY - CCDSYEventManager::ConstructL - return void" ); |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CCDSYEventManager::NewL |
|
88 // ----------------------------------------------------------------------------- |
|
89 CCDSYEventManager* CCDSYEventManager::NewL( CCDSYController& aCDSYController, CCDSYFactory& aCDSYFactory ) |
|
90 { |
|
91 COM_TRACE_2( "CDSY - CCDSYEventManager::NewL(0x%x, 0x%x)", &aCDSYController, &aCDSYFactory ); |
|
92 |
|
93 CCDSYEventManager* dsyEventManager = new ( ELeave ) CCDSYEventManager( aCDSYController, aCDSYFactory ); |
|
94 CleanupStack::PushL( dsyEventManager ); |
|
95 dsyEventManager->ConstructL(); |
|
96 CleanupStack::Pop( dsyEventManager ); |
|
97 |
|
98 COM_TRACE_1( "CDSY - CCDSYEventManager::NewL - return 0x%x", dsyEventManager ); |
|
99 return dsyEventManager; |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CCDSYEventManager::ProcessMessageL |
|
104 // ----------------------------------------------------------------------------- |
|
105 void CCDSYEventManager::ProcessMessageL( TCDSYMessage& aCDSYMessage ) |
|
106 { |
|
107 COM_TRACE_1( "CDSY - CCDSYEventManager::ProcessMessageL(0x%x)", &aCDSYMessage ); |
|
108 |
|
109 TRACE_ASSERT( aCDSYMessage.Group() == KCDSYMsgGroup ); |
|
110 TRACE_ASSERT( iCDSYFactory.EventManager() != NULL ); |
|
111 |
|
112 if ( iCDSYFactory.EventManager() != NULL ) |
|
113 { |
|
114 switch ( aCDSYMessage.ID() ) |
|
115 { |
|
116 case KCDSYEventGeneral: |
|
117 |
|
118 TRACE_ASSERT( aCDSYMessage.Data()->Length() == sizeof ( TCDSYMsgDataGeneralEvent ) ); |
|
119 API_TRACE_3( "CDSY - CCDSYEventManager::ProcessMessageL - DSY event fired:GeneralEvent(0x%x, 0x%x, 0x%x)", ( ( ( TCDSYMsgDataGeneralEvent* )( aCDSYMessage.Data()->Ptr() ) )->iEvent ), |
|
120 ( ( TAny* )( ( TCDSYMsgDataGeneralEvent* )( aCDSYMessage.Data() )->Ptr() )->iParameter ), |
|
121 ( ( ( TCDSYMsgDataGeneralEvent* )( aCDSYMessage.Data()->Ptr() ) )->iParameterSize ) ); |
|
122 TRACE_ASSERT_RETURN( iCDSYFactory.EventManager()->GeneralEvent( ( ( ( TCDSYMsgDataGeneralEvent* )( aCDSYMessage.Data()->Ptr() ) )->iEvent ), |
|
123 ( ( TAny* )( ( TCDSYMsgDataGeneralEvent* )( aCDSYMessage.Data() )->Ptr() )->iParameter ), |
|
124 ( ( ( TCDSYMsgDataGeneralEvent* )( aCDSYMessage.Data()->Ptr() ) )->iParameterSize ) ) ); |
|
125 |
|
126 break; |
|
127 |
|
128 default: |
|
129 |
|
130 TRACE_ASSERT_ALWAYS; |
|
131 |
|
132 break; |
|
133 } |
|
134 } |
|
135 |
|
136 COM_TRACE_( "CDSY - CCDSYEventManager::ProcessMessageL - return void" ); |
|
137 } |
|
138 |