Fix build error for ecall
Change-Id: I019c8d22f30d6125d74ca1fd6e0107e02e517fe0
diff --git a/mbtk/include/mbtk/mbtk_info_api.h b/mbtk/include/mbtk/mbtk_info_api.h
index 8a90395..3877e54 100755
--- a/mbtk/include/mbtk/mbtk_info_api.h
+++ b/mbtk/include/mbtk/mbtk_info_api.h
@@ -129,6 +129,8 @@
mbtk_info_callback_func pdp_state_cb;
//add signal by xr
mbtk_info_callback_func signal_state_cb;
+
+ mbtk_info_callback_func ecall_state_cb;
} mbtk_info_handle_t;
typedef struct
@@ -265,7 +267,7 @@
typedef enum {
MBTK_PIN_DISABLE = 0,
- MBTK_PIN_ENABLE = 1,
+ MBTK_PIN_ENABLE = 1,
}mbtk_pin_state_enum;
typedef enum {
@@ -523,15 +525,21 @@
#endif
} mbtk_apn_auth_proto_enum;
+typedef struct
+{
+ uint8 urc_id;
+ uint8 urc_data[5];
+} mbtk_ril_ecall_state_info_t;
+
typedef struct {
int cid; /*!< UMTS/CDMA profile ID. range: 0 - 7*/
mbtk_ip_type_enum ip_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload
exchanged over the airlink when the packet data session is
- established with this profile. */
+ established with this profile. */
mbtk_apn_req_type_enum req_type; /*!< apn req type*/
mbtk_apn_auth_proto_enum auth_proto; /*!< Authentication Protocol. */
uint8 apn_name[MBTK_APN_NAME_SIZE]; /*!< A string parameter that is a logical name used to select the GGSN
- and external packet data network. */
+ and external packet data network. */
uint8 user_name[MBTK_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
uint8 user_pass[MBTK_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
uint8 apn_type[MBTK_APN_TYPE_SIZE];
@@ -1053,6 +1061,8 @@
*/
int mbtk_ril_server_state_change_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+int mbtk_ecall_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
int mbtk_sms_cnmi_set(mbtk_info_handle_t* handle);
int mbtk_get_modem_version(mbtk_info_handle_t* handle, void *modem_version);
diff --git a/mbtk/libmbtk_lib/ril/mbtk_info.h b/mbtk/libmbtk_lib/ril/mbtk_info.h
index f1679f2..d51ed69 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info.h
+++ b/mbtk/libmbtk_lib/ril/mbtk_info.h
@@ -59,10 +59,10 @@
MBTK_INFO_ID_DEV_MODEM_REQ,
MBTK_INFO_ID_DEV_MODEM_RSP,
-
+
MBTK_INFO_ID_DEV_MD_VERSION_REQ,
MBTK_INFO_ID_DEV_MD_VERSION_RSP,
-
+
MBTK_INFO_ID_DEV_END,
// Sim Information
@@ -272,7 +272,8 @@
MBTK_INFO_ID_IND_SERVER_STATE_CHANGE,////mbtk wyq for server_ready_status add
// <uint8> State
MBTK_INFO_ID_IND_SIGNAL_STATE_CHANGE,
-
+ //
+ MBTK_INFO_ID_IND_ECALL_STATE_CHANGE,
MBTK_INFO_ID_IND_END,
MBTK_INFO_ID_REQ_UNKNOWN // Unknown information.
diff --git a/mbtk/libmbtk_lib/ril/mbtk_info_api.c b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
index 1dc3464..222bcf1 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info_api.c
+++ b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
@@ -2631,6 +2631,21 @@
return 0;
}
+int mbtk_ecall_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb)
+{
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+ if(info_item_process(handle, MBTK_INFO_ID_IND_ECALL_STATE_CHANGE, NULL, 0, NULL) < 0) {
+ return handle->info_err;
+ } else {
+ handle->ecall_state_cb = cb;
+ return 0;
+ }
+}
+
int mbtk_get_modem_version(mbtk_info_handle_t* handle, void *modem_version)
{
@@ -2648,3 +2663,4 @@
}
}
+
diff --git a/mbtk/test/libmbtk_ecall/Makefile b/mbtk/test/libmbtk_ecall/Makefile
index 8d29a6a..a8a941b 100755
--- a/mbtk/test/libmbtk_ecall/Makefile
+++ b/mbtk/test/libmbtk_ecall/Makefile
@@ -5,13 +5,18 @@
LIB_DIR +=
-LIBS += -lmbtk_lib -lmbtk_net -lmbtk_coap
+LIBS += -lmbtk_lib
-CFLAGS +=
+CFLAGS +=
DEFINE +=
-LOCAL_SRC_FILES = $(wildcard *.c) $(wildcard *.cpp)
+# LOCAL_SRC_FILES = $(wildcard *.c) $(wildcard *.cpp)
+ifeq ($(MBTK_SOURCE_VERSION), 2)
+LOCAL_SRC_FILES = mbtk_ecall_test_v2.c
+else
+LOCAL_SRC_FILES = mbtk_ecall_test_v1.c
+endif
$(info LOCAL_SRC_FILES = $(LOCAL_SRC_FILES))
diff --git a/mbtk/test/libmbtk_ecall/mbtk_ecall_test_v1.c b/mbtk/test/libmbtk_ecall/mbtk_ecall_test_v1.c
new file mode 100755
index 0000000..0f18108
--- /dev/null
+++ b/mbtk/test/libmbtk_ecall/mbtk_ecall_test_v1.c
@@ -0,0 +1,143 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <pthread.h>
+#include <sys/epoll.h>
+#include <string.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include "mbtk_info_api.h"
+
+static mbtk_info_handle_t* info_handle = NULL;
+
+
+static void help()
+{
+ printf("msdcfg <item> <value>: Set MSD item value.\n");
+ printf("msdgen: Generate MSD by items.\n");
+ printf("msd <MSD>: Get/Set MSD.\n");
+ printf("msdpush: PUSH MSD.\n");
+ printf("only <0-5> <test_num> <reconfig_num>: Get/Set ecall only mode.\n");
+ printf("reg 0/1: Set ecall reg mode.\n");
+ printf("dial <0-5>: Get/Start ecall dial.\n");
+ printf("mode EU/ERA: Get/Set ecall mode\n");
+ printf("cfg <type> <value>: Get/Set ecall config item.\n");
+ printf("sms_num <number>: Get/Set sms number.\n");
+ printf("mute_spk <0/1>: Set spk mute or not.\n");
+ printf("gain <0/1/2> <gain>: Set ecall DSP gain.\n");
+}
+
+static void ecall_state_change_cb(const void* data, int data_len)
+{
+ if(data)
+ {
+ mbtk_ril_ecall_state_info_t *ecall_data = (mbtk_ril_ecall_state_info_t*)data;
+ printf("ecall state change : urc_id - %d, urc_data - %s\n", ecall_data->urc_id, ecall_data->urc_data);
+ }
+}
+
+
+static void sig_process(int sig)
+{
+ LOGI("I got signal %d\n", sig);
+ switch(sig)
+ {
+ case SIGINT: // Ctrl + C
+ {
+ LOGI("Exit by SIGINT.\n");
+ mbtk_info_handle_free(&info_handle);
+ exit(0);
+ }
+ case SIGQUIT: // Ctrl + \ (类似 SIGINT ,但要产生core文件)
+ {
+ LOGI("Exit by SIGQUIT.\n");
+ mbtk_info_handle_free(&info_handle);
+ exit(0);
+ }
+ case SIGTERM:// 默认kill (同 SIGKILL ,但 SIGKILL 不可捕获)
+ {
+ LOGI("Exit by SIGTERM.\n");
+ mbtk_info_handle_free(&info_handle);
+ exit(0);
+ }
+ case SIGTSTP:// Ctrl + Z (同 SIGSTOP ,但 SIGSTOP 不可捕获)
+ {
+ LOGI("Exit by SIGTSTP.\n");
+ exit(0);
+ }
+ case SIGSEGV: // 如空指针
+ {
+ LOGI("Exit by SIGSEGV.\n");
+ exit(0);
+ }
+ default:
+ {
+ LOGI("Unknown sig:%d\n",sig);
+ break;
+ }
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ signal(SIGINT, sig_process);
+ signal(SIGQUIT, sig_process);
+ signal(SIGTERM, sig_process);
+ //signal(SIGTSTP, sig_process);
+ //signal(SIGSEGV, sig_process);
+
+ mbtk_log_init("radio","ECALL_CLI");
+
+#ifdef MBTK_DUMP_SUPPORT
+ mbtk_debug_open(NULL, TRUE);
+#endif
+
+ //test2(0, "192.168.1.198");
+ //test2(1, "2409:8162:140:cd3c:1:2:1494:72ba");
+ //test2(1, "254.128.0.0.0.0.0.0.0.1.0.2.144.5.212.239");
+ //test2(1, "2400:3200::1");
+
+ info_handle = mbtk_info_handle_get();
+ if(!info_handle)
+ {
+ return -1;
+ }
+
+ mbtk_ecall_state_change_cb_reg(info_handle, ecall_state_change_cb);
+
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>Enter cmd:\n");
+ char cmd[1024];
+ while(1)
+ {
+ memset(cmd, 0, sizeof(cmd));
+ if(fgets(cmd, sizeof(cmd), stdin))
+ {
+ char *ptr = cmd + strlen(cmd) - 1;
+ while(ptr >= cmd && (*ptr == '\r' || *ptr == '\n'))
+ {
+ *ptr-- = '\0';
+ }
+
+ if(!strcasecmp(cmd, "h") || !strcasecmp(cmd, "help")) {
+ help();
+ } else if(!strcasecmp(cmd, "q")) {
+ break;
+ } else {
+ printf("\n");
+ }
+ }
+ }
+
+exit:
+ mbtk_info_handle_free(&info_handle);
+
+ LOG("Client exec complete.");
+
+ return 0;
+}
+