| /** |
| * @file : gsw_eu_ecall_interface.h |
| * @brief : Europe Ecall |
| * @date : 2023-10-23 |
| * @author : |
| * @version : v1.0 |
| * @copyright Copyright(C) 2023,Gosuncnwelink |
| */ |
| #ifndef __GSW_EU_ECALL_INTERFACE_H__ |
| #define __GSW_EU_ECALL_INTERFACE_H__ |
| |
| #include <stdint.h> |
| #include <stdbool.h> |
| #include "gsw_hal_errcode.h" |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| /*********************************************************************************************/ |
| |
| |
| #define GSW_EU_ECALL_MAX_MSD 140 |
| #define GSW_EU_ECALL_MAX_PHONE_NUMBER 82 |
| |
| typedef enum { |
| GSW_EU_ECALL_TYPE_TEST = 1, |
| GSW_EU_ECALL_TYPE_EMERGENCY = 2, |
| GSW_EU_ECALL_TYPE_RECONFIG = 3, |
| } gsw_eu_ecall_type_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_STATE_NONE = -1, |
| GSW_EU_ECALL_STATE_INACTIVE = 0, |
| GSW_EU_ECALL_STATE_ORIGINATING_CALL = 1, |
| GSW_EU_ECALL_STATE_IN_CALL_TRANSMITTING = 2, |
| GSW_EU_ECALL_STATE_WAITING_FOR_AL_ACK = 3, |
| GSW_EU_ECALL_STATE_IN_CALL = 4, |
| GSW_EU_ECALL_STATE_IDLE_ALLOW_MT_ECALL = 5, |
| } gsw_eu_ecall_state_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_MODE_NORMAL = 0, |
| GSW_EU_ECALL_MODE_ONLY = 1, |
| GSW_EU_ECALL_MODE_DEFAULT = 2, |
| } gsw_eu_ecall_mode_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_CONFIG_ENABLE = (1 << 0), |
| GSW_EU_ECALL_CONFIG_VOICE_MUTE = (1 << 1), |
| GSW_EU_ECALL_CONFIG_MODE = (1 << 2), |
| GSW_EU_ECALL_CONFIG_REPORT_EVENT = (1 << 3), |
| GSW_EU_ECALL_CONFIG_START_TIMER = (1 << 4), |
| GSW_EU_ECALL_CONFIG_HACK_TIMER = (1 << 5), |
| GSW_EU_ECALL_CONFIG_TRANS_TIMER = (1 << 6), |
| GSW_EU_ECALL_CONFIG_FAIL_REDIAL = (1 << 7), |
| GSW_EU_ECALL_CONFIG_DROP_REDIAL = (1 << 8), |
| GSW_EU_ECALL_CONFIG_CLEARDOWN_TIMER = (1 << 9), |
| GSW_EU_ECALL_CONFIG_INIT_TIMER = (1 << 10), |
| GSW_EU_ECALL_CONFIG_NAD_REG_TIMER = (1 << 11), |
| GSW_EU_ECALL_CONFIG_NAD_DEREG_TIMER = (1 << 12), |
| GSW_EU_ECALL_CONFIG_STANDARD = (1 << 13), |
| GSW_EU_ECALL_CONFIG_ERA_GLONASS_REDIAL = (1 << 14), |
| GSW_EU_ECALL_CONFIG_AUTO_ANSWER = (1 << 15), |
| } gsw_eu_ecall_config_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_EVENT_FAIL_NONE = 0, |
| GSW_EU_ECALL_EVENT_FAIL_TIMEOUT = 1, |
| GSW_EU_ECALL_EVENT_FAIL_HACK_TIMEOUT = 2, |
| GSW_EU_ECALL_EVENT_FAIL_MSD_TRANS_TIMEOUT = 3, |
| GSW_EU_ECALL_EVENT_FAIL_IVS_RESET_TIMEOUT = 4, |
| GSW_EU_ECALL_EVENT_FAIL_CLEAR_DOWN_FALLBACK_TIMEOUT = 5, |
| GSW_EU_ECALL_EVENT_FAIL_IVS_INITIATION_TIMEOUT = 6, |
| } gsw_eu_ecall_event_fail_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_EVENT_PROCESS_IVS_NONE = 0, |
| GSW_EU_ECALL_EVENT_PROCESS_IVS_START_RECEIVED_MSD = 1, |
| GSW_EU_ECALL_EVENT_PROCESS_IVS_NACK_RECEIVED = 2, |
| GSW_EU_ECALL_EVENT_PROCESS_IVS_ACK_RECEIVED = 3, |
| GSW_EU_ECALL_EVENT_PROCESS_IVS_TX_COMPLETED = 4, |
| GSW_EU_ECALL_EVENT_PROCESS_IVS_HLACK_RECEIVED = 5, |
| } gsw_eu_ecall_event_process_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_EVENT_MSDUPADTE_NONE = -1, |
| GSW_EU_ECALL_EVENT_MSDUPDATE_IVS_UPDATING_MSD = 0, |
| GSW_EU_ECALL_EVENT_MSDUPDATE_PSAP_REQURE_UPDATE_MSD = 1, |
| GSW_EU_ECALL_EVENT_MSDUPDATE_IVS_UPDATE_MSD_TIMEOUT = 2, |
| } gsw_eu_ecall_event_msdupdate_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_EVENT_ESTABLISH_NONE = -1, |
| GSW_EU_ECALL_EVENT_ESTABLISH_SUCCESS = 0, |
| GSW_EU_ECALL_EVENT_ESTABLISH_FAIL = 1, |
| } gsw_eu_ecall_event_establish_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_NONE = -1, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_START_RECV_SYN = 0, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_T9_TIMEOUT = 1, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_T10_TIMEOUT = 2, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_IVS_ALACK_RECEIVED = 3, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_IVS_LLACK_RECEIVED = 4, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_STOPPED = 5, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_ANSWERING_INCOMING_PSAP_ECALL = 6, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_CLEARDOWN_RECEIVED = 7, |
| GSW_EU_ECALL_EVENT_EXTEND_STATE_CALLBACK_TIMEOUT = 8, |
| GSW_EU_ECALL_EVENT_IVS_NORMAL_CLEARING = 9, |
| GSW_EU_ECALL_EVENT_IVS_ABNORMAL_CLEARING = 10, |
| } gsw_eu_ecall_event_extend_state_e; |
| |
| typedef enum { |
| GSW_EU_ECALL_MSD_TRANS_STATUS_NONE = -1, |
| GSW_EU_ECALL_MSD_TRANS_STATUS_SUCCESS = 0, |
| GSW_EU_ECALL_MSD_TRANS_STATUS_FAILURE = 1, |
| } gsw_eu_ecall_msd_trans_status_e; |
| |
| typedef struct |
| { |
| uint32_t msd_len; |
| uint8_t msd[GSW_EU_ECALL_MAX_MSD]; |
| gsw_eu_ecall_type_e type; |
| int32_t auto_trigger; |
| char ecall_number[GSW_EU_ECALL_MAX_PHONE_NUMBER]; |
| } gsw_eu_ecall_info_t; |
| |
| typedef struct |
| { |
| uint8_t enable; |
| uint8_t voice_mute; |
| gsw_eu_ecall_mode_e mode; |
| uint8_t report_event; |
| uint16_t start_timer; |
| uint16_t hack_timer; |
| uint16_t trans_timer; |
| uint8_t fail_redial; |
| uint8_t drop_redial; |
| uint16_t cleardown_timer; |
| uint16_t init_timer; |
| uint16_t nad_reg_timer; |
| uint16_t nad_dereg_timer; |
| uint8_t standard; |
| uint16_t era_glonass_redial; |
| uint16_t auto_answer; |
| } gsw_eu_ecall_config_t; |
| |
| typedef struct |
| { |
| uint8_t ori_remainder_times; |
| uint16_t time; |
| } gsw_eu_ecall_event_originate_fail_redial_t; |
| |
| typedef struct |
| { |
| uint8_t drop_remainder_times; |
| uint16_t time; /* The minimum time duration between the previous call attempt */ |
| } gsw_eu_ecall_event_drop_redial_t; |
| |
| typedef struct |
| { |
| gsw_eu_ecall_event_fail_e fail; |
| gsw_eu_ecall_event_process_e process; |
| gsw_eu_ecall_event_msdupdate_e msdupdate; |
| gsw_eu_ecall_event_establish_e establish; |
| uint16_t hack_code; |
| gsw_eu_ecall_event_originate_fail_redial_t ori_redial; |
| gsw_eu_ecall_event_drop_redial_t drop_redial; |
| gsw_eu_ecall_event_extend_state_e extend_state; |
| } gsw_eu_ecall_event_t; |
| |
| typedef void (*gsw_eu_ecall_event_cb_f)(gsw_eu_ecall_event_t *p_event); |
| |
| typedef void (*gsw_eu_ecall_status_cb_f)(uint32_t id, gsw_eu_ecall_msd_trans_status_e status); |
| |
| /** |
| * @brief init the Europe Ecall voice |
| * @param [in] None |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_voice_init(void); |
| |
| /** |
| * @brief deinit the Europe Ecall voice |
| * @param [in] None |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_voice_deinit(void); |
| |
| /** |
| * @brief start a Europe Ecall |
| * @param [in] gsw_eu_ecall_info_t *p_info: ecall info |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_start(gsw_eu_ecall_info_t *p_info); |
| |
| /** |
| * @brief hangup a Europe Ecall |
| * @param [in] None |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_hangup(void); |
| |
| /** |
| * @brief update msd data |
| * @param [in] uint8_t *msd: msd data |
| * @param [in] uint32_t msd_len: msd data length |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_updateMsd(const uint8_t *msd, uint32_t msd_len); |
| |
| /** |
| * @brief using push mode send msd data |
| * @param [in] None |
| * @param [out] GSW_EU_ECALL_STATE_E state: ecall state |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_pushMsd(gsw_eu_ecall_state_e state); |
| |
| /** |
| * @brief get ecall config |
| * @param [in] None |
| * @param [out] gsw_eu_ecall_config_t *p_config: ecall config |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_getConfig(gsw_eu_ecall_config_t *p_config); |
| |
| /** |
| * @brief set ecall config |
| * @param [in] int32_t item: config item |
| * @param [in] gsw_eu_ecall_config_t *p_config: config info |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_setConfig(int32_t item, gsw_eu_ecall_config_t *p_config); |
| |
| /** |
| * @brief register the ecall event callback |
| * @param [in] gsw_eu_ecall_event_cb_f cb: callback |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_setEventCB(gsw_eu_ecall_event_cb_f cb); |
| |
| /** |
| * @brief register the ecall status callback |
| * @param [in] gsw_eu_ecall_status_cb_f cb:callback |
| * @param [out] None |
| * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL |
| */ |
| int32_t gsw_eu_ecall_setStatusCB(gsw_eu_ecall_status_cb_f cb); |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| #endif //__GSW_EU_ECALL_INTERFACE_H__ |