|
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 // CATNetworkRegStatusChange |
|
17 |
|
18 //user include |
|
19 #include "atnetworkregstatuschange.h" |
|
20 |
|
21 _LIT8(KATGetNetworkRegResponse,"+CREG:*"); |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // CATNetworkRegStatusChange::NewL |
|
25 // other items were commented in a header |
|
26 // --------------------------------------------------------------------------- |
|
27 CATNetworkRegStatusChange* CATNetworkRegStatusChange::NewL(CGlobalPhonemanager& aGloblePhone, |
|
28 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
29 { |
|
30 CATNetworkRegStatusChange* self = CATNetworkRegStatusChange::NewLC(aGloblePhone, aCtsyDispatcherCallback); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CATNetworkRegStatusChange::NewLC |
|
37 // other items were commented in a header |
|
38 // --------------------------------------------------------------------------- |
|
39 CATNetworkRegStatusChange* CATNetworkRegStatusChange::NewLC(CGlobalPhonemanager& aGloblePhone, |
|
40 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
41 { |
|
42 CATNetworkRegStatusChange* self = new (ELeave) CATNetworkRegStatusChange(aGloblePhone, aCtsyDispatcherCallback); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // CATNetworkRegStatusChange::~CATNetworkRegStatusChange |
|
50 // other items were commented in a header |
|
51 // --------------------------------------------------------------------------- |
|
52 CATNetworkRegStatusChange::~CATNetworkRegStatusChange() |
|
53 { |
|
54 |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CATNetworkRegStatusChange::ConstructL |
|
59 // other items were commented in a header |
|
60 // --------------------------------------------------------------------------- |
|
61 void CATNetworkRegStatusChange::ConstructL() |
|
62 { |
|
63 CAtCommandBase::ConstructL(); |
|
64 RemoveAllExpectString(); |
|
65 AddExpectStringL(KATGetNetworkRegResponse); |
|
66 Enable(); |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CATNetworkRegStatusChange::CATNetworkRegStatusChange |
|
71 // other items were commented in a header |
|
72 // --------------------------------------------------------------------------- |
|
73 CATNetworkRegStatusChange::CATNetworkRegStatusChange(CGlobalPhonemanager& aGloblePhone, |
|
74 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
75 :CAtCommandBase(aGloblePhone, aCtsyDispatcherCallback) |
|
76 { |
|
77 } |
|
78 // --------------------------------------------------------------------------- |
|
79 // CATNetworkRegStatusChange::CATNetworkRegStatusChange |
|
80 // other items were commented in a header |
|
81 // --------------------------------------------------------------------------- |
|
82 void CATNetworkRegStatusChange::Enable() |
|
83 { |
|
84 AddUnsolicitedAtCommand(); |
|
85 } |
|
86 // --------------------------------------------------------------------------- |
|
87 // CATNetworkRegStatusChange::CATNetworkRegStatusChange |
|
88 // other items were commented in a header |
|
89 // --------------------------------------------------------------------------- |
|
90 void CATNetworkRegStatusChange::Disable() |
|
91 { |
|
92 RemoveAtCommand(); |
|
93 } |
|
94 // --------------------------------------------------------------------------- |
|
95 // CATNetworkRegStatusChange::ParseResponseL |
|
96 // other items were commented in a header |
|
97 // --------------------------------------------------------------------------- |
|
98 void CATNetworkRegStatusChange::ParseResponseL(const TDesC8& /*aResponseBuf*/) |
|
99 { |
|
100 |
|
101 RArray<TPtrC8> array; |
|
102 CleanupClosePushL(array); |
|
103 iParser->ParseRespondedBuffer(array,CurrentLine()); |
|
104 ClearCurrentLine(); |
|
105 TInt Count = array.Count(); |
|
106 if (Count < 1) |
|
107 { |
|
108 CleanupStack::PopAndDestroy(); |
|
109 iError = KErrNotFound; |
|
110 return ; |
|
111 } |
|
112 if( array[0].MatchF(KATGetNetworkRegResponse)==KErrNotFound) |
|
113 { |
|
114 CleanupStack::PopAndDestroy(); |
|
115 iError = KErrNotFound; |
|
116 return ; |
|
117 } |
|
118 // Skip over one parameter |
|
119 |
|
120 TInt val = 0; |
|
121 TLex8 lex(array[1]); |
|
122 lex.Val(val); |
|
123 // Convert scond value to equivalent EtelMM enum |
|
124 switch(val) |
|
125 { |
|
126 case 0: |
|
127 iRegistrationStatus = RMobilePhone::ENotRegisteredNoService; |
|
128 break; |
|
129 case 1: |
|
130 iRegistrationStatus = RMobilePhone::ERegisteredOnHomeNetwork; |
|
131 break; |
|
132 case 2: |
|
133 iRegistrationStatus = RMobilePhone::ENotRegisteredSearching; |
|
134 break; |
|
135 case 3: |
|
136 iRegistrationStatus = RMobilePhone::ERegistrationDenied; |
|
137 break; |
|
138 case 4: |
|
139 iRegistrationStatus = RMobilePhone::ERegistrationUnknown; |
|
140 break; |
|
141 case 5: |
|
142 iRegistrationStatus = RMobilePhone::ERegisteredRoaming; |
|
143 break; |
|
144 default: |
|
145 iRegistrationStatus = RMobilePhone::ERegistrationUnknown; |
|
146 break; |
|
147 } |
|
148 CleanupStack::PopAndDestroy(&array); |
|
149 iError = KErrNone; |
|
150 } |
|
151 // --------------------------------------------------------------------------- |
|
152 // CATNetworkRegStatusChange::ParseResponseL |
|
153 // other items were commented in a header |
|
154 // --------------------------------------------------------------------------- |
|
155 void CATNetworkRegStatusChange::EventSignal(TAtEventSource /*aEventSource*/, TInt /*aStatus*/) |
|
156 { |
|
157 iCtsyDispatcherCallback.CallbackPhoneNotifyNetworkRegistrationStatusChangeInd(iError, |
|
158 iRegistrationStatus); |
|
159 } |
|
160 //End of file |