comparison g23m/condat/ms/src/aci/cphs.h @ 0:509db1a7b7b8

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