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 // CGetOperatorNmae |
|
17 |
|
18 #include <ctsy/ltsy/cctsydispatchercallback.h> |
|
19 #include <ctsy/ltsy/mltsydispatchphoneinterface.h> |
|
20 #include "getoperatorname.h" |
|
21 #include "mslogger.h" |
|
22 #include "atgetnetworkinfo.h" |
|
23 |
|
24 |
|
25 _LIT8(KATSetFormatForOperater, "AT+COPS=3,0\r"); |
|
26 // Class CGetOperatorNmae |
|
27 // --------------------------------------------------------------------------- |
|
28 // CGetOperatorNmae::NewL |
|
29 // other items were commented in a header |
|
30 // --------------------------------------------------------------------------- |
|
31 CGetOperatorNmae* CGetOperatorNmae::NewL(CGlobalPhonemanager& aGloblePhone, |
|
32 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
33 { |
|
34 CGetOperatorNmae* self = new(ELeave) CGetOperatorNmae(aGloblePhone, |
|
35 aCtsyDispatcherCallback); |
|
36 CleanupStack::PushL(self ); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 return self ; |
|
40 } |
|
41 // --------------------------------------------------------------------------- |
|
42 // CGetOperatorNmae::CGetOperatorNmae |
|
43 // other items were commented in a header |
|
44 // --------------------------------------------------------------------------- |
|
45 CGetOperatorNmae::CGetOperatorNmae(CGlobalPhonemanager& aGloblePhone, |
|
46 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
47 :CATCommandControlBase(aGloblePhone,aCtsyDispatcherCallback) |
|
48 { |
|
49 } |
|
50 // --------------------------------------------------------------------------- |
|
51 // CGetOperatorNmae::ConstructL |
|
52 // other items were commented in a header |
|
53 // --------------------------------------------------------------------------- |
|
54 void CGetOperatorNmae::ConstructL() |
|
55 { |
|
56 iATCommandName = EATNone; |
|
57 iRequestIpc = 0; |
|
58 iATHelperCommand = CATHelperCommand::NewL(iPhoneGlobals,iCtsyDispatcherCallback); |
|
59 iATNetworkInfo = CATNetworkInfo::NewL(iPhoneGlobals,iCtsyDispatcherCallback); |
|
60 } |
|
61 // --------------------------------------------------------------------------- |
|
62 // CGetOperatorNmae::~CGetOperatorNmae |
|
63 // other items were commented in a header |
|
64 // --------------------------------------------------------------------------- |
|
65 CGetOperatorNmae::~CGetOperatorNmae() |
|
66 { |
|
67 delete iATHelperCommand; |
|
68 iATHelperCommand = NULL; |
|
69 delete iATNetworkInfo; |
|
70 iATNetworkInfo = NULL; |
|
71 } |
|
72 // --------------------------------------------------------------------------- |
|
73 // CGetOperatorNmae::AtCommandExecuteComplete |
|
74 // other items were commented in a header |
|
75 // --------------------------------------------------------------------------- |
|
76 void CGetOperatorNmae::AtCommandExecuteComplete(TAtEventSource aEventSource, TInt aStatus) |
|
77 { |
|
78 if((aEventSource == EWriteCompletion)&&(KErrNone == aStatus)) |
|
79 { |
|
80 return; |
|
81 } |
|
82 switch(iATType) |
|
83 { |
|
84 case ELtsyAT_Phone_SetOperFormat: |
|
85 if((KErrNone == aStatus)&&(aEventSource == EReadCompletion)) |
|
86 { |
|
87 aStatus = iATHelperCommand->GetErrorValue(); |
|
88 } |
|
89 SetOperFormatComplete(aStatus); |
|
90 break; |
|
91 case ELtsyAT_Phone_NwkInfo: |
|
92 if((KErrNone == aStatus)&&(aEventSource == EReadCompletion)) |
|
93 { |
|
94 aStatus = iATNetworkInfo->GetErrorValue(); |
|
95 if(KErrNone == aStatus) |
|
96 { |
|
97 iNetworkInfo = iATNetworkInfo->GetNetWorkInfo(); |
|
98 } |
|
99 } |
|
100 iPhoneGlobals.iEventSignalActive = EFalse; |
|
101 iATNetworkInfo->RemoveAtCommandObserver(); |
|
102 EndATCommand(iATNetworkInfo); |
|
103 CtsyDispatcherCallBack(aStatus); |
|
104 break; |
|
105 default: |
|
106 break; |
|
107 } |
|
108 } |
|
109 // --------------------------------------------------------------------------- |
|
110 // CGetOperatorNmae::StartRequestL |
|
111 // other items were commented in a header |
|
112 // --------------------------------------------------------------------------- |
|
113 void CGetOperatorNmae::StartRequest() |
|
114 { |
|
115 iATHelperCommand->SetAtCommandObserver(this); |
|
116 iATHelperCommand->SetAtCommandString(KATSetFormatForOperater); |
|
117 iATHelperCommand->ExecuteCommand(); |
|
118 iATType = ELtsyAT_Phone_SetOperFormat; |
|
119 } |
|
120 // --------------------------------------------------------------------------- |
|
121 // CGetOperatorNmae::SetRequestTypeL |
|
122 // other items were commented in a header |
|
123 // --------------------------------------------------------------------------- |
|
124 void CGetOperatorNmae::SetRequestTypeL(TInt aIpc) |
|
125 { |
|
126 iRequestIpc = aIpc; |
|
127 } |
|
128 // --------------------------------------------------------------------------- |
|
129 // CGetOperatorNmae::SetOperFormatComplete |
|
130 // other items were commented in a header |
|
131 // --------------------------------------------------------------------------- |
|
132 void CGetOperatorNmae::SetOperFormatComplete(const TInt aError) |
|
133 { |
|
134 if(KErrNone == aError) |
|
135 { |
|
136 EndATCommand(iATHelperCommand); |
|
137 StartATCommand(iATNetworkInfo); |
|
138 } |
|
139 else |
|
140 { |
|
141 EndATCommand(iATHelperCommand); |
|
142 CtsyDispatcherCallBack(aError); |
|
143 } |
|
144 } |
|
145 // --------------------------------------------------------------------------- |
|
146 // CGetOperatorNmae::CtsyDispatcherCallBackL |
|
147 // other items were commented in a header |
|
148 // --------------------------------------------------------------------------- |
|
149 void CGetOperatorNmae::CtsyDispatcherCallBack(const TInt aError) |
|
150 { |
|
151 switch(iRequestIpc) |
|
152 { |
|
153 case MLtsyDispatchPhoneGetOperatorName::KLtsyDispatchPhoneGetOperatorNameApiId: |
|
154 iCtsyDispatcherCallback.CallbackPhoneGetOperatorNameComp(aError, |
|
155 RMmCustomAPI::EOperatorNameProgrammableLatin, |
|
156 iNetworkInfo.iLongName); |
|
157 break; |
|
158 case MLtsyDispatchPhoneGetNetworkProviderName::KLtsyDispatchPhoneGetNetworkProviderNameApiId: |
|
159 iCtsyDispatcherCallback.CallbackPhoneGetNetworkProviderNameComp(aError, |
|
160 iNetworkInfo.iLongName); |
|
161 break; |
|
162 case MLtsyDispatchPhoneGetServiceProviderName::KLtsyDispatchPhoneGetServiceProviderNameApiId: |
|
163 { |
|
164 RMobilePhone::TMobilePhoneServiceProviderNameV2 ServiceProvider; |
|
165 ServiceProvider.iSPName = iNetworkInfo.iLongName; |
|
166 iCtsyDispatcherCallback.CallbackPhoneGetServiceProviderNameComp(aError,ServiceProvider); |
|
167 } |
|
168 //CallbackPhoneGetServiceProviderNameComp(TInt aError, const RMobilePhone::TMobilePhoneServiceProviderNameV2& aServiceProvider); |
|
169 break; |
|
170 default: |
|
171 break; |
|
172 |
|
173 } |
|
174 } |
|
175 // --------------------------------------------------------------------------- |
|
176 // CGetOperatorNmae::StartATCommand |
|
177 // other items were commented in a header |
|
178 // --------------------------------------------------------------------------- |
|
179 void CGetOperatorNmae::StartATCommand(CAtCommandBase* aAtCommand) |
|
180 { |
|
181 aAtCommand->SetAtCommandObserver(this); |
|
182 iATType = aAtCommand->AtType(); |
|
183 aAtCommand->StartRequest(); |
|
184 } |
|
185 // --------------------------------------------------------------------------- |
|
186 // CGetOperatorNmae::EndATCommand |
|
187 // other items were commented in a header |
|
188 // --------------------------------------------------------------------------- |
|
189 void CGetOperatorNmae::EndATCommand(CAtCommandBase* aAtCommand) |
|
190 { |
|
191 aAtCommand->RemoveAtCommandObserver(); |
|
192 aAtCommand->Complete(); |
|
193 } |
|
194 // |
|
195 // End of file |
|