b.liu | 68a94c9 | 2025-05-24 12:53:41 +0800 | [diff] [blame] | 1 | /** |
| 2 | *@file ql_voicecall.h |
| 3 | *@date 2017-05-02 |
| 4 | *@author |
| 5 | *@brief |
| 6 | */ |
| 7 | |
| 8 | #ifndef __QL_VCALL_H__ |
| 9 | #define __QL_VCALL_H__ |
| 10 | |
| 11 | #define QL_QMI_VCALL_ECALL_MSD_MAX_LEN 140 |
| 12 | |
| 13 | |
| 14 | //-------------------------------------------------------------------------------------------------- |
| 15 | /** |
| 16 | * Reference returned by Start function and used by End function |
| 17 | */ |
| 18 | //-------------------------------------------------------------------------------------------------- |
| 19 | //typedef struct QL_VCALL_Call* ST_VCALL_CallRef; |
| 20 | typedef int ST_VCALL_CallRef; |
| 21 | |
| 22 | //-------------------------------------------------------------------------------------------------- |
| 23 | /** |
| 24 | * SIM identifiers. |
| 25 | * |
| 26 | */ |
| 27 | //-------------------------------------------------------------------------------------------------- |
| 28 | typedef enum |
| 29 | { |
| 30 | E_QL_VCALL_EXTERNAL_SLOT_1, |
| 31 | E_QL_VCALL_EXTERNAL_SLOT_2, |
| 32 | E_QL_VCALL_EMBEDDED, |
| 33 | E_QL_VCALL_REMOTE, |
| 34 | E_QL_VCALL_ID_MAX |
| 35 | }E_QL_VCALL_ID_T; |
| 36 | |
| 37 | //-------------------------------------------------------------------------------------------------- |
| 38 | /** |
| 39 | * Voice call establishment states. |
| 40 | */ |
| 41 | //-------------------------------------------------------------------------------------------------- |
| 42 | typedef enum |
| 43 | { |
| 44 | E_QL_VCALL_EVENT_ALERTING = 0, |
| 45 | ///< Voice call establishment in progress. |
| 46 | ///< Far end is now alerting its user (outgoing call). |
| 47 | |
| 48 | E_QL_VCALL_EVENT_CONNECTED = 1, |
| 49 | ///< Call has been established, and is media is active. |
| 50 | |
| 51 | E_QL_VCALL_EVENT_TERMINATED = 2, |
| 52 | ///< Call has terminated. |
| 53 | |
| 54 | E_QL_VCALL_EVENT_OFFLINE = 3, |
| 55 | ///< NO Service available to try establish a voice call. |
| 56 | |
| 57 | E_QL_VCALL_EVENT_BUSY = 4, |
| 58 | ///< Remote party (callee) is busy. |
| 59 | |
| 60 | E_QL_VCALL_EVENT_RESOURCE_BUSY = 5, |
| 61 | ///< All local connection resources (lines/channels) are in use. |
| 62 | |
| 63 | E_QL_VCALL_EVENT_CALL_END_FAILED = 6, |
| 64 | ///< Call ending failed. |
| 65 | |
| 66 | E_QL_VCALL_EVENT_CALL_ANSWER_FAILED = 7, |
| 67 | ///< Call answering failed. |
| 68 | |
| 69 | E_QL_VCALL_EVENT_INCOMING = 8 |
| 70 | ///< Incoming voice call in progress. |
| 71 | }E_QL_VCALL_EVENT_T; |
| 72 | |
| 73 | |
| 74 | //-------------------------------------------------------------------------------------------------- |
| 75 | /** |
| 76 | * Voice call termination reason. |
| 77 | */ |
| 78 | //-------------------------------------------------------------------------------------------------- |
| 79 | typedef enum |
| 80 | { |
| 81 | E_QL_VCALL_TERM_NETWORK_FAIL = 0, |
| 82 | ///< Network could not complete the call. |
| 83 | |
| 84 | E_QL_VCALL_TERM_BAD_ADDRESS = 1, |
| 85 | ///< Remote address could not be resolved. |
| 86 | |
| 87 | E_QL_VCALL_TERM_BUSY = 2, |
| 88 | ///< Caller is currently busy and cannot take the call. |
| 89 | |
| 90 | E_QL_VCALL_TERM_LOCAL_ENDED = 3, |
| 91 | ///< Local party ended the call. |
| 92 | |
| 93 | E_QL_VCALL_TERM_REMOTE_ENDED = 4, |
| 94 | ///< Remote party ended the call. |
| 95 | |
| 96 | E_QL_VCALL_TERM_UNDEFINED = 5 |
| 97 | ///< Undefined reason. |
| 98 | }E_QL_VCALL_TerminationReason_t; |
| 99 | |
| 100 | |
| 101 | //-------------------------------------------------------------------------------------------------- |
| 102 | /** |
| 103 | * Reference type used by Add/Remove functions for EVENT 'QL_VCALL_State' |
| 104 | */ |
| 105 | //-------------------------------------------------------------------------------------------------- |
| 106 | //typedef struct QL_VCALL_StateHandler* QL_VCALL_StateHandlerRef_t; |
| 107 | typedef int QL_VCALL_StateHandlerRef_t; |
| 108 | |
| 109 | |
| 110 | typedef enum |
| 111 | { |
| 112 | E_QL_VCALL_DIRECTION_MO = 1, |
| 113 | E_QL_VCALL_DIRECTION_MT = 2 |
| 114 | }E_QL_VCALL_DIRECTION_T; |
| 115 | |
| 116 | typedef enum |
| 117 | { |
| 118 | E_QL_VCALL_STATE_ORIGINATING = 1, //Origination |
| 119 | E_QL_VCALL_STATE_INCOMING, //Incoming |
| 120 | E_QL_VCALL_STATE_CONVESATION, //Conversation |
| 121 | E_QL_VCALL_STATE_CC_IN_PROGRESS, //Call is originating but waiting for call control to complete |
| 122 | E_QL_VCALL_STATE_ALERTING, //Alerting |
| 123 | E_QL_VCALL_STATE_HOLD, //Hold |
| 124 | E_QL_VCALL_STATE_WAITING, //Waiting |
| 125 | E_QL_VCALL_STATE_DISCONNECTING, //Disconnecting |
| 126 | E_QL_VCALL_STATE_END, //End |
| 127 | E_QL_VCALL_STATE_SETUP, //MT call is in setup state in 3GPP |
| 128 | }E_QL_VCALL_STATE_T; |
| 129 | |
| 130 | typedef enum |
| 131 | { |
| 132 | E_QL_VCALL_TYPE_VOICE = 0, //Voice |
| 133 | E_QL_VCALL_TYPE_VOICE_FORCED, //Avoid modem call classification |
| 134 | E_QL_VCALL_TYPE_VOICE_IP, //Voice over IP |
| 135 | E_QL_VCALL_TYPE_VT, //VideoTelephony call over IP |
| 136 | E_QL_VCALL_TYPE_VIDEOSHARE , //Videoshare |
| 137 | E_QL_VCALL_TYPE_TEST, //Test call |
| 138 | E_QL_VCALL_TYPE_OTAPA, //OTAPA |
| 139 | E_QL_VCALL_TYPE_STD_OTASP, //Standard OTASP |
| 140 | E_QL_VCALL_TYPE_NON_STD_OTASP, //Nonstandard OTASP |
| 141 | E_QL_VCALL_TYPE_EMERGENCY, //Emergency |
| 142 | E_QL_VCALL_TYPE_SUPS, //Supplementary Service |
| 143 | E_QL_VCALL_TYPE_EMERGENCY_IP, //Emergency VoIP |
| 144 | E_QL_VCALL_TYPE_ECALL //eCall |
| 145 | }E_QL_VCALL_TYPE_T; |
| 146 | |
| 147 | typedef struct |
| 148 | { |
| 149 | uint8_t call_id; |
| 150 | char PhoneNum[20]; ///Telephone number string. |
| 151 | E_QL_VCALL_DIRECTION_T e_direct; |
| 152 | E_QL_VCALL_STATE_T e_state; |
| 153 | E_QL_VCALL_TYPE_T e_type; |
| 154 | } vcall_info_t; |
| 155 | |
| 156 | typedef enum |
| 157 | { |
| 158 | E_QL_VCALL_ECALL_MANUAL = 5, |
| 159 | E_QL_VCALL_ECALL_AUTO = 6 |
| 160 | }E_QL_VCALL_ECALL_CAT_T; |
| 161 | |
| 162 | typedef enum |
| 163 | { |
| 164 | E_QL_VCALL_ECALL_TEST = 0x01, |
| 165 | E_QL_VCALL_ECALL_EMERGENCY = 0x02, |
| 166 | E_QL_VCALL_ECALL_RECONFIG = 0x03, |
| 167 | }E_QL_VCALL_ECALL_VARIANT_T; |
| 168 | |
| 169 | |
| 170 | //-------------------------------------------------------------------------------------------------- |
| 171 | /** |
| 172 | * Handler for voice call state changes. |
| 173 | * |
| 174 | * @param reference |
| 175 | * Event voice call object reference. |
| 176 | * @param identifier |
| 177 | * Identifier of the remote party |
| 178 | * @param event |
| 179 | * Voice call event. |
| 180 | * @param contextPtr |
| 181 | */ |
| 182 | //-------------------------------------------------------------------------------------------------- |
| 183 | typedef void (*QL_VCALL_StateHandlerFunc_t) |
| 184 | ( |
| 185 | ST_VCALL_CallRef reference, |
| 186 | const char* identifier, |
| 187 | E_QL_VCALL_STATE_T event, |
| 188 | void* contextPtr |
| 189 | ); |
| 190 | |
| 191 | //-------------------------------------------------------------------------------------------------- |
| 192 | /** |
| 193 | * Add handler function for EVENT 'QL_VCALL_State' |
| 194 | * |
| 195 | * This event provides information on voice call state changes |
| 196 | */ |
| 197 | //-------------------------------------------------------------------------------------------------- |
| 198 | QL_VCALL_StateHandlerRef_t QL_VCALL_AddStateHandler |
| 199 | ( |
| 200 | QL_VCALL_StateHandlerFunc_t handlerPtr, |
| 201 | ///< [IN] |
| 202 | |
| 203 | void* contextPtr |
| 204 | ///< [IN] |
| 205 | ); |
| 206 | |
| 207 | //-------------------------------------------------------------------------------------------------- |
| 208 | /** |
| 209 | * Remove handler function for EVENT 'QL_VCALL_State' |
| 210 | */ |
| 211 | //-------------------------------------------------------------------------------------------------- |
| 212 | void QL_VCALL_RemoveStateHandler |
| 213 | ( |
| 214 | QL_VCALL_StateHandlerRef_t addHandlerRef |
| 215 | ///< [IN] |
| 216 | ); |
| 217 | |
| 218 | //-------------------------------------------------------------------------------------------------- |
| 219 | /** |
| 220 | * Start a voice call. |
| 221 | * |
| 222 | * @return |
| 223 | * - Reference to the voice call (to be used later for releasing the voice call) |
| 224 | * - NULL if the voice call could not be processed |
| 225 | */ |
| 226 | //-------------------------------------------------------------------------------------------------- |
| 227 | ST_VCALL_CallRef QL_VCALL_Start |
| 228 | ( |
| 229 | E_QL_VCALL_ID_T simId, |
| 230 | const char* DestinationID |
| 231 | ///< [IN] Destination identifier for the voice |
| 232 | ); |
| 233 | |
| 234 | //-------------------------------------------------------------------------------------------------- |
| 235 | /** |
| 236 | * Release a voice call. |
| 237 | * |
| 238 | * @return |
| 239 | * - E_QL_OK if the end of voice call can be processed. |
| 240 | * - E_QL_NOT_FOUND if the voice call object reference is not found. |
| 241 | */ |
| 242 | //-------------------------------------------------------------------------------------------------- |
| 243 | int QL_VCALL_End |
| 244 | ( |
| 245 | ST_VCALL_CallRef reference |
| 246 | ///< [IN] Voice call object reference to hang-up. |
| 247 | ); |
| 248 | |
| 249 | |
| 250 | //-------------------------------------------------------------------------------------------------- |
| 251 | /** |
| 252 | * Answer to incoming voice call. |
| 253 | * |
| 254 | * @return |
| 255 | * - E_QL_OK if the incoming voice call can be answered |
| 256 | * - E_QL_NOT_FOUND if the incoming voice call object reference is not found. |
| 257 | */ |
| 258 | //-------------------------------------------------------------------------------------------------- |
| 259 | int QL_VCALL_Answer |
| 260 | ( |
| 261 | ST_VCALL_CallRef reference |
| 262 | ///< [IN] Incoming voice call object reference to answer. |
| 263 | ); |
| 264 | |
| 265 | //-------------------------------------------------------------------------------------------------- |
| 266 | /** |
| 267 | * Get the termination reason of a voice call reference. |
| 268 | * |
| 269 | * @return |
| 270 | * - E_QL_OK if the termination reason is got |
| 271 | * - E_QL_NOT_FOUND if the incoming voice call object reference is not found. |
| 272 | * - E_QL_FAULT if the voice call is not terminated. |
| 273 | */ |
| 274 | //-------------------------------------------------------------------------------------------------- |
| 275 | int QL_VCALL_GetTerminationReason |
| 276 | ( |
| 277 | ST_VCALL_CallRef reference, |
| 278 | ///< [IN] Voice call object reference to read from. |
| 279 | |
| 280 | E_QL_VCALL_TerminationReason_t* reasonPtr |
| 281 | ///< [OUT] Termination reason of the voice call. |
| 282 | ); |
| 283 | |
| 284 | |
| 285 | int QL_VCALL_Ecall(E_QL_VCALL_ID_T simId, |
| 286 | char* phone_number, |
| 287 | char* ecall_msd, |
| 288 | E_QL_VCALL_ECALL_CAT_T emer_cat, |
| 289 | E_QL_VCALL_ECALL_VARIANT_T eCallModeType, |
| 290 | ST_VCALL_CallRef *reference); //call id |
| 291 | |
| 292 | int QL_VCALL_UpdateMsd( const char *msd); |
| 293 | |
| 294 | |
| 295 | #endif // __QL_VCALL_H__ |
| 296 | |