|
1 // Copyright (c) 1997-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 #include "mSLOGGER.H" |
|
18 #include "Mphbkcom.h" |
|
19 #include "ATIO.H" |
|
20 #include "ATINIT.H" |
|
21 #include "Matstd.h" |
|
22 #include "monstore.h" |
|
23 |
|
24 |
|
25 |
|
26 CMobileONStore* CMobileONStore::NewL(CATIO* aATIO,CATInit* aInit,CPhoneGlobals* aMMStatus) |
|
27 /** NewL |
|
28 * |
|
29 * This method creats a instance of the CMobileONStore class. |
|
30 * It is implented as a standard 2 phase constructor. |
|
31 */ |
|
32 { |
|
33 CMobileONStore* oNStore=new(ELeave) CMobileONStore(aATIO,aInit,aMMStatus); |
|
34 CleanupStack::PushL(oNStore); |
|
35 oNStore->ConstructL(); |
|
36 CleanupStack::Pop(); |
|
37 return oNStore; |
|
38 } |
|
39 |
|
40 |
|
41 CMobileONStore::CMobileONStore(CATIO* aATIO,CATInit* aInit,CPhoneGlobals* aMMGlobals) |
|
42 : iIo(aATIO), iInit(aInit), iPhoneGlobals(aMMGlobals) |
|
43 {} |
|
44 |
|
45 |
|
46 void CMobileONStore::ConstructL() |
|
47 /** |
|
48 * Construction of global params. |
|
49 */ |
|
50 { |
|
51 iATOwnNumbers = CATOwnNumbers::NewL(iIo,this,iInit,iPhoneGlobals); |
|
52 } |
|
53 |
|
54 |
|
55 CMobileONStore::~CMobileONStore() |
|
56 /** |
|
57 * Destructor for CMobileONStore globals. |
|
58 */ |
|
59 { |
|
60 delete iATOwnNumbers; |
|
61 } |
|
62 |
|
63 |
|
64 CTelObject::TReqMode CMobileONStore::ReqModeL(const TInt aIpc) |
|
65 /** ReqModeL |
|
66 * |
|
67 * This function is basically a switch statement which describes the flow control |
|
68 * capabilities for each request dealt with by the CMobileONStore sub-session extension. |
|
69 * @param aIpc |
|
70 * @return |
|
71 */ |
|
72 { |
|
73 CTelObject::TReqMode ret(0); |
|
74 |
|
75 switch (aIpc) |
|
76 { |
|
77 case EMobilePhoneStoreGetInfo: |
|
78 case EMobilePhoneStoreRead: |
|
79 ret=KReqModeFlowControlObeyed; |
|
80 break; |
|
81 |
|
82 default: |
|
83 User::Leave(KErrNotSupported); |
|
84 } |
|
85 |
|
86 // Check if the data port is currently loaned. If it is and the requested IPC |
|
87 // is flow controlled then block Etel calling the IPC by leaving with KErrInUse |
|
88 if((ret&KReqModeFlowControlObeyed) && iPhoneGlobals->iPhoneStatus.iDataPortLoaned) |
|
89 { |
|
90 LOGTEXT2(_L8("ReqModeL Leaving with KErrInUse as data port is loaned (aIpc=%d)"),aIpc); |
|
91 User::Leave(KErrInUse); |
|
92 } |
|
93 |
|
94 return ret; |
|
95 } |
|
96 |
|
97 |
|
98 TInt CMobileONStore::ExtFunc(const TTsyReqHandle aTsyReqHandle, const TInt aIpc,const TDataPackage& aPackage) |
|
99 /** ExtFunc |
|
100 * |
|
101 * |
|
102 * @param aTsyReqHandle the request ID |
|
103 * @param aIpc which request to execute |
|
104 * @param aPackage refence to the argument to pas in to the method specified by the IPC number. |
|
105 * @return |
|
106 */ |
|
107 { |
|
108 |
|
109 switch (aIpc) |
|
110 { |
|
111 |
|
112 case EMobilePhoneStoreGetInfo: |
|
113 return GetOwnNumberInfo(aTsyReqHandle, aPackage.Des1n()); |
|
114 case EMobilePhoneStoreRead: |
|
115 return Read(aTsyReqHandle, aPackage.Des1n()); |
|
116 default: |
|
117 { |
|
118 LOGTEXT2(_L8("CPhoneMobile::ExtFunc\tunsupported request %d"), aIpc); |
|
119 ReqCompleted(aTsyReqHandle, KErrNotSupported); |
|
120 return KErrNone; |
|
121 } |
|
122 |
|
123 } |
|
124 } |
|
125 |
|
126 |
|
127 TInt CMobileONStore::NumberOfSlotsL(const TInt /*aIpc*/) |
|
128 /** |
|
129 * |
|
130 * Since this class does not support any kind off notification |
|
131 * 0 is returned as the size of the buffer needed. |
|
132 */ |
|
133 { |
|
134 return 0; |
|
135 } |
|
136 |
|
137 |
|
138 TInt CMobileONStore::RegisterNotification(const TInt /*aIpc*/) |
|
139 /** |
|
140 * This function is not supported. |
|
141 */ |
|
142 { |
|
143 return KErrNotSupported; |
|
144 } |
|
145 |
|
146 |
|
147 TInt CMobileONStore::DeregisterNotification(const TInt /*aIpc*/) |
|
148 /** |
|
149 * This function is not supported. |
|
150 */ |
|
151 { |
|
152 return KErrNotSupported; |
|
153 } |
|
154 |
|
155 |
|
156 void CMobileONStore::Init() |
|
157 /** |
|
158 * This function is not supported. |
|
159 */ |
|
160 {} |
|
161 |
|
162 |
|
163 TInt CMobileONStore::CancelService(const TInt aIpc, const TTsyReqHandle aTsyReqHandle) |
|
164 /** Cancel Service |
|
165 * @param aIpc which method to cancel |
|
166 * @param aTsyReqHandle the request ID to the request to cancel |
|
167 * @return |
|
168 */ |
|
169 { |
|
170 switch(aIpc) |
|
171 { |
|
172 case EMobilePhoneStoreRead: |
|
173 return ReadCancel(aTsyReqHandle); |
|
174 default: |
|
175 return KErrNotSupported; |
|
176 }//switch |
|
177 } |
|
178 |
|
179 |
|
180 CTelObject* CMobileONStore::OpenNewObjectByNameL(const TDesC& /*aName*/) |
|
181 /** |
|
182 * This function is not supported. |
|
183 */ |
|
184 { |
|
185 User::Leave(KErrNotSupported); |
|
186 return NULL; |
|
187 } |
|
188 |
|
189 |
|
190 CTelObject* CMobileONStore::OpenNewObjectL(TDes& /*aName*/) |
|
191 /** |
|
192 * This function is not supported. |
|
193 */ |
|
194 { |
|
195 User::Leave(KErrNotSupported); |
|
196 return NULL; |
|
197 } |
|
198 |
|
199 |
|
200 TInt CMobileONStore::GetOwnNumberInfo(TTsyReqHandle aTsyReqHandle, TDes8* aInfo) |
|
201 /** Get Own Number Info |
|
202 * |
|
203 * This method pases on a request to get information about the own number store. |
|
204 * The information retrieved is containing |
|
205 * @param aTsyReqHandle the request ID |
|
206 * @param aInfo Own number |
|
207 * @return Error code |
|
208 */ |
|
209 { |
|
210 iATOwnNumbers->GetInfo(aTsyReqHandle,aInfo); |
|
211 return KErrNone; |
|
212 } |
|
213 |
|
214 |
|
215 TInt CMobileONStore::Read(TTsyReqHandle aTsyReqHandle, TDes8* aEntry) |
|
216 /** Read a Own Number Store entry |
|
217 * |
|
218 * This method deals with the request to get one entry from the own number store. |
|
219 * The one entry to get is specified by the iIndex member of the TMobileONEntryV1 |
|
220 * class. |
|
221 * The iIndex is part of aEntry and is used in CATOwnNumbers::GetEntry to get the |
|
222 * entry from the phone. The request is passed on to the CATOwnNumbers class which |
|
223 * executes the AT+CNUM command(if needed) and returns the dersired information. |
|
224 * @param aTsyReqHandle The request ID |
|
225 * @param aEntry This argument is of type TMobileONEntryV1Pckg. |
|
226 * @return Error code |
|
227 */ |
|
228 { |
|
229 //Pass the request on to the CATOwnNumbers class. |
|
230 iATOwnNumbers->GetEntry(aTsyReqHandle, aEntry); |
|
231 return KErrNone; |
|
232 } |
|
233 |
|
234 |
|
235 TInt CMobileONStore::ReadCancel(const TTsyReqHandle aTsyReqHandle) |
|
236 /** Cancel Raed |
|
237 * |
|
238 * This method passae the request to cancel a read on to the CATOwnNumbers class. |
|
239 * @param aTsyReqHandle The request ID |
|
240 * @return Error code |
|
241 */ |
|
242 { |
|
243 iATOwnNumbers->CancelCommand(aTsyReqHandle); |
|
244 return KErrNone; |
|
245 } |