Add mbtk ecall v1 API.
Change-Id: Icfdb8ccf399a4e052484f6419e44755780c04725
diff --git a/mbtk/libmbtk_lib/ril/mbtk_info.h b/mbtk/libmbtk_lib/ril/mbtk_info.h
index d51ed69..462e2b9 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info.h
+++ b/mbtk/libmbtk_lib/ril/mbtk_info.h
@@ -254,6 +254,47 @@
MBTK_INFO_ID_LED_RSP,
MBTK_INFO_ID_LED_END,
+ // Ecall
+ RIL_MSG_ID_ECALL_BEGIN = 9000,
+ // mbtk_ecall_msd_cfg_info_t
+ RIL_MSG_ID_ECALL_MSDCFG_REQ,
+ RIL_MSG_ID_ECALL_MSDCFG_RSP,
+ // NULL
+ RIL_MSG_ID_ECALL_MSDGEN_REQ,
+ RIL_MSG_ID_ECALL_MSDGEN_RSP,
+ // uint8[]
+ RIL_MSG_ID_ECALL_MSD_REQ,
+ RIL_MSG_ID_ECALL_MSD_RSP,
+ // NULL
+ RIL_MSG_ID_ECALL_PUSH_REQ,
+ RIL_MSG_ID_ECALL_PUSH_RSP,
+ // mbtk_ecall_only_info_t
+ RIL_MSG_ID_ECALL_ONLY_REQ,
+ RIL_MSG_ID_ECALL_ONLY_RSP,
+ // reg <uint8>
+ RIL_MSG_ID_ECALL_REG_REQ,
+ RIL_MSG_ID_ECALL_REG_RSP,
+ // mbtk_ecall_dial_type_enum
+ RIL_MSG_ID_ECALL_DIAL_REQ,
+ RIL_MSG_ID_ECALL_DIAL_RSP,
+ // mbtk_ecall_mode_type_enum
+ RIL_MSG_ID_ECALL_MODE_REQ,
+ RIL_MSG_ID_ECALL_MODE_RSP,
+ // mbtk_ecall_cfg_item_enum / mbtk_ecall_cfg_info_t
+ RIL_MSG_ID_ECALL_CFG_REQ,
+ RIL_MSG_ID_ECALL_CFG_RSP,
+ // uint8[]
+ RIL_MSG_ID_ECALL_SMS_NUM_REQ,
+ RIL_MSG_ID_ECALL_SMS_NUM_RSP,
+ // uint8
+ RIL_MSG_ID_ECALL_MUTESPK_REQ,
+ RIL_MSG_ID_ECALL_MUTESPK_RSP,
+ // mbtk_ecall_gain_info_t
+ RIL_MSG_ID_ECALL_DSP_GAIN_REQ,
+ RIL_MSG_ID_ECALL_DSP_GAIN_RSP,
+
+ RIL_MSG_ID_ECALL_END,
+
// IND Information
MBTK_INFO_ID_IND_BEGIN = 10000,
// <uint8> State
diff --git a/mbtk/libmbtk_lib/ril/mbtk_info_api.c b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
index 222bcf1..b751aa6 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info_api.c
+++ b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
@@ -2490,6 +2490,415 @@
return info_item_process(handle, MBTK_INFO_ID_LED_REQ, buff, 2, NULL) ? handle->info_err : 0;
}
+
+/*
+* Set msd item.
+*
+*/
+int mbtk_ecall_msd_item_set(mbtk_info_handle_t* handle, const mbtk_ecall_msd_cfg_info_t *msd_cfg)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(msd_cfg == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_MSDCFG_REQ, msd_cfg, sizeof(mbtk_ecall_msd_cfg_info_t), NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Generate msd after msd item set.
+*
+*/
+int mbtk_ecall_msd_gen(mbtk_info_handle_t* handle)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_MSDGEN_REQ, NULL, 0, NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall msd.
+*
+*/
+int mbtk_ecall_msd_set(mbtk_info_handle_t* handle, const void* msd)
+{
+ if(handle == NULL || str_empty(msd))
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_MSD_REQ, msd, strlen(msd), NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Get ecall msd.
+*
+*/
+int mbtk_ecall_msd_get(mbtk_info_handle_t* handle, void* msd)
+{
+ if(!handle)
+ {
+ return -1;
+ }
+
+ if(msd == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_MSD_REQ, NULL, 0, msd) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+
+/*
+* Set ecall msd item.
+*
+*/
+int mbtk_ecall_push(mbtk_info_handle_t* handle)
+{
+ if(!handle)
+ {
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_PUSH_REQ, NULL, 0, NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall only configs.
+*
+*/
+int mbtk_ecall_only_set(mbtk_info_handle_t* handle, const mbtk_ecall_only_info_t* info)
+{
+ if(!handle)
+ {
+ return -1;
+ }
+
+ if(info == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_ONLY_REQ, info, sizeof(mbtk_ecall_only_info_t), NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Get ecall only configs.
+*
+*/
+int mbtk_ecall_only_get(mbtk_info_handle_t* handle, mbtk_ecall_only_info_t* info)
+{
+ if(!handle)
+ {
+ return -1;
+ }
+
+ if(info == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_ONLY_REQ, NULL, 0, info) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall network reg.
+*
+*/
+int mbtk_ecall_reg_set(mbtk_info_handle_t* handle, int reg)
+{
+ if(!handle)
+ {
+ return -1;
+ }
+
+ if(reg != 0 && reg != 1)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_REG_REQ, ®, 1, NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Start ecall dial start.
+*
+*/
+int mbtk_ecall_dial_start(mbtk_info_handle_t* handle, mbtk_ecall_dial_type_enum type)
+{
+ if(!handle)
+ {
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_DIAL_REQ, &type, 1, NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Get ecall dial state.
+*
+*/
+int mbtk_ecall_dial_state_get(mbtk_info_handle_t* handle, mbtk_ecall_dial_type_enum* type)
+{
+ if(!handle)
+ {
+ return -1;
+ }
+
+ if(type == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+ memset(type, 0, sizeof(mbtk_ecall_dial_type_enum));
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_DIAL_REQ, NULL, 0, type) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall mode.
+*
+*/
+int mbtk_ecall_mode_set(mbtk_info_handle_t* handle, mbtk_ecall_mode_type_enum mode)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_MODE_REQ, &mode, 1, NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Get ecall mode.
+*
+*/
+int mbtk_ecall_mode_get(mbtk_info_handle_t* handle, mbtk_ecall_mode_type_enum *mode)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(mode == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+ memset(mode, 0, sizeof(mbtk_ecall_mode_type_enum));
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_MODE_REQ, NULL, 0, mode) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall configs.
+*
+*/
+int mbtk_ecall_cfg_set(mbtk_info_handle_t* handle, const mbtk_ecall_cfg_info_t *cfg)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(cfg == NULL || cfg->type >= MBTK_ECALL_CFG_ITEM_MAX)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_CFG_REQ, cfg, sizeof(mbtk_ecall_cfg_info_t), NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Get ecall configs.
+*
+*/
+int mbtk_ecall_cfg_get(mbtk_info_handle_t* handle, mbtk_ecall_cfg_info_t* cfg)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(cfg == NULL || cfg->type >= MBTK_ECALL_CFG_ITEM_MAX)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+ mbtk_ecall_cfg_item_enum type = cfg->type;
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_CFG_REQ, &type, 1, cfg) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall sms number.
+*
+*/
+int mbtk_ecall_sms_number_set(mbtk_info_handle_t* handle, const void *number)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(str_empty(number))
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_SMS_NUM_REQ, number, strlen(number), NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Get ecall sms number.
+*
+*/
+int mbtk_ecall_sms_number_get(mbtk_info_handle_t* handle, void *number)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(number == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_SMS_NUM_REQ, NULL, 0, number) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall mute speaker.
+*
+*/
+int mbtk_ecall_mute_spk_set(mbtk_info_handle_t* handle, int mute)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(mute != 0 && mute != 1)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_MUTESPK_REQ, &mute, 1, NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+/*
+* Set ecall dsp gain.
+*
+*/
+int mbtk_ecall_dsp_gain_set(mbtk_info_handle_t* handle, const mbtk_ecall_gain_info_t *gain_info)
+{
+ if(handle == NULL)
+ {
+ return -1;
+ }
+
+ if(gain_info == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, RIL_MSG_ID_ECALL_DSP_GAIN_REQ, gain_info, sizeof(mbtk_ecall_gain_info_t), NULL) >= 0) {
+ return 0;
+ } else {
+ return handle->info_err;
+ }
+}
+
+
/*
* Set pdp state change callback function.
*/