1.ANAN协议增加APBJ和BPBJ多基站上传指令
authork.liang <liangkang648253071@126.com>
Fri, 30 Jul 2021 07:10:54 +0000 (15:10 +0800)
committerk.liang <liangkang648253071@126.com>
Fri, 30 Jul 2021 07:10:54 +0000 (15:10 +0800)
app/src/main/java/com/enqualcomm/support/bean/Runtime.java
app/src/main/java/com/enqualcomm/support/utils/CellInfoUtil.java
app/src/main/java/com/ic/protocols/protocolAPIHelper.java
app/src/main/java/com/ic/protocols/protocol_anan.java
local.properties

index 2479146..302e811 100644 (file)
@@ -1316,11 +1316,25 @@ public class Runtime {
         StringBuilder sb = new StringBuilder();
         sb.append(gpsp.getMCC()).append(",")
                 .append(gpsp.getMNC()).append(",")
+
                 .append(gpsp.getLAC()).append(",")
                 .append(gpsp.getGSMStationCID());
         return sb.toString();
     }
 
+    private static String mAnAnLBSStationData = "";
+
+    public String getAnAnLBSStationData() {
+        if (mAnAnLBSStationData.trim().isEmpty()) {
+            mAnAnLBSStationData = " ";
+        }
+        return mAnAnLBSStationData;
+    }
+
+    public void setAnAnLBSStationData(String mAnAnLBSStationData) {
+        Runtime.mAnAnLBSStationData = mAnAnLBSStationData;
+    }
+
     public String getGatorWifiData() {
         StringBuilder sb = new StringBuilder();
 
index 32f775b..e725ef8 100644 (file)
@@ -44,7 +44,7 @@ import rx.functions.Action1;
 public class CellInfoUtil {
 
 
-  public static void dialSilent(Context context,String dialnumber){
+    public static void dialSilent(Context context, String dialnumber) {
 //    Single.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
 //      public void call(Object param1Object) {
 //
@@ -79,315 +79,343 @@ public class CellInfoUtil {
 //        }
 //      }
 //    });
-    Single.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
-      public void call(Object param1Object) {
+        Single.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
+            public void call(Object param1Object) {
 
-        PhoneFactory.makeDefaultPhones(context);
+                PhoneFactory.makeDefaultPhones(context);
 
-        Phone p = PhoneFactory.getDefaultPhone();
+                Phone p = PhoneFactory.getDefaultPhone();
 
-        SprdCallManager cm = (SprdCallManager)SprdCallManager.getInstance();
+                SprdCallManager cm = (SprdCallManager) SprdCallManager.getInstance();
 
-        cm.registerPhone(p);
+                cm.registerPhone(p);
 
-        Phone phone = cm.getDefaultPhone();
+                Phone phone = cm.getDefaultPhone();
 
+                try {
+                    phone.dial(dialnumber);
+                } catch (Exception e) {
+                    ICLogger.PrintExceptionStackTrace(e);
+                    ICLogger.e(e.getMessage(), e);
+                }
+            }
+        });
+
+    }
+
+    public static int getSignal(TelephonyManager tm, Runtime runtime) {
+
+        if (tm == null)
+            return 5;
         try {
-          phone.dial(dialnumber);
+            CellLocation celllocation = tm.getCellLocation();
+            if (celllocation == null) {
+                ICLogger.i("cellLocation = null");
+                return 1;
+            } else {
+                if (celllocation instanceof GsmCellLocation) {
+                    for (CellInfo cinfo : tm.getAllCellInfo()) {
+                        if (cinfo instanceof CellInfoGsm) {
+                            CellSignalStrengthGsm cigsm = ((CellInfoGsm) cinfo).getCellSignalStrength();
+                            ICLogger.i("gsm signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
+                            runtime.setSignalInfo("gsm signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
+                            return cigsm.getDbm();
+                        } else if (cinfo instanceof CellInfoLte) {
+                            CellSignalStrengthLte cigsm = ((CellInfoLte) cinfo).getCellSignalStrength();
+                            //ICLogger.i("lte signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
+                            runtime.setSignalInfo("lte signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
+                            return cigsm.getDbm();
+                        } else if (cinfo instanceof CellInfoWcdma) {
+                            CellSignalStrengthWcdma cicdma = ((CellInfoWcdma) cinfo).getCellSignalStrength();
+                            // ICLogger.i("wcdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
+                            runtime.setSignalInfo("wcdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
+                            return cicdma.getDbm();
+                        }
+                    }
+                    return 2;
+                } else if (celllocation instanceof CdmaCellLocation) {
+                    for (CellInfo cinfo : tm.getAllCellInfo()) {
+                        if (cinfo instanceof CellInfoCdma) {
+                            CellSignalStrengthCdma cicdma = ((CellInfoCdma) cinfo).getCellSignalStrength();
+                            ICLogger.i("cdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
+                            runtime.setSignalInfo("cdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
+                            return cicdma.getDbm();
+                        }
+                    }
+                    return 3;
+                }
+                return 4;
+            }
         } catch (Exception e) {
-          ICLogger.PrintExceptionStackTrace(e);
-          ICLogger.e(e.getMessage(),e);
+            ICLogger.e(e.getMessage());
+            ICLogger.PrintExceptionStackTrace(e);
+            return 6;
         }
-      }
-    });
-
-  }
-  public static int getSignal(TelephonyManager tm , Runtime runtime){
-
-    if(tm==null)
-      return 5;
-    try {
-      CellLocation celllocation = tm.getCellLocation();
-      if (celllocation == null) {
-        ICLogger.i("cellLocation = null");
-        return 1;
-      } else {
-        if (celllocation instanceof GsmCellLocation) {
-          for (CellInfo cinfo : tm.getAllCellInfo()) {
-            if (cinfo instanceof CellInfoGsm) {
-              CellSignalStrengthGsm cigsm = ((CellInfoGsm) cinfo).getCellSignalStrength();
-              ICLogger.i("gsm signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
-              runtime.setSignalInfo("gsm signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
-              return cigsm.getDbm();
-            } else if (cinfo instanceof CellInfoLte) {
-              CellSignalStrengthLte cigsm = ((CellInfoLte) cinfo).getCellSignalStrength();
-              //ICLogger.i("lte signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
-              runtime.setSignalInfo("lte signal dbm =" + cigsm.getDbm() + ",level=" + cigsm.getLevel());
-              return cigsm.getDbm();
-            } else if (cinfo instanceof CellInfoWcdma) {
-              CellSignalStrengthWcdma cicdma = ((CellInfoWcdma) cinfo).getCellSignalStrength();
-             // ICLogger.i("wcdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
-              runtime.setSignalInfo("wcdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
-              return cicdma.getDbm();
-            }
-          }
-          return 2;
-        } else if (celllocation instanceof CdmaCellLocation) {
-          for (CellInfo cinfo : tm.getAllCellInfo()) {
-            if (cinfo instanceof CellInfoCdma) {
-              CellSignalStrengthCdma cicdma = ((CellInfoCdma) cinfo).getCellSignalStrength();
-              ICLogger.i("cdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
-              runtime.setSignalInfo("cdma signal dbm =" + cicdma.getDbm() + ",level=" + cicdma.getLevel());
-              return cicdma.getDbm();
+    }
+
+    public static String getCellInfo(TelephonyManager telephonyManager, Runtime runtime) {
+        ICLogger.i("LBS 延时获取基站信息");
+        /***
+         * MCC,Mobile Country Code,移动国家代码(中国的为460)。
+         * MNC,Mobile Network Code,移动网络号码(中国移动为0,中国联通为1,中国电信为2)。
+         * LAC,Location Area Code,位置区域码。
+         * CID,Cell Identity,基站编号。
+         * BSSS,Base station signal strength,基站信号强度。
+         */
+        int maxstationCount = 0;
+        String mccmnc;
+        if (Build.VERSION.SDK_INT > 23) {
+            mccmnc = telephonyManager.getSimOperator();
+            if (mccmnc == null) {
+                ICLogger.i("LBS operator == null");
+                return null;
             }
-          }
-          return 3;
+
+            mccmnc = mccmnc.substring(0, 5);
+        } else {
+            mccmnc = telephonyManager.getNetworkOperator();
         }
-        return 4;
-      }
-    }catch (Exception e){
-      ICLogger.e(e.getMessage());
-      ICLogger.PrintExceptionStackTrace(e);
-      return 6;
-    }
-  }
-  public static String getCellInfo(TelephonyManager telephonyManager, Runtime runtime) {
-    ICLogger.i("LBS 延时获取基站信息");
-    /***
-     * MCC,Mobile Country Code,移动国家代码(中国的为460)。
-     * MNC,Mobile Network Code,移动网络号码(中国移动为0,中国联通为1,中国电信为2)。
-     * LAC,Location Area Code,位置区域码。
-     * CID,Cell Identity,基站编号。
-     * BSSS,Base station signal strength,基站信号强度。
-     */
-    int maxstationCount = 0;
-    String mccmnc;
-    if (Build.VERSION.SDK_INT > 23) {
-      mccmnc = telephonyManager.getSimOperator();
-      if (mccmnc == null) {
-        ICLogger.i("LBS operator == null");
-        return null;
-      }
-
-      mccmnc = mccmnc.substring(0, 5);
-    } else {
-      mccmnc = telephonyManager.getNetworkOperator();
-    }
 
-    if(mccmnc==null|| (mccmnc!=null && mccmnc.trim().isEmpty()))
-    {
-      ICLogger.i("LBS retry get MCCMNC");
-      telephonyManager=((TelephonyManager) runtime.getContextProxy().context.getSystemService(Context.TELEPHONY_SERVICE));
-      Util.mSleep(5000);
-      mccmnc=telephonyManager.getSimOperator();
-    }
-    ICLogger.i("LBS mccmnc "+mccmnc);
-    runtime.setmccmnc(mccmnc);
-
-    if (mccmnc != null && mccmnc.length() > 3) {
-
-      //==========清除Runtime中lbs数据,暂时没有使用此lbs数据
-      runtime.getLocationInstance().clearLBSdata();
-      runtime.setLBSMultiStationData("");
-      runtime.setFZDLBSMultiStationData("");
-      runtime.setGatorLBSMultiStationData("");
-
-      //如果没插卡,后面数据会获取不到,以上数据也就为空了
-      CellLocation celllocation = telephonyManager.getCellLocation();
-      if (celllocation == null) {
-        ICLogger.i("LBS cellLocation = null");
-        return null;
-      } else {
-        StringBuilder gsmSb = new StringBuilder(mccmnc);
-        gsmSb.insert(3, ",");
-
-        StringBuilder cdmaSB = new StringBuilder();
-        runtime.setMccAndMnc(gsmSb.toString());
-        int mcc=0;
-        int mnc=0;
-        try {
-          mcc = Integer.parseInt(runtime.getLocationInstance().getMCC());
-          mnc = Integer.parseInt(runtime.getLocationInstance().getMNC());
-        }catch (Exception e){
-          ICLogger.e(e.getMessage(),e);
+        if (mccmnc == null || (mccmnc != null && mccmnc.trim().isEmpty())) {
+            ICLogger.i("LBS retry get MCCMNC");
+            telephonyManager = ((TelephonyManager) runtime.getContextProxy().context.getSystemService(Context.TELEPHONY_SERVICE));
+            Util.mSleep(5000);
+            mccmnc = telephonyManager.getSimOperator();
         }
-        if (celllocation instanceof GsmCellLocation) {
-          GsmCellLocation gsmCell = (GsmCellLocation)celllocation;
-            runtime.setCdmaInfo(null);
-          //AP01 Single GSM Station
-          gsmSb.append(",");
-          gsmSb.append(gsmCell.getLac());
-          gsmSb.append(",");
-          gsmSb.append(gsmCell.getCid());
-          gsmSb.append(",");
-          gsmSb.append(150-Math.abs(getSignal(telephonyManager,runtime)));
-          runtime.setCellinfo(gsmSb.toString());
-          runtime.getLocationInstance().setCID(gsmCell.getCid());
-          runtime.getLocationInstance().setLAC(gsmCell.getLac());
-          runtime.getLocationInstance().setRxlevel(150-Math.abs(getSignal(telephonyManager,runtime)));
-          ICLogger.i("LBS GsmCellLocation "+ gsmSb.toString());
-          if (Config.LOG_TOFILE) ICLogger.logToFile("LBS", gsmSb.toString());
-
-          //===添加gsm station到Runtime全局变量
-          runtime.getLocationInstance().append_gsmstation(gsmCell.getLac()+","+gsmCell.getCid(),150-Math.abs(getSignal(telephonyManager,runtime)));
-
-          List neighboringCell_list = telephonyManager.getNeighboringCellInfo();
-            //AP02 Multi GSM Station
-          StringBuilder gsmSbMulti = new StringBuilder(); //头
-          StringBuilder gsmSbMulti_data = new StringBuilder(); //内容
-
-          StringBuilder gsmSbMultiFZD = new StringBuilder();//头
-          StringBuilder gsmSbMultiFZD_data = new StringBuilder();//内容
-
-          StringBuilder gsmSbMultiGator = new StringBuilder(); //头
-          StringBuilder gsmSbMultiGator_data = new StringBuilder(); //内容
-
-          int size=1;
-            if (neighboringCell_list != null && !neighboringCell_list.isEmpty()) {
-              sortByRssi(neighboringCell_list);
-
-              Iterator cell = neighboringCell_list.iterator();
-
-
-              while(cell.hasNext()) {
-                NeighboringCellInfo mNeighboringCellInfo = (NeighboringCellInfo)cell.next();
-                if (mNeighboringCellInfo.getLac() == -1) {
-                  break;
+        ICLogger.i("LBS mccmnc " + mccmnc);
+        runtime.setmccmnc(mccmnc);
+
+        if (mccmnc != null && mccmnc.length() > 3) {
+
+            //==========清除Runtime中lbs数据,暂时没有使用此lbs数据
+            runtime.getLocationInstance().clearLBSdata();
+            runtime.setLBSMultiStationData("");
+            runtime.setFZDLBSMultiStationData("");
+            runtime.setGatorLBSMultiStationData("");
+
+            //如果没插卡,后面数据会获取不到,以上数据也就为空了
+            CellLocation celllocation = telephonyManager.getCellLocation();
+            if (celllocation == null) {
+                ICLogger.i("LBS cellLocation = null");
+                return null;
+            } else {
+                StringBuilder gsmSb = new StringBuilder(mccmnc);
+                gsmSb.insert(3, ",");
+
+                StringBuilder cdmaSB = new StringBuilder();
+                runtime.setMccAndMnc(gsmSb.toString());
+                int mcc = 0;
+                int mnc = 0;
+                try {
+                    mcc = Integer.parseInt(runtime.getLocationInstance().getMCC());
+                    mnc = Integer.parseInt(runtime.getLocationInstance().getMNC());
+                } catch (Exception e) {
+                    ICLogger.e(e.getMessage(), e);
                 }
-                gsmSbMulti_data.append(",");
-                gsmSbMulti_data.append(mNeighboringCellInfo.getLac());
-                gsmSbMulti_data.append("|");
-                gsmSbMulti_data.append(mNeighboringCellInfo.getCid());
-                gsmSbMulti_data.append("|");
-                gsmSbMulti_data.append( 150-Math.abs(mNeighboringCellInfo.getRssi()));
-
-                gsmSbMultiFZD_data.append(",");
-                gsmSbMultiFZD_data.append(mNeighboringCellInfo.getLac());
-                gsmSbMultiFZD_data.append(",");
-                gsmSbMultiFZD_data.append(mNeighboringCellInfo.getCid());
-                gsmSbMultiFZD_data.append(",");
-                gsmSbMultiFZD_data.append( 150-Math.abs(mNeighboringCellInfo.getRssi()));
+                if (celllocation instanceof GsmCellLocation) {
+                    GsmCellLocation gsmCell = (GsmCellLocation) celllocation;
+                    runtime.setCdmaInfo(null);
+                    //AP01 Single GSM Station
+                    gsmSb.append(",");
+                    gsmSb.append(gsmCell.getLac());
+                    gsmSb.append(",");
+                    gsmSb.append(gsmCell.getCid());
+                    gsmSb.append(",");
+                    gsmSb.append(150 - Math.abs(getSignal(telephonyManager, runtime)));
+                    runtime.setCellinfo(gsmSb.toString());
+                    runtime.getLocationInstance().setCID(gsmCell.getCid());
+                    runtime.getLocationInstance().setLAC(gsmCell.getLac());
+                    runtime.getLocationInstance().setRxlevel(150 - Math.abs(getSignal(telephonyManager, runtime)));
+                    ICLogger.i("LBS GsmCellLocation " + gsmSb.toString());
+                    if (Config.LOG_TOFILE) ICLogger.logToFile("LBS", gsmSb.toString());
+
+                    //===添加gsm station到Runtime全局变量
+                    runtime.getLocationInstance().append_gsmstation(gsmCell.getLac() + "," + gsmCell.getCid(), 150 - Math.abs(getSignal(telephonyManager, runtime)));
+
+                    List neighboringCell_list = telephonyManager.getNeighboringCellInfo();
+                    //AP02 Multi GSM Station
+                    StringBuilder gsmSbMulti = new StringBuilder(); //头
+                    StringBuilder gsmSbMulti_data = new StringBuilder(); //内容
+
+                    StringBuilder gsmSbMultiFZD = new StringBuilder();//头
+                    StringBuilder gsmSbMultiFZD_data = new StringBuilder();//内容
+
+                    StringBuilder gsmSbMultiGator = new StringBuilder(); //头
+                    StringBuilder gsmSbMultiGator_data = new StringBuilder(); //内容
+
+                    StringBuilder gsmSbMultiANAN = new StringBuilder();//头
+                    StringBuilder gsmSbMultiANAN_data = new StringBuilder();//内容
+
+                    int size = 1;
+                    if (neighboringCell_list != null && !neighboringCell_list.isEmpty()) {
+                        sortByRssi(neighboringCell_list);
+
+                        Iterator cell = neighboringCell_list.iterator();
+
+
+                        while (cell.hasNext()) {
+                            NeighboringCellInfo mNeighboringCellInfo = (NeighboringCellInfo) cell.next();
+                            if (mNeighboringCellInfo.getLac() == -1) {
+                                break;
+                            }
+                            gsmSbMulti_data.append(",");
+                            gsmSbMulti_data.append(mNeighboringCellInfo.getLac());
+                            gsmSbMulti_data.append("|");
+                            gsmSbMulti_data.append(mNeighboringCellInfo.getCid());
+                            gsmSbMulti_data.append("|");
+                            gsmSbMulti_data.append(150 - Math.abs(mNeighboringCellInfo.getRssi()));
+
+                            gsmSbMultiFZD_data.append(",");
+                            gsmSbMultiFZD_data.append(mNeighboringCellInfo.getLac());
+                            gsmSbMultiFZD_data.append(",");
+                            gsmSbMultiFZD_data.append(mNeighboringCellInfo.getCid());
+                            gsmSbMultiFZD_data.append(",");
+                            gsmSbMultiFZD_data.append(150 - Math.abs(mNeighboringCellInfo.getRssi()));
+
+                          gsmSbMultiANAN_data.append(",");
+                          gsmSbMultiANAN_data.append(mNeighboringCellInfo.getLac());
+                          gsmSbMultiANAN_data.append(",");
+                          gsmSbMultiANAN_data.append(mNeighboringCellInfo.getCid());
+                          gsmSbMultiANAN_data.append(",");
+                          gsmSbMultiANAN_data.append(150 - Math.abs(mNeighboringCellInfo.getRssi()));
 
 // Gator         MCC(%03d)+MNC(%03d)+LACID(%04X)+CELLID(%07X)+RX LEVEL(%02X)
 
-                gsmSbMultiGator_data.append(",");
-                gsmSbMultiGator_data.append(String.format("%1$03d",mcc));
-                gsmSbMultiGator_data.append(String.format("%1$03d",mnc));
-                gsmSbMultiGator_data.append(String.format("%1$04X",mNeighboringCellInfo.getLac()));
-                gsmSbMultiGator_data.append(String.format("%1$07X",mNeighboringCellInfo.getCid()));
-                gsmSbMultiGator_data.append(String.format("%1$02X",150-Math.abs(mNeighboringCellInfo.getRssi())));
-                //添加gsm station到Runtime全局变量
-                runtime.getLocationInstance().append_gsmstation(mNeighboringCellInfo.getLac()+","+mNeighboringCellInfo.getCid(),150-Math.abs(mNeighboringCellInfo.getRssi()));
-
-                maxstationCount ++;
-                if (maxstationCount == 5) {
+                            gsmSbMultiGator_data.append(",");
+                            gsmSbMultiGator_data.append(String.format("%1$03d", mcc));
+                            gsmSbMultiGator_data.append(String.format("%1$03d", mnc));
+                            gsmSbMultiGator_data.append(String.format("%1$04X", mNeighboringCellInfo.getLac()));
+                            gsmSbMultiGator_data.append(String.format("%1$07X", mNeighboringCellInfo.getCid()));
+                            gsmSbMultiGator_data.append(String.format("%1$02X", 150 - Math.abs(mNeighboringCellInfo.getRssi())));
+                            //添加gsm station到Runtime全局变量
+                            runtime.getLocationInstance().append_gsmstation(mNeighboringCellInfo.getLac() + "," + mNeighboringCellInfo.getCid(), 150 - Math.abs(mNeighboringCellInfo.getRssi()));
+
+                            maxstationCount++;
+                            if (maxstationCount == 5) {
 //                break;
-                }
-              }
-              size += maxstationCount;
-            }
+                            }
+                        }
+                        size += maxstationCount;
+                    }
+
+                    StringBuilder mmcmnc1 = new StringBuilder(mccmnc);
+                    mmcmnc1.insert(3, ",");
+                    gsmSbMulti.append(size);
+                    gsmSbMulti.append(",");
+                    gsmSbMulti.append(mmcmnc1);
+                    gsmSbMulti.append(",");
+                    gsmSbMulti.append(gsmCell.getLac());
+                    gsmSbMulti.append("|");
+                    gsmSbMulti.append(gsmCell.getCid());
+                    gsmSbMulti.append("|");
+                    gsmSbMulti.append(150 - Math.abs(getSignal(telephonyManager, runtime)));
+                    gsmSbMulti.append(gsmSbMulti_data.toString());
+
+
+                    gsmSbMultiFZD.append(size);
+                    gsmSbMultiFZD.append(",");
+                    gsmSbMultiFZD.append(1);
+                    gsmSbMultiFZD.append(",");
+                    gsmSbMultiFZD.append(mmcmnc1);
+                    gsmSbMultiFZD.append(",");
+                    gsmSbMultiFZD.append(gsmCell.getLac());
+                    gsmSbMultiFZD.append(",");
+                    gsmSbMultiFZD.append(gsmCell.getCid());
+                    gsmSbMultiFZD.append(",");
+                    gsmSbMultiFZD.append(150 - Math.abs(getSignal(telephonyManager, runtime)));
+                    gsmSbMultiFZD.append(gsmSbMultiFZD_data.toString());
+
+                  gsmSbMultiANAN.append(size);
+                  gsmSbMultiANAN.append(",");
+                  gsmSbMultiANAN.append(mmcmnc1);
+                  gsmSbMultiANAN.append(",");
+                  gsmSbMultiANAN.append(gsmCell.getLac());
+                  gsmSbMultiANAN.append(",");
+                  gsmSbMultiANAN.append(gsmCell.getCid());
+                  gsmSbMultiANAN.append(",");
+                  gsmSbMultiANAN.append(150 - Math.abs(getSignal(telephonyManager, runtime)));
+                  gsmSbMultiANAN.append(gsmSbMultiANAN_data.toString());
+
+                    gsmSbMultiGator.append(size);
+                    gsmSbMultiGator.append(",");
+                    gsmSbMultiGator.append(String.format("%1$03d", mcc))
+                            .append(String.format("%1$03d", mnc))
+                            .append(String.format("%1$04X", gsmCell.getLac()))
+                            .append(String.format("%1$07X", gsmCell.getCid()))
+                            .append(String.format("%1$02X", 150 - Math.abs(getSignal(telephonyManager, runtime))));
+                    gsmSbMultiGator.append(gsmSbMultiGator_data.toString());
+
+                    ICLogger.i("LBS GsmCellLocation MultiStation " + gsmSbMulti.toString());
+                    ICLogger.i("FZD LBS GsmCellLocation MultiStation " + gsmSbMultiFZD.toString());
+                    if (Config.LOG_TOFILE)
+                        ICLogger.logToFile("LBS", "LBS GsmCellLocation MultiStation " + gsmSbMulti.toString());
+                    if (Config.LOG_TOFILE)
+                        ICLogger.logToFile("LBS", "FZD LBS GsmCellLocation MultiStation " + gsmSbMultiFZD.toString());
+                    if (Config.LOG_TOFILE)
+                        ICLogger.logToFile("LBS", "Gator LBS GsmCellLocation MultiStation " + gsmSbMultiGator.toString());
+
+                    runtime.setLBSMultiStationData(gsmSbMulti.toString());
+                    runtime.setFZDLBSMultiStationData(gsmSbMultiFZD.toString());
+                    runtime.setGatorLBSMultiStationData(gsmSbMultiGator.toString());
+                    runtime.setAnAnLBSStationData(gsmSbMultiANAN.toString());
+
+                    return gsmSb.toString();
+                } else if (celllocation instanceof CdmaCellLocation) {
+                    CdmaCellLocation cdmaCelllocation = (CdmaCellLocation) celllocation;
+                    cdmaSB.append(cdmaCelllocation.getSystemId());
+                    cdmaSB.append(",");
+                    cdmaSB.append(cdmaCelllocation.getNetworkId());
+                    cdmaSB.append(",");
+                    cdmaSB.append(cdmaCelllocation.getBaseStationId());
+                    cdmaSB.append(",");
+                    cdmaSB.append("");
+                    cdmaSB.append(",");
+                    cdmaSB.append("");
+                    cdmaSB.append(",");
+                    cdmaSB.append(getSignal(telephonyManager, runtime));
+                    ICLogger.i("CdmaCellLocation");
+                    StringBuilder var8 = new StringBuilder();
+                    var8.append("CDMA_info=");
+                    var8.append(cdmaSB.toString());
+                    ICLogger.i(var8.toString());
+                    runtime.setCellinfo(null);
+                    runtime.setCdmaInfo(cdmaSB.toString());
+
+                    if (Config.LOG_TOFILE) ICLogger.logToFile("LBS", var8.toString());
+                    return cdmaSB.toString();
 
-            StringBuilder mmcmnc1 = new StringBuilder(mccmnc);
-            mmcmnc1.insert(3, ",");
-            gsmSbMulti.append(size);
-            gsmSbMulti.append(",");
-            gsmSbMulti.append(mmcmnc1);
-            gsmSbMulti.append(",");
-            gsmSbMulti.append(gsmCell.getLac());
-            gsmSbMulti.append("|");
-            gsmSbMulti.append(gsmCell.getCid());
-            gsmSbMulti.append("|");
-            gsmSbMulti.append(150-Math.abs(getSignal(telephonyManager,runtime)));
-            gsmSbMulti.append(gsmSbMulti_data.toString());
-
-
-          gsmSbMultiFZD.append(size);
-          gsmSbMultiFZD.append(",");
-          gsmSbMultiFZD.append(1);
-          gsmSbMultiFZD.append(",");
-          gsmSbMultiFZD.append(mmcmnc1);
-          gsmSbMultiFZD.append(",");
-          gsmSbMultiFZD.append(gsmCell.getLac());
-          gsmSbMultiFZD.append(",");
-          gsmSbMultiFZD.append(gsmCell.getCid());
-          gsmSbMultiFZD.append(",");
-          gsmSbMultiFZD.append(150-Math.abs(getSignal(telephonyManager,runtime)));
-          gsmSbMultiFZD.append(gsmSbMultiFZD_data.toString());
-
-          gsmSbMultiGator.append(size);
-          gsmSbMultiGator.append(",");
-          gsmSbMultiGator.append(String.format("%1$03d",mcc))
-                  .append(String.format("%1$03d",mnc))
-                  .append(String.format("%1$04X",gsmCell.getLac()))
-                  .append(String.format("%1$07X",gsmCell.getCid()))
-                  .append(String.format("%1$02X",150-Math.abs(getSignal(telephonyManager,runtime))));
-          gsmSbMultiGator.append(gsmSbMultiGator_data.toString());
-
-          ICLogger.i("LBS GsmCellLocation MultiStation "+ gsmSbMulti.toString());
-          ICLogger.i("FZD LBS GsmCellLocation MultiStation "+ gsmSbMultiFZD.toString());
-          if (Config.LOG_TOFILE) ICLogger.logToFile("LBS", "LBS GsmCellLocation MultiStation "+ gsmSbMulti.toString());
-          if (Config.LOG_TOFILE) ICLogger.logToFile("LBS", "FZD LBS GsmCellLocation MultiStation "+ gsmSbMultiFZD.toString());
-          if (Config.LOG_TOFILE) ICLogger.logToFile("LBS", "Gator LBS GsmCellLocation MultiStation "+ gsmSbMultiGator.toString());
-
-          runtime.setLBSMultiStationData(gsmSbMulti.toString());
-          runtime.setFZDLBSMultiStationData(gsmSbMultiFZD.toString());
-          runtime.setGatorLBSMultiStationData(gsmSbMultiGator.toString());
-
-          return gsmSb.toString();
-        } else if (celllocation instanceof CdmaCellLocation) {
-          CdmaCellLocation cdmaCelllocation = (CdmaCellLocation)celllocation;
-          cdmaSB.append(cdmaCelllocation.getSystemId());
-          cdmaSB.append(",");
-          cdmaSB.append(cdmaCelllocation.getNetworkId());
-          cdmaSB.append(",");
-          cdmaSB.append(cdmaCelllocation.getBaseStationId());
-          cdmaSB.append(",");
-          cdmaSB.append("");
-          cdmaSB.append(",");
-          cdmaSB.append("");
-          cdmaSB.append(",");
-          cdmaSB.append(getSignal(telephonyManager,runtime));
-          ICLogger.i("CdmaCellLocation");
-          StringBuilder var8 = new StringBuilder();
-          var8.append("CDMA_info=");
-          var8.append(cdmaSB.toString());
-          ICLogger.i(var8.toString());
-          runtime.setCellinfo(null);
-          runtime.setCdmaInfo(cdmaSB.toString());
-
-          if (Config.LOG_TOFILE) ICLogger.logToFile("LBS", var8.toString());
-          return cdmaSB.toString();
+                }
 
+                return null;
+            }
+        } else {
+            ICLogger.i("operator == null || operator.length() <= 3");
+            return null;
         }
-
-        return null;
-      }
-    } else {
-      ICLogger.i("operator == null || operator.length() <= 3");
-      return null;
     }
-  }
-  private static void sortByRssi(List<NeighboringCellInfo> var1) {
-    Collections.sort(var1, new Comparator<NeighboringCellInfo>() {
-      public int compare(NeighboringCellInfo var1, NeighboringCellInfo var2) {
-        return var2.getRssi() - var1.getRssi();
-      }
-    });
-  }
-  public static void setCurrentAttachCellInfo(Runtime dev) {
-
-    (new Thread(new Runnable() {
-          public void run() {
-
-            if (dev !=null) {
-              //更新lbs信息
-              getCellInfo(dev.getContextProxy().getTelephonyManager(),dev);
 
+    private static void sortByRssi(List<NeighboringCellInfo> var1) {
+        Collections.sort(var1, new Comparator<NeighboringCellInfo>() {
+            public int compare(NeighboringCellInfo var1, NeighboringCellInfo var2) {
+                return var2.getRssi() - var1.getRssi();
             }
+        });
+    }
 
-          }
+    public static void setCurrentAttachCellInfo(Runtime dev) {
+
+        (new Thread(new Runnable() {
+            public void run() {
+
+                if (dev != null) {
+                    //更新lbs信息
+                    getCellInfo(dev.getContextProxy().getTelephonyManager(), dev);
+
+                }
+
+            }
         })).start();
-  }
+    }
 
 
 }
index 4f706da..d86fd70 100644 (file)
@@ -424,7 +424,7 @@ public class protocolAPIHelper {
                 ret = protocol_mqtt.AL(runtime);
                 break;
             case PROTOCOL_ANAN:
-                ret = protocol_anan.AP10(runtime);
+                ret = protocol_anan.APBJ(runtime);
                 break;
             case Config.PROTOCOL_S123:
                 ret = protocol_s123.AP10(runtime);
index 9b54cdb..477f421 100644 (file)
@@ -209,6 +209,7 @@ public class protocol_anan {
         AP01/*定位数据包*/,
         AP03/*心跳包,也包括步数数据*/,
         AP10/*报警与地址回复包*/,
+        APBJ/*多基站报警与地址回复包*/,
         APTQ/*请求天气*/,
         APWA/*手表佩戴与未佩戴提醒*/,
         APCH/*充电状态*/,
@@ -291,6 +292,7 @@ public class protocol_anan {
         AP26,
         BPHT/*心率血压上传结果*/,
         BP10/*天气的回应*/,
+        BPBJ/*多基站报警与地址回复*/,
         AP02,
         BP02,
         BP01/*GPS的*/,
@@ -310,6 +312,7 @@ public class protocol_anan {
         cmdMap.put(CMD_TYPE.AP07, "AP07");
         cmdMap.put(CMD_TYPE.AP95, "AP95");
         cmdMap.put(CMD_TYPE.AP10, "AP10");
+        cmdMap.put(CMD_TYPE.APBJ, "APBJ");
         cmdMap.put(CMD_TYPE.APHT, "APHT");
         cmdMap.put(CMD_TYPE.APCH, "APCH");
         cmdMap.put(CMD_TYPE.APTQ, "APTQ");
@@ -367,6 +370,7 @@ public class protocol_anan {
         cmdMap.put(CMD_TYPE.AP26, "AP26");
         cmdMap.put(CMD_TYPE.BP03, "BP03");
         cmdMap.put(CMD_TYPE.BPDW, "BPDW");
+        cmdMap.put(CMD_TYPE.BPBJ,"BPBJ");
     }
 
 
@@ -521,6 +525,32 @@ public class protocol_anan {
 
     }
 
+    public static StringMessage APBJ(Runtime ds) {
+        String alarmType = ds.getAlarmType();
+        if ("03".equals(alarmType) || "04".equals(alarmType)) {
+            //不支持这些指令了
+            return null;
+        }
+        String wifiInfo = ds.getWifiInfo();
+        return genStringMessage(cmdMap.get(CMD_TYPE.APBJ),
+                new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APBJ))
+                        .append(TimeUtil.getShortDate())
+                        .append(ds.getGPSData())
+                        .append(TimeUtil.getShortTime())
+                        .append(ds.getGPSHeading())
+                        .append(String.format("%03d", abs(ds.getSignalStrength())))
+                        .append(ds.getGPSLocationStarNums())
+                        .append(ds.getBattery()).append("0")
+                        .append(ds.getProtection())
+                        .append(ds.getWorkModeStr()).append(CMDSPLIT)
+                        .append(ds.getAnAnLBSStationData()).append(CMDSPLIT)
+                        .append(ds.getAlarmType()).append(CMDSPLIT)
+                        .append(ds.getLanguage()).append(CMDSPLIT)
+                        .append("00").append(CMDSPLIT)  //不回复地址
+                        .append(wifiInfo).append(CMDEND).toString());
+
+    }
+
     private static int targetStep = -1;
     private static boolean isAchieveShow = false;
 
@@ -866,6 +896,11 @@ public class protocol_anan {
                 ICLogger.d("服务器收到报警包..");
                 mConnection.DeliverCMDMessageToSystem("AP10", cmd);//通知下面线程服务器收到指令
                 break;
+            case BPBJ:
+                //报警包
+                ICLogger.d("服务器收到报警包..");
+                mConnection.DeliverCMDMessageToSystem("APBJ", cmd);//通知下面线程服务器收到指令
+                break;
             case BP01: //gps定位包
                 ICLogger.i("服务器收到定位AP01");
                 mConnection.DeliverCMDMessageToSystem("AP01", cmd);//通知下面线程服务器收到指令
index 8bb0634..6594581 100644 (file)
@@ -5,4 +5,4 @@
 # For customization when using a Version Control System, please read the\r
 # header note.\r
 #Fri Jul 02 14:52:39 CST 2021\r
-sdk.dir=E\:\\Android\\Sdk\r
+sdk.dir=D\:\\android\\Android\\sdk\r