47
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
* Initial Contributors:
|
|
9 |
* Nokia Corporation - initial contribution.
|
|
10 |
*
|
|
11 |
* Contributors:
|
|
12 |
*
|
|
13 |
* Description :
|
|
14 |
*
|
|
15 |
* CSCPBRCommandHandler class declaration for AT^SCPBR command
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef SCPBRCOMMANDHANDLER_H_
|
|
20 |
#define SCPBRCOMMANDHANDLER_H_
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <etelmm.h>
|
|
24 |
#include <e32cmn.h>
|
|
25 |
#include <rmmcustomapi.h>
|
|
26 |
|
|
27 |
#include "atcmdasyncbase.h"
|
|
28 |
#include "atmisccmdpluginconsts.h"
|
|
29 |
|
|
30 |
class CPhoneBookBuffer;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* AT^SCPBR command handler implementation class
|
|
34 |
*/
|
|
35 |
NONSHARABLE_CLASS( CSCPBRCommandHandler ) : public CATCmdAsyncBase
|
|
36 |
{
|
|
37 |
private:
|
|
38 |
|
|
39 |
/**
|
|
40 |
* SCPBR States
|
|
41 |
*/
|
|
42 |
enum TSCPBRState
|
|
43 |
{
|
|
44 |
ESCPBRStateIdle, // Idle
|
|
45 |
ESCPBRStateRead, // Read
|
|
46 |
ESCPBRStateGetPhoneBookInfo, // Get phone book info.
|
|
47 |
ESCPBRStateGet3GPBInfo, // Get 3G phone book info.
|
|
48 |
ESCPBRStateNotSupported // phone book store not supported
|
|
49 |
};
|
|
50 |
private:
|
|
51 |
/**
|
|
52 |
* The data structure of phone book entry.
|
|
53 |
* Inner class used by CSCPBRCommandHandler only.
|
|
54 |
*/
|
|
55 |
class TPhoneBookEntry
|
|
56 |
{
|
|
57 |
public:
|
|
58 |
TPhoneBookEntry(): iIndex(-1)
|
|
59 |
{
|
|
60 |
}
|
|
61 |
|
|
62 |
void Externalize( TDes8& aDes ) const;
|
|
63 |
|
|
64 |
TInt iIndex;
|
|
65 |
|
|
66 |
TBuf8<KSCPBRMaxNumberLength> iNumber1;
|
|
67 |
TBuf8<KSCPBRMaxNumberLength> iNumber2;
|
|
68 |
TBuf8<KSCPBRMaxNumberLength> iNumber3;
|
|
69 |
TBuf8<KSCPBRMaxNumberLength> iNumber4;
|
|
70 |
|
|
71 |
TBuf8<KSCPBRMaxNameLength> iName;
|
|
72 |
|
|
73 |
TBuf8<KSCPBRMaxEmailLength> iEmail;
|
|
74 |
};
|
|
75 |
|
|
76 |
public:
|
|
77 |
static CSCPBRCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone );
|
|
78 |
|
|
79 |
virtual ~CSCPBRCommandHandler();
|
|
80 |
|
|
81 |
private: // from CATCmdAsyncBase
|
|
82 |
virtual void HandleCommand(const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded);
|
|
83 |
|
|
84 |
private: // from CActive
|
|
85 |
virtual void RunL();
|
|
86 |
virtual void DoCancel();
|
|
87 |
virtual TInt RunError(TInt aError);
|
|
88 |
|
|
89 |
private:
|
|
90 |
CSCPBRCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone );
|
|
91 |
void ConstructL();
|
|
92 |
|
|
93 |
void ExtractEntriesL();
|
|
94 |
void CopyToPhonebookEntryField(TDes8& aDest, const TDesC16& aSrc);
|
|
95 |
void FormatReplyL();
|
|
96 |
TInt ParseParameters();
|
|
97 |
void AppendEntryL(const TPhoneBookEntry& aEntry);
|
|
98 |
|
|
99 |
private:
|
|
100 |
/**
|
|
101 |
* The first index to be read from phonebook store.
|
|
102 |
*/
|
|
103 |
TInt iIndex1;
|
|
104 |
|
|
105 |
/**
|
|
106 |
* The last index to be read from phonebook store.
|
|
107 |
*/
|
|
108 |
TInt iIndex2;
|
|
109 |
|
|
110 |
/**
|
|
111 |
* The reply
|
|
112 |
*/
|
|
113 |
RBuf8 iReply;
|
|
114 |
|
|
115 |
/**
|
|
116 |
* The phone book store. used to get entries information and entries.
|
|
117 |
*/
|
|
118 |
RMobilePhoneBookStore iPhoneBookStore;
|
|
119 |
|
|
120 |
/**
|
|
121 |
* used to save the entries information.
|
|
122 |
*/
|
|
123 |
RArray<TPhoneBookEntry> iEntries;
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Used to parse the content get from PhoneBookStore.
|
|
127 |
*/
|
|
128 |
CPhoneBookBuffer* iPhoneBookBuffer;
|
|
129 |
|
|
130 |
/**
|
|
131 |
* The buffer to get phonebookstore entries content.
|
|
132 |
*/
|
|
133 |
RBuf8 iContactsBuf;
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Current state
|
|
137 |
*/
|
|
138 |
TSCPBRState iState;
|
|
139 |
|
|
140 |
/**
|
|
141 |
* The PhonebookInfo, used to get phone book entries information.
|
|
142 |
*/
|
|
143 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 iPhoneBookInfo;
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Total entries supported by phonebook store.
|
|
147 |
*/
|
|
148 |
TInt iTotalEntries;
|
|
149 |
/**
|
|
150 |
* The max number length supported
|
|
151 |
*/
|
|
152 |
TInt iNLength;
|
|
153 |
|
|
154 |
/**
|
|
155 |
* The max email length supported.
|
|
156 |
*/
|
|
157 |
TInt iMLength;
|
|
158 |
|
|
159 |
/**
|
|
160 |
* The max text length supported.
|
|
161 |
*/
|
|
162 |
TInt iTLength;
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Used to get 3GPBInfo.
|
|
166 |
*/
|
|
167 |
RMmCustomAPI iCustomApi;
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Used to get 3GPBInfo.
|
|
171 |
*/
|
|
172 |
RMmCustomAPI::T3GPBInfo i3GPBInfo;
|
|
173 |
|
|
174 |
};
|
|
175 |
|
|
176 |
#endif /* SCPBRCOMMANDHANDLER_H_ */
|