Add Multiple AT channels supported for ril api v2
Change-Id: I53f574c85d07bd7b8e0dd15d2e596d23c8772907
diff --git a/mbtk/libmbtk_lib_v2/ril/mbtk_ril.h b/mbtk/libmbtk_lib_v2/ril/mbtk_ril.h
index b8b21b5..678a316 100755
--- a/mbtk/libmbtk_lib_v2/ril/mbtk_ril.h
+++ b/mbtk/libmbtk_lib_v2/ril/mbtk_ril.h
@@ -19,8 +19,8 @@
// Tag(4) + Packet_Length(2)
#define RIL_SOCK_PACK_EXTRA_LEN 6
-// RIL_SOCK_PACK_EXTRA_LEN + Index(2) + Type(2) + Id(2) + Error(2) + data_len(2)
-#define RIL_SOCK_PACK_LEN_MIN (RIL_SOCK_PACK_EXTRA_LEN + 10)
+// RIL_SOCK_PACK_EXTRA_LEN + at_port(1) + Index(2) + Type(2) + Id(2) + Error(2) + data_len(2)
+#define RIL_SOCK_PACK_LEN_MIN (RIL_SOCK_PACK_EXTRA_LEN + 11)
#define RIL_MSG_INDEX_AUTO (-1) // automatically , refor to : ril_index
#define RIL_MSG_INDEX_INVALID (0) // Invalid msg index.
@@ -231,6 +231,7 @@
uint32 tag; // Refor to : RIL_SOCK_PACKET_TAG
uint16 msg_len;
+ uint8 at_port; // ATPortType_enum
uint16 msg_index; // Message index(Start from 1)
// 0 : For unknown msg id
uint16 msg_type; // Refor to : ril_msg_type_enum
@@ -396,7 +397,7 @@
void ril_msg_pack_free(ril_msg_pack_info_t* pack);
-ril_msg_pack_info_t* ril_msg_pack_creat(int msg_type, int msg_id, int msg_index, const void *data, int data_len);
+ril_msg_pack_info_t* ril_msg_pack_creat(ATPortType_enum port, int msg_type, int msg_id, int msg_index, const void *data, int data_len);
int ril_pack_send(int fd, ril_msg_pack_info_t *pack);
diff --git a/mbtk/libmbtk_lib_v2/ril/mbtk_ril_api.c b/mbtk/libmbtk_lib_v2/ril/mbtk_ril_api.c
index 663bb54..ae35fd4 100755
--- a/mbtk/libmbtk_lib_v2/ril/mbtk_ril_api.c
+++ b/mbtk/libmbtk_lib_v2/ril/mbtk_ril_api.c
@@ -18,8 +18,15 @@
#include "mbtk_str.h"
typedef struct {
+ ATPortType_enum port;
+ bool enable;
+} ril_at_port_info_t;
+
+typedef struct {
int cli_fd;
bool ril_ready;
+
+ ril_at_port_info_t ports[ATPORTTYPE_NUM];
int exit_fd[2];
mbtk_ril_callback_func cb[IND_REGISTER_MAX];
pthread_t read_thread_id;
@@ -348,13 +355,14 @@
* Return recv data length.
* -1 : fail.
*/
-static mbtk_ril_err_enum ril_req_process(ril_msg_id_enum id,
+static mbtk_ril_err_enum ril_req_process(ATPortType_enum port,
+ ril_msg_id_enum id,
const void *req,
int req_len,
void *rsp,
bool is_async)
{
- ril_msg_pack_info_t* pack = ril_msg_pack_creat(RIL_MSG_TYPE_REQ, id, RIL_MSG_INDEX_AUTO, req, req_len);
+ ril_msg_pack_info_t* pack = ril_msg_pack_creat(port, RIL_MSG_TYPE_REQ, id, RIL_MSG_INDEX_AUTO, req, req_len);
if(pack == NULL)
{
return MBTK_RIL_ERR_MEMORY;
@@ -429,18 +437,39 @@
MBTK_SOURCE_INFO_PRINT("mbtk_ril_lib");
}
-mbtk_ril_err_enum mbtk_ril_init()
+static bool at_port_check(ATPortType_enum port)
{
+ if(port < ATPORTTYPE_0 || port >= ATPORTTYPE_NUM) {
+ return FALSE;
+ }
+
+ return ril_cli.ports[port].port == port && ril_cli.ports[port].enable;
+}
+
+mbtk_ril_handle* mbtk_ril_open(ATPortType_enum port)
+{
+ if(port < ATPORTTYPE_0 || port >= ATPORTTYPE_NUM) {
+ LOGE("Port(%d) error.", port);
+ return NULL;
+ }
+
if(ril_cli.ril_ready)
{
- return MBTK_RIL_ERR_INITED;
+ if(at_port_check(port)) {
+ LOGW("Port(%d) can not reopen.", port);
+ return NULL;
+ } else {
+ ril_cli.ports[port].port = port;
+ ril_cli.ports[port].enable = TRUE;
+ return &(ril_cli.ports[port]);
+ }
}
ril_cli.cli_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
if(ril_cli.cli_fd < 0)
{
LOGE("socket() fail[%d].", errno);
- return MBTK_RIL_ERR_UNKNOWN;
+ return NULL;
}
// Set O_NONBLOCK
@@ -518,7 +547,9 @@
LOGD("RIL server ready...");
- return MBTK_RIL_ERR_SUCCESS;
+ ril_cli.ports[port].port = port;
+ ril_cli.ports[port].enable = TRUE;
+ return &(ril_cli.ports[port]);
error:
if(ril_cli.cli_fd > 0)
{
@@ -536,172 +567,220 @@
ril_cli.exit_fd[1] = -1;
}
- return MBTK_RIL_ERR_UNKNOWN;
+ return NULL;
}
-mbtk_ril_err_enum mbtk_ril_deinit()
+mbtk_ril_err_enum mbtk_ril_close(ATPortType_enum port)
{
- if(!ril_cli.ril_ready)
- {
- return MBTK_RIL_ERR_NOT_INIT;
+ if(!at_port_check(port)) {
+ return MBTK_RIL_ERR_PORT;
}
- if(ril_cli.exit_fd[1] > 0)
- {
- if(write(ril_cli.exit_fd[1], "EXIT", 4) != 4) {
- return MBTK_RIL_ERR_UNKNOWN;
+ ril_cli.ports[port].enable = FALSE;
+ ril_cli.ports[port].port = ATPORTTYPE_NON;
+
+ // All port is close ???
+ int i = ATPORTTYPE_0;
+ for(; i < ATPORTTYPE_NUM; i++) {
+ if(ril_cli.ports[i].enable)
+ break;
+ }
+
+ if(i == ATPORTTYPE_NUM) { // All port is close.
+ if(!ril_cli.ril_ready)
+ {
+ return MBTK_RIL_ERR_NOT_INIT;
}
+
+ if(ril_cli.exit_fd[1] > 0)
+ {
+ if(write(ril_cli.exit_fd[1], "EXIT", 4) != 4) {
+ return MBTK_RIL_ERR_UNKNOWN;
+ }
+ }
+
+ // Wait read_thread exit.
+ pthread_join(ril_cli.read_thread_id,NULL);
+
+ if(ril_cli.exit_fd[0] > 0)
+ {
+ close(ril_cli.exit_fd[0]);
+ ril_cli.exit_fd[0] = -1;
+ }
+
+ if(ril_cli.exit_fd[1] > 0)
+ {
+ close(ril_cli.exit_fd[1]);
+ ril_cli.exit_fd[1] = -1;
+ }
+
+ if(ril_cli.cli_fd > 0)
+ {
+ close(ril_cli.cli_fd);
+ ril_cli.cli_fd = -1;
+ }
+
+ pthread_mutex_destroy(&ril_cli.send_mutex);
+ if(ril_cli.msg_list) {
+ list_free(ril_cli.msg_list);
+ }
+ if(ril_cli.cli_thread_list) {
+ list_free(ril_cli.cli_thread_list);
+ }
+
+ ril_cli.ril_ready = FALSE;
+
+ return MBTK_RIL_ERR_SUCCESS;
+ } else {
+ return MBTK_RIL_ERR_PORT_NOT_CLOSE;
}
-
- // Wait read_thread exit.
- pthread_join(ril_cli.read_thread_id,NULL);
-
- if(ril_cli.exit_fd[0] > 0)
- {
- close(ril_cli.exit_fd[0]);
- ril_cli.exit_fd[0] = -1;
- }
-
- if(ril_cli.exit_fd[1] > 0)
- {
- close(ril_cli.exit_fd[1]);
- ril_cli.exit_fd[1] = -1;
- }
-
- if(ril_cli.cli_fd > 0)
- {
- close(ril_cli.cli_fd);
- ril_cli.cli_fd = -1;
- }
-
- pthread_mutex_destroy(&ril_cli.send_mutex);
- if(ril_cli.msg_list) {
- list_free(ril_cli.msg_list);
- }
- if(ril_cli.cli_thread_list) {
- list_free(ril_cli.cli_thread_list);
- }
-
- ril_cli.ril_ready = FALSE;
-
- return MBTK_RIL_ERR_SUCCESS;
}
/*
* Get platform version.
*/
-mbtk_ril_err_enum mbtk_version_get(void *version)
+mbtk_ril_err_enum mbtk_version_get(mbtk_ril_handle* handle, void *version)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(version == NULL)
+ if(version == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DEV_VERSION, NULL, 0, version, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_VERSION, NULL, 0, version, FALSE);
}
/*
* Get platform version.
*/
-mbtk_ril_err_enum mbtk_model_get(void *model)
+mbtk_ril_err_enum mbtk_model_get(mbtk_ril_handle* handle, void *model)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(model == NULL)
+ if(model == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DEV_MODEL, NULL, 0, model, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_MODEL, NULL, 0, model, FALSE);
}
/*
* Get platform IMEI.
*/
-mbtk_ril_err_enum mbtk_imei_get(void *imei)
+mbtk_ril_err_enum mbtk_imei_get(mbtk_ril_handle* handle, void *imei)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(imei == NULL)
+ if(imei == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DEV_IMEI, NULL, 0, imei, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_IMEI, NULL, 0, imei, FALSE);
}
/*
* Get platform SN.
*/
-mbtk_ril_err_enum mbtk_sn_get(void *sn)
+mbtk_ril_err_enum mbtk_sn_get(mbtk_ril_handle* handle, void *sn)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(sn == NULL)
+ if(sn == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DEV_SN, NULL, 0, sn, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_SN, NULL, 0, sn, FALSE);
}
/*
* Get platform MEID.
*/
-mbtk_ril_err_enum mbtk_meid_get(void *meid)
+mbtk_ril_err_enum mbtk_meid_get(mbtk_ril_handle* handle, void *meid)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(meid == NULL)
+ if(meid == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DEV_MEID, NULL, 0, meid, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_MEID, NULL, 0, meid, FALSE);
}
/*
* Return VoLTE state.
*/
-mbtk_ril_err_enum mbtk_volte_state_get(int *volte_state)
+mbtk_ril_err_enum mbtk_volte_state_get(mbtk_ril_handle* handle, int *volte_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(volte_state == NULL)
+ if(volte_state == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DEV_VOLTE, NULL, 0, volte_state, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_VOLTE, NULL, 0, volte_state, FALSE);
}
/*
@@ -713,40 +792,50 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_volte_state_set(int volte_state)
+mbtk_ril_err_enum mbtk_volte_state_set(mbtk_ril_handle* handle, int volte_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(volte_state != 0 && volte_state != 1)
+ if((volte_state != 0 && volte_state != 1) || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DEV_VOLTE, &volte_state, 1, NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_VOLTE, &volte_state, 1, NULL, FALSE);
}
/*
* Return radio state.
*/
-mbtk_ril_err_enum mbtk_radio_state_get(mbtk_radio_state_enum *radio_state)
+mbtk_ril_err_enum mbtk_radio_state_get(mbtk_ril_handle* handle, mbtk_radio_state_enum *radio_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(radio_state == NULL)
+ if(radio_state == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
uint8 result;
- mbtk_ril_err_enum err = ril_req_process(RIL_MSG_ID_DEV_MODEM, NULL, 0, &result, FALSE);
+ mbtk_ril_err_enum err = ril_req_process(port_info->port, RIL_MSG_ID_DEV_MODEM, NULL, 0, &result, FALSE);
*radio_state = (mbtk_radio_state_enum)result;
return err;
}
@@ -758,24 +847,29 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_radio_state_set(mbtk_radio_state_enum radio_state, bool reset_modem)
+mbtk_ril_err_enum mbtk_radio_state_set(mbtk_ril_handle* handle, mbtk_radio_state_enum radio_state, bool reset_modem)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(radio_state == MBTK_RADIO_STATE_UNKNOWN)
+ if(radio_state == MBTK_RADIO_STATE_UNKNOWN || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
uint8 buff[2];
buff[0] = (uint8)radio_state;
buff[1] = reset_modem ? 1 : 0;
- return ril_req_process(RIL_MSG_ID_DEV_MODEM, buff, 2, NULL, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_DEV_MODEM, buff, 2, NULL, FALSE);
}
/*
@@ -787,22 +881,27 @@
* temp[OUT]:
* temperature in celsius.
*/
-mbtk_ril_err_enum mbtk_temp_get(mbtk_temp_type_enum type, int* temp)
+mbtk_ril_err_enum mbtk_temp_get(mbtk_ril_handle* handle, mbtk_temp_type_enum type, int* temp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(temp == NULL)
+ if(temp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
int16 result;
uint8 temp_temp = (uint8)type;
- mbtk_ril_err_enum err = ril_req_process(RIL_MSG_ID_DEV_TEMP, &temp_temp, 1, &result, FALSE);
+ mbtk_ril_err_enum err = ril_req_process(port_info->port, RIL_MSG_ID_DEV_TEMP, &temp_temp, 1, &result, FALSE);
*temp = (int16)result;
return err;
}
@@ -812,21 +911,26 @@
* Get time type.
* "23/05/24,06:09:32+32" -> "23/05/24 06:09:32 +32 00"
*/
-mbtk_ril_err_enum mbtk_cell_time_get(char* time_str)
+mbtk_ril_err_enum mbtk_cell_time_get(mbtk_ril_handle* handle, char* time_str)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(time_str == NULL)
+ if(time_str == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
char buff[RIL_SOCK_MSG_LEN_MAX] = {0};
- mbtk_ril_err_enum err = ril_req_process(RIL_MSG_ID_DEV_CELL_TIME, NULL, 0, &buff, FALSE);
+ mbtk_ril_err_enum err = ril_req_process(port_info->port, RIL_MSG_ID_DEV_CELL_TIME, NULL, 0, &buff, FALSE);
if(MBTK_RIL_ERR_SUCCESS == err)
{
memcpy(time_str,buff,strlen(buff));
@@ -880,21 +984,26 @@
/*
* Get sim state.
*/
-mbtk_ril_err_enum mbtk_sim_state_get(mbtk_sim_state_enum *sim_state)
+mbtk_ril_err_enum mbtk_sim_state_get(mbtk_ril_handle* handle, mbtk_sim_state_enum *sim_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(sim_state == NULL)
+ if(sim_state == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
uint8 result;
- mbtk_ril_err_enum err = ril_req_process(RIL_MSG_ID_SIM_STATE, NULL, 0, &result, FALSE);
+ mbtk_ril_err_enum err = ril_req_process(port_info->port, RIL_MSG_ID_SIM_STATE, NULL, 0, &result, FALSE);
*sim_state = (mbtk_sim_state_enum)result;
return err;
}
@@ -902,21 +1011,26 @@
/*
* Get sim card type.
*/
-mbtk_ril_err_enum mbtk_sim_type_get(mbtk_sim_card_type_enum *sim_card_type)
+mbtk_ril_err_enum mbtk_sim_type_get(mbtk_ril_handle* handle, mbtk_sim_card_type_enum *sim_card_type)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(sim_card_type == NULL)
+ if(sim_card_type == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
uint8 result;
- mbtk_ril_err_enum err = ril_req_process(RIL_MSG_ID_SIM_TYPE, NULL, 0, &result, FALSE);
+ mbtk_ril_err_enum err = ril_req_process(port_info->port, RIL_MSG_ID_SIM_TYPE, NULL, 0, &result, FALSE);
*sim_card_type = (mbtk_sim_card_type_enum)result;
return err;
}
@@ -924,78 +1038,98 @@
/*
* Get platform IMSI.
*/
-mbtk_ril_err_enum mbtk_imsi_get(void *imsi)
+mbtk_ril_err_enum mbtk_imsi_get(mbtk_ril_handle* handle, void *imsi)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(imsi == NULL)
+ if(imsi == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SIM_IMSI, NULL, 0, imsi, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SIM_IMSI, NULL, 0, imsi, FALSE);
}
/*
* Get platform ICCID.
*/
-mbtk_ril_err_enum mbtk_iccid_get(void *iccid)
+mbtk_ril_err_enum mbtk_iccid_get(mbtk_ril_handle* handle, void *iccid)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(iccid == NULL)
+ if(iccid == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SIM_ICCID, NULL, 0, iccid, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SIM_ICCID, NULL, 0, iccid, FALSE);
}
/*
* Get current phone number.
*/
-mbtk_ril_err_enum mbtk_phone_number_get(void *phone_number)
+mbtk_ril_err_enum mbtk_phone_number_get(mbtk_ril_handle* handle, void *phone_number)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(phone_number == NULL)
+ if(phone_number == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SIM_PN, NULL, 0, phone_number, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SIM_PN, NULL, 0, phone_number, FALSE);
}
/*
* Get platform ICCID.
*/
-mbtk_ril_err_enum mbtk_sim_lock_get(int *lock_state)
+mbtk_ril_err_enum mbtk_sim_lock_get(mbtk_ril_handle* handle, int *lock_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(lock_state == NULL)
+ if(lock_state == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
uint8 result;
- mbtk_ril_err_enum err = ril_req_process(RIL_MSG_ID_SIM_LOCK, NULL, 0, &result, FALSE);
+ mbtk_ril_err_enum err = ril_req_process(port_info->port, RIL_MSG_ID_SIM_LOCK, NULL, 0, &result, FALSE);
*lock_state = result;
return err;
}
@@ -1004,121 +1138,151 @@
/*
* Get platform ICCID.
*/
-mbtk_ril_err_enum mbtk_sim_lock_set(mbtk_sim_lock_info_t *lock_info)
+mbtk_ril_err_enum mbtk_sim_lock_set(mbtk_ril_handle* handle, mbtk_sim_lock_info_t *lock_info)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(lock_info == NULL)
+ if(lock_info == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SIM_LOCK, lock_info, sizeof(mbtk_sim_lock_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SIM_LOCK, lock_info, sizeof(mbtk_sim_lock_info_t), NULL, FALSE);
}
/*
* Get PIN’s number of remaining retry
*/
-mbtk_ril_err_enum mbtk_sim_lock_retry_times_get(mbtk_pin_puk_last_times_t *retry_times)
+mbtk_ril_err_enum mbtk_sim_lock_retry_times_get(mbtk_ril_handle* handle, mbtk_pin_puk_last_times_t *retry_times)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(retry_times == NULL)
+ if(retry_times == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SIM_PINPUK_TIMES, NULL, 0, retry_times, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SIM_PINPUK_TIMES, NULL, 0, retry_times, FALSE);
}
/*
* Get plmn list
*/
-mbtk_ril_err_enum mbtk_plmn_list_get(mbtk_plmn_info *plmn_list)
+mbtk_ril_err_enum mbtk_plmn_list_get(mbtk_ril_handle* handle, mbtk_plmn_info *plmn_list)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(plmn_list == NULL)
+ if(plmn_list == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SIM_PLMN, NULL, 0, plmn_list, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SIM_PLMN, NULL, 0, plmn_list, FALSE);
}
/*
* Get available network.
*/
-mbtk_ril_err_enum mbtk_available_net_get(mbtk_net_info_array_t *net_array)
+mbtk_ril_err_enum mbtk_available_net_get(mbtk_ril_handle* handle, mbtk_net_info_array_t *net_array)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(net_array == NULL)
+ if(net_array == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_AVAILABLE, NULL, 0, net_array, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_AVAILABLE, NULL, 0, net_array, FALSE);
}
/*
* Set network select mode. (+COPS=...)
*/
-mbtk_ril_err_enum mbtk_net_sel_mode_set(const mbtk_net_info_t *net)
+mbtk_ril_err_enum mbtk_net_sel_mode_set(mbtk_ril_handle* handle, const mbtk_net_info_t *net)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(net == NULL)
+ if(net == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_SEL_MODE, net, sizeof(mbtk_net_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_SEL_MODE, net, sizeof(mbtk_net_info_t), NULL, FALSE);
}
/*
* Get network select mode. (+COPS?)
*/
-mbtk_ril_err_enum mbtk_net_sel_mode_get(mbtk_net_info_t *net)
+mbtk_ril_err_enum mbtk_net_sel_mode_get(mbtk_ril_handle* handle, mbtk_net_info_t *net)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(net == NULL)
+ if(net == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_SEL_MODE, NULL, 0, net, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_SEL_MODE, NULL, 0, net, FALSE);
}
/*
* Get platform support bands.
*/
-mbtk_ril_err_enum mbtk_support_band_get(mbtk_band_info_t *band)
+mbtk_ril_err_enum mbtk_support_band_get(mbtk_ril_handle* handle, mbtk_band_info_t *band)
{
uint8 type = 0; // Get support bands.
if(!ril_cli.ril_ready)
@@ -1126,19 +1290,24 @@
return MBTK_RIL_ERR_NOT_INIT;
}
- if(band == NULL)
+ if(band == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_BAND, &type, sizeof(uint8), band, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_BAND, &type, sizeof(uint8), band, FALSE);
}
/*
* Get platform current bands.
*/
-mbtk_ril_err_enum mbtk_current_band_get(mbtk_band_info_t *band)
+mbtk_ril_err_enum mbtk_current_band_get(mbtk_ril_handle* handle, mbtk_band_info_t *band)
{
uint8 type = 1; // Get current bands.
if(!ril_cli.ril_ready)
@@ -1146,51 +1315,66 @@
return MBTK_RIL_ERR_NOT_INIT;
}
- if(band == NULL)
+ if(band == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_BAND, &type, sizeof(uint8), band, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_BAND, &type, sizeof(uint8), band, FALSE);
}
/*
* Set platform current bands.
*/
-mbtk_ril_err_enum mbtk_current_band_set(const mbtk_band_info_t *band)
+mbtk_ril_err_enum mbtk_current_band_set(mbtk_ril_handle* handle, const mbtk_band_info_t *band)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(band == NULL)
+ if(band == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_BAND, band, sizeof(mbtk_band_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_BAND, band, sizeof(mbtk_band_info_t), NULL, FALSE);
}
/*
* Get current cell infomation.
*/
-mbtk_ril_err_enum mbtk_cell_get(mbtk_cell_info_array_t *cell_array)
+mbtk_ril_err_enum mbtk_cell_get(mbtk_ril_handle* handle, mbtk_cell_info_array_t *cell_array)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cell_array == NULL)
+ if(cell_array == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_CELL, NULL, 0, cell_array, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_CELL, NULL, 0, cell_array, FALSE);
}
/*
@@ -1202,96 +1386,121 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_cell_set(char *info, char *response)
+mbtk_ril_err_enum mbtk_cell_set(mbtk_ril_handle* handle, char *info, char *response)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(info == NULL || response == NULL)
+ if(info == NULL || response == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_CELL, info, strlen(info), response, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_CELL, info, strlen(info), response, FALSE);
}
/*
* Get current network signal.
*/
-mbtk_ril_err_enum mbtk_net_signal_get(mbtk_signal_info_t *signal)
+mbtk_ril_err_enum mbtk_net_signal_get(mbtk_ril_handle* handle, mbtk_signal_info_t *signal)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(signal == NULL)
+ if(signal == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_SIGNAL, NULL, 0, signal, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_SIGNAL, NULL, 0, signal, FALSE);
}
/*
* Get current network register information.
*/
-mbtk_ril_err_enum mbtk_net_reg_get(mbtk_net_reg_info_t *reg)
+mbtk_ril_err_enum mbtk_net_reg_get(mbtk_ril_handle* handle, mbtk_net_reg_info_t *reg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(reg == NULL)
+ if(reg == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_REG, NULL, 0, reg, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_NET_REG, NULL, 0, reg, FALSE);
}
/*
* Get all APN informations.
*/
-mbtk_ril_err_enum mbtk_apn_get(mbtk_apn_info_array_t *apns)
+mbtk_ril_err_enum mbtk_apn_get(mbtk_ril_handle* handle, mbtk_apn_info_array_t *apns)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(apns == NULL)
+ if(apns == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_DATA_CALL_APN, NULL, 0, apns, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_DATA_CALL_APN, NULL, 0, apns, FALSE);
}
/*
* Set current APN informations.
*/
-mbtk_ril_err_enum mbtk_apn_set(const mbtk_apn_info_t *apn)
+mbtk_ril_err_enum mbtk_apn_set(mbtk_ril_handle* handle, const mbtk_apn_info_t *apn)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(apn == NULL)
+ if(apn == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
if(str_empty(apn->apn)) { // Delete APN
if(!ril_cid_check(apn->cid)) {
return MBTK_RIL_ERR_CID;
@@ -1302,13 +1511,13 @@
}
}
- return ril_req_process(RIL_MSG_ID_DATA_CALL_APN, apn, sizeof(mbtk_apn_info_t), NULL, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_DATA_CALL_APN, apn, sizeof(mbtk_apn_info_t), NULL, FALSE);
}
/*
* Start data call.
*/
-mbtk_ril_err_enum mbtk_data_call_start(mbtk_ril_cid_enum cid, mbtk_data_call_item_state_enum auto_boot_call,
+mbtk_ril_err_enum mbtk_data_call_start(mbtk_ril_handle* handle, mbtk_ril_cid_enum cid, mbtk_data_call_item_state_enum auto_boot_call,
mbtk_data_call_item_state_enum def_route, mbtk_data_call_item_state_enum as_dns, int *retry_interval, int retry_interval_num,
int timeout, mbtk_ip_info_t *rsp_info)
{
@@ -1317,10 +1526,20 @@
return MBTK_RIL_ERR_NOT_INIT;
}
+ if(handle == NULL) {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
if(!ril_cid_check(cid)) {
return MBTK_RIL_ERR_CID;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
mbtk_data_call_info_t info;
memset(&info, 0, sizeof(mbtk_data_call_info_t));
info.type = MBTK_DATA_CALL_START;
@@ -1339,23 +1558,33 @@
info.timeout = (uint16)10;
}
- return ril_req_process(RIL_MSG_ID_DATA_CALL_OPT, &info, sizeof(mbtk_data_call_info_t), rsp_info, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_DATA_CALL_OPT, &info, sizeof(mbtk_data_call_info_t), rsp_info, FALSE);
}
/*
* Stop data call.
*/
-mbtk_ril_err_enum mbtk_data_call_stop(mbtk_ril_cid_enum cid, int timeout)
+mbtk_ril_err_enum mbtk_data_call_stop(mbtk_ril_handle* handle, mbtk_ril_cid_enum cid, int timeout)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
+ if(handle == NULL) {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
if(!ril_cid_check(cid)) {
return MBTK_RIL_ERR_CID;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
mbtk_data_call_info_t info;
memset(&info, 0, sizeof(mbtk_data_call_info_t));
info.type = MBTK_DATA_CALL_STOP;
@@ -1363,20 +1592,20 @@
if(timeout > 0) {
info.timeout = (uint16)timeout;
}
- return ril_req_process(RIL_MSG_ID_DATA_CALL_OPT, &info, sizeof(mbtk_data_call_info_t), NULL, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_DATA_CALL_OPT, &info, sizeof(mbtk_data_call_info_t), NULL, FALSE);
}
/*
* Get data call state.
*/
-mbtk_ril_err_enum mbtk_data_call_state_get(mbtk_ril_cid_enum cid, mbtk_ip_info_t *ip)
+mbtk_ril_err_enum mbtk_data_call_state_get(mbtk_ril_handle* handle, mbtk_ril_cid_enum cid, mbtk_ip_info_t *ip)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(ip == NULL)
+ if(ip == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
@@ -1386,32 +1615,42 @@
return MBTK_RIL_ERR_CID;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
mbtk_data_call_info_t info;
memset(&info, 0, sizeof(mbtk_data_call_info_t));
info.type = MBTK_DATA_CALL_STATE;
info.cid = cid;
- return ril_req_process(RIL_MSG_ID_DATA_CALL_OPT, &info, sizeof(mbtk_data_call_info_t), ip, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_DATA_CALL_OPT, &info, sizeof(mbtk_data_call_info_t), ip, FALSE);
}
/*
* Return sms cmgf.
*/
-mbtk_ril_err_enum mbtk_sms_cmgf_get(int *sms_state)
+mbtk_ril_err_enum mbtk_sms_cmgf_get(mbtk_ril_handle* handle, int *sms_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(sms_state == NULL)
+ if(sms_state == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
uint8 state;
- mbtk_ril_err_enum err = ril_req_process(RIL_MSG_ID_SMS_CMGF, NULL, 0, &state, FALSE);
+ mbtk_ril_err_enum err = ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGF, NULL, 0, &state, FALSE);
*sms_state = state;
return err;
}
@@ -1425,14 +1664,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cmgf_set(int mode)
+mbtk_ril_err_enum mbtk_sms_cmgf_set(mbtk_ril_handle* handle, int mode)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMGF, &mode, sizeof(uint8), NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGF, &mode, sizeof(uint8), NULL, FALSE);
}
/*
@@ -1448,20 +1698,25 @@
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cmgs_set(char * cmgs, char *resp)
+mbtk_ril_err_enum mbtk_sms_cmgs_set(mbtk_ril_handle* handle, char * cmgs, char *resp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cmgs == NULL || resp == NULL)
+ if(cmgs == NULL || resp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMGS, cmgs, strlen(cmgs), resp, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGS, cmgs, strlen(cmgs), resp, FALSE);
}
/*
@@ -1476,20 +1731,25 @@
given<ctrl-Z/ESC>
*/
-mbtk_ril_err_enum mbtk_sms_cmgw_set(char * cmgw, char *resp)
+mbtk_ril_err_enum mbtk_sms_cmgw_set(mbtk_ril_handle* handle, char * cmgw, char *resp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cmgw == NULL || resp == NULL)
+ if(cmgw == NULL || resp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMGW, cmgw, strlen(cmgw), resp, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGW, cmgw, strlen(cmgw), resp, FALSE);
}
/*
@@ -1499,20 +1759,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cmgd_set(char * cmdg)
+mbtk_ril_err_enum mbtk_sms_cmgd_set(mbtk_ril_handle* handle, char * cmdg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cmdg == NULL)
+ if(cmdg == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMGD, cmdg, strlen(cmdg), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGD, cmdg, strlen(cmdg), NULL, FALSE);
}
/*
@@ -1522,20 +1787,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cmgd_get(char * cmdg)
+mbtk_ril_err_enum mbtk_sms_cmgd_get(mbtk_ril_handle* handle, char * cmdg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cmdg == NULL)
+ if(cmdg == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMGD, NULL, 0, cmdg, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGD, NULL, 0, cmdg, FALSE);
}
@@ -1546,39 +1816,49 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cmgl_set(char * cmgl, char *resp)
+mbtk_ril_err_enum mbtk_sms_cmgl_set(mbtk_ril_handle* handle, char * cmgl, char *resp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cmgl == NULL || resp == NULL)
+ if(cmgl == NULL || resp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMGL, cmgl, strlen(cmgl), resp, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGL, cmgl, strlen(cmgl), resp, FALSE);
}
/*
* Return sms csca.
*/
-mbtk_ril_err_enum mbtk_sms_csca_get(char *buf)
+mbtk_ril_err_enum mbtk_sms_csca_get(mbtk_ril_handle* handle, char *buf)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(buf == NULL)
+ if(buf == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CSCA, NULL, 0, buf, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CSCA, NULL, 0, buf, FALSE);
}
/*
@@ -1588,20 +1868,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_csca_set(char * csca)
+mbtk_ril_err_enum mbtk_sms_csca_set(mbtk_ril_handle* handle, char * csca)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(csca == NULL)
+ if(csca == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CSCA, csca, strlen(csca), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CSCA, csca, strlen(csca), NULL, FALSE);
}
/*
@@ -1611,20 +1896,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_csmp_set(char * csmp)
+mbtk_ril_err_enum mbtk_sms_csmp_set(mbtk_ril_handle* handle, char * csmp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(csmp == NULL)
+ if(csmp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CSMP, csmp, strlen(csmp), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CSMP, csmp, strlen(csmp), NULL, FALSE);
}
/*
@@ -1634,20 +1924,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cscb_set(char * cscb)
+mbtk_ril_err_enum mbtk_sms_cscb_set(mbtk_ril_handle* handle, char * cscb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cscb == NULL)
+ if(cscb == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CSCB, cscb, strlen(cscb), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CSCB, cscb, strlen(cscb), NULL, FALSE);
}
/*
@@ -1659,14 +1954,25 @@
if sending fails:
+CMS ERROR: <err>
*/
-mbtk_ril_err_enum mbtk_sms_cnmi_set()
+mbtk_ril_err_enum mbtk_sms_cnmi_set(mbtk_ril_handle* handle)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_SMS_CNMI, NULL, 0, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CNMI, NULL, 0, NULL, FALSE);
}
/*
@@ -1680,39 +1986,49 @@
if sending fails:
+CMS ERROR: <err>
*/
-mbtk_ril_err_enum mbtk_sms_cmss_set(char * cmss, char *resp)
+mbtk_ril_err_enum mbtk_sms_cmss_set(mbtk_ril_handle* handle, char * cmss, char *resp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cmss == NULL || resp == NULL)
+ if(cmss == NULL || resp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMSS, cmss, strlen(cmss), resp, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMSS, cmss, strlen(cmss), resp, FALSE);
}
/*
* Return sms cmgf.
*/
-mbtk_ril_err_enum mbtk_sms_cpms_get(char * mem)
+mbtk_ril_err_enum mbtk_sms_cpms_get(mbtk_ril_handle* handle, char * mem)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(mem == NULL)
+ if(mem == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CPMS, NULL, 0, mem, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CPMS, NULL, 0, mem, FALSE);
}
@@ -1723,20 +2039,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cpms_set(char * mem, char* resp)
+mbtk_ril_err_enum mbtk_sms_cpms_set(mbtk_ril_handle* handle, char * mem, char* resp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(mem == NULL || resp == NULL)
+ if(mem == NULL || resp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CPMS, mem, strlen(mem), resp, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CPMS, mem, strlen(mem), resp, FALSE);
}
/*
@@ -1761,20 +2082,25 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_sms_cmgr_set(int index, char *resp)
+mbtk_ril_err_enum mbtk_sms_cmgr_set(mbtk_ril_handle* handle, int index, char *resp)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(resp == NULL)
+ if(resp == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_SMS_CMGR, &index, sizeof(uint8), resp, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_SMS_CMGR, &index, sizeof(uint8), resp, FALSE);
}
@@ -1968,128 +2294,198 @@
* call_start
*
*/
-mbtk_ril_err_enum mbtk_call_start(char* phone_number)
+mbtk_ril_err_enum mbtk_call_start(mbtk_ril_handle* handle, char* phone_number)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(phone_number == NULL)
+ if(phone_number == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_CALL_START, phone_number, strlen(phone_number), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_START, phone_number, strlen(phone_number), NULL, FALSE);
}
/*
* Answer the phone call.
*
*/
-mbtk_ril_err_enum mbtk_call_answer()
+mbtk_ril_err_enum mbtk_call_answer(mbtk_ril_handle* handle)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_CALL_ANSWER, NULL, 0, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_ANSWER, NULL, 0, NULL, FALSE);
}
/*
* Hang up all call.
*
*/
-mbtk_ril_err_enum mbtk_call_hang()
+mbtk_ril_err_enum mbtk_call_hang(mbtk_ril_handle* handle)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_CALL_HANGUP, NULL, 0, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_HANGUP, NULL, 0, NULL, FALSE);
}
/*
* Hang up a call.
*
*/
-mbtk_ril_err_enum mbtk_a_call_hang(int phone_id)
+mbtk_ril_err_enum mbtk_a_call_hang(mbtk_ril_handle* handle, int phone_id)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_CALL_HANGUP_A, &phone_id, sizeof(uint8), NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_HANGUP_A, &phone_id, sizeof(uint8), NULL, FALSE);
}
/*
* Hang up waiting or background call.
*
*/
-mbtk_ril_err_enum mbtk_waiting_or_background_call_hang()
+mbtk_ril_err_enum mbtk_waiting_or_background_call_hang(mbtk_ril_handle* handle)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_CALL_HANGUP_B, NULL, 0, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_HANGUP_B, NULL, 0, NULL, FALSE);
}
/*
* Hang up foreground resume background call.
*
*/
-mbtk_ril_err_enum mbtk_foreground_resume_background_call_hang()
+mbtk_ril_err_enum mbtk_foreground_resume_background_call_hang(mbtk_ril_handle* handle)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_CALL_HANGUP_C, NULL, 0, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_HANGUP_C, NULL, 0, NULL, FALSE);
}
/*
* Get current call phone number.
*/
-mbtk_ril_err_enum mbtk_call_reg_get(mbtk_call_info_t *reg)
+mbtk_ril_err_enum mbtk_call_reg_get(mbtk_ril_handle* handle, mbtk_call_info_t *reg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(reg == NULL)
+ if(reg == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_CALL_WAITIN, NULL, 0, reg, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_WAITIN, NULL, 0, reg, FALSE);
}
/*
* Return mute state.
*/
-mbtk_ril_err_enum mbtk_mute_state_get(int *mute_state)
+mbtk_ril_err_enum mbtk_mute_state_get(mbtk_ril_handle* handle, int *mute_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(mute_state == NULL)
+ if(mute_state == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_CALL_MUTE, NULL, 0, mute_state, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_MUTE, NULL, 0, mute_state, FALSE);
}
/*
@@ -2101,108 +2497,156 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_mute_state_set(int mute_state)
+mbtk_ril_err_enum mbtk_mute_state_set(mbtk_ril_handle* handle, int mute_state)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_CALL_MUTE, &mute_state, sizeof(uint8), NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_MUTE, &mute_state, sizeof(uint8), NULL, FALSE);
}
/*
* Set DTMF character.
*
*/
-mbtk_ril_err_enum mbtk_dtmf_send(mbtk_call_dtmf_info_t *dtmf_character)
+mbtk_ril_err_enum mbtk_dtmf_send(mbtk_ril_handle* handle, mbtk_call_dtmf_info_t *dtmf_character)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(dtmf_character == NULL)
+ if(dtmf_character == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_CALL_DTMF, dtmf_character, sizeof(mbtk_call_dtmf_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_CALL_DTMF, dtmf_character, sizeof(mbtk_call_dtmf_info_t), NULL, FALSE);
}
/*
* Set msd item.
*
*/
-mbtk_ril_err_enum mbtk_ecall_msd_item_set(const mbtk_ecall_msd_cfg_info_t *msd_cfg)
+mbtk_ril_err_enum mbtk_ecall_msd_item_set(mbtk_ril_handle* handle, const mbtk_ecall_msd_cfg_info_t *msd_cfg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(msd_cfg == NULL)
+ if(msd_cfg == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_MSDCFG, msd_cfg, sizeof(mbtk_ecall_msd_cfg_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_MSDCFG, msd_cfg, sizeof(mbtk_ecall_msd_cfg_info_t), NULL, FALSE);
}
/*
* Generate msd after msd item set.
*
*/
-mbtk_ril_err_enum mbtk_ecall_msd_gen()
+mbtk_ril_err_enum mbtk_ecall_msd_gen(mbtk_ril_handle* handle)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_ECALL_MSDGEN, NULL, 0, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_MSDGEN, NULL, 0, NULL, FALSE);
}
/*
* Set ecall msd.
*
*/
-mbtk_ril_err_enum mbtk_ecall_msd_set(const void* msd)
+mbtk_ril_err_enum mbtk_ecall_msd_set(mbtk_ril_handle* handle, const void* msd)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
if(str_empty(msd))
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_MSD, msd, strlen(msd), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_MSD, msd, strlen(msd), NULL, FALSE);
}
/*
* Get ecall msd.
*
*/
-mbtk_ril_err_enum mbtk_ecall_msd_get(void* msd)
+mbtk_ril_err_enum mbtk_ecall_msd_get(mbtk_ril_handle* handle, void* msd)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(msd == NULL)
+ if(msd == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_MSD, NULL, 0, msd, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_MSD, NULL, 0, msd, FALSE);
}
@@ -2210,264 +2654,356 @@
* Set ecall msd item.
*
*/
-mbtk_ril_err_enum mbtk_ecall_push()
+mbtk_ril_err_enum mbtk_ecall_push(mbtk_ril_handle* handle)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_ECALL_PUSH, NULL, 0, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_PUSH, NULL, 0, NULL, FALSE);
}
/*
* Set ecall only configs.
*
*/
-mbtk_ril_err_enum mbtk_ecall_only_set(const mbtk_ecall_only_info_t* info)
+mbtk_ril_err_enum mbtk_ecall_only_set(mbtk_ril_handle* handle, const mbtk_ecall_only_info_t* info)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(info == NULL)
+ if(info == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_ONLY, info, sizeof(mbtk_ecall_only_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_ONLY, info, sizeof(mbtk_ecall_only_info_t), NULL, FALSE);
}
/*
* Get ecall only configs.
*
*/
-mbtk_ril_err_enum mbtk_ecall_only_get(mbtk_ecall_only_info_t* info)
+mbtk_ril_err_enum mbtk_ecall_only_get(mbtk_ril_handle* handle, mbtk_ecall_only_info_t* info)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(info == NULL)
+ if(info == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_ONLY, NULL, 0, info, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_ONLY, NULL, 0, info, FALSE);
}
/*
* Set ecall network reg.
*
*/
-mbtk_ril_err_enum mbtk_ecall_reg_set(int reg)
+mbtk_ril_err_enum mbtk_ecall_reg_set(mbtk_ril_handle* handle, int reg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(reg != 0 && reg != 1)
+ if((reg != 0 && reg != 1) || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_REG, ®, 1, NULL, FALSE);
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_REG, ®, 1, NULL, FALSE);
}
/*
* Start ecall dial start.
*
*/
-mbtk_ril_err_enum mbtk_ecall_dial_start(mbtk_ecall_dial_type_enum type)
+mbtk_ril_err_enum mbtk_ecall_dial_start(mbtk_ril_handle* handle, mbtk_ecall_dial_type_enum type)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_ECALL_DIAL, &type, 1, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_DIAL, &type, 1, NULL, FALSE);
}
/*
* Get ecall dial state.
*
*/
-mbtk_ril_err_enum mbtk_ecall_dial_state_get(mbtk_ecall_dial_type_enum* type)
+mbtk_ril_err_enum mbtk_ecall_dial_state_get(mbtk_ril_handle* handle, mbtk_ecall_dial_type_enum* type)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(type == NULL)
+ if(type == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
memset(type, 0, sizeof(mbtk_ecall_dial_type_enum));
- return ril_req_process(RIL_MSG_ID_ECALL_DIAL, NULL, 0, type, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_DIAL, NULL, 0, type, FALSE);
}
/*
* Set ecall mode.
*
*/
-mbtk_ril_err_enum mbtk_ecall_mode_set(mbtk_ecall_mode_type_enum mode)
+mbtk_ril_err_enum mbtk_ecall_mode_set(mbtk_ril_handle* handle, mbtk_ecall_mode_type_enum mode)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- return ril_req_process(RIL_MSG_ID_ECALL_MODE, &mode, 1, NULL, FALSE);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return MBTK_RIL_ERR_PARAMETER;
+ }
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_MODE, &mode, 1, NULL, FALSE);
}
/*
* Get ecall mode.
*
*/
-mbtk_ril_err_enum mbtk_ecall_mode_get(mbtk_ecall_mode_type_enum *mode)
+mbtk_ril_err_enum mbtk_ecall_mode_get(mbtk_ril_handle* handle, mbtk_ecall_mode_type_enum *mode)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(mode == NULL)
+ if(mode == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
memset(mode, 0, sizeof(mbtk_ecall_mode_type_enum));
- return ril_req_process(RIL_MSG_ID_ECALL_MODE, NULL, 0, mode, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_MODE, NULL, 0, mode, FALSE);
}
/*
* Set ecall configs.
*
*/
-mbtk_ril_err_enum mbtk_ecall_cfg_set(const mbtk_ecall_cfg_info_t *cfg)
+mbtk_ril_err_enum mbtk_ecall_cfg_set(mbtk_ril_handle* handle, const mbtk_ecall_cfg_info_t *cfg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cfg == NULL || cfg->type == 0)
+ if(cfg == NULL || cfg->type == 0 || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_CFG, cfg, sizeof(mbtk_ecall_cfg_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_CFG, cfg, sizeof(mbtk_ecall_cfg_info_t), NULL, FALSE);
}
/*
* Get ecall configs.
*
*/
-mbtk_ril_err_enum mbtk_ecall_cfg_get(mbtk_ecall_cfg_info_t* cfg)
+mbtk_ril_err_enum mbtk_ecall_cfg_get(mbtk_ril_handle* handle, mbtk_ecall_cfg_info_t* cfg)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cfg == NULL || cfg->type == 0)
+ if(cfg == NULL || cfg->type == 0 || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
+
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
uint32 type = cfg->type;
- return ril_req_process(RIL_MSG_ID_ECALL_CFG, &type, sizeof(uint32), cfg, FALSE);
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_CFG, &type, sizeof(uint32), cfg, FALSE);
}
/*
* Set ecall sms number.
*
*/
-mbtk_ril_err_enum mbtk_ecall_sms_number_set(const void *number)
+mbtk_ril_err_enum mbtk_ecall_sms_number_set(mbtk_ril_handle* handle, const void *number)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(str_empty(number))
+ if(str_empty(number) || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_SMS_NUM, number, strlen(number), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_SMS_NUM, number, strlen(number), NULL, FALSE);
}
/*
* Get ecall sms number.
*
*/
-mbtk_ril_err_enum mbtk_ecall_sms_number_get(void *number)
+mbtk_ril_err_enum mbtk_ecall_sms_number_get(mbtk_ril_handle* handle, void *number)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(number == NULL)
+ if(number == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_SMS_NUM, NULL, 0, number, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_SMS_NUM, NULL, 0, number, FALSE);
}
/*
* Set ecall mute speaker.
*
*/
-mbtk_ril_err_enum mbtk_ecall_mute_spk_set(int mute)
+mbtk_ril_err_enum mbtk_ecall_mute_spk_set(mbtk_ril_handle* handle, int mute)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(mute != 0 && mute != 1)
+ if((mute != 0 && mute != 1) || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_MUTESPK, &mute, 1, NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_MUTESPK, &mute, 1, NULL, FALSE);
}
/*
* Set ecall dsp gain.
*
*/
-mbtk_ril_err_enum mbtk_ecall_dsp_gain_set(const mbtk_ecall_gain_info_t *gain_info)
+mbtk_ril_err_enum mbtk_ecall_dsp_gain_set(mbtk_ril_handle* handle, const mbtk_ecall_gain_info_t *gain_info)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(gain_info == NULL)
+ if(gain_info == NULL || handle == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_ECALL_DSP_GAIN, gain_info, sizeof(mbtk_ecall_gain_info_t), NULL, FALSE);
+ ril_at_port_info_t *port_info = (ril_at_port_info_t*)handle;
+ if(!at_port_check(port_info->port)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ return ril_req_process(port_info->port, RIL_MSG_ID_ECALL_DSP_GAIN, gain_info, sizeof(mbtk_ecall_gain_info_t), NULL, FALSE);
}
#if 0
@@ -2520,14 +3056,18 @@
/*
* Set ril server state change callback function.
*/
-int mbtk_ril_ser_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_ril_ser_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_SER_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_SER_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_SER_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2538,14 +3078,18 @@
/*
* Set net reg state change callback function.
*/
-int mbtk_net_reg_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_net_reg_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_NET_REG_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_NET_REG_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_NET_REG_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2556,14 +3100,18 @@
/*
* Set call state change callback function.
*/
-int mbtk_call_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_call_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_CALL_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_CALL_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_CALL_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2574,14 +3122,18 @@
/*
* Set sms state change callback function.
*/
-int mbtk_sms_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_sms_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_SMS_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_SMS_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_SMS_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2592,14 +3144,18 @@
/*
* Set radio state change callback function.
*/
-int mbtk_radio_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_radio_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_RADIO_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_RADIO_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_RADIO_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2610,14 +3166,18 @@
/*
* Set sim state change callback function.
*/
-int mbtk_sim_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_sim_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_SIM_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_SIM_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_SIM_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2628,14 +3188,18 @@
/*
* Set pdp state change callback function.
*/
-int mbtk_pdp_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_pdp_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_PDP_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_PDP_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_PDP_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2646,14 +3210,18 @@
/*
* Set signal state change callback function.
*/
-int mbtk_signal_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_signal_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_SIGNAL_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_SIGNAL_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_SIGNAL_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
@@ -2661,14 +3229,18 @@
return ret;
}
-int mbtk_ecall_state_change_cb_reg(mbtk_ril_callback_func cb)
+mbtk_ril_err_enum mbtk_ecall_state_change_cb_reg(mbtk_ril_callback_func cb)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- int ret = ril_req_process(RIL_MSG_ID_IND_ECALL_STATE_CHANGE, NULL, 0, NULL, FALSE);
+ if(!at_port_check(ATPORTTYPE_0)) {
+ return MBTK_RIL_ERR_PORT;
+ }
+
+ int ret = ril_req_process(ATPORTTYPE_0, RIL_MSG_ID_IND_ECALL_STATE_CHANGE, NULL, 0, NULL, FALSE);
if(MBTK_RIL_ERR_SUCCESS == ret)
{
ril_cli.cb[RIL_MSG_ID_IND_ECALL_STATE_CHANGE - RIL_MSG_ID_IND_BEGIN - 1] = cb;
diff --git a/mbtk/libmbtk_lib_v2/ril/ril_utils.c b/mbtk/libmbtk_lib_v2/ril/ril_utils.c
index 236c06f..6928a1d 100755
--- a/mbtk/libmbtk_lib_v2/ril/ril_utils.c
+++ b/mbtk/libmbtk_lib_v2/ril/ril_utils.c
@@ -398,7 +398,7 @@
}
}
-ril_msg_pack_info_t* ril_msg_pack_creat(int msg_type, int msg_id, int msg_index, const void *data, int data_len)
+ril_msg_pack_info_t* ril_msg_pack_creat(ATPortType_enum port, int msg_type, int msg_id, int msg_index, const void *data, int data_len)
{
ril_msg_pack_info_t *pack = (ril_msg_pack_info_t *)malloc(sizeof(ril_msg_pack_info_t));
if(!pack)
@@ -408,7 +408,7 @@
}
pack->tag = RIL_SOCK_PACKET_TAG;
-
+ pack->at_port = (uint8)port;
if(msg_index < 0) {
pack->msg_index = ril_index++;
} else {