[Bugfix][106BUG-116][Network]  T106 support get current cell's tac earfcn

       Affected branch: unknown
       Affected module: unknown
       Is it affected on both ZXIC and MTK: both ZXIC and MTK
       Self-test: Yes
       Doc Update: No

Change-Id: I8c9f89d3d7d57446e1555bf9a177532beda30540
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
index e466e46..462df68 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
@@ -6,6 +6,7 @@
 #define MODEM_GEN97 1

 #define CELLINFO_MAX_NUM  10

 #define LY_RECOVER_TIMER_INTERVAL 128

+#define MAX_CELLINFO_ITEM_NUMBER 32

 /*T800 platform support gsm,wcdma lte,nr */

 typedef struct{

     int gw_sig_valid; /*1 valid,1 invalid*/

@@ -81,6 +82,15 @@
 int lynq_wait_signalchanges(int *handle);

 int lynq_get_urc_info(const int handle,signalStrength_t *solSigStren,int *slot_id);

 

+typedef enum {  

+  LYNQ_CELL_INFO_TYPE_GSM    = 2,  

+  LYNQ_CELL_INFO_TYPE_WCDMA  = 3,

+  LYNQ_CELL_INFO_TYPE_LTE    = 4, 

+  LYNQ_CELL_INFO_TYPE_NR    = 5

+} lynq_network_cell_info_type;

+

+int lynq_query_serve_cell_info(int serve_cell_info[MAX_CELLINFO_ITEM_NUMBER], int * valid_number);

+

 typedef enum {

     NETWORK_STATE_BUFFER_TYPE_VOICE_REG,

     NETWORK_STATE_BUFFER_TYPE_DATA_REG,

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index 116503e..dc16ae4 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -117,6 +117,166 @@
     return RESULT_OK;      

 }

 

+#if 0    

+for (i = 0; i < num; i++) {

+        appendPrintBuf("%s[%d: type=%d,registered=%d,timeStampType=%d,timeStamp=%lld", printBuf, i,

+            p_cur->cellInfoType, p_cur->registered, p_cur->timeStampType, p_cur->timeStamp);

+        p.writeInt32((int)p_cur->cellInfoType);//1

+        p.writeInt32(p_cur->registered);//2

+        p.writeInt32(p_cur->timeStampType);//3

+        p.writeInt64(p_cur->timeStamp);//4

+        case RIL_CELL_INFO_TYPE_GSM: {

+               appendPrintBuf("%s GSM id: mcc=%d,mnc=%d,lac=%d,cid=%d,", printBuf,

+                   p_cur->CellInfo.gsm.cellIdentityGsm.mcc,

+                   p_cur->CellInfo.gsm.cellIdentityGsm.mnc,

+                   p_cur->CellInfo.gsm.cellIdentityGsm.lac,

+                   p_cur->CellInfo.gsm.cellIdentityGsm.cid);

+               appendPrintBuf("%s gsmSS: ss=%d,ber=%d],", printBuf,

+                   p_cur->CellInfo.gsm.signalStrengthGsm.signalStrength,

+                   p_cur->CellInfo.gsm.signalStrengthGsm.bitErrorRate);

+

+               p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.mcc);//1

+               p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.mnc);//2

+               p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.lac);//3

+               p.writeInt32(p_cur->CellInfo.gsm.cellIdentityGsm.cid);//4

+               p.writeInt32(p_cur->CellInfo.gsm.signalStrengthGsm.signalStrength); //5

+               p.writeInt32(p_cur->CellInfo.gsm.signalStrengthGsm.bitErrorRate);//6

+               break;

+           }

+           case RIL_CELL_INFO_TYPE_WCDMA: {

+               appendPrintBuf("%s WCDMA id: mcc=%d,mnc=%d,lac=%d,cid=%d,psc=%d,", printBuf,

+                   p_cur->CellInfo.wcdma.cellIdentityWcdma.mcc,

+                   p_cur->CellInfo.wcdma.cellIdentityWcdma.mnc,

+                   p_cur->CellInfo.wcdma.cellIdentityWcdma.lac,

+                   p_cur->CellInfo.wcdma.cellIdentityWcdma.cid,

+                   p_cur->CellInfo.wcdma.cellIdentityWcdma.psc);

+               appendPrintBuf("%s wcdmaSS: ss=%d,ber=%d],", printBuf,

+                   p_cur->CellInfo.wcdma.signalStrengthWcdma.signalStrength,

+                   p_cur->CellInfo.wcdma.signalStrengthWcdma.bitErrorRate);

+

+               p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.mcc);//1

