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 |
// CATGetModemStatus
|
|
15 |
// Description:
|
|
16 |
// CATGetRevision
|
|
17 |
|
|
18 |
#include "atgetrevision.h"
|
|
19 |
#include "mslogger.h"
|
|
20 |
|
|
21 |
_LIT8(KGetRevisionCommand,"AT+CGMR\r");
|
|
22 |
_LIT(KSpaceSeparator," ");
|
|
23 |
// CATGetRevision
|
|
24 |
// ---------------------------------------------------------------------------
|
|
25 |
// CATGetRevision::NewL
|
|
26 |
// other CATGetPhoneCellInfo were commented in a header
|
|
27 |
// ---------------------------------------------------------------------------
|
|
28 |
CATGetRevision* CATGetRevision::NewL(CGlobalPhonemanager& aGloblePhone,
|
|
29 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
30 |
{
|
|
31 |
CATGetRevision* self = new(ELeave) CATGetRevision(aGloblePhone,aCtsyDispatcherCallback);
|
|
32 |
CleanupStack::PushL(self );
|
|
33 |
self->ConstructL();
|
|
34 |
CleanupStack::Pop(self );
|
|
35 |
return self ;
|
|
36 |
}
|
|
37 |
// ---------------------------------------------------------------------------
|
|
38 |
// CATGetRevision::CATGetRevision
|
|
39 |
// other CATGetPhoneCellInfo were commented in a header
|
|
40 |
// ---------------------------------------------------------------------------
|
|
41 |
CATGetRevision::CATGetRevision(CGlobalPhonemanager& aGloblePhone,
|
|
42 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
43 |
:CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback)
|
|
44 |
{
|
|
45 |
}
|
|
46 |
// ---------------------------------------------------------------------------
|
|
47 |
// CATGetRevision::ConstructL
|
|
48 |
// other CATGetPhoneCellInfo were commented in a header
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
void CATGetRevision::ConstructL()
|
|
51 |
{
|
|
52 |
CAtCommandBase::ConstructL();
|
|
53 |
iAtType = ELtsyAT_Phone_GetRevision;
|
|
54 |
}
|
|
55 |
// ---------------------------------------------------------------------------
|
|
56 |
// CATGetRevision::~CATGetRevision
|
|
57 |
// other CATGetPhoneCellInfo were commented in a header
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
CATGetRevision::~CATGetRevision()
|
|
60 |
{
|
|
61 |
}
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
// CATGetRevision::StartRequest
|
|
64 |
// other CATGetPhoneCellInfo were commented in a header
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
void CATGetRevision::StartRequest()
|
|
67 |
{
|
|
68 |
ExecuteCommand();
|
|
69 |
}
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
// CATGetRevision::ExecuteCommand
|
|
72 |
// other CATGetPhoneCellInfo were commented in a header
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
void CATGetRevision::ExecuteCommand( )
|
|
75 |
{
|
|
76 |
iTxBuffer.Copy(KGetRevisionCommand);
|
|
77 |
Write();
|
|
78 |
}
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// CATGetRevision::GetPhoneRevision
|
|
81 |
// other CATGetPhoneCellInfo were commented in a header
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
RMobilePhone::TMobilePhoneIdentityV1 CATGetRevision::GetPhoneRevision()
|
|
84 |
{
|
|
85 |
return iPhoneId;
|
|
86 |
}
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
// CATGetRevision::GetErrorValue
|
|
89 |
// other CATGetPhoneCellInfo were commented in a header
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
TInt CATGetRevision::GetErrorValue()
|
|
92 |
{
|
|
93 |
return iError;
|
|
94 |
}
|
|
95 |
// ---------------------------------------------------------------------------
|
|
96 |
// CATGetRevision::ParseResponseL
|
|
97 |
// other CATGetPhoneCellInfo were commented in a header
|
|
98 |
// ---------------------------------------------------------------------------
|
|
99 |
void CATGetRevision::ParseResponseL(const TDesC8& /*aResponseBuf*/)
|
|
100 |
{
|
|
101 |
if (CurrentLine().Match(KLtsyOkString) != 0)
|
|
102 |
{
|
|
103 |
iError = KErrGeneral;
|
|
104 |
return ;
|
|
105 |
}
|
|
106 |
RArray<TPtrC8> array;
|
|
107 |
CleanupClosePushL(array);
|
|
108 |
iParser->ParseRespondedBuffer(array,PrecedingLine());
|
|
109 |
iMoreInfoFlag = EFalse;
|
|
110 |
TInt Count = array.Count();
|
|
111 |
if (Count < 1)
|
|
112 |
{
|
|
113 |
CleanupStack::PopAndDestroy();
|
|
114 |
iError = KErrGeneral;
|
|
115 |
return ;
|
|
116 |
}
|
|
117 |
for(TInt i = 0; i < Count; i++)
|
|
118 |
{
|
|
119 |
//lex.Assign(array[2]);
|
|
120 |
|
|
121 |
if (iMoreInfoFlag)
|
|
122 |
{
|
|
123 |
TBuf<RMobilePhone::KPhoneSerialNumberSize> Data;
|
|
124 |
Data.Zero();
|
|
125 |
TInt remainingBufferSize = RMobilePhone::KPhoneSerialNumberSize -
|
|
126 |
iPhoneId.iRevision.Length() - 1;
|
|
127 |
if(array[i].Length() > remainingBufferSize)
|
|
128 |
{
|
|
129 |
Data.Copy(array[i].Mid(0,remainingBufferSize));
|
|
130 |
}
|
|
131 |
else
|
|
132 |
{
|
|
133 |
Data.Copy(array[i]);
|
|
134 |
}
|
|
135 |
iPhoneId.iRevision.Append(KSpaceSeparator);
|
|
136 |
iPhoneId.iRevision.Append(Data);
|
|
137 |
}
|
|
138 |
else
|
|
139 |
{
|
|
140 |
if(array[i].Length() > RMobilePhone::KPhoneSerialNumberSize)
|
|
141 |
{
|
|
142 |
iPhoneId.iRevision.Copy(array[i].Mid(0,RMobilePhone::KPhoneSerialNumberSize));
|
|
143 |
}
|
|
144 |
else
|
|
145 |
{
|
|
146 |
iPhoneId.iRevision.Copy(array[i]);
|
|
147 |
}
|
|
148 |
iMoreInfoFlag = ETrue;
|
|
149 |
}
|
|
150 |
}
|
|
151 |
iMoreInfoFlag = EFalse;
|
|
152 |
CleanupStack::PopAndDestroy();
|
|
153 |
iError = KErrNone;
|
|
154 |
}
|
|
155 |
//
|
|
156 |
// End of file
|
|
157 |
|