代码拉取完成,页面将自动刷新
#include "lxz_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#ifdef LXZAT_WIN32
#include <io.h>
#include <windows.h>
#endif /* LXZAT_WIN32 */
#ifdef LXZAT_LINUX
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <linux/sockios.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <pthread.h>
#include <errno.h>
#endif /* LXZAT_LINUX */
#include "lxz_types.h"
#include "os_port.h"
#include "lxz_runlog.h"
#include "lxz_debug.h"
#include "latserver.h"
#include "lxz_version.h"
#include "lxz_ring.h"
#include "lxz_string.h"
#include "lxz_dstring.h"
#include "lxz_atc_req.h"
#include "lxz_ccore_cmd.h"
#include "lxz_urc_table.h"
#include "lxz_dbg_vmem.h"
/*
* Description:
* A structure for saving parameters and result.
* Note: NONE
*/
typedef struct _lxzat_resp_cops_t
{
sint32 i_nb_infos;
sint32 i_cur_mode;
sint32 i_cur_format;
uint08 u_cur_oper[128];
sint32 i_cur_rat;
} lxzat_resp_cops_t;
typedef struct _lxzat_oper_cops_t
{
sint32 it_mn_mcc;
sint32 it_mn_mnc;
uint08* up_oper_short;
uint08* up_oper_long;
}lxzat_oper_cops_t;
/*
* Description:
* A structure for saving parameters and result.
* Note: NONE
*/
typedef struct _lxzat_resp_ccid_t
{
uint08 u_iccid_buf[LXZAT_MAX_LEN_ICCID];
} lxzat_resp_ccid_t;
static sint32 lxzat_plus_csq_init(void * pctxt);
static sint32 lxzat_plus_csq_req(void * pctxt);
static sint32 lxzat_plus_csq_resp(void * pctxt);
static sint32 lxzat_plus_csq_reset(void * pctxt);
static sint32 lxzat_plus_cpin_init(void * pctxt);
static sint32 lxzat_plus_cpin_req(void * pctxt);
static sint32 lxzat_plus_cpin_resp(void * pctxt);
static sint32 lxzat_plus_cpin_reset(void * pctxt);
static sint32 lxzat_plus_cimi_init(void * pctxt);
static sint32 lxzat_plus_cimi_req(void * pctxt);
static sint32 lxzat_plus_cimi_resp(void * pctxt);
static sint32 lxzat_plus_cimi_reset(void * pctxt);
static sint32 lxzat_plus_cgsn_init(void * pctxt);
static sint32 lxzat_plus_cgsn_req(void * pctxt);
static sint32 lxzat_plus_cgsn_resp(void * pctxt);
static sint32 lxzat_plus_cgsn_reset(void * pctxt);
static sint32 lxzat_plus_cgmi_init(void * pctxt);
static sint32 lxzat_plus_cgmi_req(void * pctxt);
static sint32 lxzat_plus_cgmi_resp(void * pctxt);
static sint32 lxzat_plus_cgmi_reset(void * pctxt);
static sint32 lxzat_plus_cgmm_init(void * pctxt);
static sint32 lxzat_plus_cgmm_req(void * pctxt);
static sint32 lxzat_plus_cgmm_resp(void * pctxt);
static sint32 lxzat_plus_cgmm_reset(void * pctxt);
static sint32 lxzat_plus_gmr_init(void * pctxt);
static sint32 lxzat_plus_gmr_req(void * pctxt);
static sint32 lxzat_plus_gmr_resp(void * pctxt);
static sint32 lxzat_plus_gmr_reset(void * pctxt);
static sint32 lxzat_plus_cgmr_init(void * pctxt);
static sint32 lxzat_plus_cgmr_req(void * pctxt);
static sint32 lxzat_plus_cgmr_resp(void * pctxt);
static sint32 lxzat_plus_cgmr_reset(void * pctxt);
static sint32 lxzat_plus_cclk_init(void * pctxt);
static sint32 lxzat_plus_cclk_req(void * pctxt);
static sint32 lxzat_plus_cclk_resp(void * pctxt);
static sint32 lxzat_plus_cclk_reset(void * pctxt);
static sint32 lxzat_plus_creg_init(void * pctxt);
static sint32 lxzat_plus_creg_req(void * pctxt);
static sint32 lxzat_plus_creg_resp(void * pctxt);
static sint32 lxzat_plus_creg_reset(void * pctxt);
static sint32 lxzat_plus_cgreg_init(void * pctxt);
static sint32 lxzat_plus_cgreg_req(void * pctxt);
static sint32 lxzat_plus_cgreg_resp(void * pctxt);
static sint32 lxzat_plus_cgreg_reset(void * pctxt);
static sint32 lxzat_plus_cereg_init(void * pctxt);
static sint32 lxzat_plus_cereg_req(void * pctxt);
static sint32 lxzat_plus_cereg_resp(void * pctxt);
static sint32 lxzat_plus_cereg_reset(void * pctxt);
static sint32 lxzat_plus_cops_init(void * pctxt);
static sint32 lxzat_plus_cops_req(void * pctxt);
static sint32 lxzat_plus_cops_resp(void * pctxt);
static sint32 lxzat_plus_cops_reset(void * pctxt);
static sint32 lxzat_plus_cgdcont_init(void * pctxt);
static sint32 lxzat_plus_cgdcont_req(void * pctxt);
static sint32 lxzat_plus_cgdcont_resp(void * pctxt);
static sint32 lxzat_plus_cgdcont_reset(void * pctxt);
static sint32 lxzat_plus_cgpco_init(void * pctxt);
static sint32 lxzat_plus_cgpco_req(void * pctxt);
static sint32 lxzat_plus_cgpco_resp(void * pctxt);
static sint32 lxzat_plus_cgpco_reset(void * pctxt);
static sint32 lxzat_plus_cgact_init(void * pctxt);
static sint32 lxzat_plus_cgact_req(void * pctxt);
static sint32 lxzat_plus_cgact_resp(void * pctxt);
static sint32 lxzat_plus_cgact_reset(void * pctxt);
static sint32 lxzat_plus_cgpaddr_init(void * pctxt);
static sint32 lxzat_plus_cgpaddr_req(void * pctxt);
static sint32 lxzat_plus_cgpaddr_resp(void * pctxt);
static sint32 lxzat_plus_cgpaddr_reset(void * pctxt);
static sint32 lxzat_plus_cnum_init(void * pctxt);
static sint32 lxzat_plus_cnum_req(void * pctxt);
static sint32 lxzat_plus_cnum_resp(void * pctxt);
static sint32 lxzat_plus_cnum_reset(void * pctxt);
static sint32 lxzat_plus_cfun_init(void * pctxt);
static sint32 lxzat_plus_cfun_req(void * pctxt);
static sint32 lxzat_plus_cfun_resp(void * pctxt);
static sint32 lxzat_plus_cfun_reset(void * pctxt);
static sint32 lxzat_plus_ccid_init(void * pctxt);
static sint32 lxzat_plus_ccid_req(void * pctxt);
static sint32 lxzat_plus_ccid_resp(void * pctxt);
static sint32 lxzat_plus_ccid_reset(void * pctxt);
static sint32 lxzat_null_o_req(void * pctxt);
static sint32 lxzat_null_i_req(void * pctxt);
static sint32 lxzat_and_f0_req(void * pctxt);
static sint32 lxzat_and_w_req(void * pctxt);
static sint32 lxzat_and_z_req(void * pctxt);
static sint32 lxzat_null_e0_req(void * pctxt);
static sint32 lxzat_null_e1_req(void * pctxt);
static sint32 lxzat_null_s1_req(void * pctxt);
static sint32 lxzat_null_s2_req(void * pctxt);
static sint32 lxzat_null_s3_req(void * pctxt);
static sint32 lxzat_null_s4_req(void * pctxt);
static sint32 lxzat_null_s5_req(void * pctxt);
static sint32 lxzat_null_v0_req(void * pctxt);
static sint32 lxzat_null_v1_req(void * pctxt);
static sint32 lxzat_null_e0v1_req(void * pctxt);
static sint32 lxzat_plus_cmee_req(void * pctxt);
static sint32 lxzat_plus_ipr_init(void * pctxt);
static sint32 lxzat_plus_ipr_req(void * pctxt);
static sint32 lxzat_plus_ipr_resp(void * pctxt);
static sint32 lxzat_plus_ipr_reset(void * pctxt);
static sint32 lxzat_plus_crsm_init(void * pctxt);
static sint32 lxzat_plus_crsm_req(void * pctxt);
static sint32 lxzat_plus_crsm_resp(void * pctxt);
static sint32 lxzat_plus_crsm_reset(void * pctxt);
static sint32 lxzat_plus_cscs_init(void * pctxt);
static sint32 lxzat_plus_cscs_req(void * pctxt);
static sint32 lxzat_plus_cscs_resp(void * pctxt);
static sint32 lxzat_plus_cscs_reset(void * pctxt);
static sint32 lxzat_callback_pdpactive_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_pdpactive_f_exit(sint32 p1, sint32 p2);
static sint32 lxzat_callback_pdpdeactive_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_pdpdeactive_f_exit(sint32 p1, sint32 p2);
static sint32 lxzat_task_pdpactive_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt);
static sint32 lxzat_task_pdpdeactive_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt);
static sint08 gp_buf_phonenumber[31] = {0};
static sint08 gp_buf_cscs[7] = {"GSM"};
static const lxzat_oper_cops_t gs_oper_cops_table[] =
{
{460, 0, "CMCC", "CHINA MOBILE" /* China Mobile,LTE/GSM */},
{460, 1, "CUCC", "CHINA UNICOM" /* China Unicom,LTE/GSM */},
{460, 2, "CMCC", "CHINA MOBILE" /* China Mobile,TD-S */},
{460, 3, "CTCC", "CHINA TSGCCOM" /* China Tsgccom,CDMA/EVDO */},
{460, 4, "CMCC", "CHINA MOBILE" /* China Mobile,LTE/GSM */},
{460, 5, "CTCC", "CHINA TSGCCOM" /* China Tsgccom */},
{460, 6, "CUCC", "CHINA UNICOM" /* China Unicom,GSM/UMTS */},
{460, 7, "CMCC", "CHINA MOBILE" /* China Mobile,TD-S */},
{460, 11, "CTCC", "CHINA TSGCCOM" /* China Tsgccom,FDD-LTE */},
{460, 20, "CRCC", "CHINA RIALCOM" /* China Rialcom,GMR-R */},
{0, 0, NULL, NULL}
};
static lxzat_pdpcfg_t gs_pdpcfg_table[LXZAT_MAX_CID_PDP_CTXT+1]=
{
{""/*USR*/, ""/*PWD*/, ""/*APN*/, ""/*IPType*/, E_LPAT_MAX/*0:NONE,1:PAP,2:CHAP,3:PAP/CHAP*/},
{""/*USR*/, ""/*PWD*/, ""/*APN*/, ""/*IPType*/, E_LPAT_MAX/*0:NONE,1:PAP,2:CHAP,3:PAP/CHAP*/},
{""/*USR*/, ""/*PWD*/, ""/*APN*/, ""/*IPType*/, E_LPAT_MAX/*0:NONE,1:PAP,2:CHAP,3:PAP/CHAP*/},
{""/*USR*/, ""/*PWD*/, ""/*APN*/, ""/*IPType*/, E_LPAT_MAX/*0:NONE,1:PAP,2:CHAP,3:PAP/CHAP*/},
{""/*USR*/, ""/*PWD*/, ""/*APN*/, ""/*IPType*/, E_LPAT_MAX/*0:NONE,1:PAP,2:CHAP,3:PAP/CHAP*/},
{""/*USR*/, ""/*PWD*/, ""/*APN*/, ""/*IPType*/, E_LPAT_MAX/*0:NONE,1:PAP,2:CHAP,3:PAP/CHAP*/}
};
static lxzat_pdpinfo_t gs_pdpinfo_table[LXZAT_MAX_CID_PDP_CTXT+1] = {0};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_csq =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CSQ",
lxzat_plus_csq_init,
lxzat_plus_csq_req,
lxzat_plus_csq_resp,
lxzat_plus_csq_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cpin =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CPIN",
lxzat_plus_cpin_init,
lxzat_plus_cpin_req,
lxzat_plus_cpin_resp,
lxzat_plus_cpin_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cimi =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CIMI",
lxzat_plus_cimi_init,
lxzat_plus_cimi_req,
lxzat_plus_cimi_resp,
lxzat_plus_cimi_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgsn =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGSN",
lxzat_plus_cgsn_init,
lxzat_plus_cgsn_req,
lxzat_plus_cgsn_resp,
lxzat_plus_cgsn_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgmi =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGMI",
lxzat_plus_cgmi_init,
lxzat_plus_cgmi_req,
lxzat_plus_cgmi_resp,
lxzat_plus_cgmi_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgmm =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGMM",
lxzat_plus_cgmm_init,
lxzat_plus_cgmm_req,
lxzat_plus_cgmm_resp,
lxzat_plus_cgmm_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_gmr =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+GMR",
lxzat_plus_gmr_init,
lxzat_plus_gmr_req,
lxzat_plus_gmr_resp,
lxzat_plus_gmr_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgmr =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGMR",
lxzat_plus_cgmr_init,
lxzat_plus_cgmr_req,
lxzat_plus_cgmr_resp,
lxzat_plus_cgmr_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cclk =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CCLK",
lxzat_plus_cclk_init,
lxzat_plus_cclk_req,
lxzat_plus_cclk_resp,
lxzat_plus_cclk_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_creg =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CREG",
lxzat_plus_creg_init,
lxzat_plus_creg_req,
lxzat_plus_creg_resp,
lxzat_plus_creg_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgreg =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGREG",
lxzat_plus_cgreg_init,
lxzat_plus_cgreg_req,
lxzat_plus_cgreg_resp,
lxzat_plus_cgreg_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cereg =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CEREG",
lxzat_plus_cereg_init,
lxzat_plus_cereg_req,
lxzat_plus_cereg_resp,
lxzat_plus_cereg_reset
};
const lxzat_info_t lai_plus_cops =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
"+COPS",
lxzat_plus_cops_init,
lxzat_plus_cops_req,
lxzat_plus_cops_resp,
lxzat_plus_cops_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgdcont =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGDCONT",
lxzat_plus_cgdcont_init,
lxzat_plus_cgdcont_req,
lxzat_plus_cgdcont_resp,
lxzat_plus_cgdcont_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgpco =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGPCO",
lxzat_plus_cgpco_init,
lxzat_plus_cgpco_req,
lxzat_plus_cgpco_resp,
lxzat_plus_cgpco_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgact =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGACT",
lxzat_plus_cgact_init,
lxzat_plus_cgact_req,
lxzat_plus_cgact_resp,
lxzat_plus_cgact_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cgpaddr =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CGPADDR",
lxzat_plus_cgpaddr_init,
lxzat_plus_cgpaddr_req,
lxzat_plus_cgpaddr_resp,
lxzat_plus_cgpaddr_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cnum =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CNUM",
lxzat_plus_cnum_init,
lxzat_plus_cnum_req,
lxzat_plus_cnum_resp,
lxzat_plus_cnum_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cfun =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CFUN",
lxzat_plus_cfun_init,
lxzat_plus_cfun_req,
lxzat_plus_cfun_resp,
lxzat_plus_cfun_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_ccid =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CCID",
lxzat_plus_ccid_init,
lxzat_plus_ccid_req,
lxzat_plus_ccid_resp,
lxzat_plus_ccid_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_i =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"I",
NULL,
lxzat_null_i_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_o =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"O",
NULL,
lxzat_null_o_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_and_f0 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"&F0",
NULL,
lxzat_and_f0_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_and_w =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"&W",
NULL,
lxzat_and_w_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_and_z =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"&Z",
NULL,
lxzat_and_z_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_e0 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"E0",
NULL,
lxzat_null_e0_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_e1 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"E1",
NULL,
lxzat_null_e1_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_s1 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"S1",
NULL,
lxzat_null_s1_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_s2 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"S2",
NULL,
lxzat_null_s2_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_s3 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"S3",
NULL,
lxzat_null_s3_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_s4 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"S4",
NULL,
lxzat_null_s4_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_s5 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"S5",
NULL,
lxzat_null_s5_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_v0 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"V0",
NULL,
lxzat_null_v0_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_v1 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"V1",
NULL,
lxzat_null_v1_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_null_e0v1 =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"E0V1",
NULL,
lxzat_null_e0v1_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cmee =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
"+CMEE",
NULL,
lxzat_plus_cmee_req,
NULL,
NULL
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_ipr =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
"+IPR",
lxzat_plus_ipr_init,
lxzat_plus_ipr_req,
lxzat_plus_ipr_resp,
lxzat_plus_ipr_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_crsm =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
"+CRSM",
lxzat_plus_crsm_init,
lxzat_plus_crsm_req,
lxzat_plus_crsm_resp,
lxzat_plus_crsm_reset
};
/*
* Description:
* A caplets for hiding concrete implementation.
* Note:
* Please do not change any part of current piece when you unsure.
*/
const lxzat_info_t lai_plus_cscs =
{
LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
"+CSCS",
lxzat_plus_cscs_init,
lxzat_plus_cscs_req,
lxzat_plus_cscs_resp,
lxzat_plus_cscs_reset
};
/*
* Description:
* The initialize handler of "AT+CSQ".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_csq_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CSQ".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_csq_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CSQ".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_csq_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzdata_info_t * p_cur_datacfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_csq_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_csq_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
sint32 i_csq_signal = 27;
sint32 i_csq_ber = 99;
i_csq_signal = rand()%11 + 20;
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,%d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i_csq_signal, i_csq_ber);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CSQ".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_csq_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CPIN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cpin_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CPIN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cpin_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CPIN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cpin_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzdata_info_t * p_cur_datacfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cpin_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cpin_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i_cpin_status = 0;
i_cpin_status = lxzat_cpin_f_getstatus(p_cur_spcfg->i_vsp_id);
if (1 == i_cpin_status)
{
lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %s",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"READY");
}
else
{
lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %s",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"SIM BUSY");
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"PINCode");
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CPIN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cpin_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CIMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cimi_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CIMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cimi_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CIMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cimi_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cimi_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cimi_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"460018621721170");
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CIMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cimi_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CGSN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgsn_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGSN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgsn_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CGSN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgsn_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgsn_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgsn_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"6630118621721170");
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CGSN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgsn_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CGMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmi_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmi_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CGMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmi_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgmi_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgmi_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"CYCT");
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CGMI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmi_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CGMM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmm_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGMM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmm_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CGMM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmm_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgmm_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgmm_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
LXZAT_MDM_MODEL);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CGMM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmm_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+GMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_gmr_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+GMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_gmr_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+GMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_gmr_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat:lxzat_plus_gmr_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat:lxzat_plus_gmr_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s",
LXZAT_MDM_REVISION);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+GMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_gmr_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CGMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmr_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmr_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CGMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmr_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgmr_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgmr_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
LXZAT_MDM_REVISION);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CGMR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgmr_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CCLK".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cclk_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CCLK".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cclk_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CCLK".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cclk_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cclk_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cclk_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
e_err_code = E_LEC_OK;
break;
}
case LXZAT_REQ_TYPE_READ:
{
char llbuf[63];
time_t atime;
int i_cur_year;
int i_cur_mon;
int i_cur_day;
int i_cur_hour;
int i_cur_min;
int i_cur_sec;
int i_cur_tz = 32;
struct tm* p = NULL;
time(&atime);
p = gmtime(&atime);
memset(llbuf, 0, sizeof(llbuf));
i_cur_year = p->tm_year+1900-2000;
i_cur_mon = p->tm_mon+1;
i_cur_day = p->tm_mday;
i_cur_hour = p->tm_hour;
i_cur_min = p->tm_min;
i_cur_sec = p->tm_sec;
sprintf(llbuf, "%d/%02d/%02d,%02d:%02d:%02d+%02d", i_cur_year,
i_cur_mon, i_cur_day, i_cur_hour, i_cur_min, i_cur_sec, i_cur_tz);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
llbuf);
break;
}
case LXZAT_REQ_TYPE_TEST:
{
e_err_code = E_LEC_OK;
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CCLK".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cclk_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_creg_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_creg_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_creg_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_creg_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
sint32 i_creg_mode = 0;
if (p_cur_req->it_nb_param != 1)
{
OS_DBG_LOG(("lxzat_plus_creg_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_creg_req,param1 type error!r\n"));
return E_LEC_ERR_P_TYPE;
}
i_creg_mode = PARAM1(p_cur_req).it_number;
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i_creg_mode = 0;
sint32 i_creg_stat = 0;
i_creg_stat = lxzat_creg_f_getstatus(p_cur_spcfg->i_vsp_id);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,%d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i_creg_mode,
i_creg_stat);
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (0-2)",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_creg_resp(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The reset handler of "AT+CREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_creg_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CGREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgreg_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgreg_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgreg_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgreg_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
sint32 i_cgreg_mode = 0;
if (p_cur_req->it_nb_param != 1)
{
OS_DBG_LOG(("lxzat_plus_cgreg_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgreg_req,param1 type error!r\n"));
return E_LEC_ERR_P_TYPE;
}
i_cgreg_mode = PARAM1(p_cur_req).it_number;
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i_cgreg_mode = 0;
sint32 i_cgreg_stat = 1;
i_cgreg_stat = lxzat_creg_f_getstatus(p_cur_spcfg->i_vsp_id);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,%d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i_cgreg_mode,
i_cgreg_stat);
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (0-2)",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CGREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgreg_resp(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The reset handler of "AT+CGREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgreg_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CEREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cereg_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CEREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cereg_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cereg_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cereg_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
sint32 i_cgreg_mode = 0;
if (p_cur_req->it_nb_param != 1)
{
OS_DBG_LOG(("lxzat_plus_cereg_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cereg_req,param1 type error!r\n"));
return E_LEC_ERR_P_TYPE;
}
i_cgreg_mode = PARAM1(p_cur_req).it_number;
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i_cereg_mode = 0;
sint32 i_cereg_stat = 1;
i_cereg_stat = lxzat_creg_f_getstatus(p_cur_spcfg->i_vsp_id);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,%d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i_cereg_mode,
i_cereg_stat);
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (0-2)",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CEREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cereg_resp(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The reset handler of "AT+CEREG".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cereg_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+COPS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cops_init(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_resp_cops_t * p_resp_cops = NULL;
if (p_lxzat_ctxt != NULL)
{
p_resp_cops = (lxzat_resp_cops_t *)malloc(sizeof(lxzat_resp_cops_t));
if (p_resp_cops != NULL)
{
memset(p_resp_cops, 0, sizeof(lxzat_resp_cops_t));
p_lxzat_ctxt->pt_rsp_data = p_resp_cops;
e_err_code = E_LEC_OK;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "AT+COPS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cops_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_resp_cops_t * p_resp_cops = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cops_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cops_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
#ifdef LXZAT_EASYRIL_API
sint32 i_op_status = 0;
ATResponse *p_outResponse = NULL;
sint32 i_cops_mode = 0;
sint32 i_cops_format = 0;
uint08 p_cops_oper[64] = {0};
sint32 i_cops_rat = 0;
uint08 p_req_buf[127] = {0};
switch (p_cur_req->it_nb_param)
{
case 1:
{
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param1 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_cops_mode = PARAM1(p_cur_req).it_number;
sprintf(p_req_buf, "AT+COPS=%d", i_cops_mode);
i_op_status = (sint32)at_send_command_multiline(p_req_buf, "+COPS: ", &p_outResponse);
if(i_op_status < 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error\r\n", p_req_buf);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else if( p_outResponse->success == 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error:%s\r\n", p_req_buf, p_outResponse->finalResponse);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else
{
at_response_free(p_outResponse);
}
break;
}
case 2:
{
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param1 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param2 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_cops_mode = PARAM1(p_cur_req).it_number;
i_cops_format = PARAM2(p_cur_req).it_number;
sprintf(p_req_buf, "AT+COPS=%d,%d", i_cops_mode, i_cops_format);
i_op_status = (sint32)at_send_command_multiline(p_req_buf, "+COPS: ", &p_outResponse);
if(i_op_status < 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error\r\n", p_req_buf);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else if( p_outResponse->success == 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error:%s\r\n", p_req_buf, p_outResponse->finalResponse);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else
{
at_response_free(p_outResponse);
}
break;
}
case 3:
{
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param1 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param2 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param3 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_cops_mode = PARAM1(p_cur_req).it_number;
i_cops_format = PARAM2(p_cur_req).it_number;
lxz_dstring_get(PARAM3(p_cur_req).pt_str, p_cops_oper, sizeof(p_cops_oper));
sprintf(p_req_buf, "AT+COPS=%d,%d,\"%s\"", i_cops_mode, i_cops_format, p_cops_oper);
i_op_status = (sint32)at_send_command_multiline(p_req_buf, "+COPS: ", &p_outResponse);
if(i_op_status < 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error\r\n", p_req_buf);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else if( p_outResponse->success == 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error:%s\r\n", p_req_buf, p_outResponse->finalResponse);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else
{
at_response_free(p_outResponse);
}
break;
}
case 4:
{
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param1 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param2 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param3 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req,param4 type is error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_cops_mode = PARAM1(p_cur_req).it_number;
i_cops_format = PARAM2(p_cur_req).it_number;
lxz_dstring_get(PARAM3(p_cur_req).pt_str, p_cops_oper, sizeof(p_cops_oper));
i_cops_rat = PARAM4(p_cur_req).it_number;
sprintf(p_req_buf, "AT+COPS=%d,%d,\"%s\",%d", i_cops_mode, i_cops_format, p_cops_oper, i_cops_rat);
i_op_status = (sint32)at_send_command_multiline(p_req_buf, "+COPS: ", &p_outResponse);
if(i_op_status < 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error\r\n", p_req_buf);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else if( p_outResponse->success == 0)
{
OS_DBG_LOG(("lxzat:lxzat_plus_cops_req:%s error:%s\r\n", p_req_buf, p_outResponse->finalResponse);
at_response_free(p_outResponse);
e_err_code = E_LEC_ERR_UNKNOWN;
}
else
{
at_response_free(p_outResponse);
}
break;
}
default:
{
e_err_code = E_LEC_ERR_P_NB_PARAM;
break;
}
}
#endif /* LXZAT_EASYRIL_API */
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i_creg_status = 0;
i_creg_status = lxzat_creg_f_getstatus(p_cur_spcfg->i_vsp_id);
if (1 == i_creg_status)
{
p_resp_cops = ((lxzat_resp_cops_t *)(p_lxzat_ctxt->pt_rsp_data));
p_resp_cops->i_nb_infos = 4;
p_resp_cops->i_cur_mode = 0;
p_resp_cops->i_cur_format = 2;
sprintf(p_resp_cops->u_cur_oper, "%s", "46011");
p_resp_cops->i_cur_rat= 7;
}
else
{
p_resp_cops = ((lxzat_resp_cops_t *)(p_lxzat_ctxt->pt_rsp_data));
p_resp_cops->i_nb_infos = 1;
p_resp_cops->i_cur_mode = 0;
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+COPS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cops_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_resp_cops_t * p_resp_cops = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cops_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cops_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
break;
}
case LXZAT_REQ_TYPE_READ:
{
p_resp_cops = ((lxzat_resp_cops_t *)(p_lxzat_ctxt->pt_rsp_data));
if ((p_resp_cops->i_nb_infos == 1) || (p_resp_cops->i_nb_infos == 4))
{
if (p_resp_cops->i_nb_infos == 4)
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,%d,\"%s\",%d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
p_resp_cops->i_cur_mode,
p_resp_cops->i_cur_format,
p_resp_cops->u_cur_oper,
p_resp_cops->i_cur_rat);
}
else
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
p_resp_cops->i_cur_mode);
}
}
else
{
e_err_code = E_LEC_OK;
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %s,%s,%s,%s,%s",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"(1,\"CTCC\",\"CT\",\"46011\",7)",
"(2,\"CMCC\",\"CM\",\"46000\",7)",
"(3,\"CUCC\",\"CU\",\"46001\",7)",
"(0,1,2,3,4)",
"(0,1,2)");
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+COPS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cops_reset(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_resp_cops_t * p_resp_cops = NULL;
if (p_lxzat_ctxt != NULL)
{
p_resp_cops = ((lxzat_resp_cops_t *)(p_lxzat_ctxt->pt_rsp_data));
if (p_resp_cops != NULL)
{
free(p_resp_cops);
p_resp_cops = NULL;
e_err_code = E_LEC_OK;
}
}
return e_err_code;
}
/*
* Description:
* The initialize handler of "AT+CGDCONT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgdcont_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGDCONT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgdcont_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
sint32 i_id_pdpctxt = 0;
sint32 i_apn_len = 0;
lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if(p_cur_nvcfg == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,p_cur_spcfg->pt_nv_cfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if (p_cur_req->it_nb_param < 3)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,param2 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,param3 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_id_pdpctxt = PARAM1(p_cur_req).it_number;
if ((i_id_pdpctxt < LXZAT_MIN_CID_ALLOWED) || (i_id_pdpctxt > LXZAT_MAX_CID_ALLOWED))
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,param1 error!\r\n"));
return E_LEC_ERR_P_LENGTH;
}
if ( (0 != strcasecmp(PARAM2(p_cur_req).pt_str->pt_string, "IP"))
&& (0 != strcasecmp(PARAM2(p_cur_req).pt_str->pt_string, "IPv4"))
&& (0 != strcasecmp(PARAM2(p_cur_req).pt_str->pt_string, "IPv6"))
&& (0 != strcasecmp(PARAM2(p_cur_req).pt_str->pt_string, "IPv4v6")))
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,param2 error!\r\n"));
return E_LEC_ERR_P_RANGE;
}
i_apn_len = PARAM3(p_cur_req).pt_str->it_length;
if (i_apn_len > LXZAT_MAX_LEN_APN)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_req,param3 error!\r\n"));
return E_LEC_ERR_P_LENGTH;
}
p_cur_pdpcfg = lxzat_pdpcfg_f_get(i_id_pdpctxt);
sprintf(p_cur_pdpcfg->ut_net_iptype, "%s", PARAM2(p_cur_req).pt_str->pt_string);
sprintf(p_cur_pdpcfg->ut_net_apn, "%s", PARAM3(p_cur_req).pt_str->pt_string);
break;
}
case LXZAT_REQ_TYPE_READ:
{
break;
}
case LXZAT_REQ_TYPE_TEST:
{
break;
}
default:
{
e_err_code = E_LEC_OK;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CGDCONT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgdcont_resp(void * pctxt)
{
sint32 i_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgdcont_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgdcont_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i = 0;
lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
while (i < LXZAT_MAX_CID_ALLOWED)
{
p_cur_pdpcfg = lxzat_pdpcfg_f_get(i);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,\"%s\",\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i,
p_cur_pdpcfg->ut_net_iptype,
p_cur_pdpcfg->ut_net_apn);
i = i + 1;
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (1-11),\"%s\",\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"IP",
"APN");
break;
}
default:
{
i_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return i_err_code;
}
/*
* Description:
* The reset handler of "AT+CGDCONT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgdcont_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CGPCO".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpco_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGPCO".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpco_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
sint32 i_str_type = 0;
sint32 i_user_len = 0;
sint32 i_pwd_len = 0;
sint32 i_id_pdpctxt = 0;
sint32 i_auth_type = 0;
lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if(p_cur_nvcfg == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,p_cur_spcfg->pt_nv_cfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if (p_cur_req->it_nb_param != 5)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param2 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param3 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param4 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM5_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param5 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_str_type = PARAM1(p_cur_req).it_number;
if (i_str_type != 0)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param1 error!\r\n"));
return E_LEC_ERR_P_RANGE;
}
i_user_len = PARAM2(p_cur_req).pt_str->it_length;
if (i_user_len > LXZAT_MAX_LEN_USR)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param2 error!\r\n"));
return E_LEC_ERR_P_RANGE;
}
i_pwd_len = PARAM3(p_cur_req).pt_str->it_length;
if (i_pwd_len > LXZAT_MAX_LEN_PWD)
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param3 error!\r\n"));
return E_LEC_ERR_P_LENGTH;
}
i_id_pdpctxt = PARAM4(p_cur_req).it_number;
if ((i_id_pdpctxt < LXZAT_MIN_CID_ALLOWED) || (i_id_pdpctxt > LXZAT_MAX_CID_ALLOWED))
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param4 error!\r\n"));
return E_LEC_ERR_P_LENGTH;
}
i_auth_type= PARAM5(p_cur_req).it_number;
if ((i_auth_type < 0) || (i_auth_type > 3))
{
OS_DBG_LOG(("lxzat_plus_cgpco_req,param5 error!\r\n"));
return E_LEC_ERR_P_RANGE;
}
p_cur_pdpcfg = lxzat_pdpcfg_f_get(i_id_pdpctxt);
/* p_cur_pdpcfg->it_str_type = i_str_type; */
p_cur_pdpcfg->it_auth_type = i_auth_type;
sprintf(p_cur_pdpcfg->ut_user_name, "%s", PARAM2(p_cur_req).pt_str->pt_string);
sprintf(p_cur_pdpcfg->ut_pass_word, "%s", PARAM3(p_cur_req).pt_str->pt_string);
p_cur_pdpcfg->it_auth_type = i_auth_type;
break;
}
case LXZAT_REQ_TYPE_READ:
{
break;
}
case LXZAT_REQ_TYPE_TEST:
{
break;
}
default:
{
e_err_code = E_LEC_OK;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CGPCO".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpco_resp(void * pctxt)
{
sint32 i_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgpco_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgpco_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i = 0;
lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
while (i < LXZAT_MAX_CID_ALLOWED)
{
p_cur_pdpcfg = lxzat_pdpcfg_f_get(i);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,\"%s\",\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i,
p_cur_pdpcfg->ut_user_name,
p_cur_pdpcfg->ut_pass_word,
p_cur_pdpcfg->it_auth_type);
i = i + 1;
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (0-1),\"%s\",\"%s\",(1-11),(0-3)",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
"USERNAME",
"PASSWORD");
break;
}
default:
{
i_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return i_err_code;
}
/*
* Description:
* The reset handler of "AT+CGPCO".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpco_reset(void * pctxt)
{
sint32 i_err_code = E_LEC_OK;
return i_err_code;
}
/*
* Description:
* The initialize handler of "AT+CGACT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgact_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGACT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgact_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
sint32 i_str_type = 0;
sint32 i_user_len = 0;
sint32 i_pwd_len = 0;
sint32 i_id_pdpctxt = 0;
sint32 i_auth_type = 0;
lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
/*lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;*/
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgact_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgact_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if(p_cur_nvcfg == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgact_req,p_cur_spcfg->pt_nv_cfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
sint32 i_id_pdpctxt = 0;
sint32 i_flag_active = 0;
sint32 i_creg_status = 0;
sint32 i_cur_pdpstatus = 0;
if (p_cur_req->it_nb_param != 2)
{
OS_DBG_LOG(("lxzat_plus_cgact_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgact_req,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgact_req,param2 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_flag_active = PARAM1(p_cur_req).it_number;
if ((i_flag_active != 0) && (i_flag_active != 1))
{
OS_DBG_LOG(("lxzat_plus_cgact_req,PARAM1 is error: %d\r\n",i_flag_active));
return E_LEC_ERR_P_RANGE;
}
i_id_pdpctxt = PARAM2(p_cur_req).it_number;
if(i_id_pdpctxt > LXZAT_MAX_CID_ALLOWED )
{
OS_DBG_LOG(("lxzat_plus_cgact_req,i_id_pdpctxt=%d!\r\n", i_id_pdpctxt));
return E_LEC_ERR_P_TOO_BIG;
}
if(0 == i_flag_active)
{
lxzat_pdpinfo_f_getstatus(i_id_pdpctxt, &i_cur_pdpstatus);
if (E_PDP_STATUS_ACTIVATED == i_cur_pdpstatus)
{
lxzat_pdpinfo_f_deactive(p_cur_spcfg->i_vsp_id, i_id_pdpctxt);
}
}
else
{
i_creg_status = lxzat_creg_f_getstatus(p_cur_spcfg->i_vsp_id);
if(i_creg_status == 0)
{
return E_LEC_SGCC_PDP_ACTIVE_REJECT;
}
lxzat_pdpinfo_f_getstatus(i_id_pdpctxt, &i_cur_pdpstatus);
if (E_PDP_STATUS_ACTIVATING == i_cur_pdpstatus)
{
return E_LEC_SGCC_PDP_ACTIVE_REJECT;
}
if (E_PDP_STATUS_ACTIVATED == i_cur_pdpstatus)
{
return E_LEC_SGCC_PDP_ACTIVED;
}
lxzat_pdpinfo_f_active(p_cur_spcfg->i_vsp_id, i_id_pdpctxt);
}
break;
}
case LXZAT_REQ_TYPE_READ:
{
break;
}
case LXZAT_REQ_TYPE_TEST:
{
break;
}
default:
{
e_err_code = E_LEC_OK;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CGACT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgact_resp(void * pctxt)
{
sint32 i_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgact_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgact_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i = 0;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
while (i < LXZAT_MAX_CID_ALLOWED)
{
p_cur_pdpinfo = lxzat_pdpinfo_f_get(i);
if (E_PDP_STATUS_ACTIVATED == p_cur_pdpinfo->it_pdp_state)
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,1",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i);
}
i = i + 1;
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: <IsActive>,<CID>",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
i_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return i_err_code;
}
/*
* Description:
* The reset handler of "AT+CGACT".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgact_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CGPADDR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpaddr_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CGPADDR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpaddr_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The response handler of "AT+CGPADDR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpaddr_resp(void * pctxt)
{
sint32 i_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cgpaddr_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cgpaddr_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
sint32 i_id_pdpctxt = 0;
if (p_cur_req->it_nb_param != 1)
{
OS_DBG_LOG(("lxzat_plus_cgpaddr_resp,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cgpaddr_resp,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_id_pdpctxt = PARAM1(p_cur_req).it_number;
if(i_id_pdpctxt > LXZAT_MAX_CID_ALLOWED )
{
OS_DBG_LOG(("lxzat_plus_cgpaddr_resp,i_id_pdpctxt=%d!\r\n", i_id_pdpctxt));
return E_LEC_ERR_P_TOO_BIG;
}
p_cur_pdpinfo = lxzat_pdpinfo_f_get(i_id_pdpctxt);
if (E_PDP_STATUS_ACTIVATED == p_cur_pdpinfo->it_pdp_state)
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i_id_pdpctxt,
p_cur_pdpinfo->pt_ip_host);
}
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i = 0;
while (i < LXZAT_MAX_CID_ALLOWED)
{
p_cur_pdpinfo = lxzat_pdpinfo_f_get(i);
if (E_PDP_STATUS_ACTIVATED == p_cur_pdpinfo->it_pdp_state)
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d,\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i,
p_cur_pdpinfo->pt_ip_host);
}
i = i + 1;
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: <CID>",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
i_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return i_err_code;
}
/*
* Description:
* The reset handler of "AT+CGPADDR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cgpaddr_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The reset handler of "AT+CNUM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cnum_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CNUM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cnum_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzdata_info_t * p_cur_datacfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cnum_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cnum_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
{
e_err_code = E_LEC_OK;
break;
}
case LXZAT_REQ_TYPE_SET:
{
sint32 i_len_phonenumber = 0;
char p_buf_phonenumber[31];
if (p_cur_req->it_nb_param != 1)
{
OS_DBG_LOG(("lxzat_plus_cnum_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_cnum_req,PARAM1_TYPE error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_len_phonenumber = PARAM1(p_cur_req).pt_str->it_length;
if((i_len_phonenumber <= 0) || (i_len_phonenumber > 31))
{
OS_DBG_LOG(("lxzat_plus_cnum_req,i_len_phonenumber=%d!\r\n", i_len_phonenumber));
return E_LEC_ERR_P_RANGE;
}
memset(p_buf_phonenumber, 0, sizeof(p_buf_phonenumber));
lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_buf_phonenumber, sizeof(p_buf_phonenumber));
strcpy(gp_buf_phonenumber, p_buf_phonenumber);
break;
}
case LXZAT_REQ_TYPE_READ:
{
e_err_code = E_LEC_OK;
break;
}
case LXZAT_REQ_TYPE_TEST:
{
e_err_code = E_LEC_OK;
break;
}
default:
{
e_err_code = E_LEC_ERR_UNKNOWN;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CNUM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cnum_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzdata_info_t * p_cur_datacfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cnum_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cnum_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
e_err_code = E_LEC_OK;
break;
}
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
sint32 i_len_phonenumber = 0;
e_err_code = E_LEC_OK;
i_len_phonenumber = strlen(gp_buf_phonenumber);
if (i_len_phonenumber > 0)
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
gp_buf_phonenumber);
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
e_err_code = E_LEC_OK;
break;
}
default:
{
e_err_code = E_LEC_ERR_UNKNOWN;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CNUM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cnum_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CFUN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cfun_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CFUN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cfun_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cfun_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cfun_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if (p_cur_nvcfg == NULL)
{
OS_DBG_LOG(("lxzat_plus_cfun_req,p_cur_nvcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
sint32 i_cfun_mode = 0;
sint32 i_flag_reboot = 0;
switch(p_cur_req->it_nb_param)
{
case 1:
{
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cfun_req,param1 type error!r\n"));
return E_LEC_ERR_P_TYPE;
}
i_cfun_mode = PARAM1(p_cur_req).it_number;
if ( (i_cfun_mode != 0)
&&(i_cfun_mode != 1)
&&(i_cfun_mode != 4))
{
OS_DBG_LOG(("lxzat_plus_cfun_req,i_cfun_mode=%d\r\n",i_cfun_mode));
return E_LEC_ERR_P_TYPE;
}
if (i_cfun_mode == p_cur_nvcfg->i_cfun_reg)
{
OS_DBG_LOG(("lxzat_plus_cfun_req,no-difference!r\n"));
return E_LEC_OK;
}
p_cur_nvcfg->i_cfun_reg = i_cfun_mode;
switch (i_cfun_mode)
{
case 0:
{
sint32 i = 0;
while (i < (LXZAT_MAX_CID_PDP_CTXT + 1))
{
lxzat_pdpinfo_f_reset(i);
i = i + 1;
}
lxzat_creg_f_setstatus(p_cur_spcfg->i_vsp_id, LXZAT_FALSE);
lxzat_cpin_f_setstatus(p_cur_spcfg->i_vsp_id, LXZAT_FALSE);
break;
}
case 1:
{
lxzat_ticks_cpintime_update(p_cur_spcfg->i_vsp_id);
lxzat_ticks_cregtime_update(p_cur_spcfg->i_vsp_id);
lxzat_ticks_marktime_update(p_cur_spcfg->i_vsp_id);
lxzat_task_cpinstatus_newtask(p_cur_spcfg->i_vsp_id);
lxzat_task_cregstatus_newtask(p_cur_spcfg->i_vsp_id);
break;
}
case 4:
{
sint32 i = 0;
while (i < (LXZAT_MAX_CID_PDP_CTXT + 1))
{
lxzat_pdpinfo_f_reset(i);
i = i + 1;
}
lxzat_creg_f_setstatus(p_cur_spcfg->i_vsp_id, LXZAT_FALSE);
break;
}
default:
{
break;
}
}
break;
}
case 2:
{
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cfun_req,param1 type error!r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_cfun_req,param2 type error!r\n"));
return E_LEC_ERR_P_TYPE;
}
i_flag_reboot = PARAM2(p_cur_req).it_number;
if (i_flag_reboot == 1)
{
latos_reboot(p_cur_spcfg->i_vsp_id);
}
i_cfun_mode = PARAM1(p_cur_req).it_number;
p_cur_nvcfg->i_cfun_reg = i_cfun_mode;
break;
}
default:
{
OS_DBG_LOG(("lxzat_plus_cfun_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
}
break;
}
case LXZAT_REQ_TYPE_READ:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
p_cur_nvcfg->i_cfun_reg);
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (0,1,4),(0,1)",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CFUN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cfun_resp(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The reset handler of "AT+CFUN".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cfun_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CCID".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ccid_init(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_resp_ccid_t * p_resp_ccid = NULL;
if (p_lxzat_ctxt != NULL)
{
p_resp_ccid = (lxzat_resp_ccid_t *)malloc(sizeof(lxzat_resp_ccid_t));
if (p_resp_ccid != NULL)
{
memset(p_resp_ccid, 0, sizeof(lxzat_resp_ccid_t));
p_lxzat_ctxt->pt_rsp_data = p_resp_ccid;
e_err_code = E_LEC_OK;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "AT+CCID".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ccid_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_resp_ccid_t * p_resp_ccid = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_ccid_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_ccid_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
#ifdef LXZAT_EASYRIL_API
uint08 u_data_buf[50] = {0};
sint32 i_op_status = 0;
ATResponse *p_outResponse = NULL;
int ret = 0;
char * line, * out;
ATLine * p_cur_atline = NULL;
ATLine * p_nxt_atline = NULL;
sint32 i = 0;
sint32 i_nb_item = 0;
/* Step1: Send "AT^ICCID?" to C-core */
i_op_status = (sint32)at_send_command_multiline("AT^ICCID?", "^ICCID: ", &p_outResponse);
if(i_op_status < 0)
{
OS_DBG_LOG(("lxzat:lxzat_dollar_myccid_req:AT^ICCID? error\r\n"));
at_response_free(p_outResponse);
return E_LEC_OK;
}
else if( p_outResponse->success == 0)
{
OS_DBG_LOG(("lxzat:lxzat_dollar_myccid_req:AT^ICCID? error:%s\r\n", p_outResponse->finalResponse);
at_response_free(p_outResponse);
return E_LEC_OK;
}
else
{
p_cur_atline = p_outResponse->p_intermediates;
if (p_cur_atline == NULL)
{
at_response_free(p_outResponse);
return E_LEC_OK;
}
p_nxt_atline = p_cur_atline->p_next;
if (p_nxt_atline != NULL)
{
at_response_free(p_outResponse);
return E_LEC_OK;
}
line = p_cur_atline->line;
ret = at_tok_start(&line);
if (ret < 0)
{
at_response_free(p_outResponse);
return E_LEC_OK;
}
ret = at_tok_nextstr(&line, &out);
if (ret < 0)
{
at_response_free(p_outResponse);
return E_LEC_OK;
}
at_response_free(p_outResponse);
}
/* step2: find and match, get iccid */
p_resp_ccid = ((lxzat_resp_ccid_t *)(p_lxzat_ctxt->pt_rsp_data));
sprintf(p_resp_ccid->u_iccid_buf, "%s", out);
#else /* LXZAT_EASYRIL_API */
p_resp_ccid = ((lxzat_resp_ccid_t *)(p_lxzat_ctxt->pt_rsp_data));
sprintf(p_resp_ccid->u_iccid_buf, "%s", "89860120818621721170");
#endif /* LXZAT_EASYRIL_API */
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CCID".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ccid_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_resp_ccid_t * p_resp_ccid = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_ccid_resp,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_ccid_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
p_resp_ccid = ((lxzat_resp_ccid_t *)(p_lxzat_ctxt->pt_rsp_data));
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
p_resp_ccid->u_iccid_buf);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CCID".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ccid_reset(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_resp_ccid_t * p_resp_ccid = NULL;
if (p_lxzat_ctxt != NULL)
{
p_resp_ccid = ((lxzat_resp_ccid_t *)(p_lxzat_ctxt->pt_rsp_data));
if (p_resp_ccid != NULL)
{
free(p_resp_ccid);
p_resp_ccid = NULL;
e_err_code = E_LEC_OK;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATI".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_i_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzdata_info_t * p_cur_datacfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_null_i_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_null_i_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id, LXZAT_RSP_MODE_P1N0, "%s: %s", "Manufacturer", "CYCT");
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id, LXZAT_RSP_MODE_P1N0, "%s: %s", "Model", LXZAT_MDM_MODEL);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id, LXZAT_RSP_MODE_P1N0, "%s: %s", "Revision", LXZAT_MDM_REVISION);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id, LXZAT_RSP_MODE_P1N0, "%s: %s", "+IMEI", "6630118621721170");
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id, LXZAT_RSP_MODE_P1N0, "%s: %s", "+GCAP", "+CGSM,+DS,+ES");
break;
}
default:
{
e_err_code = E_LEC_ERR_UNKNOWN;
break;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATO".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_o_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_NOK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
if (p_lxzat_ctxt != NULL)
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if (p_cur_spcfg != NULL)
{
e_err_code = E_LEC_OK;
if (0 != p_cur_spcfg->u_ppp_mfd)
{
p_cur_spcfg->i_echo_auxiliary = LXZAT_FALSE;
lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
E_LSMA_PPP, 0, 0);
e_err_code = E_LEC_OK_CONNECT;
}
else
{
if (p_cur_spcfg->pt_di_cfg != NULL)
{
p_cur_spcfg->i_echo_auxiliary = LXZAT_FALSE;
lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
E_LSMA_FIXED_3PLUS, 0, 0);
e_err_code = E_LEC_OK_CONNECT;
}
}
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "AT&F0".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_and_f0_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT&W".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_and_w_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT&Z".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_and_z_req(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "ATE0".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_e0_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
if (p_lxzat_ctxt != NULL)
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_e_reg = LXZAT_FALSE;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATE1".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_e1_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
if (p_lxzat_ctxt != NULL)
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_e_reg = LXZAT_TRUE;
p_cur_spcfg->i_echo_auxiliary = LXZAT_TRUE;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATS1".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_s1_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK_NOTHING;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_null_s1_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_null_s1_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_s1_reg = PARAM1(p_cur_req).it_number;
}
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATS2".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_s2_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK_NOTHING;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_null_s2_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_null_s2_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_s2_reg = PARAM1(p_cur_req).it_number;
}
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATS3".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_s3_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK_NOTHING;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_null_s3_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_null_s3_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_s3_reg = PARAM1(p_cur_req).it_number;
p_cur_spcfg->u_end_char1 = p_cur_nvcfg->i_s3_reg;
}
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATS4".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_s4_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK_NOTHING;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_null_s4_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_null_s4_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_s4_reg = PARAM1(p_cur_req).it_number;
p_cur_spcfg->u_end_char2 = p_cur_nvcfg->i_s4_reg;
}
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATS5".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_s5_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK_NOTHING;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_null_s5_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_null_s5_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_s5_reg = PARAM1(p_cur_req).it_number;
}
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATV0".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_v0_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
if (p_lxzat_ctxt != NULL)
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_v_reg = 0;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATV1".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_v1_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
if (p_lxzat_ctxt != NULL)
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_v_reg = 1;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "ATE0V1".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_null_e0v1_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
if (p_lxzat_ctxt != NULL)
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_e_reg = LXZAT_FALSE;
p_cur_nvcfg->i_v_reg = LXZAT_TRUE;
}
}
return e_err_code;
}
/*
* Description:
* The request handler of "AT+CMEE".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cmee_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cmee_req,p_lxzat_ctxt is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cmee_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
p_cur_nvcfg->i_cmee_reg = PARAM1(p_cur_req).it_number;
}
break;
}
case LXZAT_REQ_TYPE_READ:
{
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_spcfg != NULL) && (p_cur_spcfg->pt_nv_cfg != NULL))
{
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
p_cur_nvcfg->i_cmee_reg);
}
break;
}
default:
{
e_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return e_err_code;
}
/*
* Description:
* The initialize handler of "AT+IPR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ipr_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+IPR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ipr_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
sint32 i_new_baudrate = 0;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_ipr_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_ipr_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if(p_cur_nvcfg == NULL)
{
OS_DBG_LOG(("lxzat_plus_ipr_req,p_cur_spcfg->pt_nv_cfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
if (p_cur_req->it_nb_param != 1)
{
OS_DBG_LOG(("lxzat_plus_ipr_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_ipr_req,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_new_baudrate = PARAM1(p_cur_req).it_number;
if ( (i_new_baudrate == 0)
||(i_new_baudrate == 9600)
||(i_new_baudrate == 19200)
||(i_new_baudrate == 38400)
||(i_new_baudrate == 57600)
||(i_new_baudrate == 115200))
{
#if 0
if (access("/data/myconfig/", F_OK) < 0)
{
system("busybox mkdir -p /data/myconfig/");
system("touch /data/myconfig/lstbaudrate.cfg-ipr");
}
if(i_new_baudrate == 0)
{
system("echo 0 > /data/myconfig/lstbaudrate.cfg-ipr");
e_err_code = E_LEC_OK;
}
#endif
}
break;
}
case LXZAT_REQ_TYPE_READ:
{
break;
}
case LXZAT_REQ_TYPE_TEST:
{
break;
}
default:
{
e_err_code = E_LEC_OK;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+IPR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ipr_resp(void * pctxt)
{
sint32 i_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_ipr_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_ipr_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
break;
}
case LXZAT_REQ_TYPE_READ:
{
sint32 i_cur_baudrate = lxzat_spcomm_baudrate_f_get(p_lxzat_ctxt->it_vsp_id);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: %d",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
i_cur_baudrate);
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (0,9600,19200,38400,57600,115200)",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
i_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return i_err_code;
}
/*
* Description:
* The reset handler of "AT+IPR".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_ipr_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The initialize handler of "AT+CRSM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_crsm_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CRSM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_crsm_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
sint32 i_new_baudrate = 0;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_crsm_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if(p_cur_nvcfg == NULL)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,p_cur_spcfg->pt_nv_cfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
sint32 i_crsm_cmd = 0;
sint32 i_crsm_fileid = 0;
sint32 i_crsm_p1 = 0;
sint32 i_crsm_p2 = 0;
sint32 i_crsm_p3 = 0;
sint08 * p_crsm_data = NULL;
sint08 * p_crsm_pathid = NULL;
FILE * p_fd_fileid = NULL;
sint32 i_len_read = 0;
char ll_buf_fname[128];
char ll_buf_read[1024];
switch (p_cur_req->it_nb_param)
{
case 1:
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
e_err_code = E_LEC_ERR_P_NB_PARAM;
break;
case 5:
OS_DBG_LOG(("lxzat_plus_crsm_req,i_nb_param:%d\r\n",p_cur_req->it_nb_param));
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param2 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param3 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param4 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM5_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param5 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_crsm_cmd = PARAM1(p_cur_req).it_number;
if ( (i_crsm_cmd != 176)
&&(i_crsm_cmd != 178)
&&(i_crsm_cmd != 192)
&&(i_crsm_cmd != 214)
&&(i_crsm_cmd != 220)
&&(i_crsm_cmd != 242))
{
OS_DBG_LOG(("lxzat_plus_crsm_req,i_crsm_cmd:%d\r\n",i_crsm_cmd));
return E_LEC_ERR_P_RANGE;
}
i_crsm_fileid = PARAM2(p_cur_req).it_number;
if ((i_crsm_fileid < 0) || (i_crsm_fileid > 0xFFFF))
{
OS_DBG_LOG(("lxzat_plus_crsm_req,i_crsm_fileid:%d\r\n",i_crsm_fileid));
return E_LEC_ERR_P_RANGE;
}
i_crsm_p1 = PARAM3(p_cur_req).it_number;
i_crsm_p2 = PARAM4(p_cur_req).it_number;
i_crsm_p3 = PARAM5(p_cur_req).it_number;
sprintf(ll_buf_fname, "%s/%d-%X.txt", LXZAT_VSIM1_ROOT_DIRECTORY, i_crsm_fileid, i_crsm_fileid);
OS_DBG_LOG(("lxzat_plus_crsm_req,fileid:%s\r\n",ll_buf_fname));
p_fd_fileid = fopen(ll_buf_fname, "rb");
if(p_fd_fileid == NULL)
{
memset(ll_buf_read, 0, sizeof(ll_buf_read));
strcpy(ll_buf_read, "008618621721170");
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: 144,0,\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
ll_buf_read);
return E_LEC_OK;
}
memset(ll_buf_read, 0, sizeof(ll_buf_read));
i_len_read = fread(ll_buf_read, 1, sizeof(ll_buf_read), p_fd_fileid);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: 144,0,\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
ll_buf_read);
fclose(p_fd_fileid);
break;
case 7:
OS_DBG_LOG(("lxzat_plus_crsm_req,i_nb_param:%d\r\n",p_cur_req->it_nb_param));
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param1 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param2 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM3_TYPE(p_cur_req) == LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param3 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM4_TYPE(p_cur_req) == LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param4 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM5_TYPE(p_cur_req) == LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param5 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM6_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_DEFAULT)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param6 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
if (PARAM7_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_crsm_req,param7 type error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_crsm_cmd = PARAM1(p_cur_req).it_number;
if ( (i_crsm_cmd != 176)
&&(i_crsm_cmd != 178)
&&(i_crsm_cmd != 192)
&&(i_crsm_cmd != 214)
&&(i_crsm_cmd != 220)
&&(i_crsm_cmd != 242))
{
OS_DBG_LOG(("lxzat_plus_crsm_req,i_crsm_cmd:%d\r\n",i_crsm_cmd));
return E_LEC_ERR_P_RANGE;
}
i_crsm_fileid = PARAM2(p_cur_req).it_number;
if ((i_crsm_fileid < 0) || (i_crsm_fileid > 0xFFFF))
{
OS_DBG_LOG(("lxzat_plus_crsm_req,i_crsm_fileid:%d\r\n",i_crsm_fileid));
return E_LEC_ERR_P_RANGE;
}
sprintf(ll_buf_fname, "%s/%d-%X.txt", LXZAT_VSIM1_ROOT_DIRECTORY, i_crsm_fileid, i_crsm_fileid);
OS_DBG_LOG(("lxzat_plus_crsm_req,fileid:%s\r\n",ll_buf_fname));
p_fd_fileid = fopen(ll_buf_fname, "rb");
if(p_fd_fileid == NULL)
{
memset(ll_buf_read, 0, sizeof(ll_buf_read));
strcpy(ll_buf_read, "008618621721170");
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: 144,0,\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
ll_buf_read);
return E_LEC_OK;
}
memset(ll_buf_read, 0, sizeof(ll_buf_read));
i_len_read = fread(ll_buf_read, 1, sizeof(ll_buf_read), p_fd_fileid);
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: 144,0,\"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
ll_buf_read);
fclose(p_fd_fileid);
break;
default:
OS_DBG_LOG(("lxzat_plus_crsm_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
break;
}
break;
}
case LXZAT_REQ_TYPE_READ:
{
break;
}
case LXZAT_REQ_TYPE_TEST:
{
break;
}
default:
{
e_err_code = E_LEC_OK;
break;
}
}
return e_err_code;
}
/*
* Description:
* The response handler of "AT+CRSM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_crsm_resp(void * pctxt)
{
sint32 i_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_crsm_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_crsm_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
break;
}
case LXZAT_REQ_TYPE_READ:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"crsm.cyctester.org\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: <command>[,<fileid>[,<p1>,<p2>,<p3>[,<data>[,<pathid>]]]]",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
i_err_code = E_LEC_ERR_UNSUPPORTED;
break;
}
}
return i_err_code;
}
/*
* Description:
* The reset handler of "AT+CRSM".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_crsm_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The reset handler of "AT+CSCS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cscs_init(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* The request handler of "AT+CSCS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cscs_req(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzdata_info_t * p_cur_datacfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cscs_req,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cscs_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_EXE:
{
e_err_code = E_LEC_OK;
break;
}
case LXZAT_REQ_TYPE_SET:
{
sint32 i_len_cscs = 0;
char p_buf_cscs[7];
if (p_cur_req->it_nb_param != 1)
{
OS_DBG_LOG(("lxzat_plus_cscs_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
return E_LEC_ERR_P_NB_PARAM;
}
if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
{
OS_DBG_LOG(("lxzat_plus_cscs_req,PARAM1_TYPE error!\r\n"));
return E_LEC_ERR_P_TYPE;
}
i_len_cscs = PARAM1(p_cur_req).pt_str->it_length;
if((i_len_cscs <= 0) || (i_len_cscs > 31))
{
OS_DBG_LOG(("lxzat_plus_cscs_req,i_len_cscs=%d!\r\n", i_len_cscs));
return E_LEC_ERR_P_RANGE;
}
memset(p_buf_cscs, 0, sizeof(p_buf_cscs));
lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_buf_cscs, sizeof(p_buf_cscs));
strcpy(gp_buf_cscs, p_buf_cscs);
break;
}
case LXZAT_REQ_TYPE_READ:
{
e_err_code = E_LEC_OK;
break;
}
case LXZAT_REQ_TYPE_TEST:
{
e_err_code = E_LEC_OK;
break;
}
default:
{
e_err_code = E_LEC_ERR_UNKNOWN;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CSCS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cscs_resp(void * pctxt)
{
LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
lxzat_req_t * p_cur_req = NULL;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzdata_info_t * p_cur_datacfg = NULL;
lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
if (p_lxzat_ctxt == NULL)
{
OS_DBG_LOG(("lxzat_plus_cnum_resp,p_lxzat_ctxt is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_req = p_lxzat_ctxt->pt_req_data;
p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
{
OS_DBG_LOG(("lxzat_plus_cnum_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_req_type = p_cur_req->it_req_type;
switch (i_req_type)
{
case LXZAT_REQ_TYPE_SET:
{
e_err_code = E_LEC_OK;
break;
}
case LXZAT_REQ_TYPE_EXE:
case LXZAT_REQ_TYPE_READ:
{
sint32 i_len_cscs = 0;
e_err_code = E_LEC_OK;
i_len_cscs = strlen(gp_buf_cscs);
if (i_len_cscs > 0)
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: \"%s\"",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
gp_buf_cscs);
}
break;
}
case LXZAT_REQ_TYPE_TEST:
{
lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
LXZAT_RSP_MODE_P1N0,
"%s: (\"GSM\",\"IRA\",\"UCS2\")",
p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
break;
}
default:
{
e_err_code = E_LEC_ERR_UNKNOWN;
break;
}
}
return e_err_code;
}
/*
* Description:
* The reset handler of "AT+CSCS".
* Param: pctxt, the pointer of AT command context;
* Return: Operating results;
* Note: NONE
*/
static sint32 lxzat_plus_cscs_reset(void * pctxt)
{
return E_LEC_OK;
}
/*
* Description:
* Get registration status.
* Param: i_vsp_id, the ID of serial-port;
* Return: the status of registration.
*/
sint32 lxzat_creg_f_getstatus(sint32 i_vsp_id)
{
sint32 i_creg_status = 0;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_vsp_id);
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if ((p_cur_spcfg == NULL) || (p_cur_nvcfg == NULL))
{
OS_DBG_LOG(("lxzat_creg_f_getstatus,p_cur_spcfg or p_cur_nvcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_creg_status = p_cur_nvcfg->i_creg_status;
return i_creg_status;
}
/*
* Description:
* Update registration status.
* Param: i_vsp_id, the ID of serial-port;
* Param: i_creg_newstatus, the new-status of registration;
* Return: the status of registration.
*/
sint32 lxzat_creg_f_setstatus(sint32 i_vsp_id, sint32 i_creg_newstatus)
{
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_vsp_id);
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if ((p_cur_spcfg == NULL) || (p_cur_nvcfg == NULL))
{
OS_DBG_LOG(("lxzat_creg_f_setstatus,p_cur_spcfg or p_cur_nvcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg->i_creg_status = i_creg_newstatus;
return i_creg_newstatus;
}
/*
* Description:
* Get SIM card status.
* Param: i_vsp_id, the ID of serial-port;
* Return: the status of SIM-Card.
*/
sint32 lxzat_cpin_f_getstatus(sint32 i_vsp_id)
{
sint32 i_cpin_status = 0;
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_vsp_id);
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if ((p_cur_spcfg == NULL) || (p_cur_nvcfg == NULL))
{
OS_DBG_LOG(("lxzat_cpin_f_getstatus,p_cur_spcfg or p_cur_nvcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
i_cpin_status = p_cur_nvcfg->i_cpin_status;
return i_cpin_status;
}
/*
* Description:
* Update SIM card status.
* Param: i_vsp_id, the ID of serial-port;
* Param: i_cpin_newstatus, the new-status of SIM-Card;
* Return: the status of SIM-Card.
*/
sint32 lxzat_cpin_f_setstatus(sint32 i_vsp_id, sint32 i_cpin_newstatus)
{
lxzat_spcfg_t * p_cur_spcfg = NULL;
lxzat_nvcfg_t * p_cur_nvcfg = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_vsp_id);
p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
if ((p_cur_spcfg == NULL) || (p_cur_nvcfg == NULL))
{
OS_DBG_LOG(("lxzat_cpin_f_getstatus,p_cur_spcfg or p_cur_nvcfg is NULL\r\n"));
return E_LEC_ERR_UNKNOWN;
}
p_cur_nvcfg->i_cpin_status = i_cpin_newstatus;
return i_cpin_newstatus;
}
/*
* Description:
* Get the context of pdp-configuration.
* Param: i_id_vspctxt, the ID of serial-port;
* Return: the context of pdp-configuration.
*/
lxzat_pdpcfg_t* lxzat_pdpcfg_f_get(sint32 i_id_pdpctxt)
{
lxzat_pdpcfg_t* p_cur_pdpcfg = NULL;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_pdpcfg_f_get,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return NULL;
}
p_cur_pdpcfg = &(gs_pdpcfg_table[i_id_pdpctxt]);
return p_cur_pdpcfg;
}
/*
* Description:
* Reset the context of pdp-information.
* Param: i_id_vspctxt, the ID of serial-port;
* Return: the status of operation.
*/
sint32 lxzat_pdpinfo_f_reset(sint32 i_id_pdpctxt)
{
sint32 i_op_status = 0;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_pdpcfg_f_get,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
i_op_status = 1;
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
memset(p_cur_pdpinfo, 0, sizeof(lxzat_pdpinfo_t));
return i_op_status;
}
/*
* Description:
* Get the context of pdp-information.
* Param: i_id_vspctxt, the ID of serial-port;
* Return: the context of pdp-information.
*/
lxzat_pdpinfo_t* lxzat_pdpinfo_f_get(sint32 i_id_pdpctxt)
{
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_pdpcfg_f_get,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return NULL;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
return p_cur_pdpinfo;
}
/*
* Description:
* Get the status of PDP-Context.
* Param: i_id_pdpctxt, the ID of PDP-Context;
* Param: p_cur_pdpstatus, the status of PDP-Context;
* Return: the status of operation.
*/
sint32 lxzat_pdpinfo_f_getstatus(sint32 i_id_pdpctxt, sint32 * p_cur_pdpstatus)
{
sint32 i_op_status = 0;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_pdpcfg_f_get,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
i_op_status = 1;
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
*p_cur_pdpstatus = p_cur_pdpinfo->it_pdp_state;
return i_op_status;
}
/*
* Description:
* Get the Ip of PDP-Context.
* Param: i_id_pdpctxt, the ID of PDP-Context;
* Param: p_buf_localip, the buffer of IP-address;
* Return: the status of operation.
*/
sint32 lxzat_pdpinfo_f_getipaddress(sint32 i_id_pdpctxt, uint08 * p_buf_ipaddr)
{
sint32 i_op_status = 0;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_pdpcfg_f_get,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
if (p_buf_ipaddr != NULL)
{
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
if (E_PDP_STATUS_ACTIVATED == p_cur_pdpinfo->it_pdp_state)
{
i_op_status = 1;
strcpy(p_buf_ipaddr, p_cur_pdpinfo->pt_ip_host);
}
}
return i_op_status;
}
/*
* Description:
* deactive PDP-Context.
* Param: i_id_vspctxt, the ID of serial-port;
* Param: i_id_pdpctxt, the ID of PDP-Context;
* Return: the status of operation.
*/
sint32 lxzat_pdpinfo_f_deactive(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
sint32 i_op_status = 0;
lxzat_spcfg_t* p_cur_spcfg = NULL;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
if (p_cur_spcfg == NULL)
{
OS_DBG_LOG(("lxzat_pdpinfo_f_deactive,i_id_vspctxt=%d\r\n", i_id_vspctxt));
return i_op_status;
}
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_pdpinfo_f_deactive,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
if (E_PDP_STATUS_IDLE == p_cur_pdpinfo->it_pdp_state)
{
OS_DBG_LOG(("lxzat_pdpinfo_f_deactive,i_id_pdpctxt=%d has been actived!\r\n", i_id_pdpctxt));
i_op_status = 1;
return i_op_status;
}
i_op_status = 1;
p_cur_pdpinfo->it_pdp_state = E_PDP_STATUS_DEACTIVATING;
lxzat_task_pdpdeactive_newtask(i_id_vspctxt, i_id_pdpctxt);
return i_op_status;
}
/*
* Description:
* active PDP-Context.
* Param: i_id_vspctxt, the ID of serial-port;
* Param: i_id_pdpctxt, the ID of PDP-Context;
* Return: the status of operation.
*/
sint32 lxzat_pdpinfo_f_active(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
sint32 i_op_status = 0;
lxzat_spcfg_t* p_cur_spcfg = NULL;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
if (p_cur_spcfg == NULL)
{
OS_DBG_LOG(("lxzat_pdpinfo_f_active,i_id_vspctxt=%d\r\n", i_id_vspctxt));
return i_op_status;
}
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_pdpinfo_f_active,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
if (E_PDP_STATUS_ACTIVATING == p_cur_pdpinfo->it_pdp_state)
{
OS_DBG_LOG(("lxzat_pdpinfo_f_active,i_id_pdpctxt=%d is activating!\r\n", i_id_pdpctxt));
return i_op_status;
}
if (E_PDP_STATUS_ACTIVATED == p_cur_pdpinfo->it_pdp_state)
{
OS_DBG_LOG(("lxzat_pdpinfo_f_active,i_id_pdpctxt=%d has been actived!\r\n", i_id_pdpctxt));
return i_op_status;
}
i_op_status = 1;
p_cur_pdpinfo->it_pdp_state = E_PDP_STATUS_ACTIVATING;
lxzat_task_pdpactive_newtask(i_id_vspctxt, i_id_pdpctxt);
return i_op_status;
}
/*
* Description:
* Get the IP of interface-card.
* Param: p_buf_localip, the buffer of IP-address;
* Return: the status of operation.
*/
sint32 lxzat_ifconfig_f_getip(uint08 * p_buf_localip)
{
sint32 i_op_status = 0;
sint32 i_fd_socket = 0;
uint16 i_my_port = 0;
i_fd_socket = osp_socket_f_open(2/*AF_INET*/, 2/*SOCK_DGRAM*/, 0);
if (i_fd_socket < 0)
{
return i_op_status;
}
i_op_status = osp_socket_f_connect(i_fd_socket, "8.8.8.8", 53);
if (i_op_status == 0)
{
return i_op_status;
}
if (p_buf_localip != NULL)
{
i_op_status = 1;
osp_getsockname(i_fd_socket, p_buf_localip, &i_my_port);
}
osp_socket_f_close(i_fd_socket);
return i_op_status;
}
sint32 lxzat_pdpinfo_f_setip(sint32 i_id_pdpctxt, uint08 * p_buf_localip)
{
sint32 i_op_status = 0;
sint32 i_nb_string = 0;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
return i_op_status;
}
if (p_buf_localip == NULL)
{
return i_op_status;
}
i_nb_string = strlen(p_buf_localip);
if (i_nb_string > LXZAT_MAX_LEN_IPV4)
{
return i_op_status;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
if (p_buf_localip != NULL)
{
i_op_status = 1;
memset(p_cur_pdpinfo->pt_ip_host, 0, LXZAT_MAX_LEN_IPV4+1);
strcpy(p_cur_pdpinfo->pt_ip_host, p_buf_localip);
}
return i_op_status;
}
static sint32 lxzat_callback_pdpactive_f_exec(sint32 p1, sint32 p2)
{
sint32 i_op_status = 1;
sint32 i_id_vspctxt = 0;
sint32 i_id_pdpctxt = 0;
uint32 i_cur_ticks = 0;
uint32 i_mark_ticks = 0;
sint32 i_spvcomm_open = 0;
lxzat_spcfg_t* p_cur_spcfg = NULL;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
sint08 ll_buf_ipaddr [LXZAT_MAX_LEN_IPV4];
i_id_vspctxt = p1;
p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
if (p_cur_spcfg == NULL)
{
OS_DBG_LOG(("lxzat_callback_pdpactive_f_exec,i_id_vspctxt=%d\r\n", i_id_vspctxt));
return i_op_status;
}
i_id_pdpctxt = p2;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_callback_pdpactive_f_exec,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
if (E_PDP_STATUS_ACTIVATED == p_cur_pdpinfo->it_pdp_state)
{
OS_DBG_LOG(("lxzat_callback_pdpactive_f_exec,i_id_pdpctxt=%d has been actived!\r\n", i_id_pdpctxt));
i_op_status = 0;
return i_op_status;
}
i_cur_ticks = osp_time_tickget();
i_mark_ticks = p_cur_pdpinfo->it_mark_ticks;
if (i_cur_ticks < (i_mark_ticks + p_cur_pdpinfo->it_act_msecs))
{
return i_op_status;
}
memset(ll_buf_ipaddr, 0, sizeof(ll_buf_ipaddr));
i_op_status = lxzat_ifconfig_f_getip(ll_buf_ipaddr);
if (i_op_status == 0)
{
i_op_status = 1;
return i_op_status;
}
i_op_status = 1;
strcpy(p_cur_pdpinfo->pt_ip_host, ll_buf_ipaddr);
strcpy(p_cur_pdpinfo->pt_ip_1stdns, "1.1.1.1");
strcpy(p_cur_pdpinfo->pt_ip_2nddns, "2.2.2.2");
p_cur_pdpinfo->it_pdp_state = E_PDP_STATUS_ACTIVATED;
return i_op_status;
}
static sint32 lxzat_callback_pdpactive_f_exit(sint32 p1, sint32 p2)
{
OS_DBG_LOG(("lxzat:lxzat_callback_pdpactive_f_exit\r\n"));
return 1;
}
static sint32 lxzat_callback_pdpdeactive_f_exec(sint32 p1, sint32 p2)
{
sint32 i_op_status = 1;
sint32 i_id_vspctxt = 0;
sint32 i_id_pdpctxt = 0;
uint32 i_cur_ticks = 0;
uint32 i_mark_ticks = 0;
sint32 i_spvcomm_open = 0;
lxzat_spcfg_t* p_cur_spcfg = NULL;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
i_id_vspctxt = p1;
p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
if (p_cur_spcfg == NULL)
{
OS_DBG_LOG(("lxzat_callback_pdpdeactive_f_exec,i_id_vspctxt=%d\r\n", i_id_vspctxt));
return i_op_status;
}
i_id_pdpctxt = p2;
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_callback_pdpdeactive_f_exec,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
if (E_PDP_STATUS_IDLE == p_cur_pdpinfo->it_pdp_state)
{
OS_DBG_LOG(("lxzat_callback_pdpdeactive_f_exec,i_id_pdpctxt=%d has been deactived!\r\n", i_id_pdpctxt));
i_op_status = 0;
return i_op_status;
}
i_cur_ticks = osp_time_tickget();
i_mark_ticks = p_cur_pdpinfo->it_mark_ticks;
if (i_cur_ticks < (i_mark_ticks + p_cur_pdpinfo->it_act_msecs))
{
return i_op_status;
}
memset(p_cur_pdpinfo, 0, sizeof(lxzat_pdpinfo_t));
return i_op_status;
}
static sint32 lxzat_callback_pdpdeactive_f_exit(sint32 p1, sint32 p2)
{
OS_DBG_LOG(("lxzat:lxzat_callback_pdpdeactive_f_exit\r\n"));
return 1;
}
/*
* Description:
* new task, pdpactive task.
* Param: i_id_vspctxt, the ID of serial-port;
* Param: i_id_vspctxt, the ID of pdp-context;
*
* Return: status of operating.
*/
static sint32 lxzat_task_pdpactive_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
sint32 i_op_status = 0;
lxzat_task_t *p_new_task = NULL;
lxzat_spcfg_t* p_cur_spcfg = NULL;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
if (p_cur_spcfg == NULL)
{
OS_DBG_LOG(("lxzat_task_pdpactive_newtask,i_id_vspctxt=%d\r\n", i_id_vspctxt));
return i_op_status;
}
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_task_pdpactive_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
p_cur_pdpinfo->it_mark_ticks = osp_time_tickget();
p_cur_pdpinfo->it_act_msecs = (uint32)((rand() % 4096) + 1024);
OS_DBG_LOG(("lxzat:lxzat_task_pdpactive_newtask,entry\r\n"));
OS_DBG_LOG(("lxzat:lxzat_task_pdpactive_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
if(p_new_task == NULL)
{
OS_DBG_LOG(("lxzat:lxzat_task_pdpactive_newtask,p_new_task==NULL!\r\n"));
return i_op_status;
}
i_op_status = 1;
memset(p_new_task, 0, sizeof(lxzat_task_t));
p_new_task->fp_exec = lxzat_callback_pdpactive_f_exec;
p_new_task->fp_exit = lxzat_callback_pdpactive_f_exit;
p_new_task->sparam1 = i_id_vspctxt;
p_new_task->sparam2 = i_id_pdpctxt;
p_new_task->next = NULL;
lxzat_task_f_create(p_new_task);
return i_op_status;
}
/*
* Description:
* new task, pdpactive task.
* Param: i_id_vspctxt, the ID of serial-port;
* Param: i_id_vspctxt, the ID of pdp-context;
*
* Return: status of operating.
*/
static sint32 lxzat_task_pdpdeactive_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
sint32 i_op_status = 0;
lxzat_task_t *p_new_task = NULL;
lxzat_spcfg_t* p_cur_spcfg = NULL;
lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;
p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
if (p_cur_spcfg == NULL)
{
OS_DBG_LOG(("lxzat_task_pdpdeactive_newtask,i_id_vspctxt=%d\r\n", i_id_vspctxt));
return i_op_status;
}
if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
{
OS_DBG_LOG(("lxzat_task_pdpdeactive_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
return i_op_status;
}
p_cur_pdpinfo = &(gs_pdpinfo_table[i_id_pdpctxt]);
p_cur_pdpinfo->it_mark_ticks = osp_time_tickget();
p_cur_pdpinfo->it_act_msecs = (uint32)((rand() % 1024) + 128);
OS_DBG_LOG(("lxzat:lxzat_task_pdpdeactive_newtask,entry\r\n"));
OS_DBG_LOG(("lxzat:lxzat_task_pdpdeactive_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
if(p_new_task == NULL)
{
OS_DBG_LOG(("lxzat:lxzat_task_pdpdeactive_newtask,p_new_task==NULL!\r\n"));
return i_op_status;
}
i_op_status = 1;
memset(p_new_task, 0, sizeof(lxzat_task_t));
p_new_task->fp_exec = lxzat_callback_pdpdeactive_f_exec;
p_new_task->fp_exit = lxzat_callback_pdpdeactive_f_exit;
p_new_task->sparam1 = i_id_vspctxt;
p_new_task->sparam2 = i_id_pdpctxt;
p_new_task->next = NULL;
lxzat_task_f_create(p_new_task);
return i_op_status;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。