1 // Copyright (c) 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 // CATGetModemStatus |
|
15 // Description: |
|
16 // CGetPhoneID |
|
17 |
|
18 #include <ctsy/ltsy/cctsydispatchercallback.h> |
|
19 #include <ctsy/ltsy/mltsydispatchphoneinterface.h> |
|
20 #include "getphoneid.h" |
|
21 #include "mslogger.h" |
|
22 #include "atgetimei.h" |
|
23 #include "atgetmanufacturer.h" |
|
24 #include "atgetmodel.h" |
|
25 #include "atgetrevision.h" |
|
26 |
|
27 |
|
28 // Class CGetPhoneID |
|
29 // --------------------------------------------------------------------------- |
|
30 // CGetPhoneID::NewL |
|
31 // other items were commented in a header |
|
32 // --------------------------------------------------------------------------- |
|
33 CGetPhoneID* CGetPhoneID::NewL(CGlobalPhonemanager& aGloblePhone, |
|
34 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
35 { |
|
36 CGetPhoneID* self = new(ELeave) CGetPhoneID(aGloblePhone, |
|
37 aCtsyDispatcherCallback); |
|
38 CleanupStack::PushL(self ); |
|
39 self->ConstructL(); |
|
40 CleanupStack::Pop(); |
|
41 return self ; |
|
42 } |
|
43 // --------------------------------------------------------------------------- |
|
44 // CGetPhoneID::CGetPhoneID |
|
45 // other items were commented in a header |
|
46 // --------------------------------------------------------------------------- |
|
47 CGetPhoneID::CGetPhoneID(CGlobalPhonemanager& aGloblePhone, |
|
48 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
49 :CATCommandControlBase(aGloblePhone,aCtsyDispatcherCallback) |
|
50 { |
|
51 } |
|
52 // --------------------------------------------------------------------------- |
|
53 // CGetPhoneID::ConstructL |
|
54 // other items were commented in a header |
|
55 // --------------------------------------------------------------------------- |
|
56 void CGetPhoneID::ConstructL() |
|
57 { |
|
58 iATGetImei = CATGetImei::NewL(iPhoneGlobals,iCtsyDispatcherCallback); |
|
59 iATGetManufacturer = CATGetManufacturer::NewL(iPhoneGlobals,iCtsyDispatcherCallback); |
|
60 iATGetModel = CATGetModel::NewL(iPhoneGlobals,iCtsyDispatcherCallback); |
|
61 iATGetRevision = CATGetRevision::NewL(iPhoneGlobals,iCtsyDispatcherCallback); |
|
62 } |
|
63 // --------------------------------------------------------------------------- |
|
64 // CGetPhoneID::~CGetPhoneID |
|
65 // other items were commented in a header |
|
66 // --------------------------------------------------------------------------- |
|
67 CGetPhoneID::~CGetPhoneID() |
|
68 { |
|
69 delete iATGetImei; |
|
70 iATGetImei = NULL; |
|
71 delete iATGetManufacturer; |
|
72 iATGetManufacturer = NULL; |
|
73 delete iATGetModel; |
|
74 iATGetModel = NULL; |
|
75 delete iATGetRevision; |
|
76 iATGetRevision = NULL; |
|
77 } |
|
78 // --------------------------------------------------------------------------- |
|
79 // CGetPhoneID::AtCommandExecuteComplete |
|
80 // other items were commented in a header |
|
81 // --------------------------------------------------------------------------- |
|
82 void CGetPhoneID::AtCommandExecuteComplete(TAtEventSource aEventSource, TInt aStatus) |
|
83 { |
|
84 if((aEventSource == EWriteCompletion)&&(KErrNone == aStatus)) |
|
85 { |
|
86 return; |
|
87 } |
|
88 switch(iATType) |
|
89 { |
|
90 case ELtsyAT_Phone_GetImei: |
|
91 if((KErrNone == aStatus)&&(aEventSource == EReadCompletion)) |
|
92 { |
|
93 aStatus = iATGetImei->GetErrorValue(); |
|
94 } |
|
95 GetImeiComplete(aStatus); |
|
96 break; |
|
97 case ELtsyAT_Phone_GetManufacturer: |
|
98 if((KErrNone == aStatus)&&(aEventSource == EReadCompletion)) |
|
99 { |
|
100 aStatus = iATGetManufacturer->GetErrorValue(); |
|
101 } |
|
102 GetManufacturerComplete(aStatus); |
|
103 break; |
|
104 case ELtsyAT_Phone_GetModel: |
|
105 if((KErrNone == aStatus)&&(aEventSource == EReadCompletion)) |
|
106 { |
|
107 aStatus = iATGetModel->GetErrorValue(); |
|
108 } |
|
109 GetModelComplete(aStatus); |
|
110 break; |
|
111 case ELtsyAT_Phone_GetRevision: |
|
112 if((KErrNone == aStatus)&&(aEventSource == EReadCompletion)) |
|
113 { |
|
114 aStatus = iATGetRevision->GetErrorValue(); |
|
115 if(KErrNone == aStatus) |
|
116 { |
|
117 RMobilePhone::TMobilePhoneIdentityV1 PhoneId; |
|
118 PhoneId = iATGetRevision->GetPhoneRevision(); |
|
119 iPhoneId.iRevision = PhoneId.iRevision; |
|
120 } |
|
121 } |
|
122 iCtsyDispatcherCallback.CallbackPhoneGetPhoneIdComp(aStatus,iPhoneId); |
|
123 EndATCommand(iATGetRevision); |
|
124 iPhoneGlobals.iEventSignalActive = EFalse; |
|
125 break; |
|
126 default: |
|
127 break; |
|
128 } |
|
129 } |
|
130 // --------------------------------------------------------------------------- |
|
131 // CGetPhoneID::StartRequestL |
|
132 // other items were commented in a header |
|
133 // --------------------------------------------------------------------------- |
|
134 void CGetPhoneID::StartRequest() |
|
135 { |
|
136 StartATCommand(iATGetImei); |
|
137 } |
|
138 // --------------------------------------------------------------------------- |
|
139 // CGetPhoneID::GetImeiComplete |
|
140 // other items were commented in a header |
|
141 // --------------------------------------------------------------------------- |
|
142 void CGetPhoneID::GetImeiComplete(const TInt aError) |
|
143 { |
|
144 if(KErrNone == aError) |
|
145 { |
|
146 RMobilePhone::TMobilePhoneIdentityV1 PhoneId; |
|
147 PhoneId = iATGetImei->GetPhoneImei(); |
|
148 iPhoneId.iSerialNumber = PhoneId.iSerialNumber; |
|
149 EndATCommand(iATGetImei); |
|
150 iPhoneGlobals.iEventSignalActive = EFalse; |
|
151 StartATCommand(iATGetManufacturer); |
|
152 } |
|
153 else |
|
154 { |
|
155 EndATCommand(iATGetImei); |
|
156 iPhoneGlobals.iEventSignalActive = EFalse; |
|
157 iCtsyDispatcherCallback.CallbackPhoneGetPhoneIdComp(aError,iPhoneId); |
|
158 } |
|
159 } |
|
160 // --------------------------------------------------------------------------- |
|
161 // CGetPhoneID::GetManufacturerComplete |
|
162 // other items were commented in a header |
|
163 // --------------------------------------------------------------------------- |
|
164 void CGetPhoneID::GetManufacturerComplete(const TInt aError) |
|
165 { |
|
166 if(KErrNone == aError) |
|
167 { |
|
168 RMobilePhone::TMobilePhoneIdentityV1 PhoneId; |
|
169 PhoneId = iATGetManufacturer->GetPhoneManufacturer(); |
|
170 iPhoneId.iManufacturer = PhoneId.iManufacturer; |
|
171 EndATCommand(iATGetManufacturer); |
|
172 StartATCommand(iATGetModel); |
|
173 } |
|
174 else |
|
175 { |
|
176 EndATCommand(iATGetManufacturer); |
|
177 iPhoneGlobals.iEventSignalActive = EFalse; |
|
178 iCtsyDispatcherCallback.CallbackPhoneGetPhoneIdComp(aError,iPhoneId); |
|
179 } |
|
180 } |
|
181 // --------------------------------------------------------------------------- |
|
182 // CGetPhoneID::GetModelComplete |
|
183 // other items were commented in a header |
|
184 // --------------------------------------------------------------------------- |
|
185 void CGetPhoneID::GetModelComplete(const TInt aError) |
|
186 { |
|
187 if(KErrNone == aError) |
|
188 { |
|
189 RMobilePhone::TMobilePhoneIdentityV1 PhoneId; |
|
190 PhoneId = iATGetModel->GetPhoneModel(); |
|
191 iPhoneId.iModel = PhoneId.iModel; |
|
192 EndATCommand(iATGetModel); |
|
193 StartATCommand(iATGetRevision); |
|
194 } |
|
195 else |
|
196 { |
|
197 EndATCommand(iATGetModel); |
|
198 iCtsyDispatcherCallback.CallbackPhoneGetPhoneIdComp(aError,iPhoneId); |
|
199 } |
|
200 } |
|
201 // --------------------------------------------------------------------------- |
|
202 // CGetPhoneID::StartATCommand |
|
203 // other items were commented in a header |
|
204 // --------------------------------------------------------------------------- |
|
205 void CGetPhoneID::StartATCommand(CAtCommandBase* aAtCommand) |
|
206 { |
|
207 aAtCommand->SetAtCommandObserver(this); |
|
208 iATType = aAtCommand->AtType(); |
|
209 aAtCommand->StartRequest(); |
|
210 } |
|
211 // --------------------------------------------------------------------------- |
|
212 // CGetPhoneID::EndATCommand |
|
213 // other items were commented in a header |
|
214 // --------------------------------------------------------------------------- |
|
215 void CGetPhoneID::EndATCommand(CAtCommandBase* aAtCommand) |
|
216 { |
|
217 aAtCommand->RemoveAtCommandObserver(); |
|
218 aAtCommand->Complete(); |
|
219 } |
|
220 // |
|
221 // End of file |
|