|
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 // This contains CATUnsolicited |
|
15 // |
|
16 |
|
17 //system include |
|
18 |
|
19 //user include |
|
20 #include "atunsolicited.h" |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // CATUnsolicited::NewL |
|
24 // other items were commented in a header |
|
25 // --------------------------------------------------------------------------- |
|
26 CATUnsolicited* CATUnsolicited::NewL(CGlobalPhonemanager& aGloblePhone, |
|
27 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
28 { |
|
29 CATUnsolicited* self = CATUnsolicited::NewLC(aGloblePhone, aCtsyDispatcherCallback); |
|
30 CleanupStack::Pop(self); |
|
31 return self; |
|
32 } |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // CATUnsolicited::NewLC |
|
36 // other items were commented in a header |
|
37 // --------------------------------------------------------------------------- |
|
38 CATUnsolicited* CATUnsolicited::NewLC(CGlobalPhonemanager& aGloblePhone, |
|
39 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
40 { |
|
41 CATUnsolicited* self = new (ELeave) CATUnsolicited(aGloblePhone, aCtsyDispatcherCallback); |
|
42 CleanupStack::PushL(self); |
|
43 self->ConstructL(); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CATUnsolicited::~CATUnsolicited |
|
49 // other items were commented in a header |
|
50 // --------------------------------------------------------------------------- |
|
51 CATUnsolicited::~CATUnsolicited() |
|
52 { |
|
53 |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CATUnsolicited::ConstructL |
|
58 // other items were commented in a header |
|
59 // --------------------------------------------------------------------------- |
|
60 void CATUnsolicited::ConstructL() |
|
61 { |
|
62 CAtCommandBase::ConstructL(); |
|
63 RemoveAllExpectString(); |
|
64 AddExpectStringL(KLtsyGeneralIndMatchString); |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CATUnsolicited::CATUnsolicited |
|
69 // other items were commented in a header |
|
70 // --------------------------------------------------------------------------- |
|
71 CATUnsolicited::CATUnsolicited(CGlobalPhonemanager& aGloblePhone, |
|
72 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
73 :CAtCommandBase(aGloblePhone, aCtsyDispatcherCallback) |
|
74 { |
|
75 iAtType = ELtsyAT_General_WIND; |
|
76 iResult = KErrNone; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CATUnsolicited::GetParserResult |
|
81 // other items were commented in a header |
|
82 // --------------------------------------------------------------------------- |
|
83 TInt CATUnsolicited::GetParserResult() const |
|
84 { |
|
85 return iResult; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CATUnsolicited::GetUnsolicitedParams |
|
90 // other items were commented in a header |
|
91 // --------------------------------------------------------------------------- |
|
92 const TDesC8& CATUnsolicited::GetUnsolicitedParams() const |
|
93 { |
|
94 return iPckgBuf; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CATUnsolicited::ParseResponseL |
|
99 // other items were commented in a header |
|
100 // --------------------------------------------------------------------------- |
|
101 void CATUnsolicited::ParseResponseL(const TDesC8& aResponseBuf) |
|
102 { |
|
103 iResult = KErrNone; |
|
104 |
|
105 RArray<TPtrC8> rArray; |
|
106 CleanupClosePushL(rArray); |
|
107 |
|
108 iParser->ParseRespondedBuffer(rArray, aResponseBuf); |
|
109 |
|
110 TUnsolicitedParams& tParams(iPckgBuf()); |
|
111 tParams.InitParams(); |
|
112 |
|
113 TInt nCount = rArray.Count(); |
|
114 if (nCount <= 1) |
|
115 { |
|
116 iResult = KErrGeneral; |
|
117 CleanupStack::PopAndDestroy(1); |
|
118 return; |
|
119 } |
|
120 |
|
121 if (nCount >= 2) |
|
122 { |
|
123 TInt tVal(0); |
|
124 TLex8 tLex(rArray[1]); |
|
125 TInt nRes = tLex.Val(tVal); |
|
126 if (nRes == KErrNone) |
|
127 { |
|
128 tParams.iEvent = tVal; |
|
129 } |
|
130 else |
|
131 { |
|
132 iResult = nRes; |
|
133 CleanupStack::PopAndDestroy(1); |
|
134 return; |
|
135 } |
|
136 } |
|
137 |
|
138 if (nCount == 3 && tParams.iEvent != 10 && tParams.iEvent != 11) |
|
139 { |
|
140 TInt tVal(0); |
|
141 TLex8 tLex(rArray[2]); |
|
142 TInt nRes = tLex.Val(tVal); |
|
143 if (nRes == KErrNone) |
|
144 { |
|
145 tParams.iIdx = tVal; |
|
146 } |
|
147 else |
|
148 { |
|
149 iResult = nRes; |
|
150 CleanupStack::PopAndDestroy(1); |
|
151 return; |
|
152 } |
|
153 } |
|
154 CleanupStack::PopAndDestroy(1); |
|
155 } |
|
156 |
|
157 //End of file |