mrp_phonebook.c
6.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#ifdef __MMI_DSM_NEW__
#define __NEWSIMULATOR
#include "MMI_features.h"
#include "stdC.h"
#include "PixtelDataTypes.h"
#include "GlobalDefs.h"
#include "CommonScreens.h"
#include "PhoneBookTypes.h"
#include "PhoneBookDef.h"
#include "PhoneBookProt.h"
#include "PhoneBookGProt.h"
#include "SettingDefs.h" /*For FDN on check*/
#include "SettingsGdcl.h"
#include "Nvram_user_defs.h"
#include "Ucs2prot.h"
#include "mrp_include.h"
#undef __NEWSIMULATOR
T_MR_PHB_SEARCH_RSP phb_search_rsp;
T_MR_PHB_SET_ENTRY_RSP phb_set_entry_rsp;
T_MR_PHB_GET_ENTRY_RSP phb_get_entry_rsp;
T_MR_PHB_SET_OWNER_ENTRY_RSP phb_set_owner_entry_rsp;
T_MR_PHB_GET_OWNER_ENTRY_RSP phb_get_owner_entry_rsp;
//T_MR_PHB_GET_COUNT_RSP phb_get_count_rsp;
T_MR_PHB_ENTRY phb_entry;
extern U16 PhoneBookEntryCount;
extern U8 g_phb_enter_from;
extern U16 g_phb_name_index[];
extern S8 pbName[];
extern S8 pbNumber[];
#if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) || defined(__MMI_PHB_USIM_FIELD__)
extern S8 pbHomeNumber[];
extern S8 pbOfficeNumber[];
extern S8 pbFaxNumber[];
extern S8 pbEmailAddress[];
#endif
extern U8 g_phb_enter_from;
int mr_phone_win = 1;
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#if (MTK_VERSION < 0x09B0952)
#include ".\mt07a-09a\mrp_phonebook(07a-09a).c"
#else
#include ".\mt09b\mrp_phonebook(09b).c"
#endif
int32 mr_phonebook_get_contact_item(uint8* input, int32 input_len, uint8** output, int32* output_len, MR_PLAT_EX_CB *cb)
{
#ifndef __MR_CFG_FEATURE_NO_PHB__
*output =(uint8*) &phb_entry;
*output_len = sizeof(T_MR_PHB_ENTRY);
return MR_SUCCESS;
#else
return MR_IGNORE;
#endif
}
int32 mr_phonebook_search(uint8* input, int32 input_len, uint8** output, int32* output_len, MR_PLAT_EX_CB *cb)
{
#ifndef __MR_CFG_FEATURE_NO_PHB__
T_MR_PHB_SEARCH_REQ * phb_search_req = (T_MR_PHB_SEARCH_REQ*)input;
int32 srch_rst;
if(phb_search_req == NULL)
return MR_PHB_ERROR;
mr_str_convert_endian(phb_search_req->pattern);
srch_rst = _mmi_dsm_phb_search_entry(phb_search_req,&phb_search_rsp);
if (srch_rst == MR_PHB_SUCCESS)
{
mr_str_convert_endian(phb_search_rsp.phb_entry.name);
mr_str_convert_endian(phb_search_rsp.phb_entry.number);
mr_str_convert_endian(phb_search_rsp.phb_entry.homeNumber);
mr_str_convert_endian(phb_search_rsp.phb_entry.officeNumber);
mr_str_convert_endian(phb_search_rsp.phb_entry.faxNumber);
mr_str_convert_endian(phb_search_rsp.phb_entry.emailAddress);
*output = (uint8*)&phb_search_rsp;
*output_len = sizeof(phb_search_rsp);
}
return srch_rst;
#else
return MR_IGNORE;
#endif
}
int32 mr_phonebook_set_entry(uint8* input, int32 input_len, uint8** output, int32* output_len, MR_PLAT_EX_CB *cb)
{
#ifndef __MR_CFG_FEATURE_NO_PHB__
T_MR_PHB_SET_ENTRY_REQ *phb_set_entry_req = (T_MR_PHB_SET_ENTRY_REQ*)input;
int32 set_rst;
kal_prompt_trace(MOD_MMI,"phb_set_entry_req");
if(phb_set_entry_req == NULL)
return MR_PHB_ERROR;
mr_str_convert_endian(phb_set_entry_req->entry.name);
mr_str_convert_endian(phb_set_entry_req->entry.number);
mr_str_convert_endian(phb_set_entry_req->entry.homeNumber);
mr_str_convert_endian(phb_set_entry_req->entry.officeNumber);
mr_str_convert_endian(phb_set_entry_req->entry.faxNumber);
mr_str_convert_endian(phb_set_entry_req->entry.emailAddress);
set_rst = _mmi_dsm_phb_write_entry(phb_set_entry_req);
kal_prompt_trace(MOD_MMI,"set_rst=%d",set_rst);
if(set_rst == MR_PHB_SUCCESS)
{
*output = (uint8*)&phb_set_entry_rsp;
*output_len = sizeof(phb_set_entry_rsp);
}
return set_rst;
#else
return MR_IGNORE;
#endif
}
int32 mr_phonebook_get_entry(uint8* input, int32 input_len, uint8** output, int32* output_len, MR_PLAT_EX_CB *cb)
{
#ifndef __MR_CFG_FEATURE_NO_PHB__
T_MR_PHB_GET_ENTRY_REQ *phb_get_entry_req = (T_MR_PHB_GET_ENTRY_REQ*)input;
int32 read_rst;
if(phb_get_entry_req == NULL)
return MR_PHB_ERROR;
read_rst = _mmi_dsm_phb_read_entry(phb_get_entry_req,&phb_get_entry_rsp);
if(read_rst == MR_PHB_SUCCESS)
{
mr_str_convert_endian(phb_get_entry_rsp.entry.name);
mr_str_convert_endian(phb_get_entry_rsp.entry.number);
mr_str_convert_endian(phb_get_entry_rsp.entry.homeNumber);
mr_str_convert_endian(phb_get_entry_rsp.entry.officeNumber);
mr_str_convert_endian(phb_get_entry_rsp.entry.faxNumber);
mr_str_convert_endian(phb_get_entry_rsp.entry.emailAddress);
*output = (uint8*)&phb_get_entry_rsp;
*output_len = sizeof(phb_get_entry_rsp);
}
return read_rst;
#else
return MR_IGNORE;
#endif
}
int32 mr_phonebook_get_count(uint8* input, int32 input_len, uint8** output, int32* output_len, MR_PLAT_EX_CB *cb)
{
#ifndef __MR_CFG_FEATURE_NO_PHB__
T_MR_PHB_GET_COUNT_REQ *phb_get_count_req = (T_MR_PHB_GET_COUNT_REQ*)input;
int cnt_rst;
if(phb_get_count_req == NULL)
return MR_PHB_ERROR;
cnt_rst = _mmi_dsm_phb_get_count(phb_get_count_req,(T_MR_PHB_GET_COUNT_RSP*)&g_mr_common_rsp);
if(cnt_rst == MR_PHB_SUCCESS)
{
*output = (uint8*)&g_mr_common_rsp;
*output_len = sizeof(int32);
}
return cnt_rst;
#else
return MR_IGNORE;
#endif
}
int32 mr_phonebook_show_contact_list(uint8* input, int32 input_len, uint8** output, int32* output_len, MR_PLAT_EX_CB *cb)
{
#ifndef __MR_CFG_FEATURE_NO_PHB__
extern int mr_phone_win;
mmi_dsm_entry_phone_book();
if(mr_phone_win == 1)
return MR_SUCCESS;
else
return MR_FAILED;
#else
return MR_IGNORE;
#endif
}
int32 mr_phonebook_get_total_num(uint8* input, int32 input_len, uint8** output, int32* output_len, MR_PLAT_EX_CB *cb)
{
#ifndef __MR_CFG_FEATURE_NO_PHB__
T_MR_PHB_GET_TOTAL_RSP * pTotal;
if( output)
{
pTotal = (T_MR_PHB_GET_TOTAL_RSP *)(*output);
pTotal->phone = srv_phb_get_total_contact(PHB_STORAGE_NVRAM);
pTotal->sim = srv_phb_get_total_contact(PHB_STORAGE_SIM);
pTotal->sim2= 0;
pTotal->sim3= 0;
pTotal->sim4= 0;
#ifdef __MMI_DUAL_SIM_MASTER__
pTotal->sim2= srv_phb_get_total_contact(PHB_STORAGE_SIM2);
#ifdef __RAGENT_SIM3_SUPPORT__
pTotal->sim3= srv_phb_get_total_contact(PHB_STORAGE_SIM3);
#endif
#ifdef __RAGENT_SIM4_SUPPORT__
pTotal->sim4= srv_phb_get_total_contact(PHB_STORAGE_SIM4);
#endif
#else
pTotal->sim2= 0;
pTotal->sim3= 0;
pTotal->sim4= 0;
#endif
*output_len = sizeof(T_MR_PHB_GET_TOTAL_RSP);
return MR_SUCCESS;
}
return MR_FAILED;
#else
return MR_IGNORE;
#endif
}
#endif