comparison src/aci2/mfw/mfw_phb.h @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: GSM-MFW (8417) $Workfile:: mfw_phb.h $|
4 | $Author:: Vo $Revision:: 1 $|
5 | CREATED: 7.1.99 $Modtime:: 24.03.00 11:47 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 PURPOSE : Types defination for phonebook management
10 .
11 */
12
13 #ifndef DEF_MFW_PHB
14 #define DEF_MFW_PHB
15
16 #include "message.h"
17 #include "prim.h"
18 #include "aci_cmh.h"
19 #ifdef FF_2TO1_PS
20 #include "p_8010_127_sim_sap.h" //GW 22/11/01 - Added
21 #else
22 #include "prim.h"
23 #endif
24 #include "phb.h" //GW 22/11/01 - Added
25
26 /*
27 * events are organised as bitmaps
28 */
29 #define E_PHB_STATUS 0x0001
30 #define E_PHB_ERROR 0x0002
31 #define E_PHB_UPN_LIST 0x0004
32 #define E_PHB_READY 0x0008
33 #define E_PHB_BUSY 0x0010
34
35 #define PHB_MAX_DIGITS 2
36 #define PHB_MAX_ENTRY_NUM 5
37
38 /* SPR#1112 - Internal phonebook */
39 #ifdef INT_PHONEBOOK
40 #define DEFAULT_PB 0
41 #endif
42
43 #ifdef TI_PS_FFS_PHB
44 //#define PHB_MAX_LEN MAX_PHB_NUM_LEN /* Phonebook number length + '\0' */
45 #define PHB_MAX_LEN (44+1) /* Phonebook number length + '\0' */
46 #else
47 //GW-SPR#762 For 44 digit phonebook, see aci_cmh.h
48 #ifdef PHONEBOOK_EXTENSION
49 #define PHB_MAX_LEN (44+1) /* Phonebook number length + '\0' */
50 #else
51 #define PHB_MAX_LEN (20+1) /* Phonebook number length + '\0' */
52 #endif /* else, #ifdef PHONEBOOK_EXTENSION */
53 #endif /* else, #ifdef TI_PS_FFS_PHB */
54
55 #define MAX_UPN_NUM 6
56
57 #define PHB_UNRESTRICTED 0
58 #define PHB_RESTRICTED 1
59 #define PHB_LOADING 2
60 #define PHB_NOT_ALLOCATED 3
61
62 #define PHB_AUTO_OFF 0
63 #define PHB_AUTO_ON 1
64
65
66 /* global constants */
67
68 typedef enum /* phonebook type */
69 {
70 PHB_ECC = 0, /* Emergency call numbers */
71 PHB_ADN, /* Abbreviated dialing number */
72 PHB_FDN, /* Fixed dialing number */
73 PHB_BDN, /* Barred dialing number */
74 PHB_LDN, /* Last dialing number */
75 PHB_LRN, /* Last received number */
76 PHB_SDN, /* Service dialing number */
77 PHB_LMN,
78 PHB_ADN_FDN,
79 PHB_UPN,
80 #ifdef INT_PHONEBOOK /* SPR#1112 - Internal phonebook */
81 PHB_IPB,
82 #endif
83 PHB_NONE,
84 MAX_PHB_TYPE
85 } T_MFW_PHB_TYPE;
86
87 typedef enum /* type of number */
88 {
89 MFW_TON_UNKNOWN,
90 MFW_TON_INTERNATIONAL,
91 MFW_TON_NATIONAL,
92 MFW_TON_NET_SPECIFIC,
93 MFW_TON_DED_ACCESS,
94 MFW_TON_ALPHA_NUMERIC,
95 MFW_TON_ABBREVIATED,
96 MFW_TON_EXTENDED
97 } T_MFW_PHB_TON;
98
99 typedef enum /* numbering plan identifier */
100 {
101 MFW_NPI_UNKNOWN,
102 MFW_NPI_ISDN = 1,
103 MFW_NPI_DATA = 3,
104 MFW_NPI_TELEX = 4,
105 MFW_NPI_NATIONAL = 8,
106 MFW_NPI_PRIVATE = 9,
107 MFW_NPI_M_ERMES = 10,
108 MFW_NPI_M_CTS = 11
109 } T_MFW_PHB_NPI;
110
111 typedef enum /* service related to the phone number */
112 {
113 SERVICE_UNKNOWN,
114 SERVICE_ASYNCH, /* asynchronous modem */
115 SERVICE_SYNCH, /* synchronous modem */
116 SERVICE_PAD_ASYNCH, /* PAD access (asynchronous) */
117 SERVICE_PACKET_SYNCH, /* packet access (synchronous) */
118 SERVICE_VOICE, /* voice */
119 SERVICE_FAX /* fax */
120 } T_MFW_PHB_SERVICE;
121
122 typedef enum /* Result of operation */
123 {
124 MFW_NO_ENTRY,
125 MFW_ENTRY_EXIST
126 } T_MFW_PHB_RESULT;
127
128
129 typedef enum /* Return values */
130 {
131 MFW_PHB_OK, /* success */
132 MFW_PHB_FULL, /* phonebook is full */
133 MFW_PHB_PIN2_REQ,
134 MFW_PHB_PUK2_REQ,
135 MFW_PHB_FAIL
136 } T_MFW_PHB_RETURN;
137
138 typedef enum /* mode of sorted phonebook */
139 {
140 MFW_PHB_ALPHA,
141 MFW_PHB_NUMBER,
142 MFW_PHB_PHYSICAL,
143 MFW_PHB_INDEX
144 } T_MFW_PHB_MODE;
145
146 /* Structures */
147 typedef struct /* Character */
148 {
149 UBYTE dcs;
150 UBYTE len; /* length of string data */
151 UBYTE data[PHB_MAX_LEN]; /* string data */
152 UBYTE dummy;
153 } T_MFW_PHB_TEXT;
154
155 typedef struct
156 {
157 UBYTE year [PHB_MAX_DIGITS];
158 UBYTE month [PHB_MAX_DIGITS];
159 UBYTE day [PHB_MAX_DIGITS];
160 UBYTE dummy1;
161 UBYTE dummy2;
162 } T_MFW_PHB_DATE;
163
164 typedef struct
165 {
166 UBYTE hour [PHB_MAX_DIGITS];
167 UBYTE minute [PHB_MAX_DIGITS];
168 UBYTE second [PHB_MAX_DIGITS];
169 UBYTE dummy1;
170 UBYTE dummy2;
171 } T_MFW_PHB_TIME;
172
173
174 typedef struct /* Phonebook entry */
175 {
176 UBYTE book; /* phonebook */
177 UBYTE dummy1;
178 UBYTE dummy2;
179 UBYTE dummy3;
180 #ifdef NO_ASCIIZ
181 T_MFW_PHB_TEXT name; /* length of name */
182 #else
183 UBYTE name[/*PHB_MAX_LEN*/MAX_ALPHA_LEN]; /* alpha identifier */
184 #endif
185 UBYTE number[PHB_MAX_LEN+1]; /* telephone number, +1 for '+' in intl. numbers */
186 SHORT index; /* index in phonebook table */
187 UBYTE ton; /* type of number */
188 UBYTE npi; /* numbering plan identifier */
189 T_MFW_PHB_DATE date; /* date of entry */
190 T_MFW_PHB_TIME time; /* time of entry */
191 UBYTE line;
192 } T_MFW_PHB_ENTRY;
193
194
195 typedef struct /* phonebook read operation */
196 {
197 UBYTE result; /* result of operation */
198 UBYTE book; /* phonebook */
199 SHORT num_entries; /* number of phonebook entries */
200 T_MFW_PHB_ENTRY *entry; /* phonebook entries */
201 } T_MFW_PHB_LIST;
202
203
204 typedef struct /* phonebook status indication */
205 {
206 UBYTE book; /* phonebook */
207 SHORT max_entries; /* max entries in the phonebook */
208 UBYTE tag_len; /*length of alpha identifier */
209 SHORT used_entries; /* used entries in the phonebook */
210 SHORT avail_entries;
211 } T_MFW_PHB_STATUS;
212
213 typedef struct /* MSISDN number */
214 {
215 #ifdef NO_ASCIIZ
216 T_MFW_PHB_TEXT name; /* length of name */
217 #else
218 UBYTE name[/*PHB_MAX_LEN*/MAX_ALPHA_LEN/*MC, SPR1257*/]; /* alpha identifier */
219 #endif
220 UBYTE number[PHB_MAX_LEN+1]; /* telephone number, +1 for '+' in intl. numbers */
221 T_MFW_PHB_SERVICE service; /* service related to phone number */
222 T_MFW_PHB_TON ton; /* type of number */
223 T_MFW_PHB_NPI npi; /* numbering plan identifier */
224 } T_MFW_UPN;
225
226 typedef struct
227 {
228 UBYTE count;
229 T_MFW_UPN upn[MAX_UPN_NUM];
230 } T_MFW_UPN_LIST;
231
232
233 /* PHB Parameter */
234
235 typedef union
236 {
237 T_MFW_PHB_STATUS phb_status;
238 T_MFW_UPN_LIST upn_list;
239 } T_MFW_PHB_PARA;
240
241 EXTERN void phb_init (void);
242 EXTERN void phb_exit (void);
243 EXTERN T_MFW_HND phb_create (T_MFW_HND hWin,
244 T_MFW_EVENT event,
245 T_MFW_CB cbfunc);
246 EXTERN T_MFW_RES phb_delete (T_MFW_HND h);
247 EXTERN T_MFW phb_read_entries (UBYTE book,
248 UBYTE index,
249 UBYTE mode,
250 UBYTE num_entries,
251 T_MFW_PHB_LIST *entries);
252 #ifdef NO_ASCIIZ
253 EXTERN T_MFW phb_find_entries (UBYTE book,
254 SHORT *index,
255 UBYTE mode,
256 SHORT num_entries,
257 T_MFW_PHB_TEXT *search_pattern,
258 T_MFW_PHB_LIST *entries);
259 #else
260 EXTERN T_MFW phb_find_entries (UBYTE book,
261 SHORT *index,
262 UBYTE mode,
263 SHORT num_entries,
264 CHAR *search_pattern,
265 T_MFW_PHB_LIST *entries);
266 #endif
267 EXTERN T_MFW phb_store_entry (UBYTE book,
268 T_MFW_PHB_ENTRY *entry,
269 T_MFW_PHB_STATUS *status);
270 EXTERN T_MFW phb_delete_entry (UBYTE book, UBYTE index,
271 T_MFW_PHB_STATUS *status);
272 EXTERN T_MFW phb_delete_book (UBYTE book);
273 EXTERN T_MFW phb_set_mode (UBYTE book, UBYTE *passed);
274 EXTERN T_MFW phb_check_number (UBYTE *number);
275 EXTERN T_MFW phb_get_status (T_MFW_PHB_STATUS *status);
276 EXTERN T_MFW phb_set_auto_off (UBYTE mode);
277 EXTERN T_MFW phb_get_auto_off (UBYTE *mode);
278 EXTERN T_MFW_PHB_RETURN phb_switch_entry (T_MFW_PHB_ENTRY *entry, UBYTE *passwd);
279 EXTERN void phb_get_upn (void);
280 EXTERN T_MFW phb_save_upn (T_MFW_UPN *upn);
281 EXTERN void phb_Alpha2Gsm(T_ACI_PB_TEXT *text, UBYTE *alpha);
282 EXTERN void phb_Gsm2Alpha(UBYTE *alpha, T_ACI_PB_TEXT *text);
283 EXTERN int phb_get_mode (void);
284 EXTERN int numbersMatch(char * num1, char* num2);
285
286 #endif
287