|
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 // @file atphbkstoreread.h |
|
15 // This contains CAtPhbkStoreRead which is use to read a phonebook Entry |
|
16 // |
|
17 |
|
18 #ifndef ATPHBKSTOREREAD_H |
|
19 #define ATPHBKSTOREREAD_H |
|
20 |
|
21 //system include |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 |
|
25 //user include |
|
26 #include "atcommandbase.h" |
|
27 |
|
28 /** |
|
29 * CAtPhbkStoreRead |
|
30 * |
|
31 */ |
|
32 class CAtPhbkStoreRead : public CAtCommandBase |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Destructor |
|
37 * |
|
38 */ |
|
39 ~CAtPhbkStoreRead(); |
|
40 |
|
41 /** |
|
42 * static NewL |
|
43 * |
|
44 * @param aGloblePhone |
|
45 * @param aCtsyDispatcherCallback |
|
46 */ |
|
47 static CAtPhbkStoreRead* NewL(CGlobalPhonemanager& aGloblePhone, |
|
48 CCtsyDispatcherCallback& aCtsyDispatcherCallback); |
|
49 |
|
50 /** |
|
51 * static NewLC |
|
52 * |
|
53 * @param aGloblePhone |
|
54 * @param aCtsyDispatcherCallback |
|
55 */ |
|
56 static CAtPhbkStoreRead* NewLC(CGlobalPhonemanager& aGloblePhone, |
|
57 CCtsyDispatcherCallback& aCtsyDispatcherCallback); |
|
58 |
|
59 /** |
|
60 * Virtual function. Inherited from CAtCommandBase |
|
61 * Start Execute AT Command |
|
62 */ |
|
63 virtual void ExecuteCommand(); |
|
64 |
|
65 /** |
|
66 * Will be called by AT Manager whenever a event was triggered |
|
67 * |
|
68 * @param aEventSource |
|
69 * @param aStatus |
|
70 */ |
|
71 virtual void EventSignal(TAtEventSource aEventSource, TInt aStatus); |
|
72 |
|
73 /** |
|
74 * Virtual function. Inherited from CAtCommandBase |
|
75 * |
|
76 * @param aResponseBuf Line buf reading from baseband |
|
77 */ |
|
78 virtual void ParseResponseL(const TDesC8& aResponseBuf); |
|
79 |
|
80 /** |
|
81 * Start this request |
|
82 * |
|
83 */ |
|
84 void StartRequest(); |
|
85 |
|
86 /** |
|
87 * Set read phonebook parameters |
|
88 * |
|
89 * @param aIndex |
|
90 * @param aSlotNum |
|
91 */ |
|
92 void SetReadParam(TInt aIndex,TInt aSlotNum); |
|
93 |
|
94 /** |
|
95 * Set Phonebook Type |
|
96 * |
|
97 * @param aPhonebookType |
|
98 */ |
|
99 void SetPhonebookType(DispatcherPhonebook::TPhonebook aPhonebookType); |
|
100 protected: |
|
101 /** |
|
102 * Constructor |
|
103 * |
|
104 * @param aGloblePhone |
|
105 * @param aCtsyDispatcherCallback |
|
106 */ |
|
107 CAtPhbkStoreRead(CGlobalPhonemanager& aGloblePhone, |
|
108 CCtsyDispatcherCallback& aCtsyDispatcherCallback); |
|
109 |
|
110 /** |
|
111 * 2nd Constructor |
|
112 */ |
|
113 void ConstructL(); |
|
114 private: |
|
115 /** |
|
116 * Executer AT command for reading a phonebook entry |
|
117 */ |
|
118 void ReadEntry(); |
|
119 |
|
120 /** |
|
121 * Generate TLV Data should be used by callback |
|
122 */ |
|
123 TInt GeneratePhbkDataL(); |
|
124 private: |
|
125 /** |
|
126 * save PhoneBookType by SetPhonebookType |
|
127 */ |
|
128 DispatcherPhonebook::TPhonebook iPhoneBookType; |
|
129 |
|
130 /** |
|
131 * state machine for EventSignal |
|
132 */ |
|
133 enum |
|
134 { |
|
135 ESetStoreName, |
|
136 ESetStoreNameComplete, |
|
137 EReadEntry, |
|
138 EReadEntryComplete, |
|
139 EATNotInProgress |
|
140 }iState; |
|
141 |
|
142 /** |
|
143 * The return error value of AT command executed |
|
144 */ |
|
145 TInt iError; |
|
146 |
|
147 /* |
|
148 * the first index should be read |
|
149 */ |
|
150 TInt iIndex; |
|
151 |
|
152 /* |
|
153 * the phonebook item number want to read |
|
154 */ |
|
155 TInt iSlotNum; |
|
156 |
|
157 /** |
|
158 * This is used to generate TLV data by GeneratePhbkData |
|
159 */ |
|
160 TPhonebookReadEntry iReadEntry; |
|
161 |
|
162 /* |
|
163 * Client reserved space for phonebook data |
|
164 */ |
|
165 TBuf8<800> iPhbkData; |
|
166 |
|
167 /* |
|
168 * indicate whether it is OK or ERROR string |
|
169 */ |
|
170 TBool iEndFlag; |
|
171 |
|
172 }; // class CAtPhbkStoreRead |
|
173 #endif // ATPHBKSTOREREAD_H |