+               p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.mnc);//2

+               p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.lac);//3

+               p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.cid);//4

+               p.writeInt32(p_cur->CellInfo.wcdma.cellIdentityWcdma.psc);//5

+               p.writeInt32(p_cur->CellInfo.wcdma.signalStrengthWcdma.signalStrength);//6

+               p.writeInt32(p_cur->CellInfo.wcdma.signalStrengthWcdma.bitErrorRate);//7

+               break;

+           }

+           case RIL_CELL_INFO_TYPE_CDMA: {

+               appendPrintBuf("%s CDMA id: nId=%d,sId=%d,bsId=%d,long=%d,lat=%d", printBuf,

+                   p_cur->CellInfo.cdma.cellIdentityCdma.networkId,

+                   p_cur->CellInfo.cdma.cellIdentityCdma.systemId,

+                   p_cur->CellInfo.cdma.cellIdentityCdma.basestationId,

+                   p_cur->CellInfo.cdma.cellIdentityCdma.longitude,

+                   p_cur->CellInfo.cdma.cellIdentityCdma.latitude);

+

+               p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.networkId);//1

+               p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.systemId);//2

+               p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.basestationId);//3

+               p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.longitude);//4

+               p.writeInt32(p_cur->CellInfo.cdma.cellIdentityCdma.latitude);//5

+

+               appendPrintBuf("%s cdmaSS: dbm=%d ecio=%d evdoSS: dbm=%d,ecio=%d,snr=%d", printBuf,

+                   p_cur->CellInfo.cdma.signalStrengthCdma.dbm,

+                   p_cur->CellInfo.cdma.signalStrengthCdma.ecio,

+                   p_cur->CellInfo.cdma.signalStrengthEvdo.dbm,

+                   p_cur->CellInfo.cdma.signalStrengthEvdo.ecio,

+                   p_cur->CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio);

+

+               p.writeInt32(p_cur->CellInfo.cdma.signalStrengthCdma.dbm);//6

+               p.writeInt32(p_cur->CellInfo.cdma.signalStrengthCdma.ecio);//7

+               p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.dbm);//8

+               p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.ecio);//9

+               p.writeInt32(p_cur->CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio);//10

+               break;

+           }

+           case RIL_CELL_INFO_TYPE_LTE: {

+               /*Typethree add for T800 earfcn 2022/06/09 start*/

+               appendPrintBuf("%s LTE id: mcc=%d,mnc=%d,ci=%d,pci=%d,tac=%d,earfcn=%d", printBuf,

+                   p_cur->CellInfo.lte.cellIdentityLte.mcc,

+                   p_cur->CellInfo.lte.cellIdentityLte.mnc,

+                   p_cur->CellInfo.lte.cellIdentityLte.ci,

+                   p_cur->CellInfo.lte.cellIdentityLte.pci,

+                   p_cur->CellInfo.lte.cellIdentityLte.tac,

+                   p_cur->CellInfo.lte.cellIdentityLte.earfcn);

+

+               p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.mcc);

+               p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.mnc);

+               p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.ci);

+               p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.pci);

+               p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.tac);//5

+               p.writeInt32(p_cur->CellInfo.lte.cellIdentityLte.earfcn);//6

+               /*Typethree add for T800 earfcn 2022/06/09 end*/

+               appendPrintBuf("%s lteSS: ss=%d,rsrp=%d,rsrq=%d,rssnr=%d,cqi=%d,ta=%d", printBuf,

+                   p_cur->CellInfo.lte.signalStrengthLte.signalStrength,

+                   p_cur->CellInfo.lte.signalStrengthLte.rsrp,

+                   p_cur->CellInfo.lte.signalStrengthLte.rsrq,

+                   p_cur->CellInfo.lte.signalStrengthLte.rssnr,

+                   p_cur->CellInfo.lte.signalStrengthLte.cqi,

+                   p_cur->CellInfo.lte.signalStrengthLte.timingAdvance);

