[Bugfix][108][bug-view-2045][Network] signalStrength_t  rssi only valid in 2g, range is 0-31,99

 Only Configure:No
 Affected branch:Na
 Affected module:Network
 Is it affected on:only asr
 Self-test:Yes
 Doc Update:No

Change-Id: I3063b16aec5936aca0619885244604b7b90700d1
diff --git a/mbtk/libgsw_lib/gsw_nw_interface.c b/mbtk/libgsw_lib/gsw_nw_interface.c
index 5f83c41..42dd7f4 100755
--- a/mbtk/libgsw_lib/gsw_nw_interface.c
+++ b/mbtk/libgsw_lib/gsw_nw_interface.c
@@ -25,6 +25,7 @@
 #define GSW_IMEI_LENGTH 15+1

 

 #define INT_32_MAX    (0x7FFFFFFF)

+#define INVALID_AT_SIGNAL_LEVEL (99)

 

 

 #ifndef FALSE

@@ -671,45 +672,6 @@
     }

 }

 

-

-static int32_t rscp_minus_dbm_convert_to_rssi_dBm(int32_t rscp)

-{

-    if(rscp!=INT_32_MAX)

-    {

-        return -rscp;

-    }

-    else

-    {

-        return INT_32_MAX;

-    }

-}

-

-static int32_t rsrp_minus_dbm_convert_to_rssi_dBm(int32_t rsrp)

-{

-    if(rsrp!=INT_32_MAX)

-    {

-        return -rsrp;

-    }

-    else

-    {

-        return INT_32_MAX;

-    }

-}

-

-static int32_t  rxlev_convert_to_rssi_dBm(uint8 rxlev)

-{

-    if(rxlev<=63)

-    {

-        return rxlev-111;  //0 map -111, below -110

-                           // 63 map -48                           

-    }

-    else

-    {

-        return INT_32_MAX;

-    }

-    

-}

-

 //int ecno;        /**< Valid values are positive integers.  This value is the actual Ec/Io multiplied

 //                      * by -10.  Example: If the actual Ec/Io is -12.5 dB, then this response value

 //                      * will be 125.*/

@@ -805,7 +767,7 @@
     {

         return 31;

     }

-    return 99;        

+    return INVALID_AT_SIGNAL_LEVEL;        

 }

 

 static int convert_reg_state(int reg_state_t)

@@ -1140,7 +1102,6 @@
             sig_strength->lte_sig_valid = 1;

             sig_strength->rsrp = rsrp_convert_to_minus_dBm(signal->rsrp);

             sig_strength->rsrq = rsrq_convert_to_minus_dB(signal->rsrq);

-            sig_strength->rssi = rsrp_minus_dbm_convert_to_rssi_dBm(sig_strength->rsrp);

             sig_strength->rssnr= sinr_convert_to_10_times_dB(signal->sinr);

             break;

         }

@@ -1153,8 +1114,7 @@
             LOGI(GSW_NW,"rscp = %d",signal->rscp);

             sig_strength->wcdma_sig_valid = 1;

             sig_strength->rscp = rscp_convert_to_minus_dBm(signal->rscp);

-            sig_strength->ecno = ecno_convert_to_minus_10_times_dB(signal->ecno);

-            sig_strength->rssi = rscp_minus_dbm_convert_to_rssi_dBm(sig_strength->rscp);   

+            sig_strength->ecno = ecno_convert_to_minus_10_times_dB(signal->ecno); 

             break;

         }

         case MBTK_RADIO_TECH_GSM:

@@ -1163,7 +1123,7 @@
         {

             LOGI(GSW_NW,"g rxlev = %d",signal->rxlev);

             sig_strength->gw_sig_valid = 1;

-            sig_strength->rssi = rxlev_convert_to_rssi_dBm(signal->rxlev);

+            sig_strength->rssi = rxlevToLevel(signal->rxlev);

             break;

         }

         default:

@@ -2282,11 +2242,11 @@
     {        

         case 4:        

         {

-            return rsrpToLevel(sigValue);

+            return rsrpToLevel(-sigValue);

         }            

         case 3:        //WCDMA

         {

-            return rscpToLevel(sigValue);

+            return rscpToLevel(-sigValue);

         }            

         case 2:        //GSM

         {

@@ -2420,8 +2380,8 @@
                     cell_info->arfcn_valid = 1;

                     cell_info->arfcn = cell->value3;

 

-                    cell_info->rssi=rxlev_convert_to_rssi_dBm(cell->value7);

-                    cell_info->rssi_valid = (cell_info->rssi!=INT_32_MAX);

+                    cell_info->rssi=rxlevToLevel(cell->value7);

+                    cell_info->rssi_valid = (cell_info->rssi!=INVALID_AT_SIGNAL_LEVEL);

                     break;

                 }

                     

@@ -2500,9 +2460,6 @@
                     cell_info->cell_id_valid = 1;

                     cell_info->cell_id = cell->value10;

 

-                    cell_info->rssi=rsrp_minus_dbm_convert_to_rssi_dBm(cell_info->rsrp);

-                    cell_info->rssi_valid = (cell_info->rssi!=INT_32_MAX);

-

                     break;

                 }

 

@@ -2575,9 +2532,6 @@
 

                           cell_info->ext_info[neibor_count].band = cell->value9;

                           cell_info->ext_info[neibor_count].band_valid = 1;

-

-                          cell_info->ext_info[neibor_count].rssi=rsrp_minus_dbm_convert_to_rssi_dBm(cell_info->ext_info[neibor_count].rsrp);

-                          cell_info->ext_info[neibor_count].rssi_valid = (cell_info->ext_info[neibor_count].rssi!=INT_32_MAX);

                     }

 

                     neibor_count++;