44
|
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 |
// +CGREG: <stat>[,<lac>,<ci>]
|
|
15 |
// <stat>:
|
|
16 |
// 0 not registered, ME is not currently searching a new operator to register to
|
|
17 |
// 1 registered, home network
|
|
18 |
// 2 not registered, but ME is currently searching a new operator to register to
|
|
19 |
// 3 registration denied
|
|
20 |
// 4 unknown
|
|
21 |
// 5 registered, roaming
|
|
22 |
// <lac>:
|
|
23 |
// string type; two byte location area code in hexadecimal format.
|
|
24 |
// <ci>:
|
|
25 |
// string type; two byte cell ID in hexadecimal format
|
|
26 |
|
|
27 |
#include <et_phone.h> // For CTelObject
|
|
28 |
#include "atgprsntwkregstatuschange.h" // Header file for this source file
|
|
29 |
#include "mslogger.h" // For LOGTEXT macros
|
|
30 |
|
|
31 |
_LIT8(KATGetGprsNtwkRegResponse,"+CGREG:*");
|
|
32 |
|
|
33 |
// ---------------------------------------------------------------------------
|
|
34 |
// CATGprsNtwkRegStatusChange::NewL
|
|
35 |
// other items were commented in a header
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
CATGprsNtwkRegStatusChange* CATGprsNtwkRegStatusChange::NewL(CGlobalPhonemanager& aGloblePhone,
|
|
38 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
39 |
{
|
|
40 |
CATGprsNtwkRegStatusChange* self = CATGprsNtwkRegStatusChange::NewLC(aGloblePhone, aCtsyDispatcherCallback);
|
|
41 |
CleanupStack::Pop(self);
|
|
42 |
return self;
|
|
43 |
}
|
|
44 |
|
|
45 |
// ---------------------------------------------------------------------------
|
|
46 |
// CATGprsNtwkRegStatusChange::NewLC
|
|
47 |
// other items were commented in a header
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
CATGprsNtwkRegStatusChange* CATGprsNtwkRegStatusChange::NewLC(CGlobalPhonemanager& aGloblePhone,
|
|
50 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
51 |
{
|
|
52 |
CATGprsNtwkRegStatusChange* self = new (ELeave) CATGprsNtwkRegStatusChange(aGloblePhone, aCtsyDispatcherCallback);
|
|
53 |
CleanupStack::PushL(self);
|
|
54 |
self->ConstructL();
|
|
55 |
return self;
|
|
56 |
}
|
|
57 |
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
// CATGprsNtwkRegStatusChange::~CATGprsNtwkRegStatusChange
|
|
60 |
// other items were commented in a header
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
CATGprsNtwkRegStatusChange::~CATGprsNtwkRegStatusChange()
|
|
63 |
{
|
|
64 |
|
|
65 |
}
|
|
66 |
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
// CATGprsNtwkRegStatusChange::ConstructL
|
|
69 |
// other items were commented in a header
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
void CATGprsNtwkRegStatusChange::ConstructL()
|
|
72 |
{
|
|
73 |
CAtCommandBase::ConstructL();
|
|
74 |
RemoveAllExpectString();
|
|
75 |
AddExpectStringL(KATGetGprsNtwkRegResponse);
|
|
76 |
Enable();
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// CATGprsNtwkRegStatusChange::CATGprsNtwkRegStatusChange
|
|
81 |
// other items were commented in a header
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
CATGprsNtwkRegStatusChange::CATGprsNtwkRegStatusChange(CGlobalPhonemanager& aGloblePhone,
|
|
84 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
85 |
:CAtCommandBase(aGloblePhone, aCtsyDispatcherCallback)
|
|
86 |
{
|
|
87 |
}
|
|
88 |
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
// CATGprsNtwkRegStatusChange::CATGprsNtwkRegStatusChange
|
|
91 |
// other items were commented in a header
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
void CATGprsNtwkRegStatusChange::Enable()
|
|
94 |
{
|
|
95 |
AddUnsolicitedAtCommand();
|
|
96 |
}
|
|
97 |
|
|
98 |
// ---------------------------------------------------------------------------
|
|
99 |
// CATGprsNtwkRegStatusChange::CATGprsNtwkRegStatusChange
|
|
100 |
// other items were commented in a header
|
|
101 |
// ---------------------------------------------------------------------------
|
|
102 |
void CATGprsNtwkRegStatusChange::Disable()
|
|
103 |
{
|
|
104 |
RemoveAtCommand();
|
|
105 |
}
|
|
106 |
|
|
107 |
// ---------------------------------------------------------------------------
|
|
108 |
// CATGprsNtwkRegStatusChange::ParseResponseL
|
|
109 |
// other items were commented in a header
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
void CATGprsNtwkRegStatusChange::ParseResponseL(const TDesC8& /*aResponseBuf*/)
|
|
112 |
{
|
|
113 |
|
|
114 |
RArray<TPtrC8> array;
|
|
115 |
CleanupClosePushL(array);
|
|
116 |
iParser->ParseRespondedBuffer(array,CurrentLine());
|
|
117 |
ClearCurrentLine();
|
|
118 |
TInt Count = array.Count();
|
|
119 |
if (Count < 1)
|
|
120 |
{
|
|
121 |
CleanupStack::PopAndDestroy();
|
|
122 |
iError = KErrNotFound;
|
|
123 |
return ;
|
|
124 |
}
|
|
125 |
if( array[0].MatchF(KATGetGprsNtwkRegResponse)==KErrNotFound)
|
|
126 |
{
|
|
127 |
CleanupStack::PopAndDestroy();
|
|
128 |
iError = KErrNotFound;
|
|
129 |
return ;
|
|
130 |
}
|
|
131 |
// Skip over one parameter
|
|
132 |
|
|
133 |
TInt val = 0;
|
|
134 |
TLex8 lex(array[1]);
|
|
135 |
lex.Val(val);
|
|
136 |
// Convert scond value to equivalent EtelMM enum
|
|
137 |
switch(val)
|
|
138 |
{
|
|
139 |
case 0: // ETSI value as defined in ETSI 07.07 section 10.1.14
|
|
140 |
iRegistrationStatus = RPacketService::ENotRegisteredNotSearching;
|
|
141 |
break;
|
|
142 |
case 1: // ETSI value as defined in ETSI 07.07 section 10.1.14
|
|
143 |
iRegistrationStatus=RPacketService::ERegisteredOnHomeNetwork;
|
|
144 |
break;
|
|
145 |
case 2: // ETSI value as defined in ETSI 07.07 section 10.1.14
|
|
146 |
iRegistrationStatus=RPacketService::ENotRegisteredSearching;
|
|
147 |
break;
|
|
148 |
case 3: // ETSI value as defined in ETSI 07.07 section 10.1.14
|
|
149 |
iRegistrationStatus=RPacketService::ERegistrationDenied;
|
|
150 |
break;
|
|
151 |
case 4: // ETSI value as defined in ETSI 07.07 section 10.1.14
|
|
152 |
iRegistrationStatus=RPacketService::EUnknown;
|
|
153 |
break;
|
|
154 |
case 5: // ETSI value as defined in ETSI 07.07 section 10.1.14
|
|
155 |
iRegistrationStatus=RPacketService::ERegisteredRoaming;
|
|
156 |
break;
|
|
157 |
default:
|
|
158 |
iRegistrationStatus = RPacketService::EUnknown;
|
|
159 |
break;
|
|
160 |
}
|
|
161 |
CleanupStack::PopAndDestroy(&array);
|
|
162 |
iError = KErrNone;
|
|
163 |
}
|
|
164 |
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
// CATGprsNtwkRegStatusChange::ParseResponseL
|
|
167 |
// other items were commented in a header
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
void CATGprsNtwkRegStatusChange::EventSignal(TAtEventSource /*aEventSource*/, TInt /*aStatus*/)
|
|
170 |
{
|
|
171 |
iCtsyDispatcherCallback.CallbackPacketServicesNotifyPacketNetworkRegistrationStatusInd(iError,
|
|
172 |
iRegistrationStatus);
|
|
173 |
}
|
|
174 |
|
|
175 |
//End file
|