+               p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.signalStrength); //7

+               p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rsrp);//8

+               p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rsrq);//9

+               p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.rssnr);//10

+               p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.cqi);//11

+               p.writeInt32(p_cur->CellInfo.lte.signalStrengthLte.timingAdvance);//12

+               break;

+           }

+           case RIL_CELL_INFO_TYPE_TD_SCDMA: {

+               appendPrintBuf("%s TDSCDMA id: mcc=%d,mnc=%d,lac=%d,cid=%d,cpid=%d,", printBuf,

+                   p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mcc,

+                   p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mnc,

+                   p_cur->CellInfo.tdscdma.cellIdentityTdscdma.lac,

+                   p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cid,

+                   p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cpid);

+               appendPrintBuf("%s tdscdmaSS: rscp=%d],", printBuf,

+                   p_cur->CellInfo.tdscdma.signalStrengthTdscdma.rscp);

+

+               p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mcc);//1

+               p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.mnc);//2

+               p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.lac);//3

+               p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cid);//4

+               p.writeInt32(p_cur->CellInfo.tdscdma.cellIdentityTdscdma.cpid);//5

+               p.writeInt32(p_cur->CellInfo.tdscdma.signalStrengthTdscdma.rscp);//6

+               break;

+           }

+           #ifdef TELEMATIC_5G_SUPPORT

+            case RIL_CELL_INFO_TYPE_NR: {

+                /*Typethree add for T800 5G cid 2022/06/09 start*/

+                appendPrintBuf("%s NR id: mcc=%d,mnc=%d,nci=%llu,pci=%d,tac=%d", printBuf,

+                    p_cur->CellInfo.nr.cellidentity.mcc,

+                    p_cur->CellInfo.nr.cellidentity.mnc,

+                    p_cur->CellInfo.nr.cellidentity.nci,

+                    p_cur->CellInfo.nr.cellidentity.pci,

+                    p_cur->CellInfo.nr.cellidentity.tac,

+                    p_cur->CellInfo.nr.cellidentity.nrarfcn);

+

+                p.writeInt32(p_cur->CellInfo.nr.cellidentity.mcc);//1

+                p.writeInt32(p_cur->CellInfo.nr.cellidentity.mnc);//2

+                p.writeUint64(p_cur->CellInfo.nr.cellidentity.nci);//3

+                p.writeInt32(p_cur->CellInfo.nr.cellidentity.pci);//4

+                p.writeInt32(p_cur->CellInfo.nr.cellidentity.tac);//5

+                p.writeInt32(p_cur->CellInfo.nr.cellidentity.nrarfcn);//6

+                /*Typethree add for T800 5G cid 2022/06/09 end*/

+                appendPrintBuf("%s NRSS: ssRsrp=%d,ssRsrq=%d,ssSinr=%d,csiRsrp=%d,csiRsrq=%d,csiSinr=%d", printBuf,

+                    p_cur->CellInfo.nr.signalStrength.ssRsrp,

+                    p_cur->CellInfo.nr.signalStrength.ssRsrq,

+                    p_cur->CellInfo.nr.signalStrength.ssSinr,

+                    p_cur->CellInfo.nr.signalStrength.csiRsrp,

+                    p_cur->CellInfo.nr.signalStrength.csiRsrq,

+                    p_cur->CellInfo.nr.signalStrength.csiSinr);

+                p.writeInt32(p_cur->CellInfo.nr.signalStrength.ssRsrp);//7

+                p.writeInt32(p_cur->CellInfo.nr.signalStrength.ssRsrq);//8

+                p.writeInt32(p_cur->CellInfo.nr.signalStrength.ssSinr);//9

+                p.writeInt32(p_cur->CellInfo.nr.signalStrength.csiRsrp);//10

+                p.writeInt32(p_cur->CellInfo.nr.signalStrength.csiRsrq);//11

+                p.writeInt32(p_cur->CellInfo.nr.signalStrength.csiSinr);//12

+                break;

+            }

