Merge "[Bugfix][T106]fix linux-zxic build for esdk"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
index 16e7981..6e80cd8 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
@@ -154,6 +154,8 @@
         liblynq-sms \
         liblynq-data \
         liblynq-qser-voice \
+        liblynq-qser-sim \
+        liblynq-qser-sms \
 	"
 zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libbinder libril', 'libtelsvr', d)}"
 
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-sim/liblynq-qser-sim.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-sim/liblynq-qser-sim.bb
new file mode 100755
index 0000000..9bc8573
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-sim/liblynq-qser-sim.bb
@@ -0,0 +1,47 @@
+inherit externalsrc package
+
+DESCRIPTION = "liblynq-qser-sms"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"
+DEPENDS += "liblynq-log liblynq-sim"
+inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-qser-sim/"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+#Parameters passed to do_compile()
+
+FILES_${PN} = "${base_libdir}/*.so "
+
+FILES_${PN}-dev = "/test \
+                   ${includedir}"
+
+FILES_${PN}-doc = "/doc"
+
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+                  ${base_libdir}/.debug \
+                  ${base_sbindir}/.debug"
+
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+		oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+}
+
+do_install () {
+    oe_runmake install ROOT=${D}
+	
+    if [ -d "${WORKONSRC}" ] ; then
+        install -d ${D}${includedir}/
+        cp -af ${S}include/ ${D}${includedir}/
+    fi 
+}
+
+addtask bachclean
+do_bachclean () {
+    oe_runmake clean
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-sms/liblynq-qser-sms.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-sms/liblynq-qser-sms.bb
new file mode 100755
index 0000000..1e81eca
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-sms/liblynq-qser-sms.bb
@@ -0,0 +1,47 @@
+inherit externalsrc package
+
+DESCRIPTION = "liblynq-qser-sms"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"
+DEPENDS += "liblynq-log liblynq-sms"
+inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-qser-sms/"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+#Parameters passed to do_compile()
+
+FILES_${PN} = "${base_libdir}/*.so "
+
+FILES_${PN}-dev = "/test \
+                   ${includedir}"
+
+FILES_${PN}-doc = "/doc"
+
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+                  ${base_libdir}/.debug \
+                  ${base_sbindir}/.debug"
+
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+		oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+}
+
+do_install () {
+    oe_runmake install ROOT=${D}
+	
+    if [ -d "${WORKONSRC}" ] ; then
+        install -d ${D}${includedir}/
+        cp -af ${S}include/ ${D}${includedir}/
+    fi 
+}
+
+addtask bachclean
+do_bachclean () {
+    oe_runmake clean
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb
index 245b5f8..54356c9 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb
@@ -2,7 +2,7 @@
 
 DESCRIPTION = "lynq sim"
 LICENSE = "MobileTekProprietary"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
 DEPENDS += "libpal gstreamer1.0 glib-2.0 libapn liblynq-log libvendor-ril liblynq-shm libbinder"
 inherit workonsrc
 WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-sim/"
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/include/lynq_qser_sim.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/include/lynq_qser_sim.h
new file mode 100755
index 0000000..0192db5
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/include/lynq_qser_sim.h
@@ -0,0 +1,382 @@
+#ifndef __LYNQ_QSER_SIM__
+#define __LYNQ_QSER_SIM__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define QSER_SIM_IMSI_LEN_MAX     16  /**  Maximum length of IMSI data. */
+#define QSER_SIM_ICCID_LEN_MAX    20  /**  Maximum length of ICCID data. */
+
+typedef enum 
+{
+    E_QSER_SUCCESS                        = 0,    /**<  Success. */
+    E_QSER_ERROR_BADPARM                  = 4,    /**<  Bad parameter. */
+}E_QSER_ERROR_CODE_T;
+
+typedef uint32_t sim_client_handle_type;
+
+typedef enum 
+{
+    QSER_SIM_SLOT_ID_1          = 0xB01,    /**< Identify card in slot 1.  */
+    QSER_SIM_SLOT_ID_2          = 0xB02,    /**< Identify card in slot 2.  */
+}QSER_SIM_SLOT_ID_TYPE_T;
+
+typedef enum 
+{
+    QSER_SIM_APP_TYPE_UNKNOWN   = 0xB00,    /**<  Unknown application type  */
+    QSER_SIM_APP_TYPE_3GPP      = 0xB01,    /**< Identify the SIM/USIM application on the card.  */
+    QSER_SIM_APP_TYPE_3GPP2     = 0xB02,    /**< Identify the RUIM/CSIM application on the card.  */
+    QSER_SIM_APP_TYPE_ISIM      = 0xB03,    /**< Identify the ISIM application on the card.  */
+}QSER_SIM_APP_TYPE_T;
+
+typedef struct 
+{
+    QSER_SIM_SLOT_ID_TYPE_T     e_slot_id;  /**< Indicates the slot to be used. */
+    QSER_SIM_APP_TYPE_T         e_app;      /**< Indicates the type of the application. */
+}QSER_SIM_APP_ID_INFO_T;  /* Type */
+
+#define QSER_SIM_PIN_LEN_MAX  8   /**  Maximum length of PIN data. */
+
+typedef enum 
+{
+    QSER_SIM_PIN_ID_1 = 0xB01,  /**< Level 1 user verification.  */
+    QSER_SIM_PIN_ID_2 = 0xB02,  /**< Level 2 user verification.  */
+}QSER_SIM_PIN_ID_TYPE_T;
+
+typedef struct 
+{
+    QSER_SIM_APP_ID_INFO_T        app_info;                           /**< Application identification information. */
+    QSER_SIM_PIN_ID_TYPE_T  pin_id;                             /**< PIN ID. */
+    uint32_t                    pin_value_len;                      /**< Must be set to the number of elements in pin_value. */
+    char                        pin_value[QSER_SIM_PIN_LEN_MAX];  /*  Value of the PIN */
+}QSER_SIM_VERIFY_PIN_INFO_T;
+
+/** Changes the PIN value of an application. The application must pass both the 
+    new and the old values of the PIN to complete the operation.     
+    The same PIN can be used by multiple sessions (i.e., the PIN is shared
+    between GSM and RUIM in an ICC card). The PIN is automatically verified
+    for all the sessions when the command is executed. */
+typedef struct 
+{
+    QSER_SIM_APP_ID_INFO_T        app_info;                               /**< Application identification information. */
+    QSER_SIM_PIN_ID_TYPE_T  pin_id;                                 /**< PIN ID. */
+    uint32_t                    old_pin_value_len;                      /**< Must be set to the number of elements in old_pin_value. */
+    char                        old_pin_value[QSER_SIM_PIN_LEN_MAX];  /**< Value of the old PIN as a sequence of ASCII characters. */
+    uint32_t                    new_pin_value_len;                      /**< Must be set to the number of elements in new_pin_value. */
+    char                        new_pin_value[QSER_SIM_PIN_LEN_MAX];  /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_SIM_CHANGE_PIN_INFO_T;
+
+/** Unblocks a blocked PIN using the PUK code. The client must pass PUK1 to unblock PIN1 or PUK2 to unblock PIN2.
+    The same PIN can be used by multiple sessions (i.e., the PIN is shared between GSM and RUIM in an ICC card). 
+    The PIN is automatically verified for all the sessions when the command is executed. */
+typedef struct 
+{
+    QSER_SIM_APP_ID_INFO_T        app_info;                               /**< Application identification information. */
+    QSER_SIM_PIN_ID_TYPE_T  pin_id;                                 /**< PIN ID. */
+    uint32_t                    puk_value_len;                          /**< Must be set to the number of elements in puk_value. */
+    char                        puk_value[QSER_SIM_PIN_LEN_MAX];      /**< Value of the PUK as a sequence of ASCII characters. */
+    uint32_t                    new_pin_value_len;                      /**< Must be set to the number of elements in new_pin_value. */
+    char                        new_pin_value[QSER_SIM_PIN_LEN_MAX];  /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_SIM_UNBLOCK_PIN_INFO_T;
+
+/** Enables the PIN on an application. */
+typedef  QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_ENABLE_PIN_INFO_T; //Same 
+
+/** Disables the PIN of an application, */
+typedef  QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_DISABLE_PIN_INFO_T; //Same 
+
+
+typedef enum 
+{
+    QSER_SIM_PERSO_FEATURE_TYPE_UNKNOWN                 = 0xB00, /**<  Unknown personalization feature.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK            = 0xB01, /**<  Featurization based on 3GPP MCC and MNC.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK_SUBSET     = 0xB02, /**<  Featurization based on 3GPP MCC, MNC, and IMSI digits 6 and 7.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SERVICE_PROVIDER   = 0xB03, /**<  Featurization based on 3GPP MCC, MNC, and GID1.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP_CORPORATE          = 0xB04, /**<  Featurization based on 3GPP MCC, MNC, GID1, and GID2.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SIM                = 0xB05, /**<  Featurization based on the 3GPP IMSI.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_1    = 0xB06, /**<  Featurization based on 3GPP2 MCC and MNC.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_2    = 0xB07, /**<  Featurization based on 3GPP2 IRM code.  */
+    QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_RUIM              = 0xB08, /**<  Featurization based on 3GPP2 IMSI_M.  */
+}QSER_SIM_PERSO_FEATURE_TYPE_T;
+
+typedef enum 
+{
+    QSER_SIM_CARD_STATE_UNKNOWN                     = 0xB01,    /**< Card state unknown. */
+    QSER_SIM_CARD_STATE_ABSENT                      = 0xB02,    /**< Card is absent. */
+    QSER_SIM_CARD_STATE_PRESENT                     = 0xB03,    /**< Card is present. */
+    QSER_SIM_CARD_STATE_ERROR_UNKNOWN               = 0xB04,    /**< Unknown error state. */
+    QSER_SIM_CARD_STATE_ERROR_POWER_DOWN            = 0xB05,    /**< Power down. */
+    QSER_SIM_CARD_STATE_ERROR_POLL_ERROR            = 0xB06,    /**< Poll error. */
+    QSER_SIM_CARD_STATE_ERROR_NO_ATR_RECEIVED       = 0xB07,    /**<  Failed to receive an answer to reset.  */
+    QSER_SIM_CARD_STATE_ERROR_VOLT_MISMATCH         = 0xB08,    /**< Voltage mismatch. */
+    QSER_SIM_CARD_STATE_ERROR_PARITY_ERROR          = 0xB09,    /**< Parity error. */
+    QSER_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS= 0xB0A,    /**< Card returned technical problems. */
+}QSER_SIM_CARD_STATE_TYPE_T;  /**< Card state. */
+
+typedef enum 
+{
+    QSER_SIM_CARD_TYPE_UNKNOWN  = 0xB00,    /**<  Unidentified card type.  */
+    QSER_SIM_CARD_TYPE_ICC      = 0xB01,    /**<  Card of SIM or RUIM type.  */
+    QSER_SIM_CARD_TYPE_UICC     = 0xB02,    /**<  Card of USIM or CSIM type.  */
+}QSER_SIM_CARD_TYPE_T;
+
+typedef enum 
+{
+    QSER_SIM_PROV_STATE_NONE    = 0xB00,    /**<  Nonprovisioning.  */
+    QSER_SIM_PROV_STATE_PRI     = 0xB01,    /**<  Primary provisioning subscription.  */
+    QSER_SIM_PROV_STATE_SEC     = 0xB02,    /**<  Secondary provisioning subscription.  */
+}QSER_SIM_SUBSCRIPTION_TYPE_T;
+
+typedef enum 
+{
+    QSER_SIM_APP_STATE_UNKNOWN                  = 0xB00,    /**< Application state unknown. */
+    QSER_SIM_APP_STATE_DETECTED                 = 0xB01,    /**<  Detected state.  */
+    QSER_SIM_APP_STATE_PIN1_REQ                 = 0xB02,    /**<  PIN1 required.  */
+    QSER_SIM_APP_STATE_PUK1_REQ                 = 0xB03,    /**<  PUK1 required.  */
+    QSER_SIM_APP_STATE_INITALIZATING            = 0xB04,    /**<  Initializing.  */
+    QSER_SIM_APP_STATE_PERSO_CK_REQ             = 0xB05,    /**<  Personalization control key required.  */
+    QSER_SIM_APP_STATE_PERSO_PUK_REQ            = 0xB06,    /**<  Personalization unblock key required.  */
+    QSER_SIM_APP_STATE_PERSO_PERMANENTLY_BLOCKED= 0xB07,    /**<  Personalization is permanently blocked.  */
+    QSER_SIM_APP_STATE_PIN1_PERM_BLOCKED        = 0xB08,    /**<  PIN1 is permanently blocked.  */
+    QSER_SIM_APP_STATE_ILLEGAL                  = 0xB09,    /**<  Illegal application state.  */
+    QSER_SIM_APP_STATE_READY                    = 0xB0A,    /**<  Application ready state.  @newpage */
+}QSER_SIM_APP_STATE_TYPE_T;
+
+typedef enum 
+{
+    QSER_SIM_PIN_STATE_UNKNOWN                  = 0xB01,    /**< Unknown PIN state. */
+    QSER_SIM_PIN_STATE_ENABLED_NOT_VERIFIED     = 0xB02,    /**<  PIN required, but has not been verified.  */
+    QSER_SIM_PIN_STATE_ENABLED_VERIFIED         = 0xB03,    /**<  PIN required and has been verified.  */
+    QSER_SIM_PIN_STATE_DISABLED                 = 0xB04,    /**<  PIN not required.  */
+    QSER_SIM_PIN_STATE_BLOCKED                  = 0xB05,    /**<  PIN verification has failed too many times and is blocked. Recoverable through PUK verification.  */
+    QSER_SIM_PIN_STATE_PERMANENTLY_BLOCKED      = 0xB06,    /**<  PUK verification has failed too many times and is not recoverable.  */
+}QSER_SIM_PIN_STATE_TYPE_T;
+
+typedef struct 
+{
+    QSER_SIM_SUBSCRIPTION_TYPE_T      subscription;           /**<   Type of subscription (i.e., primary, secondary, etc.). */
+    QSER_SIM_APP_STATE_TYPE_T         app_state;              /**<   Current state of the application. */
+    QSER_SIM_PERSO_FEATURE_TYPE_T   perso_feature;          /**<   Current personalization state and feature enabled. */
+    uint8_t                             perso_retries;          /**<   Number of personalization retries. */
+    uint8_t                             perso_unblock_retries;  /**<   Number of personalization unblock retries. */
+    QSER_SIM_PIN_STATE_TYPE_T         pin1_state;             /**<   Current PIN 1 state. */
+    uint8_t                             pin1_num_retries;       /**<   Number of PIN 1 retries. */
+    uint8_t                             puk1_num_retries;       /**<   Number of PUK 1 retries. */
+    QSER_SIM_PIN_STATE_TYPE_T         pin2_state;             /**<   Current PIN 2 state. */
+    uint8_t                             pin2_num_retries;       /**<   Number of PIN 2 retries. */
+    uint8_t                             puk2_num_retries;       /**<   Number of PUK 2 retries. */
+}QSER_SIM_CARD_APP_INFO_T;
+
+typedef struct 
+{
+    QSER_SIM_CARD_APP_INFO_T          app_3gpp;               /**<   Stores 3GPP application information. */
+    QSER_SIM_CARD_APP_INFO_T          app_3gpp2;              /**<   Stores 3GPP2 application information. */
+    QSER_SIM_CARD_APP_INFO_T          app_isim;               /**<   Stores ISIM application information. */
+}QSER_SIM_CARD_ALL_APP_INFO_T;
+
+typedef struct 
+{
+    QSER_SIM_CARD_STATE_TYPE_T      e_card_state;/**<   Current card and card error state. */
+    QSER_SIM_CARD_TYPE_T            e_card_type; /**<   Card type. */
+    QSER_SIM_CARD_ALL_APP_INFO_T      card_app_info; /**<   Stores all relevant application information. */
+}QSER_SIM_CARD_STATUS_INFO_T;
+
+int qser_sim_client_init(sim_client_handle_type  *ph_sim);
+
+int qser_sim_client_deinit(sim_client_handle_type h_sim);
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_getimsi
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to retrieve the IMSI (for 3GPP)
+    or IMSI_M (for 3GPP2) from the SIM in ASCII form
+
+    @return
+    void
+*/
+/*=========================================================================*/
+int qser_sim_getimsi(
+    sim_client_handle_type          h_sim,
+    QSER_SIM_APP_ID_INFO_T            *pt_info,   ///< [IN] The SIM identifier info.
+    char                            *imsi,      ///< [OUT] IMSI buffer
+    size_t                          imsiLen     ///< [IN] IMSI buffer length
+);
+
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_geticcid
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to retrieve the ICCID from
+    SIM in ASCII form
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_geticcid
+(
+    sim_client_handle_type          h_sim,
+    QSER_SIM_SLOT_ID_TYPE_T     simId,     ///< [IN] The SIM identifier.
+    char                            *iccid,    ///< [OUT] ICCID
+    size_t                          iccidLen   ///< [IN] ICCID buffer length
+);
+
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_getphonenumber
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to retrieve the device phone
+    number from MSISDN (for 3GPP) or MDN (for 3GPP2) from the SIM in
+    ASCII form
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_getphonenumber
+(
+    sim_client_handle_type          h_sim,
+    QSER_SIM_APP_ID_INFO_T            *pt_info,   ///< [IN] The SIM identifier.
+    char                            *phone_num, ///< [OUT] phone number
+    size_t                          phoneLen    ///< [IN] phone number buffer length
+);
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_verifypin
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to verify either PIN1 or PIN2
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_verifypin
+(
+    sim_client_handle_type      h_sim,
+    QSER_SIM_VERIFY_PIN_INFO_T    *pt_info   ///< [IN] Verify PIN infor
+);
+
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_changepin
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to change the value of
+    either PIN1 or PIN2
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_changepin
+(
+    sim_client_handle_type      h_sim,
+    QSER_SIM_CHANGE_PIN_INFO_T    *pt_info   ///< [IN] Change PIN infor
+);
+
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_unblockpin
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to unblock a PIN1 or PIN2 that
+    has been blocked
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_unblockpin
+(
+    sim_client_handle_type      h_sim,
+    QSER_SIM_UNBLOCK_PIN_INFO_T   *pt_info   ///< [IN] Unblock PIN infor
+);
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_enablepin
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to enable PIN1 or PIN2
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_enablepin
+(
+    sim_client_handle_type      h_sim,
+    QSER_SIM_ENABLE_PIN_INFO_T    *pt_info   ///< [IN] Enable PIN infor
+);
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_disablepin
+
+===========================================================================*/
+/*
+    @brief
+    Function sends a command to the modem to disable PIN1 or PIN2
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_disablepin
+(
+    sim_client_handle_type      h_sim,
+    QSER_SIM_DISABLE_PIN_INFO_T   *pt_info   ///< [IN] Disable PIN infor
+);
+
+
+/*===========================================================================
+
+  FUNCTION:  qser_sim_getcardstatus
+
+===========================================================================*/
+/*
+    @brief
+    Function retrieves the server cached card status informations and
+    sends the information to the client
+
+    @return
+    int
+*/
+/*=========================================================================*/
+int qser_sim_getcardstatus
+(
+    sim_client_handle_type          h_sim,
+    QSER_SIM_SLOT_ID_TYPE_T     simId,     ///< [IN] The SIM identifier.
+    QSER_SIM_CARD_STATUS_INFO_T   *pt_info   ///< [OUT] Cart status infor output
+);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
new file mode 100755
index 0000000..6416d9e
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
@@ -0,0 +1,183 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
+#include <log/log.h>
+#include <include/lynq_sim.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <liblog/lynq_deflog.h>
+#include "lynq_qser_sim.h"
+
+#define USER_LOG_TAG "LYNQ_QSER_SIM"
+
+sim_client_handle_type h_sim = 0;
+
+int qser_sim_client_init(sim_client_handle_type  *ph_sim)
+{
+    if(NULL == ph_sim)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    *ph_sim = (sim_client_handle_type)getpid();
+    //*ph_sim = (sim_client_handle_type)53234323;
+    h_sim = *ph_sim;
+    return lynq_sim_init(*ph_sim);
+}
+
+int qser_sim_client_deinit(sim_client_handle_type h_sim)
+{
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_sim_deinit();
+}
+
+int qser_sim_getimsi(sim_client_handle_type h_sim, QSER_SIM_APP_ID_INFO_T *pt_info, char *imsi, size_t imsiLen)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(NULL == imsi)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_get_imsi(imsi);
+}
+
+int qser_sim_geticcid(sim_client_handle_type h_sim, QSER_SIM_SLOT_ID_TYPE_T simId, char *iccid, size_t iccidLen)
+{
+    if(NULL == iccid)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_get_iccid(iccid);
+}
+
+int qser_sim_getphonenumber(sim_client_handle_type h_sim, QSER_SIM_APP_ID_INFO_T *pt_info,  char *phone_num, size_t phoneLen)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(NULL == phone_num)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_query_phone_number(phone_num);
+}
+
+int qser_sim_verifypin(sim_client_handle_type h_sim, QSER_SIM_VERIFY_PIN_INFO_T *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_verify_pin(pt_info->pin_value);
+}
+
+int qser_sim_changepin(sim_client_handle_type h_sim,QSER_SIM_CHANGE_PIN_INFO_T *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_change_pin(pt_info->old_pin_value, pt_info->new_pin_value);
+}
+
+int qser_sim_unblockpin(sim_client_handle_type h_sim, QSER_SIM_UNBLOCK_PIN_INFO_T *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_unlock_pin(pt_info->puk_value, pt_info->new_pin_value);
+}
+
+int qser_sim_enablepin(sim_client_handle_type h_sim, QSER_SIM_ENABLE_PIN_INFO_T *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_enable_pin(pt_info->pin_value);
+}
+
+int qser_sim_disablepin(sim_client_handle_type h_sim, QSER_SIM_DISABLE_PIN_INFO_T *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_disable_pin(pt_info->pin_value);
+}
+
+int qser_sim_getcardstatus(sim_client_handle_type h_sim,QSER_SIM_SLOT_ID_TYPE_T simId, QSER_SIM_CARD_STATUS_INFO_T   *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("input  error\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    if(h_sim == 0)
+    {
+        LYERRLOG("not init\n");
+        return E_QSER_ERROR_BADPARM;
+    }
+    return lynq_get_sim_status((int*)&pt_info->e_card_state);
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/makefile
new file mode 100755
index 0000000..cafc77c
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/makefile
@@ -0,0 +1,65 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+                -std=gnu++14 \
+                -g -Os \
+                -flto \
+                -fPIC \
+                -DECALL_SUPPORT \
+                -fpermissive \
+
+
+
+$(warning ################# lynq qser sms demo ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH   = .
+
+LOCAL_C_INCLUDES = \
+  -I. \
+  -I$(LOCAL_PATH)/include/ \
+  -I$(ROOT)$(includedir)/logger \
+  -I$(ROOT)$(includedir)/liblog \
+
+LOCAL_LIBS := \
+    -L. \
+    -ldl \
+    -lstdc++ \
+    -lcutils \
+    -lutils \
+    -lpthread \
+    -llynq-log \
+    -llynq-sim \
+
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-qser-sim.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs 
+all: build
+$(EXECUTABLE): $(OBJECTS)
+	$(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+	$(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build:  $(EXECUTABLE)
+	$(warning ########## build $(EXECUTABLE)  ##########)
+install:
+	mkdir -p $(ROOT)$(base_libdir)/
+	install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+	mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+pack_rootfs:
+	mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+	cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+	$(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+	mkdir -p $(PACK_TO)$(base_libdir)/
+	cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+	$(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+	$(RM) $(OBJECTS) $(EXECUTABLE)
+	-find . -name "*.o" -delete
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/include/lynq_qser_sms.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/include/lynq_qser_sms.h
new file mode 100755
index 0000000..5f0f0c3
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/include/lynq_qser_sms.h
@@ -0,0 +1,241 @@
+#ifndef LYNQ_QSER_SMS_H
+#define LYNQ_QSER_SMS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+
+#define MIN_MSM_PARAM_NUM 4
+#define MIN_IMS_MSM_PARAM_NUM 6
+#define MIN_WRITMSM_PARAM_NUM 5
+#define MSG_MAX_LEN 1024
+#define TELEPHONNUM_LEN 64
+#define STORAGSMS_MAX_SIZE 128
+#define SMSC_MAX_LEN 22
+#define SMS_NUM_MAX 255
+
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef uint32_t sms_client_handle_type;
+
+/**  Maximum length of an SMS. */
+#define QSER_SMS_MAX_MT_MSG_LENGTH    1440
+
+/**  Maximum string length. */
+#define QSER_SMS_MAX_ADDR_LENGTH      252
+
+/**  Maximum string length. */
+#define QSER_SMS_MAX_SCA_TYPLENGTH 3
+
+typedef enum   
+{    
+    QSER_SMS_7BIT        = 0,
+    QSER_SMS_8BIT     = 1,
+    QSER_SMS_UCS2            = 2,
+    //<2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao, <[SMS] Segment 1==> CharSet to Alpha implementation.>
+    QSER_SMS_IRA             = 3,
+    //>2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao
+
+}QSER_SMS_T;   
+
+typedef enum   
+{    
+    QSER_SMS_MO               = 0,    ///< SMS mobile terminated message.  
+    QSER_SMS_MT               = 1,    ///< SMS mobile originated message. 
+    QSER_SMS_BROADCAST_MT      = 2     ///< SMS Cell Broadcast message.   
+}QSER_SMS_TYPT; 
+
+typedef enum 
+{
+    QSER_SMS_STORAGTYPNONE      = -1,   /**<  Message no need to store. */
+    QSER_SMS_STORAGTYPUIM       = 0,    /**<  Message store to UIM. */
+    QSER_SMS_STORAGTYPNV        = 1,    /**<  Message store to NV. */
+    QSER_SMS_STORAGTYPDB     = 2,    /**<  Message store to NV. */
+}QSER_SMS_STORAGTYPT;
+
+typedef enum 
+{
+    QSER_SMS_MESSAGMODUNKNOWN   = -1,   /**<  Message type CDMA */
+    QSER_SMS_MESSAGMODCDMA      = 0,    /**<  Message type CDMA */
+    QSER_SMS_MESSAGMODGW        = 1,    /**<  Message type GW. */
+}QSER_SMS_MODTYPT;
+
+typedef struct 
+ {
+    uint8_t total_segments;     /**<     The number of long  short message*/
+    uint8_t seg_number;         /**<     Current number.*/
+	uint8_t referencnumber;   /**< referencnumber.*/
+}QSER_sms_user_data_head_t; 
+
+typedef struct
+{
+    /* If sms is stored, it won't parse, you need read it by yourself */
+    QSER_SMS_STORAGTYPT storage;                          ///specify where stored this msg
+    
+    QSER_SMS_T       format;
+    QSER_SMS_TYPT         type;
+    char                    src_addr[QSER_SMS_MAX_ADDR_LENGTH]; ///Telephone number string.  
+    int                     sms_data_len;
+    char                    sms_data[QSER_SMS_MAX_MT_MSG_LENGTH];   ///SMS content, data format depends on format
+    char                    timestamp[21];                      ///Message time stamp (in text mode). string format: "yy/MM/dd,hh:mm:ss+/-TimeZone" 
+    uint8_t                 user_data_head_valid;               //indicate whether long sms. TRUE-long sms; FALSE-short message;
+    QSER_sms_user_data_head_t  user_data_head;                    //long sms user data head info.
+    QSER_SMS_MODTYPT    mode;                             ///specify where stored this msg cdma or gw area
+    uint32_t                storage_index;                      ///storage index, -1 means not store
+} QSER_sms_info_t;
+     
+typedef struct
+{
+    QSER_SMS_STORAGTYPT storage;
+    QSER_SMS_MODTYPT    mode;
+    uint32_t                storage_idx;
+} QSER_sms_storage_info_t;
+
+typedef enum 
+{
+    QSER_SMS_UNKNOWN            = -1, 
+    QSER_SMS_DISCARD            = 0x00, /*  Incoming messages for this route are discarded by the WMS service without 
+                                            notifying QMI_WMS clients */
+    QSER_SMS_STORAND_NOTIFY   = 0x01, /*  Incoming messages for this route are stored to the specified device 
+                                            memory, and new message notifications */
+    QSER_SMS_TRANSFER_ONLY      = 0x02, /*  Incoming messages for this route are transferred to the client, and the
+                                            client is expected to send ACK to the network */
+    QSER_SMS_TRANSFER_AND_ACK   = 0x03, /*  Incoming messages for this route are transferred to the client, and ACK is
+                                            sent to the network */
+}QSER_SMS_RECEPTION_ACTION_TYPT;
+
+#define QSER_WMS_MESSAGLENGTH_MAX 255
+
+typedef enum 
+ {
+    QSER_WMS_MESSAGCDMA            = 0x00,     //- 0x00 -- MESSAGCDMA -- CDMA \n 
+    QSER_WMS_MESSAGGW_PP           = 0x06,     //- 0x06 -- MESSAGGW_PP -- GW_PP
+}QSER_WMS_MESSAGTYPE;
+
+
+typedef struct
+ {
+  QSER_WMS_MESSAGTYPE format;
+  uint32_t raw_messaglen;                             /**< Must be set to # of elements in raw_message */
+  uint8_t raw_message[QSER_WMS_MESSAGLENGTH_MAX];       /**< Raw message data*/
+}QSER_wms_send_raw_message_data_t; 
+
+typedef enum
+{
+  QSER_WMS_TL_CAUSCODADDR_VACANT                        = 0x00, 
+  QSER_WMS_TL_CAUSCODADDR_TRANSLATION_FAILURE           = 0x01, 
+  QSER_WMS_TL_CAUSCODNETWORK_RESOURCSHORTAGE          = 0x02, 
+  QSER_WMS_TL_CAUSCODNETWORK_FAILURE                    = 0x03, 
+  QSER_WMS_TL_CAUSCODINVALID_TELESERVICID             = 0x04, 
+  QSER_WMS_TL_CAUSCODNETWORK_OTHER                      = 0x05, 
+  QSER_WMS_TL_CAUSCODNO_PAGRESPONSE                   = 0x20, 
+  QSER_WMS_TL_CAUSCODDEST_BUSY                          = 0x21, 
+  QSER_WMS_TL_CAUSCODNO_ACK                             = 0x22, 
+  QSER_WMS_TL_CAUSCODDEST_RESOURCSHORTAGE             = 0x23, 
+  QSER_WMS_TL_CAUSCODSMS_DELIVERY_POSTPONED             = 0x24, 
+  QSER_WMS_TL_CAUSCODDEST_OUT_OF_SERV                   = 0x25, 
+  QSER_WMS_TL_CAUSCODDEST_NOT_AT_ADDR                   = 0x26, 
+  QSER_WMS_TL_CAUSCODDEST_OTHER                         = 0x27, 
+  QSER_WMS_TL_CAUSCODRADIO_IF_RESOURCSHORTAGE         = 0x40, 
+  QSER_WMS_TL_CAUSCODRADIO_IF_INCOMPATABILITY           = 0x41, 
+  QSER_WMS_TL_CAUSCODRADIO_IF_OTHER                     = 0x42, 
+  QSER_WMS_TL_CAUSCODENCODING                           = 0x60, 
+  QSER_WMS_TL_CAUSCODSMS_ORIG_DENIED                    = 0x61, 
+  QSER_WMS_TL_CAUSCODSMS_TERM_DENIED                    = 0x62, 
+  QSER_WMS_TL_CAUSCODSUPP_SERV_NOT_SUPP                 = 0x63, 
+  QSER_WMS_TL_CAUSCODSMS_NOT_SUPP                       = 0x64, 
+  QSER_WMS_TL_CAUSCODMISSING_EXPECTED_PARAM             = 0x65, 
+  QSER_WMS_TL_CAUSCODMISSING_MAND_PARAM                 = 0x66, 
+  QSER_WMS_TL_CAUSCODUNRECOGNIZED_PARAM_VAL             = 0x67, 
+  QSER_WMS_TL_CAUSCODUNEXPECTED_PARAM_VAL               = 0x68, 
+  QSER_WMS_TL_CAUSCODUSER_DATA_SIZERR                 = 0x69, 
+  QSER_WMS_TL_CAUSCODGENERAL_OTHER                      = 0x6A, 
+}QSER_WMS_TL_CAUSCODTYPE;
+
+
+
+typedef struct
+ {
+  uint16_t                              messagid;            /*  Message ID */
+  uint8_t                               causcodvalid;      /**< Must be set to true if causcode is being passed */
+  QSER_WMS_TL_CAUSCODTYPE           causcode;  
+}QSER_wms_raw_send_resp_t;
+
+typedef struct 
+ {
+  char service_center_addr[QSER_SMS_MAX_ADDR_LENGTH + 1];         /**<   Address of the service center.*/
+  uint8_t service_center_addr_typvalid;
+  char service_center_addr_type[QSER_SMS_MAX_SCA_TYPLENGTH + 1];    /**<   129 if the SMSC address does not start with a "+" characte;
+                                                                           145 if the SMSC address starts with a "+" character*/
+}QSER_sms_service_center_cfg_t;
+
+typedef QSER_sms_info_t       QSER_SMS_Msg_t; 
+typedef QSER_sms_info_t*      QSER_SMS_MsgRef; 
+
+/* Callback function registered to qser_sms_addrxmsghandler, msgRef contains the detail msg infor */
+typedef void (*QSER_SMS_RxMsgHandlerFunc_t)(QSER_SMS_MsgRef msgRef, void* contextPtr);
+
+/* Init SMS module and return h_sms, this should be called before any othe ones */
+int qser_sms_client_init(sms_client_handle_type  *ph_sms);
+
+/* Add callback function, if any new msg arrived, it will notify app */
+int qser_sms_addrxmsghandler(QSER_SMS_RxMsgHandlerFunc_t handlerPtr, void* contextPtr);
+
+/* Send sms, you just need to fill format/src_addr/sms_data_len/sms_data,
+   if format is UCS2, the data should be Unicode-BE format.
+*/
+int qser_sms_send_sms(sms_client_handle_type h_sms, QSER_sms_info_t *pt_sms_info);
+
+/* DeInit SMS module and release resource, this should be called in the last one. */
+int qser_sms_client_deinit(sms_client_handle_type h_sms);
+     
+/* Delete the SMS specified in the  pt_sms_storage */
+int qser_sms_deletefromstorage(sms_client_handle_type  h_sms, QSER_sms_storage_info_t  *pt_sms_storage);
+
+/* Send sms PDU.
+*/
+int qser_sms_send_smspdu( sms_client_handle_type     h_sms,
+                         QSER_wms_send_raw_message_data_t *raw_messagdata,
+                         QSER_wms_raw_send_resp_t *rawresp);
+
+
+/* Get sms center address.
+*/
+int qser_sms_getsmscenteraddress( sms_client_handle_type     h_sms,
+                       QSER_sms_service_center_cfg_t *set_sca_cfg);
+
+/* Set sms center address.
+*/
+int qser_sms_setsmscenteraddress( sms_client_handle_type     h_sms,
+                       QSER_sms_service_center_cfg_t *get_sca_cfg);
+
+/*
+Usage 1 (register callback and wait for new sms arrive): 
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, wait for sms arrive, pf_cb will pass the detail sms info to app.
+4, qser_sms_client_deinit
+
+
+Usage 2 (Send sms): 
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, qser_sms_send_sms
+4, qser_sms_client_deinit
+
+
+Usage 3 (store sms): 
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, qser_sms_setroutelist (Notice: class-0 not allowed to store, class-2 must be stored to UIM)
+4, pf_cb will be called when new sms arrived, and tell you where the sms stored
+5, you can call qser_sms_deletefromstorage to delete specified sms, the location can be got from pf_cb.
+6, qser_sms_client_deinit
+*/
+    
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/lynq_qser_sms.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/lynq_qser_sms.cpp
new file mode 100755
index 0000000..5ff13a7
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/lynq_qser_sms.cpp
@@ -0,0 +1,195 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+#include <unistd.h>
+#include <liblog/lynq_deflog.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <libsms/lynq_sms.h>
+#include "lynq_qser_sms.h"
+#define USER_LOG_TAG "LYNQ_QSER_SMS"
+
+QSER_SMS_RxMsgHandlerFunc_t tmp = NULL;
+
+sms_client_handle_type h_sms = 0;
+
+enum{
+    SMS_OK = 0,
+    SMS_FAIL,
+    SMS_PARAM_ERR
+};
+
+void *new_sms_thread_recv(void *p)
+{
+    int handle = -1;
+    int status = -1;
+    int charset = -1;
+    char smsc[1024];
+    int smscLen = -1;
+    int smslen = -1;
+    char message[1024];
+    char teleNum[1024];
+    int numLen = -1;
+    int current = -1;
+    int total = -1;
+    QSER_sms_info_t QSER_sms_info;
+    while (1)
+    {
+        if(!lynq_wait_receive_new_sms(&handle))
+        {
+            if(!lynq_read_sms(handle,&status,&charset,smsc,&smscLen,&smslen,message,teleNum,&numLen,&current,&total))
+            {
+                QSER_sms_info.storage_index = handle;
+                QSER_sms_info.format = (QSER_SMS_T)charset;
+                memcpy(QSER_sms_info.sms_data, message, smslen);
+                QSER_sms_info.sms_data[smslen] = '\0';
+                QSER_sms_info.sms_data_len = smslen;
+                if(total > 1)
+                {
+                    QSER_sms_info.user_data_head_valid = 1;
+                }
+                else
+                {
+                    QSER_sms_info.user_data_head_valid = 0;
+                }
+                tmp(&QSER_sms_info, &h_sms);
+            }
+            else
+            {
+                LYDBGLOG("lynq_read_sms error\n");
+            }
+        }
+        else
+        {
+            LYDBGLOG("lynq_wait_receive_new_sms error\n");
+            break;
+        }
+    }
+    return NULL;
+}
+
+int qser_sms_client_init(sms_client_handle_type  *ph_sms)
+{
+    if(NULL == ph_sms)
+    {
+        LYERRLOG("input error\n");
+        return SMS_PARAM_ERR;
+    }
+    *ph_sms = (sms_client_handle_type)getpid();
+    h_sms = *ph_sms;
+    return lynq_sms_init(*ph_sms);
+}
+
+int qser_sms_client_deinit(sms_client_handle_type h_sms)
+{
+    if(h_sms == 0)
+    {
+        LYERRLOG("not init\n");
+        return SMS_PARAM_ERR;
+    }
+    return lynq_sms_deinit();
+}
+
+int qser_sms_send_sms(sms_client_handle_type h_sms, QSER_sms_info_t *pt_sms_info)
+{
+    if(NULL == pt_sms_info)
+    {
+        LYERRLOG("input error\n");
+        return SMS_PARAM_ERR;
+    }
+    if(h_sms == 0)
+    {
+        LYERRLOG("not init\n");
+        return SMS_PARAM_ERR;
+    }
+    return lynq_send_sms(pt_sms_info->src_addr, pt_sms_info->type, pt_sms_info->sms_data, pt_sms_info->sms_data_len);
+}
+
+int qser_sms_addrxmsghandler(QSER_SMS_RxMsgHandlerFunc_t handlerPtr, void* contextPtr)
+{
+    if(NULL == handlerPtr)
+    {
+        return SMS_PARAM_ERR;
+    }
+    if(NULL == contextPtr)
+    {
+        return SMS_PARAM_ERR;
+    }
+    tmp = handlerPtr;
+    pthread_t lynq_new_sms_tid = -1;
+    int rt = pthread_create(&lynq_new_sms_tid, NULL, new_sms_thread_recv, NULL);
+    if(rt < 0)
+    {
+        LYDBGLOG("qser_sms_addrxmsghandler pthread_create error!!!\n");
+        return -1;
+    }
+    return SMS_OK;
+}
+
+int qser_sms_deletefromstorage(sms_client_handle_type  h_sms, QSER_sms_storage_info_t  *pt_sms_storage)
+{
+    if(NULL == pt_sms_storage)
+    {
+        LYERRLOG("input error\n");
+        return SMS_PARAM_ERR;
+    }
+    if(h_sms == 0)
+    {
+        LYERRLOG("not init\n");
+        return SMS_PARAM_ERR;
+    }
+    return lynq_delete_sms(pt_sms_storage->storage_idx);
+}
+
+int qser_sms_send_smspdu(sms_client_handle_type h_sms, QSER_wms_send_raw_message_data_t *raw_messagdata, QSER_wms_raw_send_resp_t *rawresp)
+{
+    if(NULL == raw_messagdata)
+    {
+        LYERRLOG("input error\n");
+        return SMS_PARAM_ERR;
+    }
+    if(NULL == rawresp)
+    {
+        LYERRLOG("input error\n");
+        return SMS_PARAM_ERR;
+    }
+    if(h_sms == 0)
+    {
+        LYERRLOG("not init\n");
+        return SMS_PARAM_ERR;
+    }
+    LYERRLOG("not support\n");
+    return 0;
+}
+
+int qser_sms_getsmscenteraddress( sms_client_handle_type h_sms, QSER_sms_service_center_cfg_t *set_sca_cfg)
+{
+    if(NULL == set_sca_cfg)
+    {
+        LYERRLOG("input error\n");
+        return SMS_PARAM_ERR;
+    }
+    if(h_sms == 0)
+    {
+        LYERRLOG("not init\n");
+        return SMS_PARAM_ERR;
+    }
+    return lynq_get_smsc_address(set_sca_cfg->service_center_addr);
+}
+
+int qser_sms_setsmscenteraddress( sms_client_handle_type h_sms, QSER_sms_service_center_cfg_t *get_sca_cfg)
+{
+    if(NULL == get_sca_cfg)
+    {
+        LYERRLOG("input error\n");
+        return SMS_PARAM_ERR;
+    }
+    if(h_sms == 0)
+    {
+        LYERRLOG("not init\n");
+        return SMS_PARAM_ERR;
+    }
+    return lynq_set_smsc_address(get_sca_cfg->service_center_addr);
+}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/makefile
new file mode 100755
index 0000000..82a52b4
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sms/makefile
@@ -0,0 +1,65 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+                -std=gnu++14 \
+                -g -Os \
+                -flto \
+                -fPIC \
+                -fpermissive \
+
+
+
+$(warning ################# lynq qser sms demo ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH   = .
+
+LOCAL_C_INCLUDES = \
+  -I. \
+  -I$(LOCAL_PATH)/include/ \
+  -I$(ROOT)$(includedir)/logger \
+  -I$(ROOT)$(includedir)/liblog \
+  -I$(ROOT)$(includedir)/libsms \
+
+
+LOCAL_LIBS := \
+    -L. \
+    -lstdc++ \
+    -lcutils \
+    -lutils \
+    -lpthread \
+    -llynq-log \
+    -llynq-sms \
+
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-qser-sms.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs 
+all: build
+$(EXECUTABLE): $(OBJECTS)
+	$(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+	$(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build:  $(EXECUTABLE)
+	$(warning ########## build $(EXECUTABLE)  ##########)
+install:
+	mkdir -p $(ROOT)$(base_libdir)/
+	install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+	mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+pack_rootfs:
+	mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+	cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+	$(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+	mkdir -p $(PACK_TO)$(base_libdir)/
+	cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+	$(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+	$(RM) $(OBJECTS) $(EXECUTABLE)
+	-find . -name "*.o" -delete
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sim/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-sim/LICENSE
index 77f59ed..605b7ea 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sim/LICENSE
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sim/LICENSE
@@ -1,31 +1,31 @@
 Copyright Statement:
 
-This software/firmware and related documentation ("MediaTek Software") are
+This software/firmware and related documentation ("MobileTek Software") are
 protected under relevant copyright laws. The information contained herein is
-confidential and proprietary to MediaTek Inc. and/or its licensors. Without
-the prior written permission of MediaTek inc. and/or its licensors, any
-reproduction, modification, use or disclosure of MediaTek Software, and
+confidential and proprietary to MobileTek Inc. and/or its licensors. Without
+the prior written permission of MobileTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MobileTek Software, and
 information contained herein, in whole or in part, shall be strictly
 prohibited.
 
-MediaTek Inc. (C) 2015. All rights reserved.
+MobileTek Inc. (C) 2015. All rights reserved.
 
 BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
-THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
-RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
-ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MobileTek SOFTWARE")
+RECEIVED FROM MobileTek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MobileTek EXPRESSLY DISCLAIMS ANY AND ALL
 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
-NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+NONINFRINGEMENT. NEITHER DOES MobileTek PROVIDE ANY WARRANTY WHATSOEVER WITH
 RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
-INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+INCORPORATED IN, OR SUPPLIED WITH THE MobileTek SOFTWARE, AND RECEIVER AGREES
 TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
 RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
-OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
-SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MobileTek
+SOFTWARE. MobileTek SHALL ALSO NOT BE RESPONSIBLE FOR ANY MobileTek SOFTWARE
 RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
-STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
-ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
-RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
-MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
-CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MobileTek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MobileTek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MobileTek'S OPTION, TO REVISE OR REPLACE THE
+MobileTek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MobileTek FOR SUCH MobileTek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
index 293cc82..2ec043b 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
@@ -27,7 +27,7 @@
     -llynq-sms \
     -llynq-network \
     -llynq-data \
-
+    -llynq-sim \
 
 
 SOURCES = main.cpp cc.cpp dispatch.cpp sms.cpp network.cpp data.cpp