comparison src/g23m-aci/aci/cphs.h @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: $Workfile:: cphs.h $|
4 | $Author:: $Revision:: $|
5 | CREATED: $Modtime:: $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : CPHS
10
11 PURPOSE : header file for CPHS functionalities.
12 */
13
14 #ifndef CPHS_H
15 #define CPHS_H
16
17 /* CPHS functions return type */
18 typedef enum
19 {
20 CPHS_FAIL = -1,
21 CPHS_OK,
22 CPHS_EXEC,
23 CPHS_BUSY,
24 CPHS_NOT_INIT
25 } T_CPHS_RET;
26
27 /* Definition of parameter LINES */
28 #define T_CPHS_LINES USHORT
29
30 #define CPHS_LINE_NULL (0x0000)
31 #define CPHS_LINE1 (0x0001)
32 #define CPHS_LINE_DATA (0x0002)
33 #define CPHS_LINE_FAX (0x0004)
34 #define CPHS_LINE2 (0x0100)
35
36 /* Definition of max length for operator name */
37 #define CPHS_MAX_OPER_LONG (30)
38 #define CPHS_MAX_OPER_SHORT (10)
39
40 /* Definition for customer service profile */
41 #define CPHS_MAX_CSP (22) /* Phase 2: field should be always 22 bytes long (RFU = 2 bytes) */
42
43 //#define CPHS_SERVICE_CSP (1)
44 //#define CPHS_SERVICE_SST (2)
45 //#define CPHS_SERVICE_MB (3)
46 //#define CPHS_SERVICE_OPNS (4)
47 //#define CPHS_SERVICE_NUMS (5)
48 #define CPHS_SERVICE_CSP (5)
49 #define CPHS_SERVICE_SST (6)
50 #define CPHS_SERVICE_MB (7)
51 #define CPHS_SERVICE_OPNS (8)
52 #define CPHS_SERVICE_NUMS (1)
53 #define CPHS_SERVICE_ALLOCATED (1)
54 #define CPHS_SERVICE_ACTIVATED (2)
55 #define CPHS_CHECK_SST(sst,service,attribute) \
56 ((UBYTE) ((sst) >> ((service-1)*2)) & (attribute))
57
58 /* Definition for mailbox numbers */
59 #define CPHS_MIN_MB_ENTRIES (1)
60 #define CPHS_MAX_MB_ENTRIES (4)
61 #define CPHS_MAX_MB_NUMBER_LEN (40)
62 #define CPHS_MAX_MB_ALPHA_LEN (22)
63 #define CPHS_MIN_MB_LEN (14)
64
65 #define CPHS_MAX_MB_NUMBER_BYTES (10)
66
67 #define CPHS_MAX_INF_ALPHA_TAG (16)
68 #define CPHS_MAX_INF_NUMBER (12)
69
70 /* Definition of flag status for voice message waiting */
71 #define CPHS_ERASE_WAITING_FLAG (0)
72 #define CPHS_SET_WAITING_FLAG (1)
73 #define CPHS_QUERY_WAITING_FLAG (2)
74
75 /* Definition of flag status for CFU */
76 #define CPHS_ERASE_CFU_FLAG (0)
77 #define CPHS_SET_CFU_FLAG (1)
78 #define CPHS_QUERY_CFU_FLAG (2)
79
80 #define CPHS_FLAG_DEACTIVATED (0)
81 #define CPHS_FLAG_ACTIVATED (1)
82 #define CPHS_FLAG_NOT_PRESENT (2)
83 #define CPHS_FLAG_ERROR (3)
84
85 /* CPROAM related parameters */
86 typedef enum /* Roaming indicator values */
87 {
88 CPHS_ROAMING_STAT_NotPresent = -1,
89 CPHS_ROAMING_OFF,
90 CPHS_NATIONAL_ROAMING_ON,
91 CPHS_INTERNATIONAL_ROAMING_ON
92 } T_CPHS_ROAMING_IND;
93
94 /* Information numbers feature related parameter */
95 typedef enum
96 {
97 CPNUMS_MODE_EXPLORE = 1, // should apply to a folder to be explored
98 CPNUMS_MODE_QUERY = 2 // queries information related to an entry
99 } T_CPHS_CPNUMS_MODE;
100
101 /* structure used to hold information numbers entry */
102 typedef struct
103 {
104 UBYTE element_index; // index of element described in this structure
105 UBYTE index_level;
106 CHAR alpha_tag[CPHS_MAX_INF_ALPHA_TAG];
107 CHAR number[CPHS_MAX_INF_NUMBER];
108 UBYTE type_of_address;
109 BOOL premium_flag; // should it be charged with premium price?
110 BOOL network_flag; // is it network specific ?
111 } T_CPHS_INF_NUM;
112
113 /* structure used to hold cphs information */
114 typedef struct
115 {
116 UBYTE phase;
117 USHORT sst; /* same format as on the SIM: field 6F16 */
118 } T_CPHS_CINF;
119
120 /* structure used to hold mailbox number entries */
121 typedef struct
122 {
123 T_CPHS_LINES line;
124 CHAR number[CPHS_MAX_MB_NUMBER_LEN];
125 UBYTE toa;
126 CHAR alpha_id[CPHS_MAX_MB_ALPHA_LEN];
127 } T_CPHS_MB;
128
129 /* Callback types */
130 typedef enum
131 {
132 CPHS_INIT_RES = 1,
133 CPHS_ROAM_IND,
134 CPHS_VOICE_MAIL_IND,
135 CPHS_VOICE_MAIL_RES,
136 CPHS_CFU_RES
137 } T_CPHS_CB;
138
139 /* Callback parameters */
140 typedef struct
141 {
142 T_CPHS_CB cb_type;
143 T_CPHS_RET operation_result;
144 UBYTE set_flag;
145 T_CPHS_LINES line;
146 } T_CPHS_PARAMS;
147
148 /* data buffer for phonebook alpha */
149 typedef struct
150 {
151 UBYTE data[CPHS_MAX_MB_ALPHA_LEN];
152 UBYTE len;
153 } T_CPHS_PB_TEXT;
154
155 /* Callback general prototype */
156 typedef void T_CPHS_USER_CB( T_CPHS_PARAMS *params );
157
158
159 /* user interface functions */
160 EXTERN T_CPHS_RET cphs_start (T_CPHS_USER_CB *cphs_user_cb);
161 EXTERN T_CPHS_RET cphs_refresh_data (void);
162 EXTERN T_CPHS_RET cphs_stop (void);
163 EXTERN T_CPHS_RET cphs_check_status(void);
164 EXTERN T_CPHS_RET cphs_explore_info_nbs (UBYTE element_idx,
165 UBYTE *inf_num_indexes,
166 UBYTE *max_elmts);
167 EXTERN T_CPHS_RET cphs_read_info_nb (UBYTE element_idx,
168 T_CPHS_INF_NUM *inf_num);
169 EXTERN T_CPHS_RET cphs_info_num_get_max(UBYTE *max_index);
170 EXTERN T_CPHS_RET cphs_get_line(UBYTE srcId,
171 UBYTE call_id,
172 T_CPHS_LINES *line,
173 CHAR *line_desc,
174 UBYTE *max_line_desc);
175 EXTERN T_CPHS_RET cphs_get_fwd_flag(UBYTE *cfu_set,
176 T_CPHS_LINES line);
177 EXTERN T_CPHS_RET cphs_set_waiting_flag(UBYTE flag_set, T_CPHS_LINES lines);
178 EXTERN T_CPHS_RET cphs_get_waiting_flag(UBYTE *flag_set, T_CPHS_LINES line);
179 EXTERN T_CPHS_RET cphs_get_opn (CHAR *longname, UBYTE *max_longname,
180 CHAR *shortname, UBYTE *max_shortname);
181 EXTERN T_CPHS_RET cphs_get_cphs_info (UBYTE *phase, USHORT *sst);
182 EXTERN T_CPHS_RET cphs_get_csprof (CHAR *csp,
183 CHAR *csp2,
184 UBYTE *max_csp_length,
185 UBYTE *max_csp2_length);
186 EXTERN T_CPHS_RET cphs_read_mb_number (BYTE rec_id, T_CPHS_MB *mailbox_entry);
187 EXTERN SHORT cphs_state_indication (UBYTE psaStatus, SHORT cmeError);
188 EXTERN void cphs_write_mb_number_cb (SHORT table_id);
189 GLOBAL T_CPHS_RET cphs_write_mb_number (UBYTE srcId,
190 UBYTE rec_id,
191 UBYTE *tag,
192 UBYTE tag_len,
193 UBYTE bcd_len,
194 UBYTE *number,
195 UBYTE ton_npi);
196 EXTERN T_CPHS_RET cphs_first_free (UBYTE *first_free);
197 GLOBAL T_CPHS_RET cphs_get_mb_parameter ( SHORT* firstIdx,
198 SHORT* lastIdx,
199 UBYTE* nlength,
200 UBYTE* tlength );
201
202
203 EXTERN BOOL cphs_line_makes_sense(T_CPHS_LINES line);
204 EXTERN void cphs_write_csp_cb (SHORT table_id);
205 EXTERN T_CPHS_RET cphs_set_csp_value(UBYTE srcId,
206 UBYTE *csp,
207 UBYTE csp_len);
208
209 /* control interface functions */
210 EXTERN void cphs_voice_mail_ind (UBYTE flag_set, USHORT line);
211 EXTERN void cphs_roaming_ind (UBYTE roaming_status);
212 EXTERN T_CPHS_RET cphs_set_cfu_flag(UBYTE cfu_set, T_CPHS_LINES lines);
213
214
215 /* ACI/CPHS adapter layer */
216 EXTERN void cphs_sim_access_data(UBYTE cphs_sim_operation,
217 UBYTE cphs_sim_field,
218 UBYTE record,
219 UBYTE *data_buffer,
220 UBYTE data_buffer_size);
221
222 EXTERN void cphs_sim_read_mb_ext_rcd(UBYTE record,UBYTE *data_buffer);
223
224
225 EXTERN void cphs_bcd2number(CHAR *number,
226 UBYTE *bcd,
227 UBYTE bcd_size);
228 EXTERN T_CPHS_RET cphs_get_als_active_line(UBYTE srcId, T_CPHS_LINES *line);
229
230 EXTERN T_CPHS_LINES als_get_call_info(SHORT call_id);
231
232
233
234
235 EXTERN void cphs_abort_current_action(void);
236 EXTERN void cphs_sim_data_accessed(UBYTE max_records, UBYTE data_len);
237 EXTERN void cphs_write_sim_mb_ext_data(UBYTE data_len);
238 EXTERN void cphs_sim_data_failure(void);
239
240
241 /* structure containing internal parameters of CPHS */
242 /* describes SIM operation in progress */
243 #define CPHS_SIM_NO_ACTION (0)
244 #define CPHS_SIM_READ_TRANSP_EF (1)
245 #define CPHS_SIM_WRITE_TRANSP_EF (2)
246 #define CPHS_SIM_READ_RECORD (3)
247 #define CPHS_SIM_WRITE_RECORD (4)
248
249 /* describes SIM updating operation status */
250 #define CPHS_SIM_NOT_UPDATING (0)
251 #define CPHS_SIM_CFU (1)
252 #define CPHS_SIM_INFO_NUMS (2)
253 #define CPHS_SIM_INFO_NUMS_EA01 (3)
254 #define CPHS_SIM_CSP (4)
255 #define CPHS_SIM_VWI (5) /* when updating SIM user initiated */
256 #define CPHS_SIM_OPNLONG (6)
257 #define CPHS_SIM_OPNSHORT (7)
258 #define CPHS_SIM_ALSNAMES (8)
259 #define CPHS_SIM_CINF (9)
260 #define CPHS_SIM_MB (10)
261 #define CPHS_SIM_STOP_INIT (11)
262 /* Add support for Orange SIM's */
263 #define CPHS_SIM_ORANGE_CSP (12)
264
265 /* decribes SIM write failures */
266 #define CPHS_SIM_WRITE_FAIL (0)
267 #define CPHS_SIM_WRITE_OK (1)
268
269 #endif /* CPHS_H */