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