completed rest api.
authorTrillGates <williamtrillgates@gmail.com>
Thu, 5 Aug 2021 08:18:23 +0000 (16:18 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Thu, 5 Aug 2021 08:18:23 +0000 (16:18 +0800)
app/src/main/java/com/enqualcomm/support/LocationClient.java
app/src/main/java/com/enqualcomm/support/service/SignFlagObserver.java
app/src/main/java/com/ic/protocols/protocolAPIHelper.java
app/src/main/java/com/ic/protocols/protocol_s123.java

index 97db6a6..a4668eb 100644 (file)
@@ -33,7 +33,6 @@ import java.util.concurrent.Executors;
 
 import rx.Single;
 import rx.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
 
 import static com.enqualcomm.support.Config.GPSLocationTimeoutInSeconds;
 import static com.enqualcomm.support.Config.WiFiLocationTimeoutInSeconds;
@@ -461,9 +460,8 @@ public class LocationClient {
         startCheckTime = System.currentTimeMillis();
         needCheckAgain = true;
         ICLogger.i("startCheckResult ");
-
-        AlarmHelper.setRealTimeAlarmInSeconds(runtime.getContextProxy().context, 1, ACTION_CHECK_LOCATION_RESULT);
-
+        AlarmHelper.setRealTimeAlarmInSeconds(runtime.getContextProxy().context,
+                1, ACTION_CHECK_LOCATION_RESULT);
     }
 
 
@@ -475,13 +473,9 @@ public class LocationClient {
 
         @Override
         public boolean handleMessage(Message msg) {
-
             if (msg.what == msgWhat_WaitAndSendLocation) {
-                Single.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {
-                    public void call(Object param1Object) {
-                        waitAndSendLocation();
-                    }
-                });
+                Single.just(null).observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(param1Object -> waitAndSendLocation());
             } else if (msg.what == msgWhat_StartLocationProcess) {
                 startNomalLocation = true;
                 if (Config.BLEScanProtocol == 0 && runtime.bleInfo.btMacList.size() > 0) {
@@ -603,7 +597,7 @@ public class LocationClient {
 
         //        ICLogger.i("getMNC "+runtime.getLocationInstance().getMNC()+" getMCC "+runtime.getLocationInstance().getMCC()+" getGSMStationCID " + runtime.getLocationInstance().getGSMStationCID()+ " getLAC "+runtime.getLocationInstance().getLAC()+" changed "+runtime.getLocationInstance().isDataChanged());
         ICLogger.i("waitAndSendLocation " + checktimes + ", lbs=" + lbs_ok + ", wifi=" + wifi_ok + ", gps=" + gps_ok + ", mode=" + mode);
-        if (NoMoveAndNoGPSsignalSkipGpsFlag == true) {
+        if (NoMoveAndNoGPSsignalSkipGpsFlag) {
             ICLogger.i("NoMove And NoGPSsignal SkipGpsLocation!");
             mode = ICLocation.NORMAL_MOD;//如果没有移动且没有Gps信号,则采用Normal 模式进行wifi定位
         }
@@ -612,13 +606,10 @@ public class LocationClient {
             case ICLocation.CUSTOM_MOD8_GPS:
             case ICLocation.EMERGNECY_MOD:
             case ICLocation.REALTIME_MOD:
-
-
                 //GPS 优先的话多给些时间(10秒)
                 if (checktimes > GPSLocationTimeoutInSeconds) {
                     ICLogger.i("waitAndSendLocation " + checktimes + " timeout");
                     timeout = true;
-
                 }
                 if (NoMoveTimeout && (timeout || gps_nosignal)) {
                     //没有移动,GPS超时或者没信号都会给 计数 加 1
@@ -638,24 +629,20 @@ public class LocationClient {
                         || (lbs_ok && (gps_ok || startSOSLocation) && wifi_ok)
                         || (lbs_ok && gps_nosignal && wifi_ok)
                 ) {
-
                     String locationtype = "LBS";
                     if (gps_ok) {
                         locationtype = "GPS";
                     } else if (wifi_ok) {
                         locationtype = "WiFi";
                     }
-
                     runtime.getLocationInstance().setLocationType(locationtype);
                     runtime.getLocationInstance().setLocationTime(TimeUtil.getSystemTime3());
-
-                    if (startSOSLocation == true) {
+                    if (startSOSLocation) {
                         StringMessage AP10_CMD = protocolAPIHelper.getWarningMSG(runtime);
                         DeliverMessage(AP10_CMD);
                         runtime.setAlarmType(Runtime.AlarmType.ALARM_REMOVE_SOS);
                         startSOSLocation = false;
                     }
-
                     if (startNomalLocation = true) {
                         startNomalLocation = false;
                         if (gps_ok) {
@@ -667,29 +654,21 @@ public class LocationClient {
                             StringMessage AP02_CMD = protocolAPIHelper.getLBSLocationMSG(runtime);
                             DeliverMessage(AP02_CMD);
                         }
-
                     }
-
-
                     stopCheckLocationResult();
-
-
                     String msg = "Location Fixed Type " + runtime.getLocationInstance().getLocationType() + " at " + runtime.getLocationInstance().getLocationTime() + " timeout " + timeout;
                     ICLogger.i(msg);
-
                     if (responseUrl != null) {
                         if (locationtype.equals("GPS")) {
                             responseUrl.replyCallBack(runtime.getLocationInstance().getLocation().latGPSStr + "," + runtime.getLocationInstance().getLocation().lonGPSStr);
                         } else {
                             responseUrl.replyCallBack("Location Fixed Type " + locationtype);
                         }
-
                     }
-                    if (Config.LOG_TOFILE)
+                    if (Config.LOG_TOFILE) {
                         ICLogger.logToFile("GPS", msg);
-
-
-                } else if (timeout == true) {
+                    }
+                } else if (timeout) {
                     //timeout + noLBS +noGPS
                     ICLogger.i("timeout no location  ");
                     stopCheckLocationResult();
@@ -703,7 +682,6 @@ public class LocationClient {
             case ICLocation.CUSTOM_MOD8_WIFI:
             default:
                 //wifi优先的话给20秒时间
-
                 if (checktimes > WiFiLocationTimeoutInSeconds) {
                     ICLogger.i("waitAndSendLocation " + checktimes + " timeout");
                     timeout = true;
@@ -714,7 +692,6 @@ public class LocationClient {
                     ICLogger.i("waitAndSendLocation " + timeCost + "> 20000ms timeout");
                     // timeout=true;
                 }
-
                 if ((lbs_ok && timeout) || (lbs_ok && wifi_ok)) {
                     String locationtype = "LBS";
                     if (wifi_ok) {
@@ -736,8 +713,6 @@ public class LocationClient {
                     }
 
                     stopCheckLocationResult();
-
-
                     String msg = "Location Fixed Type " + runtime.getLocationInstance().getLocationType() + " at " + runtime.getLocationInstance().getLocationTime() + " timeout " + timeout;
                     ICLogger.i(msg);
 
@@ -1001,7 +976,7 @@ public class LocationClient {
         }
 
         if (NoMoveTimeout) {
-// 记录gps 无信号或者timeout的次数,超过5 就会停止使用gps定位,只要有一次 移动,或者设置为wifi定位,则清零。
+            // 记录gps 无信号或者timeout的次数,超过5 就会停止使用gps定位,只要有一次 移动,或者设置为wifi定位,则清零。
             if (gpsTimeoutCountOnNoMove >= MaxGpsTimeoutCountOnNoMove) {
                 NoMoveAndNoGPSsignalSkipGpsFlag = true;
             } else {
@@ -1023,7 +998,7 @@ public class LocationClient {
         switch (mod) {
             case ICLocation.CUSTOM_MOD:
             case ICLocation.CUSTOM_MOD8_GPS:
-                if (NoMoveAndNoGPSsignalSkipGpsFlag == false) {
+                if (!NoMoveAndNoGPSsignalSkipGpsFlag) {
                     if (runtime.getLocationInstance().getLocation_cycle() <= 60) {
                         nmeaListener.setNoStop(true);
                     } else {
@@ -1036,16 +1011,13 @@ public class LocationClient {
                 break;
             case ICLocation.EMERGNECY_MOD:
             case ICLocation.REALTIME_MOD:
-
-
-                if (NoMoveAndNoGPSsignalSkipGpsFlag == false) {
+                if (!NoMoveAndNoGPSsignalSkipGpsFlag) {
                     nmeaListener.setNoStop(true);
-//        nmeaListener.setNoStop(false);//保证从Custom切换回来的时候不至于不关闭gps
+                    //nmeaListener.setNoStop(false);//保证从Custom切换回来的时候不至于不关闭gps
                     startGpsLocate();
                 } else {
                     clearGPSlocateStat(); //确保gps关闭,防止切换回来gps状态错误,尤其是不NoStop模式下的gps切换回来有此风险。
                 }
-
                 break;
             case ICLocation.LOWPOWER_MOD:
             case ICLocation.NORMAL_MOD:
@@ -1065,9 +1037,8 @@ public class LocationClient {
     private static int forceLocation = 0;
 
     public void onReceive(StringMessage paramStringMessage) {
-
         ICLogger.i("LocationClient onReceive " + paramStringMessage.cmd());
-//    Deliver.triggerSendThread();
+        //Deliver.triggerSendThread();
         //响应定位指令
         if ("StartLocate".equals(paramStringMessage.cmd())) {
             forceLocation = 1;
@@ -1078,11 +1049,9 @@ public class LocationClient {
             ICLogger.i("Set WorkMODE  " + mod + " and reset Location AlarmCycle");
             CoreService.getInstance().setLocationAlarm(mod); //默认设置好Alarm后会触发一次定位,无需后面再触发定位了。
             forceLocation = 1; //不管是什么模式,都强制定位一次,然后再说其他情况
-
-            if (mod == ICLocation.EMERGNECY_MOD)
-                CoreService.getInstance().setEmegencyLocationSTOPAlarm(5);//Emergency模式5分钟自动停止
-//      this.startLocationProcess(mod);
-
+            if (mod == ICLocation.EMERGNECY_MOD) {
+                CoreService.getInstance().setEmegencyLocationSTOPAlarm(5);//Emergency模式5分钟自动停止}
+            }
         }
     }
 
@@ -1126,7 +1095,6 @@ public class LocationClient {
         stringBuilder.append(runtime.getLocationInstance().getLocation_cycle());
         ICLogger.i(stringBuilder.toString());
 
-
         /*注册 亮屏监控*/
 //    IntentFilter intentFilter = new IntentFilter();
 //    intentFilter.addAction("android.intent.action.SCREEN_ON");
index cadef03..5972e52 100644 (file)
@@ -1,12 +1,8 @@
 package com.enqualcomm.support.service;
 
 import android.content.ContentResolver;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.net.Uri;
 import android.os.Handler;
 
-import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
 import com.enqualcomm.support.service.base.BaseSettingsObserver;
 import com.enqualcomm.support.utils.ICLogger;
 import com.ic.protocols.protocolAPIHelper;
@@ -14,19 +10,17 @@ import com.ic.protocols.protocolAPIHelper;
 public class SignFlagObserver extends BaseSettingsObserver {
 
     private final Handler mHandler;
-    private final ContentResolver mResolver;
 
     public SignFlagObserver(Handler handler, ContentResolver resolver) {
-        super(handler);
+        super(handler, resolver);
         this.mHandler = handler;
-        this.mResolver = resolver;
     }
 
     @Override
     public void onChange(boolean selfChange) {
         ICLogger.d("SignFlagObserver on value change...");
         mHandler.post(() -> {
-
+            String value = getSettingsValueByKey("sign_action_flag", "");
             protocolAPIHelper.sendSignMsg(value);
         });
     }
index 0bafe32..797844c 100644 (file)
@@ -520,7 +520,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.APBJ(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = protocol_s123.AP10(runtime);
+                ret = protocol_s123.APAL(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = protocol_gator.BP30(runtime);
@@ -584,7 +584,6 @@ public class protocolAPIHelper {
                 ret = protocol_anan.AP03(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                //ret = protocol_s123.AP00(runtime);
                 ret = protocol_s123.AP03(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
@@ -617,7 +616,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.APDW(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = protocol_s123.AP01(runtime);
+                ret = protocol_s123.APFF(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = protocol_gator.BP30(runtime);
@@ -649,7 +648,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.APDW(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = protocol_s123.AP02(runtime);
+                ret = protocol_s123.APFF(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = protocol_gator.BP30(runtime);
index 0dddabf..25dfef6 100644 (file)
@@ -188,7 +188,6 @@ public class protocol_s123 {
         BP00,
         AP01,//混合定位
         BP01,
-        AP02,//多基站定位
         BP02,
         AP92,//CDMA 混合定位
         BP92,
@@ -200,8 +199,8 @@ public class protocol_s123 {
         BP05,
         AP07,//语音上行
         BP07,
-        AP10,//报警与地址回复
-        BP10,
+        BPAL,//报警与地址回复
+        APAL,
         AP49,//心率上传
         BP49,
         APHT,//心率血压上传
@@ -214,6 +213,8 @@ public class protocol_s123 {
         BPBR,
         APRP,//签到信息上传
         BPRP,
+        APFF,//定位数据包
+        BPFF,
         /* 服务器发起*/
         AP12,
         BP12,//SOS 号码设置
@@ -329,7 +330,6 @@ public class protocol_s123 {
         cmdMap.put(CMD_TYPE.BP00, "BP00");
         cmdMap.put(CMD_TYPE.AP01, "AP01");
         cmdMap.put(CMD_TYPE.BP01, "BP01");
-        cmdMap.put(CMD_TYPE.AP02, "AP02");
         cmdMap.put(CMD_TYPE.BP02, "BP02");
         cmdMap.put(CMD_TYPE.AP92, "AP92");
         cmdMap.put(CMD_TYPE.BP92, "BP92");
@@ -341,8 +341,8 @@ public class protocol_s123 {
         cmdMap.put(CMD_TYPE.BP05, "BP05");
         cmdMap.put(CMD_TYPE.AP07, "AP07");
         cmdMap.put(CMD_TYPE.BP07, "BP07");
-        cmdMap.put(CMD_TYPE.AP10, "AP10");
-        cmdMap.put(CMD_TYPE.BP10, "BP10");
+        cmdMap.put(CMD_TYPE.BPAL, "BPAL");
+        cmdMap.put(CMD_TYPE.APAL, "APAL");
         cmdMap.put(CMD_TYPE.AP49, "AP49");
         cmdMap.put(CMD_TYPE.BP49, "BP49");
         cmdMap.put(CMD_TYPE.APHT, "APHT");
@@ -356,6 +356,8 @@ public class protocol_s123 {
         cmdMap.put(CMD_TYPE.APGJ, "APGJ");
         cmdMap.put(CMD_TYPE.APRP, "APRP");
         cmdMap.put(CMD_TYPE.BPRP, "BPRP");
+        cmdMap.put(CMD_TYPE.APFF, "APFF");
+        cmdMap.put(CMD_TYPE.BPFF, "BPFF");
         /* 服务器发起*/
         cmdMap.put(CMD_TYPE.AP12, "AP12");
         cmdMap.put(CMD_TYPE.BP12, "BP12");
@@ -774,7 +776,8 @@ public class protocol_s123 {
     }
 
     public static StringMessage AP03(Runtime ds) {
-        //示例数据:IWAP03,06000908000102,5555,30#  IWAP03,000000null00000,0,0#
+        //IWAP03,06000908000102,5555,30,1200#
+        //IWAP03,06000908000102,5555,30#
         //IW: 标识符
         //AP03:命令字
         //设备在静止时,可以通过该指令与平台保持连接和解决静态漂移
@@ -789,41 +792,60 @@ public class protocol_s123 {
         //02为工作模式 ,(设防,工作模式如果为00,则代表无或未设置)
         //5555: 计步步数,每次到达 9999 后重 0 开始计 (此处 9999 为示例,可以为2字节int 然后溢出归零)
         //30: 翻滚次数
-        return genStringMessage(cmdMap.get(CMD_TYPE.AP03), new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP03)).append(CMDSPLIT).append(String.format("%03d", abs(ds.getSignalStrength())))
-                .append(ds.getGPSLocationStarNums()).append(ds.getBattery()).append(ds.isPowerConnected() ? "1" : "0")
-                .append(ds.getProtection()).append(ds.getWorkModeStr()).append(CMDSPLIT)
-                .append(ds.getTotalStepCount()).append(CMDSPLIT).append(ds.getRolltimes()).append(CMDEND).toString());
-    }
-
-    //处理 心跳 BP03
-    public void handleBP03(String cmd) {
-        log("BP03心跳接收成功");
+        //获取一下卡路里
+        ContentResolver resolver = ds.getContextProxy().getResolver();
+        Cursor query = resolver.query(Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+                new String[]{"s_value"}, "s_key=?", new String[]{"sport_calorie_value"}, null);
+        String calorie = "0";
+        if (query != null) {
+            if (query.moveToNext()) {
+                calorie = query.getString(0);
+            }
+            query.close();
+        }
+        return genStringMessage(cmdMap.get(CMD_TYPE.AP03),
+                new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP03))
+                        .append(CMDSPLIT)
+                        .append(String.format("%03d", abs(ds.getSignalStrength())))
+                        .append(ds.getGPSLocationStarNums())
+                        .append(ds.getBattery())
+                        .append(ds.isPowerConnected() ? "1" : "0")
+                        .append(ds.getProtection())
+                        .append(ds.getWorkModeStr()).append(CMDSPLIT)
+                        .append(ds.getTotalStepCount())
+                        .append(CMDSPLIT)
+                        .append(ds.getRolltimes())
+                        .append(CMDSPLIT).append(calorie)
+                        .append(CMDEND).toString());
     }
 
-
-    public static StringMessage AP10(Runtime ds) {
+    public static StringMessage APAL(Runtime mRuntime) {
         /**
-         * IWAP10080524A2232.9806N11404.9355E000.1061830323.8706000908000502,
-         * 460,0,9520,3671,
-         * 00,zh-cn,00,
-         * 00为报警状态,00为无任何报警(01:SOS,02:低电,03:脱落报警,04:佩戴提醒,05:剪断报警,06:跌倒报警,07:心率异常, 08:心率过高, 09:心率过低,10:收缩压过高,11:收缩压过低,12:舒张压过高,13:舒张压过低,14:久坐提醒,15:非法解锁(剪断报警),16:锁定提醒(佩戴提醒),17:体温过高,18体温过低)
-         * zh-cn:设备语言
-         * 00:第一个0:是否需要回复地址信息,0:不回复,1回复.
-         * HOME|74-DE-2B-44-88-8C|97&HOME1|74-DE-2B-44-88-8C|97&HOME2|74-DE-2B-44-88-8C|97&HOME3|74-DE-2B-44-88-8C|97#
+         * IWAPAL,080524, 102533,00, A,22.567898,113.1234567, 50,5,61, 120, wgs84, 99, 20, 460, 0,
+         * 9520|3671|-54&9521|3675|-53, Home|74-DE-2B-44-88-8C|97&
+         * Home1|74-DE-2B-44-88-8C|97&Home2|74-DE-2B-44-88-8C|97&
+         * Home3|74-DE-2B-44-88-8C|97
+         * IW标识符
+         * APAL:命令字
+         * 080524: 2008 年05 月24
+         * 102533: 10点25分33秒
+         * 00为报警状态,00为无任何报警(01:SOS,02:低电,03:脱落报警,04:佩戴提醒,05:剪断报警,06:跌倒报警,07:心率异常, 08:心率过高, 09:心率过低,10:收缩压过高,11:收缩压过低,12:舒张压过高,13:舒张压过低,14:久坐提醒,15:非法解锁(表带剪断报警),16:锁定提醒(表带佩戴提醒),17:体温过高,18体温过低)    【05和15冲突,目前使用15】
+         * --:余下的参考APFF 格式
          */
-        return genStringMessage(cmdMap.get(CMD_TYPE.AP10), new StringBuffer(CMDHEADER)
-                .append(cmdMap.get(CMD_TYPE.AP10))
-                .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.getLBSData()).append(CMDSPLIT)
-                .append(ds.getAlarmType()).append(CMDSPLIT)
-                .append(ds.getLanguage()).append(CMDSPLIT)
-                .append("00").append(CMDSPLIT)  //不回复地址
-                .append(ds.getWifiInfo()).append(CMDEND).toString());
-
+        return genStringMessage(cmdMap.get(CMD_TYPE.APAL),
+                new StringBuffer(CMDHEADER)
+                        .append(cmdMap.get(CMD_TYPE.APAL))
+                        .append(CMDSPLIT)
+                        .append(TimeUtil.getShortDate())
+                        .append(CMDSPLIT).append(TimeUtil.getSystemTimeHHmmss())
+                        .append(CMDSPLIT).append(mRuntime.getAlarmType())
+                        .append(CMDSPLIT).append(mRuntime.getS123GpsData())
+                        .append(CMDSPLIT).append("wgs84")//原始经纬度
+                        .append(CMDSPLIT).append(mRuntime.getSignalStrength())
+                        .append(CMDSPLIT).append(mRuntime.getBatterylevel())
+                        .append(CMDSPLIT).append(mRuntime.getLBSData())
+                        .append(CMDSPLIT).append(mRuntime.getWifiInfo())
+                        .toString());
     }
 
     /*LBS+GPS混合定位*/
@@ -846,38 +868,53 @@ public class protocol_s123 {
     }
 
     /*LBS+WiFi混合定位*/
-    public static StringMessage AP02(Runtime ds) {
+    public static StringMessage APFF(Runtime ds) {
         //示例数据:IWAP02,
-        // zh_cn,
-        // 0,
-        // 7,
-        // 460,0,
-        // 9520|3671|13,9520|3672|12,9520|3673|11,9520|3674|10,9520|3675|9,9520|3676|8,9520|3677|7,
-        // 4,
-        // 1|D8-24-BD-79-FA-1F|59&2|3C-46-D8-6D-CE-01|81&3|0C-4C-39-1A-7C-65|69&4|70-A8-E3-5D-D7-C0|65#
+        //IWAPFF, 180410,102533,A,22.567898,113.1234567, 50,5,61, 120, wgs84, 99, 20, 460, 0,
+        // 9520|3671|-54&9521|3675|-53,
+        // Home|74-DE-2B-44-88-8C|97&
+        // Home1|74-DE-2B-44-88-8C|97&
+        // Home2|74-DE-2B-44-88-8C|97&
+        // Home3|74-DE-2B-44-88-8C|97#
         //IW标识符
-        //AP02:命令字
-        //zh_cn: 语言标志
-        //0:回复标识,为0时不回复地址,为 1 时,服务器回复地址信息
-        //7: 表示共有7组基站
-        //460: MCC 国家码
-        //0: MNC运营商代码
-        //9520|3671|10: LAC|CID|dbm表示一组基站信息,后面数量需和基站组数地应  10:dbm为信号强度多基站信号强度建议从高到低排列后上传,信号强度转正数:150 – abs(dbm)
-        //4: 表示WIFI组数,
-        //1|D8-24-BD-79-FA-1F|59: ssid|mac地址|信号强度,信号强度转正数:150 – abs(信号强度)
+        //APFF:命令字
+        //180410: 2018 年04 月10
+        //102533:10点25分33秒
+        //A:“A”表示数据有效,”V”无效,如为V则取WIFI,LBS数据
+        //22.567898: 纬度
+        //113.1234567: 经度
+        //50:精准度
+        //5:速度
+        //61:方向
+        //120:高度
+        //wgs84:坐标系,坐标类型(wgs84: 原始经纬度,SDK国外一般取到原始的,bd09: 百度经纬度,百度SDK,在国内获取到的经纬度,gcj02: 国测局,火星坐标,高德SDK国内取到的经纬度)
+        //99:GSM信号
+        //20电量
+        //460:基站国家码
+        //0:基站运营商代码
+        //9520|3671|-54:LAC|CID|DB信号强度
+        //&:连接符多基站或者多wifi时使用
+        //Home|74-DE-2B-44-88-8C|97:Wifi名称|wifiMAC地址|wifi信号强度,
+        //&:连接符多基站或者多wifi时使用
         int apsum = 0;
         String wifiinfo = ds.getWifiInfo();
         if (!wifiinfo.isEmpty()) {
             String[] list = wifiinfo.split("&");
             apsum = list.length;
         }
-
         ICLogger.i("Wifi ap sum " + apsum);
-        return genStringMessage(cmdMap.get(CMD_TYPE.AP02), new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP02)).append(CMDSPLIT)
-                .append(ds.getLanguage()).append(CMDSPLIT)
-                .append(0).append(CMDSPLIT) //为0时不回复地址
-                .append(ds.getLBSMultiStationData()).append(CMDSPLIT)  //基站信息数据
-                .append(apsum).append(CMDSPLIT).append(ds.getWifiInfo()).append(CMDEND).toString());  //wifi信息数据
+        return genStringMessage(cmdMap.get(CMD_TYPE.APFF),
+                new StringBuffer(CMDHEADER)
+                        .append(cmdMap.get(CMD_TYPE.APFF))
+                        .append(CMDSPLIT).append(TimeUtil.getSystemDateYYMMDD())
+                        .append(CMDSPLIT).append(TimeUtil.getSystemTimeHHmmss())
+                        .append(CMDSPLIT).append(ds.getS123GpsData())
+                        .append(CMDSPLIT).append("wgs84")//原始经纬度
+                        .append(CMDSPLIT).append(ds.getSignalStrength())
+                        .append(CMDSPLIT).append(ds.getBatterylevel())
+                        .append(CMDSPLIT).append(ds.getLBSData())
+                        .append(CMDSPLIT).append(ds.getWifiInfo())
+                        .toString());  //wifi信息数据
     }
 
     //处理 定位 BP01
@@ -887,7 +924,7 @@ public class protocol_s123 {
 
 
     public static StringMessage APXL(String id) {
-//设备响应:      IWAPXL,080835#
+        //设备响应:      IWAPXL,080835#
         //080835:指令流水号
         return genStringMessage(cmdMap.get(CMD_TYPE.APXL), new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APXL))
                 .append(CMDSPLIT).append(id)
@@ -3359,13 +3396,6 @@ public class protocol_s123 {
                 ICLogger.i("服务器收到定位AP01");
                 mConnection.DeliverCMDMessageToSystem("AP01", cmd);//通知下面线程状态变化
                 break;
-            case AP02:
-                break;
-            case BP02:// wifi定位包
-                handleBP02(cmd);
-                ICLogger.i("服务器收到定位AP02");
-                mConnection.DeliverCMDMessageToSystem("AP02", cmd);//通知下面线程状态变化
-                break;
             case AP92:
                 break;
             case BP92:
@@ -3376,14 +3406,11 @@ public class protocol_s123 {
                 ICLogger.d("服务器收到文字确认/快捷回复");
                 handleBP94();
                 break;
-            case AP03:
-                break;
             case BP03: //心跳包
-                handleBP03(cmd);
                 ICLogger.i("服务器收到心跳包AP03");
-                mConnection.DeliverCMDMessageToSystem("heartbeat", cmd);//通知下面线程状态变化
+                //通知下面线程状态变化
+                mConnection.DeliverCMDMessageToSystem("heartbeat", cmd);
                 break;
-
             case AP05:
                 break;
             case BP05:
@@ -3394,11 +3421,10 @@ public class protocol_s123 {
                 //收到发送的语音包
                 handleBP07(cmd, mConnection);
                 break;
-            case AP10:
-                break;
-            case BP10:
+            case BPAL:
+                ICLogger.d("服务器收到了APAL指令");
                 //报警包
-                mConnection.DeliverCMDMessageToSystem("AP10", cmd);//通知下面线程状态变化
+                mConnection.DeliverCMDMessageToSystem("APAL", cmd);//通知下面线程状态变化
                 break;
             case BPBR:
                 mConnection.DeliverCMDMessageToSystem("APBR", cmd);//通知下面线程状态变化
@@ -3435,12 +3461,14 @@ public class protocol_s123 {
                 handleBP16(mConnection, mRuntime, cmd);
                 mConnection.DeliverCMDMessageToSystem("StartLocate", cmd);//通知下面线程状态变化
                 break;
-
             case BP46: //立即拍照
                 ICLogger.i("立即拍照!");
                 handleBP46(cmd, mConnection, mRuntime);
                 break;
-
+            case BPFF:
+                //服务器收到定位数据包
+                ICLogger.d("BPFF==>服务器收到了定位数据包APFF");
+                break;
             case BP12:
                 //收到设置SOS号码
                 handleBP12(mConnection, cmd, mRuntime);