|
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 // CATGetPhoneCellInfo |
|
17 |
|
18 #include "atgetphonecellinfo.h" |
|
19 #include "mslogger.h" |
|
20 |
|
21 _LIT8(KGetPhoneCellInfoCommand,"AT+CCED=0,5\r"); |
|
22 _LIT8(KGetPhoneCellInfoCmdRepondStr,"+CCED:"); |
|
23 // Class CATGetPhoneCellInfo |
|
24 // --------------------------------------------------------------------------- |
|
25 // CATGetPhoneCellInfo::NewL |
|
26 // other CATGetPhoneCellInfo were commented in a header |
|
27 // --------------------------------------------------------------------------- |
|
28 CATGetPhoneCellInfo* CATGetPhoneCellInfo::NewL(CGlobalPhonemanager& aGloblePhone, |
|
29 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
30 { |
|
31 CATGetPhoneCellInfo* self = new(ELeave) CATGetPhoneCellInfo(aGloblePhone, |
|
32 aCtsyDispatcherCallback); |
|
33 CleanupStack::PushL(self ); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self ); |
|
36 return self ; |
|
37 } |
|
38 // --------------------------------------------------------------------------- |
|
39 // CATGetPhoneCellInfo::CATGetPhoneCellInfo |
|
40 // other CATGetPhoneCellInfo were commented in a header |
|
41 // --------------------------------------------------------------------------- |
|
42 CATGetPhoneCellInfo::CATGetPhoneCellInfo(CGlobalPhonemanager& aGloblePhone, |
|
43 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
44 :CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback) |
|
45 { |
|
46 } |
|
47 // --------------------------------------------------------------------------- |
|
48 // CATGetPhoneCellInfo::ConstructL |
|
49 // other CATGetPhoneCellInfo were commented in a header |
|
50 // --------------------------------------------------------------------------- |
|
51 void CATGetPhoneCellInfo::ConstructL() |
|
52 { |
|
53 CAtCommandBase::ConstructL(); |
|
54 } |
|
55 // --------------------------------------------------------------------------- |
|
56 // CATGetPhoneCellInfo::~CATGetPhoneCellInfo |
|
57 // other CATGetPhoneCellInfo were commented in a header |
|
58 // --------------------------------------------------------------------------- |
|
59 CATGetPhoneCellInfo::~CATGetPhoneCellInfo() |
|
60 { |
|
61 } |
|
62 // --------------------------------------------------------------------------- |
|
63 // CATGetPhoneCellInfo::StartRequestL |
|
64 // other CATGetPhoneCellInfo were commented in a header |
|
65 // --------------------------------------------------------------------------- |
|
66 void CATGetPhoneCellInfo::StartRequest() |
|
67 { |
|
68 ExecuteCommand(); |
|
69 } |
|
70 // --------------------------------------------------------------------------- |
|
71 // CATGetPhoneCellInfo::ExecuteCommand |
|
72 // other CATGetPhoneCellInfo were commented in a header |
|
73 // --------------------------------------------------------------------------- |
|
74 void CATGetPhoneCellInfo::ExecuteCommand() |
|
75 { |
|
76 iTxBuffer.Copy(KGetPhoneCellInfoCommand); |
|
77 Write(); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CATGetPhoneCellInfo::ParseResponseL |
|
82 // other CATGetPhoneCellInfo were commented in a header |
|
83 // --------------------------------------------------------------------------- |
|
84 void CATGetPhoneCellInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/) |
|
85 { |
|
86 if (CurrentLine().Match(KLtsyOkString) != 0) |
|
87 { |
|
88 iError = KErrGeneral; |
|
89 return ; |
|
90 } |
|
91 RArray<TPtrC8> array; |
|
92 CleanupClosePushL(array); |
|
93 iParser->ParseRespondedBuffer(array,PrecedingLine()); |
|
94 TInt Count = array.Count(); |
|
95 if (Count < 1) |
|
96 { |
|
97 CleanupStack::PopAndDestroy(); |
|
98 iError = KErrNotFound; |
|
99 return; |
|
100 } |
|
101 if( array[0].MatchF(KGetPhoneCellInfoCmdRepondStr)==KErrNotFound) |
|
102 { |
|
103 CleanupStack::PopAndDestroy(); |
|
104 iError = KErrNotFound; |
|
105 return ; |
|
106 } |
|
107 iCellInfo.iMode = RMobilePhone::ECellModeGsm; |
|
108 TInt val = 0; |
|
109 TLex8 lex(array[4]); |
|
110 lex.Val(val); |
|
111 iCellInfo.iCellId = val; |
|
112 TLex8 lex1(array[14]); |
|
113 lex1.Val(val); |
|
114 iCellInfo.iTimingAdvance = val; |
|
115 |
|
116 |
|
117 CleanupStack::PopAndDestroy(&array); |
|
118 iError = KErrNone; |
|
119 } |
|
120 // --------------------------------------------------------------------------- |
|
121 // CATGetPhoneCellInfo::EventSignal |
|
122 // other CATGetPhoneCellInfo were commented in a header |
|
123 // --------------------------------------------------------------------------- |
|
124 void CATGetPhoneCellInfo::EventSignal(TAtEventSource aEventSource, TInt aStatus) |
|
125 { |
|
126 // handle IO error |
|
127 if(aStatus != KErrNone) |
|
128 { |
|
129 iPhoneGlobals.iEventSignalActive = EFalse; |
|
130 iCtsyDispatcherCallback.CallbackPhoneGetPhoneCellInfoComp(aStatus,iCellInfo); |
|
131 CAtCommandBase::Complete(); |
|
132 if(iIpcCompleteObserver) |
|
133 { |
|
134 iIpcCompleteObserver->NotifyIpcRequestComplete(iIpcId); |
|
135 } |
|
136 } |
|
137 else if(aEventSource == EReadCompletion) |
|
138 { |
|
139 iPhoneGlobals.iEventSignalActive = EFalse; |
|
140 iCtsyDispatcherCallback.CallbackPhoneGetPhoneCellInfoComp(iError,iCellInfo); |
|
141 CAtCommandBase::Complete(); |
|
142 if(iIpcCompleteObserver) |
|
143 { |
|
144 iIpcCompleteObserver->NotifyIpcRequestComplete(iIpcId); |
|
145 } |
|
146 } |
|
147 } |
|
148 // |
|
149 // End of file |