+            #endif

+#endif

+

 int copyCellInfoList(Parcel* &p,uint64_t *cellinfo,int *tac,int *earfcn)

 {

     int32_t v=0;

@@ -128,100 +288,85 @@
     }

 

     int nothing = 0;

-    int tmp_uint64 = 0;

-    p->readInt32(&v);

+    int cell_id = 0;

+    int i;

+    p->readInt32(&v);//1

     RIL_CellInfoType cellinfoType  = RIL_CellInfoType(v);

-    p->readInt32(&nothing);

+    p->readInt32(&nothing);//2

     // cellinfo->cellinfo.cellInfoType = RIL_CellInfoType(v);

     // p->readInt32(&cellinfo->cellinfo.registered);

-    p->readInt32(&v);

+    p->readInt32(&v);//3

     // cellinfo->cellinfo.timeStampType = RIL_TimeStampType(v);

-    p->readInt64(&v6);

+    p->readInt64(&v6);//4

     // cellinfo->cellinfo.timeStamp = v6;

     switch(cellinfoType) {

         case RIL_CELL_INFO_TYPE_GSM: {

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&tmp_uint64);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            *cellinfo = (uint64_t)tmp_uint64;

-            tac = &nothing;

-            earfcn = &nothing;

+            p->readInt32(&nothing);//1

+            p->readInt32(&nothing); //2

+            p->readInt32(tac);//lac

+            p->readInt32(&cell_id);//4

+            p->readInt32(earfcn);// 5 signalStrength

+            p->readInt32(&nothing);//6    

+            *cellinfo = (uint64_t)cell_id;            

             break;

         }

         case RIL_CELL_INFO_TYPE_WCDMA: {

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&tmp_uint64);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            *cellinfo = (uint64_t)tmp_uint64;

-            tac = &nothing;

-            earfcn = &nothing;

+            p->readInt32(&nothing);//1

+            p->readInt32(&nothing);//2

+            p->readInt32(tac);//3 lac

+            p->readInt32(&cell_id);//4

+            p->readInt32(earfcn);//5 psc

+            p->readInt32(&nothing); //6

+            p->readInt32(&nothing);//7

+            *cellinfo = (uint64_t)cell_id;            

             break;

         }

         case RIL_CELL_INFO_TYPE_CDMA: {

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            cellinfo = 0;

-            tac = &nothing;

-            earfcn = &nothing;

+            for(i=0;i<10;i++)

+            {

+                p->readInt32(&nothing);            

+            }            

+            *cellinfo = 0;

+            *tac = 0;

+            *earfcn = 0;

             break;

         }

         case RIL_CELL_INFO_TYPE_LTE: {

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&tmp_uint64);

-            p->readInt32(&nothing);

-            p->readInt32(tac);

-            p->readInt32(earfcn);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            *cellinfo = (uint64_t)tmp_uint64;

+            p->readInt32(&nothing);//1

+            p->readInt32(&nothing);//2

+            p->readInt32(&cell_id);//3

+            p->readInt32(&nothing);//4 pci

+            p->readInt32(tac);//5

+            p->readInt32(earfcn);//6

+            for(i=0;i<6;i++)

+            {

+                p->readInt32(&nothing);

+            }            

+            *cellinfo = (uint64_t)cell_id;

             break;

         }

         case RIL_CELL_INFO_TYPE_TD_SCDMA: {

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&tmp_uint64);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            *cellinfo = (uint64_t)tmp_uint64;

-            tac = &nothing;

-            earfcn = &nothing;

+            p->readInt32(&nothing);//1

+            p->readInt32(&nothing);//2

+            p->readInt32(tac);//lac

+            p->readInt32(&cell_id);//4

+            p->readInt32(&nothing);//5

+            p->readInt32(&nothing);//6

+            *cellinfo = (uint64_t)cell_id;       

