Add DS support.
Change-Id: Ib8bc4e171dd5ca526f8e151ff3d467097582a8cb
diff --git a/mbtk/mbtk_rild_v2/src/ril_net.c b/mbtk/mbtk_rild_v2/src/ril_net.c
index 7042954..7935352 100755
--- a/mbtk/mbtk_rild_v2/src/ril_net.c
+++ b/mbtk/mbtk_rild_v2/src/ril_net.c
@@ -23,7 +23,9 @@
mbtk_cell_pack_info_t cell_info;
extern ril_band_info_t band_info;
-void ril_rsp_pack_send(ATPortType_enum port, int fd, int ril_id, int msg_index, const void* data, int data_len);
+void ril_rsp_pack_send(mbtk_sim_type_enum sim_id, ATPortType_enum port, int fd, int ril_id, int msg_index, const void* data, int data_len);
+ATPortId_enum portType_2_portId(mbtk_sim_type_enum sim_id, ATPortType_enum port);
+
static bool net_support_check(uint32 net_type, uint32 net_flag)
{
@@ -37,10 +39,10 @@
OK
*/
-static int req_available_net_get(ATPortType_enum port, mbtk_net_info_array_t* nets, int *cme_err)
+static int req_available_net_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_net_info_array_t* nets, int *cme_err)
{
ATResponse *response = NULL;
- int err = at_send_command_singleline(port, "AT+COPS=?", "+COPS:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+COPS=?", "+COPS:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err) {
@@ -135,14 +137,14 @@
OK
*/
-static int req_net_sel_mode_get(ATPortType_enum port, mbtk_net_info_t *net, int *cme_err)
+static int req_net_sel_mode_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_net_info_t *net, int *cme_err)
{
//LOG("req_net_sel_mode_get() 0");
//sleep(1);
ATResponse *response = NULL;
int tmp_int;
char *tmp_ptr = NULL;
- int err = at_send_command_singleline(port, "AT+COPS?", "+COPS:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+COPS?", "+COPS:", &response);
//LOG("req_net_sel_mode_get() 00");
//sleep(1);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -221,7 +223,7 @@
OK
*/
-static int req_net_sel_mode_set(ATPortType_enum port, mbtk_net_info_t* net, int *cme_err)
+static int req_net_sel_mode_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_net_info_t* net, int *cme_err)
{
ATResponse *response = NULL;
char cmd[50] = {0};
@@ -238,7 +240,7 @@
}
}
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0) {
if(cme_err) {
@@ -257,7 +259,7 @@
OK
*/
-int req_band_set(ATPortType_enum port, mbtk_band_info_t* band, int *cme_err)
+int req_band_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_band_info_t* band, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
@@ -352,7 +354,7 @@
}
if(band->net_pref == 0xFF) { // No change net_pref.
int tmp_int;
- err = at_send_command_singleline(port, "AT*BAND?", "*BAND:", &response);
+ err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT*BAND?", "*BAND:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err) {
*cme_err = at_get_cme_error(response);
@@ -394,7 +396,7 @@
}
}
}
- err = at_send_command(port, cmd, &response);
+ err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
if(cme_err) {
@@ -479,13 +481,13 @@
65536 ?C FDDLTE _BAND_17
524288 ?C FDDLTE _BAND_20
*/
-static int req_band_get(ATPortType_enum port, mbtk_band_info_t *band, int *cme_err)
+static int req_band_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_band_info_t *band, int *cme_err)
{
ATResponse *response = NULL;
int tmp_int;
log_hex("BAND_SUPPORT", &band_info.band_support, sizeof(mbtk_band_info_t));
- int err = at_send_command_singleline(port, "AT*BAND?", "*BAND:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT*BAND?", "*BAND:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err) {
*cme_err = at_get_cme_error(response);
@@ -626,13 +628,13 @@
OK
*/
-static int req_net_signal_get(ATPortType_enum port, mbtk_signal_info_t *signal, int *cme_err)
+static int req_net_signal_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_signal_info_t *signal, int *cme_err)
{
ATResponse *response = NULL;
int tmp_int;
char *tmp_ptr = NULL;
// AT+EEMOPT=1 in the first.
- int err = at_send_command_singleline(port, "AT+CSQ", "+CSQ:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+CSQ", "+CSQ:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err != NULL)
*cme_err = at_get_cme_error(response);
@@ -654,7 +656,7 @@
signal->rssi = (uint8)tmp_int;
at_response_free(response);
- err = at_send_command_singleline(port, "AT+CESQ", "+CESQ:", &response);
+ err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+CESQ", "+CESQ:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err != NULL)
*cme_err = at_get_cme_error(response);
@@ -736,7 +738,7 @@
}
at_response_free(response);
- err = at_send_command_singleline(port, "AT+COPS?", "+COPS:", &response);
+ err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+COPS?", "+COPS:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err != NULL)
*cme_err = at_get_cme_error(response);
@@ -811,12 +813,12 @@
*/
-static int req_net_reg_get(ATPortType_enum port, mbtk_net_reg_info_t *reg, int *cme_err)
+static int req_net_reg_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_net_reg_info_t *reg, int *cme_err)
{
ATResponse *response = NULL;
int tmp_int;
char *tmp_str = NULL;
- int err = at_send_command(port, "AT+CREG=3", &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), "AT+CREG=3", &response);
if (err < 0 || response->success == 0){
if(cme_err) {
*cme_err = at_get_cme_error(response);
@@ -825,7 +827,7 @@
}
at_response_free(response);
- err = at_send_command_multiline(port, "AT+CREG?", "+CREG:", &response);
+ err = at_send_command_multiline(portType_2_portId(sim_id, port), "AT+CREG?", "+CREG:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err) {
*cme_err = at_get_cme_error(response);
@@ -875,7 +877,7 @@
}
at_response_free(response);
- err = at_send_command_multiline(port, "AT+CEREG?", "+CEREG:", &response);
+ err = at_send_command_multiline(portType_2_portId(sim_id, port), "AT+CEREG?", "+CEREG:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err) {
*cme_err = at_get_cme_error(response);
@@ -924,7 +926,7 @@
reg->type = (uint8)tmp_int;
} else if(reg->data_state == 0 && (band_info.net_support & MBTK_NET_SUPPORT_5G)) {
at_response_free(response);
- err = at_send_command_multiline(port, "AT+C5GREG?", "+C5GREG:", &response);
+ err = at_send_command_multiline(portType_2_portId(sim_id, port), "AT+C5GREG?", "+C5GREG:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err) {
*cme_err = at_get_cme_error(response);
@@ -975,7 +977,7 @@
}
at_response_free(response);
- err = at_send_command_multiline(port, "AT+CIREG?", "+CIREG:", &response);
+ err = at_send_command_multiline(portType_2_portId(sim_id, port), "AT+CIREG?", "+CIREG:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
reg->ims_state = (uint8)0;
err = 0;
@@ -1207,13 +1209,13 @@
OK
*/
-static int req_cell_info_get(ATPortType_enum port, int *cme_err)
+static int req_cell_info_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, int *cme_err)
{
ATResponse *response = NULL;
int tmp_int;
int buff_size = 0;
// AT+EEMOPT=1 in the first.
- int err = at_send_command(port, "AT+EEMOPT=1", &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), "AT+EEMOPT=1", &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -1224,7 +1226,7 @@
cell_info.running = true;
cell_info.cell_list.num = 0;
- err = at_send_command_singleline(port, "AT+EEMGINFO?", "+EEMGINFO:", &response);
+ err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+EEMGINFO?", "+EEMGINFO:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -1315,7 +1317,7 @@
return buff_size;
}
-static int req_cell_info_set(ATPortType_enum port, const char *cmgl, char *reg, int len, int *cme_err)
+static int req_cell_info_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, const char *cmgl, char *reg, int len, int *cme_err)
{
ATResponse *response = NULL;
char cmd[500] = {0};
@@ -1328,7 +1330,7 @@
if(strlen(cmd) > 0)
{
- err = at_send_command_multiline(port, cmd, "", &response);
+ err = at_send_command_multiline(portType_2_portId(sim_id, port), cmd, "", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -1374,7 +1376,7 @@
ƽ̨±¾ÉíÊÇÓÐÒ»Ì×¼ä¸ôËÑÍø£¬Ò²ÓÐÀúʷƵµãÓÅÏÈ´¦ÀíµÄÂß¼£¨²»ÐèÒªÎÒÃǽøÐд¦Àí£©£¬
Ìṩ¸øÎÒÃǵÄAT+OOSPPÖ¸ÁîÊÇÈÃÎÒÃÇ¿ÉÒÔ×Ô¶¨ÒåËÑÍø¼ä¸ô
*/
-static int req_oos_set(ATPortType_enum port, const mbtk_ril_oos_info_t* oos_info, int *cme_err)
+static int req_oos_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, const mbtk_ril_oos_info_t* oos_info, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
@@ -1407,7 +1409,7 @@
}
LOGI("Set the oos command is = [%s]\n", cmd);
- err = at_send_command(port, cmd, &response);
+ err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -1425,11 +1427,11 @@
¹Ø£º
+OOSPP:0
*/
-static int req_oos_get(ATPortType_enum port, mbtk_ril_oos_info_t *oos_info, int *cme_err)
+static int req_oos_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ril_oos_info_t *oos_info, int *cme_err)
{
ATResponse *response = NULL;
- int err = at_send_command_singleline(port, "AT+OOSPP?", "+OOSPP:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+OOSPP?", "+OOSPP:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -1501,7 +1503,7 @@
{
mbtk_net_info_array_t net_array;
memset(&net_array, 0, sizeof(mbtk_net_info_array_t));
- if(req_available_net_get(cli_info->port, &net_array, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_available_net_get(cli_info->sim_id, cli_info->port, &net_array, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1512,7 +1514,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &net_array, sizeof(mbtk_net_info_array_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &net_array, sizeof(mbtk_net_info_array_t));
}
}
else // Set
@@ -1528,7 +1530,7 @@
{
mbtk_net_info_t info;
memset(&info, 0, sizeof(mbtk_net_info_t));
- if(req_net_sel_mode_get(cli_info->port, &info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_net_sel_mode_get(cli_info->sim_id, cli_info->port, &info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1539,13 +1541,13 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &info, sizeof(mbtk_net_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &info, sizeof(mbtk_net_info_t));
}
}
else // Set
{
mbtk_net_info_t *info = (mbtk_net_info_t*)pack->data;
- if(req_net_sel_mode_set(cli_info->port, info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_net_sel_mode_set(cli_info->sim_id, cli_info->port, info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1556,7 +1558,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -1574,7 +1576,7 @@
if(*(pack->data)) { // Get current bands.
mbtk_band_info_t band;
memset(&band, 0x0, sizeof(mbtk_band_info_t));
- if(req_band_get(cli_info->port, &band, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_band_get(cli_info->sim_id, cli_info->port, &band, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1585,10 +1587,10 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &band, sizeof(mbtk_band_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &band, sizeof(mbtk_band_info_t));
}
} else { // Get support bands.
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &band_info.band_support, sizeof(mbtk_band_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &band_info.band_support, sizeof(mbtk_band_info_t));
}
} else { // Set current bands.
mbtk_band_info_t* band = (mbtk_band_info_t*)pack->data;
@@ -1599,7 +1601,7 @@
break;
}
- if(req_band_set(cli_info->port, band, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_band_set(cli_info->sim_id, cli_info->port, band, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1610,7 +1612,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
}
@@ -1622,7 +1624,7 @@
{
mbtk_signal_info_t signal;
memset(&signal, 0, sizeof(mbtk_signal_info_t));
- if(req_net_signal_get(cli_info->port, &signal, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_net_signal_get(cli_info->sim_id, cli_info->port, &signal, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1633,7 +1635,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &signal, sizeof(mbtk_signal_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &signal, sizeof(mbtk_signal_info_t));
}
}
else // Set
@@ -1649,7 +1651,7 @@
{
mbtk_net_reg_info_t net_reg;
memset(&net_reg, 0, sizeof(mbtk_net_reg_info_t));
- if(req_net_reg_get(cli_info->port, &net_reg, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_net_reg_get(cli_info->sim_id, cli_info->port, &net_reg, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1660,7 +1662,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &net_reg, sizeof(mbtk_net_reg_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &net_reg, sizeof(mbtk_net_reg_info_t));
}
}
else // Set
@@ -1674,7 +1676,7 @@
{
if(pack->data_len == 0 || pack->data == NULL) // Get net cell.
{
- if(req_cell_info_get(cli_info->port, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_cell_info_get(cli_info->sim_id, cli_info->port, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1687,7 +1689,7 @@
{
LOG("req_cell_info_get() success,cell number: %d", cell_info.cell_list.num);
LOGD("data_len = %d", sizeof(mbtk_cell_info_array_t));
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &cell_info.cell_list, sizeof(mbtk_cell_info_array_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &cell_info.cell_list, sizeof(mbtk_cell_info_array_t));
}
}
else // Lock cell
@@ -1695,7 +1697,7 @@
char *mem = (char*)(pack->data);
int len = pack->data_len;
char reg[100] = {0};
- if(req_cell_info_set(cli_info->port, mem, reg, len, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_cell_info_set(cli_info->sim_id, cli_info->port, mem, reg, len, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1705,7 +1707,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, reg, strlen(reg));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, reg, strlen(reg));
}
}
break;
@@ -1716,7 +1718,7 @@
{
mbtk_ril_oos_info_t oos_info;
memset(&oos_info, 0, sizeof(mbtk_ril_oos_info_t));
- if(req_oos_get(cli_info->port, &oos_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_oos_get(cli_info->sim_id, cli_info->port, &oos_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1728,13 +1730,13 @@
else
{
LOG("req_oos_get() success,cell number: %d", oos_info.state);
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &oos_info, sizeof(mbtk_ril_oos_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &oos_info, sizeof(mbtk_ril_oos_info_t));
}
}
else // Set net oos.
{
mbtk_ril_oos_info_t *oos_info = (mbtk_ril_oos_info_t*)(pack->data);
- if(req_oos_set(cli_info->port, oos_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_oos_set(cli_info->sim_id, cli_info->port, oos_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1744,7 +1746,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;