|
1 // Copyright (c) 2006-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 "cmmmessagemanagerbase.h" |
|
20 #include "tflogger.h" |
|
21 #include "ctsydelegates.h" |
|
22 #include "csatmessagerouterproxy.h" |
|
23 #include <ctsy/pluginapi/mmessagerouter.h> |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 CMmMessageManagerBase* CMmMessageManagerBase::NewL(MMessageRouter& aMessageRouter) |
|
28 { |
|
29 CMmMessageManagerBase* messageManager = new ( ELeave ) CMmMessageManagerBase(aMessageRouter); |
|
30 CleanupStack::PushL( messageManager ); |
|
31 messageManager->ConstructL(); |
|
32 CleanupStack::Pop(); |
|
33 return messageManager; |
|
34 } |
|
35 |
|
36 CMmMessageManagerBase::~CMmMessageManagerBase() |
|
37 { |
|
38 // instance was created in this object, so we delete it here |
|
39 if ( iTsyDelgates ) |
|
40 { |
|
41 delete iTsyDelgates; |
|
42 } |
|
43 iTsyDelgates = NULL; |
|
44 |
|
45 if ( iMessageRouterProxy ) |
|
46 { |
|
47 delete iMessageRouterProxy; |
|
48 } |
|
49 iMessageRouterProxy = NULL; |
|
50 } |
|
51 |
|
52 CMmMessageManagerBase::CMmMessageManagerBase(MMessageRouter& aMessageRouter) |
|
53 : iMessageRouter (aMessageRouter) |
|
54 { |
|
55 } |
|
56 |
|
57 void CMmMessageManagerBase::ConstructL() |
|
58 { |
|
59 //Create instances |
|
60 iTsyDelgates = CTsyDelegates::NewL(); |
|
61 iMessageRouterProxy = CSatMessageRouterProxy::NewL( *iTsyDelgates ); |
|
62 } |
|
63 |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CMmMessageManagerBase::HandleRequestL |
|
67 // Forwards a request to DOS layer |
|
68 // (other items were commented in a header). |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 TInt CMmMessageManagerBase::HandleRequestL( |
|
72 const TInt aIpc ) |
|
73 { |
|
74 TFLOGSTRING2("TSY: CMmMessageManagerBase::HandleRequestL. IPC = %d", aIpc ); |
|
75 return HandleRequestL( |
|
76 aIpc, REINTERPRET_CAST( const CMmDataPackage*, NULL ) ); |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CMmMessageManagerBase::HandleRequestL |
|
81 // Forwards a request to DOS layer |
|
82 // (other items were commented in a header). |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 TInt CMmMessageManagerBase::HandleRequestL( |
|
86 const TInt aIpc, |
|
87 const CMmDataPackage* aDataPackage ) |
|
88 { |
|
89 TFLOGSTRING2("TSY: CMmMessageManagerBase::HandleRequestL. IPC = %d", aIpc ); |
|
90 |
|
91 return iMessageRouter.ExtFuncL( aIpc, aDataPackage ); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CMmMessageManagerBase::HandleRequestL |
|
96 // Forwards a request to DOS layer |
|
97 // (other items were commented in a header). |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 TInt CMmMessageManagerBase::HandleRequestL( |
|
101 const TInt aIpc, |
|
102 const TDataPackage* aDataPackage ) |
|
103 { |
|
104 TFLOGSTRING2("TSY: CMmMessageManagerBase::HandleRequestL. IPC = %d", aIpc ); |
|
105 |
|
106 // map the TDataPackage into a CMmDataPackage |
|
107 // Non-core Methods from the SOS layer using the DOS layer will perforn |
|
108 // always this mapping. |
|
109 // TSY core methods will call directly the overloaded HandleRequest method |
|
110 // which uses a CMmDataPackage in the method's signature. |
|
111 iDataPackage.SetPacketData ( aDataPackage ); |
|
112 |
|
113 //call the overloaded HandleRequest of CMmMessageManagerBase |
|
114 return HandleRequestL( aIpc, &iDataPackage ); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CMmMessageManagerBase::RegisterTsyObject |
|
119 // Registers a Tsy object for request and notification completions |
|
120 // Stored in Tsy Delegates |
|
121 // (other items were commented in a header). |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 void CMmMessageManagerBase::RegisterTsyObject( |
|
125 TTsyObjects aTsyObjectType, |
|
126 CBase* aTsyObject ) |
|
127 { |
|
128 iTsyDelgates->RegisterTsyObject( aTsyObjectType, aTsyObject ); |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CMmMessageManagerBase::DeregisterTsyObject |
|
133 // Remove registered Tsy object stored in Tsy Delegates |
|
134 // (other items were commented in a header). |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CMmMessageManagerBase::DeregisterTsyObject( |
|
138 CBase* aTsyObject ) |
|
139 { |
|
140 iTsyDelgates->DeregisterTsyObject( aTsyObject ); |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CMmMessageManagerBase::GetMessageManagerCallback |
|
145 // Return pointer to MessageManagerCallback object |
|
146 // (other items were commented in a header). |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 MmMessageManagerCallback* |
|
150 CMmMessageManagerBase::GetMessageManagerCallback() |
|
151 { |
|
152 return iMessageRouterProxy; |
|
153 } |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 // End of File |
|
159 |