+            *earfcn = 0;

             break;

         }

         case RIL_CELL_INFO_TYPE_NR: {

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readUint64(cellinfo);

-            p->readInt32(&nothing);

-            p->readInt32(tac);

-            p->readInt32(earfcn);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

-            p->readInt32(&nothing);

+            p->readInt32(&nothing);//1

+            p->readInt32(&nothing);//2

+            p->readUint64(cellinfo);//3

+            p->readInt32(&nothing);//4 pci

+            p->readInt32(tac);//5

+            p->readInt32(earfcn);//6

+            for(i=0;i<6;i++)

+            {

+                p->readInt32(&nothing);

+            }         

             break;

         }

     }

@@ -231,6 +376,109 @@
     return RESULT_OK;    

 }

 

+int copyCellInfo(Parcel* &p, int cell_info[MAX_CELLINFO_ITEM_NUMBER], int* valid_number)

+{

+    int32_t v=0;

+    int64_t timeStamp=0;

+    uint64_t cell_id=0;

+    int head_num=2;   

+    int i;

+    *valid_number=0;

+    p->readInt32(&v);//1

+    RIL_CellInfoType cellinfoType  = RIL_CellInfoType(v);

+    p->readInt32(&(cell_info[1]));//2

+    // cellinfo->cellinfo.cellInfoType = RIL_CellInfoType(v);

+    // p->readInt32(&cellinfo->cellinfo.registered);

+    p->readInt32(&(cell_info[2]));//3

+    // cellinfo->cellinfo.timeStampType = RIL_TimeStampType(v);

+    p->readInt64(&timeStamp);//4

+    // cellinfo->cellinfo.timeStamp = v6;

+    //cell_info[3]=(timeStamp & 0x00000000ffffffff);

+    //cell_info[4]=((timeStamp & 0xffffffff00000000) >> 32);

+    switch(cellinfoType) 

+    {

+        case RIL_CELL_INFO_TYPE_GSM: 

+        {

+            cell_info[0] = LYNQ_CELL_INFO_TYPE_GSM;

+            for(i=0;i<6;i++)

+            {

+                p->readInt32(&(cell_info[head_num+i]));

+            }      

+            *valid_number=6+head_num;

+            break;

+        }

+        case RIL_CELL_INFO_TYPE_WCDMA: 

+        {

+            cell_info[0] = LYNQ_CELL_INFO_TYPE_WCDMA;

+            for(i=0;i<7;i++)

+            {

+                p->readInt32(&(cell_info[head_num+i]));

+            }         

+            *valid_number=7+head_num;

+            break;

+        }

+        case RIL_CELL_INFO_TYPE_CDMA: 

+        {

+            for(i=0;i<10;i++)

+            {

+                p->readInt32(&(cell_info[head_num+i]));

+            }                                

+            *valid_number=0;

+            break;

+        }

+        case RIL_CELL_INFO_TYPE_LTE: 

+        {

+            cell_info[0] = LYNQ_CELL_INFO_TYPE_LTE;

+            for(i=0;i<2;i++)

+            {

+                p->readInt32(&(cell_info[head_num+i]));

+            }   

+            p->readInt32(&(cell_info[head_num+2+1]));//cid            

+            p->readInt32(&(cell_info[head_num+2+2]));//pci

+             p->readInt32(&(cell_info[head_num+2+0]));//tac

+            for(i=0;i<7;i++) //arfcn+signal strength + cqi+time advance 

+            {

+                p->readInt32(&(cell_info[head_num+5+i]));

+            } 

+            *valid_number=12+head_num;

+            break;

+        }

+        case RIL_CELL_INFO_TYPE_TD_SCDMA: 

+        {

+            for(i=0;i<12;i++)

+            {

+                p->readInt32(&(cell_info[head_num+i]));

+            }                   

+            *valid_number=0;

+            break;

+        }

+        case RIL_CELL_INFO_TYPE_NR: 

+        {

+            cell_info[0] = LYNQ_CELL_INFO_TYPE_NR;

+            for(i=0;i<2;i++)

+            {

+                p->readInt32(&(cell_info[head_num+i]));

+            }                   

+            p->readUint64(&cell_id);//3

+            cell_info[head_num+2+1] = (cell_id & 0x00000000ffffffff);

+            cell_info[head_num+2+2]=((cell_id & 0xffffffff00000000) >> 32);

+            p->readInt32(&(cell_info[head_num+2+3]));//pci

+            p->readInt32(&(cell_info[head_num+2+0]));//tac

+            for(i=0;i<7;i++)  //arfcn+signal strength 

+            {

+                p->readInt32(&(cell_info[head_num+6+i]));

+            }    

+            *valid_number=13+head_num;

+            break;

+        }

+    }

+    for(i=0; i<(*valid_number); i++)

+    {

+        LYERRLOG("cell info %d is %d",i, cell_info[i]);

+    }    

+    return RESULT_OK;    

+}

+

 static char * lynqStrdupReadString(Parcel* &p) {

     size_t stringlen;

     const char16_t *s16;

@@ -580,7 +828,7 @@
         return ret;  

     }   

     

-    int num,i;

+    int num;

     char *resp[LYNQ_RESP_STRING_MAX_NUM]={0};       

     if(!strcmp(str,"VOICE"))

     {        

@@ -750,6 +998,167 @@
     return RESULT_OK;  

 }

 

+int copy_local_cellinfo_to_user_server_cell_info(int local_cell_info[MAX_CELLINFO_ITEM_NUMBER],int cell_info[MAX_CELLINFO_ITEM_NUMBER])

+{

+     int cellinfo_type= local_cell_info[0];

+     int head_num=1;

+     int i;

+     cell_info[0] = cellinfo_type;

+    

+     switch(cellinfo_type) 

+     {

+        case LYNQ_CELL_INFO_TYPE_GSM: 

+        {

+            for(i=0;i<4;i++)

+            {

+                cell_info[head_num+i]=local_cell_info[2+i];

+            }      

+            return head_num+4;            

+        }

+        case LYNQ_CELL_INFO_TYPE_WCDMA: 

+        {

+            for(i=0;i<5;i++)

+            {

+                cell_info[head_num+i]=local_cell_info[2+i];

+            }         

+            return head_num+5;            

+        }

+        case LYNQ_CELL_INFO_TYPE_LTE: 

+        {

+            for(i=0;i<6;i++)

+            {

+                cell_info[head_num+i]=local_cell_info[2+i];

+            }                                   

+            return  head_num+6;          

+        }

+        case LYNQ_CELL_INFO_TYPE_NR: 

+        {

+            for(i=0;i<7;i++)

+            {

+                cell_info[head_num+i]=local_cell_info[2+i];

+            }                                   

+            return  head_num+7;            

+        }

+        default:

+        {

+            LYINFLOG("%s cell type %d not support",__func__,cellinfo_type); 

+            return 0;

+        }           

+     }

+

+}

+

+#if 0

+return 0  :query success

+return not 0 :query failure

+

+serve_cell_info       serve cell info

+serve_cell_info[0]    corresponding to lynq_network_cell_info_type 

+serve_cell_info[1]    /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown  */

+serve_cell_info[2]    /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown  */

+                      /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown  */

+serve_cell_info[3]    lac or tac

+                      for LYNQ_CELL_INFO_TYPE_GSM or LYNQ_CELL_INFO_TYPE_WCDMA

+                      /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown  */

+                       for  LYNQ_CELL_INFO_TYPE_LTE or LYNQ_CELL_INFO_TYPE_NR

+                       /* 16-bit tracking area code, INT_MAX if unknown  */

+serve_cell_info[4]  cellid

+                    for LYNQ_CELL_INFO_TYPE_GSM

+                    /* 16-bit GSM Cell Identity described in TS 27.007, 0..65535, INT_MAX if unknown  */            

+                    for LYNQ_CELL_INFO_TYPE_WCDMA 

+                    /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown  */

+                    for LYNQ_CELL_INFO_TYPE_LTE

+                    /* 28-bit Cell Identity described in TS 36.331, INT_MAX if unknown */        

+                    for LYNQ_CELL_INFO_TYPE_NR

+                    NR Cell Identity 'S low 32 bit

+                    /**

+                      * NR Cell Identity in range [0, 68719476735] (36 bits) described in 3GPP TS 38.331, which

+                      * unambiguously identifies a cell within a PLMN. This value must be valid for registered or

+                      * camped cells; LONG_MAX (2^63-1) means invalid/unreported.

+                    */                    

+serve_cell_info[5]

+                 for LYNQ_CELL_INFO_TYPE_WCDMA  psc  /* 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511, INT_MAX if unknown */

+                 for LYNQ_CELL_INFO_TYPE_LTE    pci    /* physical cell id 0..503, INT_MAX if unknown  */

+                 for LYNQ_CELL_INFO_TYPE_NR     NR Cell Identity 's high 32 bit 

+                 /**

+                      * NR Cell Identity in range [0, 68719476735] (36 bits) described in 3GPP TS 38.331, which

+                      * unambiguously identifies a cell within a PLMN. This value must be valid for registered or

+                      * camped cells; LONG_MAX (2^63-1) means invalid/unreported.

+                 */        

+                 

+serve_cell_info[6]                 

+                 for LYNQ_CELL_INFO_TYPE_LTE    earfcn; /* 18-bit LTE Absolute RF Channel Number; this value must be reported */

+                 for LYNQ_CELL_INFO_TYPE_NR     pci     /* Physical cell id in range [0, 1007] described in 3GPP TS 38.331. This value must be valid. */

+                 

+serve_cell_info[7]                  

+                 for LYNQ_CELL_INFO_TYPE_NR     nrarfcn     /**

+                                                         * NR Absolute Radio Frequency Channel Number, in range [0, 3279165].

+                                                         * Reference: 3GPP TS 38.101-1 and 3GPP TS 38.101-2 section 5.4.2.1.

+                                                         * This value must be valid.

+                                                         */ 

+valid_number  serve_cell_info's valid data length

+

+for LYNQ_CELL_INFO_TYPE_GSM    valid_number >= 5 &&  <= MAX_CELLINFO_ITEM_NUMBER

+for LYNQ_CELL_INFO_TYPE_WCDMA  valid_number >= 6 &&  <= MAX_CELLINFO_ITEM_NUMBER

+for LYNQ_CELL_INFO_TYPE_LTE     valid_number  >= 7 &&  <= MAX_CELLINFO_ITEM_NUMBER

+for LYNQ_CELL_INFO_TYPE_NR     valid_number  >= 8 &&  <= MAX_CELLINFO_ITEM_NUMBER

+#endif

+

+int lynq_query_serve_cell_info(int serve_cell_info[MAX_CELLINFO_ITEM_NUMBER], int *valid_number)

+{

+    if(g_module_init_flag != MODULE_RUNNING)

+    {

+        LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

+        return LYNQ_E_CONFLICT;

+    }

+    if(NULL == valid_number || NULL == serve_cell_info)

+    {

+        LYERRLOG("%s there is parameter is NULL",__func__);  

+        return LYNQ_E_PARAMETER_ANONALY;

+    }      

+    

+    Parcel* p=NULL;      

+    int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_GET_CELL_INFO_LIST,0,"");

+    

+    if(ret!=RESULT_OK)

+    {

+        LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

+        return ret;  

+    }   

+    

+    int num;

+    int local_valid_number;

+    int local_cell_info[MAX_CELLINFO_ITEM_NUMBER];

+

+    p->readInt32(&num);

+    *valid_number=0;

+    LYINFLOG("cell info num:%d",num);

+    for(int i = 0;i<num;i++)

+    {

+        copyCellInfo(p,local_cell_info,&local_valid_number);

+        if(local_valid_number>0 && local_cell_info[1]!=0)

+        {

+              (*valid_number)=copy_local_cellinfo_to_user_server_cell_info(local_cell_info,serve_cell_info);

+              if((*valid_number)>0)

+              {

+                  break;

+              }

+            else 

+            {

+                LYINFLOG("%s fail",__func__); 

+                delete p;

+                return LYNQ_E_INNER_ERROR;

+            }

+        }

+        

+    }

+    

+    LYINFLOG("%s suc",__func__); 

+    delete p;

+    return RESULT_OK;  

+}

+

+

 int lynq_set_unsol_cell_info_listrate(const int rate)

 {

     if(g_module_init_flag != MODULE_RUNNING)