与客户联调MQTT协议,除了登录已经基本都调通了。
authorsnickersun <scy@incartech.cn>
Tue, 1 Sep 2020 11:02:52 +0000 (19:02 +0800)
committersnickersun <scy@incartech.cn>
Tue, 1 Sep 2020 11:02:52 +0000 (19:02 +0800)
去除所有rx.Observable.Timer ,改用 handler.post(runable)。 试图增强稳定性,避免之前总是出现的rx 错误问题。

22 files changed:
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/ICSmsManager.java
app/src/main/java/com/enqualcomm/support/MainActivity.java
app/src/main/java/com/enqualcomm/support/adapter/LBSHelper.java
app/src/main/java/com/enqualcomm/support/bean/Runtime.java
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java
app/src/main/java/com/enqualcomm/support/service/KeepAlive.java
app/src/main/java/com/enqualcomm/support/service/SendChatMessage.java
app/src/main/java/com/enqualcomm/support/service/SilentManager.java
app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java
app/src/main/java/com/enqualcomm/support/utils/DBHelper.java
app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java
app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java
app/src/main/java/com/enqualcomm/support/utils/WakeLockUtil.java
app/src/main/java/com/enqualcomm/support/utils/mqttConnection.java
app/src/main/java/com/ic/protocols/protocolAPIHelper.java
app/src/main/java/com/ic/protocols/protocol_ic.java
app/src/main/java/com/ic/protocols/protocol_mqtt.java
app/src/main/java/com/ic/protocols/protocol_mqtt_client.java
app/src/main/java/se/wetcat/qatja/android/MQTTConnectionConstants.java
app/src/main/java/se/wetcat/qatja/android/QatjaService.java

index 60244b9..680803a 100644 (file)
@@ -60,8 +60,6 @@ import com.enqualcomm.support.utils.Util;
 \r
 import java.lang.ref.WeakReference;\r
 import chestnut.ui.Toastc;\r
-import rx.Observable;\r
-import rx.functions.Action1;\r
 \r
 import android.content.BroadcastReceiver;\r
 import android.content.Context;\r
@@ -221,12 +219,12 @@ public class CoreService extends Service {
 \r
                    if(Config.SOSNoNeedDial==false) {\r
                        //50ms后开始拨打电话\r
-                       Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                           public void call(Long param1Long) {\r
+                       new Handler().postDelayed(new Runnable() {\r
+                           @Override\r
+                           public void run() {\r
                                trigger_SOS_Call();\r
                            }\r
-                       });\r
-\r
+                       },500);\r
                    }\r
                 }\r
         }\r
@@ -323,8 +321,10 @@ public class CoreService extends Service {
 \r
                 //为了保证唤醒时各个状态及时更新到服务器,发送一个同步心跳包,这样用户体验更好\r
                 CoreService.this.locationClient.updateStepCount();\r
-                Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                    public void call(Long param1Long) {\r
+\r
+                new Handler().postDelayed(new Runnable() {\r
+                    @Override\r
+                    public void run() {\r
                         if (connection.isServerConnected()&& runtime.isServerProtocolConnected()) {\r
                             mKeepAlive.onHeartAlarm(connection, runtime);\r
                         }else{\r
@@ -333,7 +333,7 @@ public class CoreService extends Service {
                             startConnectionRetryTimer();\r
                         }\r
                     }\r
-                });\r
+                },500);\r
 \r
 \r
                 if (CoreService.is_wifi_network_ok) {\r
index af186c8..1ee6550 100644 (file)
@@ -49,8 +49,6 @@ import java.util.Iterator;
 import java.util.concurrent.TimeUnit;\r
 \r
 import chestnut.utils.PhoneUtils;\r
-import rx.Observable;\r
-import rx.functions.Action1;\r
 \r
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;\r
 import static com.enqualcomm.support.Config.upload_logs_via_ftp;\r
@@ -525,12 +523,12 @@ public class ICSmsManager  extends BroadcastReceiver {
                             Config.setWiFiPasswd(mContext,PWD);\r
                             sendSMS(phonenumber, "set and connect to Wifi SSID " + Config.getWiFiSSID(mContext) +", WiFiPassword "+Config.getWiFiPasswd(mContext)+ ", encryptType "+encyptType+"!");\r
                             //connect to wifi\r
-                            Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                                public void call(Long param1Long) {\r
+                            new Handler().postDelayed(new Runnable() {\r
+                                @Override\r
+                                public void run() {\r
                                     Deliver.connectToWifi(SSID,PWD,encyptType);\r
                                 }\r
-                            });\r
-\r
+                            }, 500);\r
                         }else {\r
                             sendSMS(phonenumber, "WiFi Control format error!");\r
                         }\r
@@ -580,8 +578,10 @@ public class ICSmsManager  extends BroadcastReceiver {
 //                                String filelist[]={"APILog","LocationAlarm","Battery"};\r
                                 String time = TimeUtil.getSystemTime3();\r
                                 StringBuilder sb = new StringBuilder();\r
-                                Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                                    public void call(Long param1Long) {\r
+\r
+                                new Handler().postDelayed(new Runnable() {\r
+                                    @Override\r
+                                    public void run() {\r
                                         sendSMS(phonenumber, "start Upload allLogfile [crashlog Nmea APILog log GPS alarmCycle Battery] to " + Config.getFtpServer(mContext));\r
                                         String logtime = TimeUtil.getSystemTime3();\r
                                         for (String file : filelist) {\r
@@ -622,14 +622,16 @@ public class ICSmsManager  extends BroadcastReceiver {
                                             sendSMS(phonenumber, "Upload all files failed to " + Config.getFtpServer(mContext));\r
                                         }\r
                                     }\r
-                                });\r
+                                }, 500);\r
+\r
                             }else if (!logfile.isEmpty()&& ( logfile.startsWith("SDLog:")||logfile.startsWith("SDLogInfo:"))){\r
 \r
                                 String sdfilelist[] = logfile.split(":");\r
                                 if (sdfilelist.length==2) {\r
                                     String fileOrDir=sdfilelist[1];\r
-                                    Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                                        public void call(Long param1Long) {\r
+                                    new Handler().postDelayed(new Runnable() {\r
+                                        @Override\r
+                                        public void run() {\r
                                             String filepath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + fileOrDir;\r
                                             URL serverurl = null;\r
                                             try {\r
@@ -679,14 +681,16 @@ public class ICSmsManager  extends BroadcastReceiver {
                                                 }\r
                                             }\r
                                         }\r
-                                    });\r
+                                    }, 500);\r
+\r
                                 }else{\r
                                     sendSMS(phonenumber,  " SDLog format error !");\r
                                 }\r
 \r
                             }else{\r
-                                Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                                    public void call(Long param1Long) {\r
+                                new Handler().postDelayed(new Runnable() {\r
+                                    @Override\r
+                                    public void run() {\r
                                         String filepath = Util.getLogfilePath(runtime, logfile);\r
                                         URL serverurl = null;\r
                                         try {\r
@@ -716,7 +720,8 @@ public class ICSmsManager  extends BroadcastReceiver {
                                             sendSMS(phonenumber, logfile + " not exist !");\r
                                         }\r
                                     }\r
-                                });\r
+                                }, 500);\r
+\r
                             }\r
 \r
 //                            sendSMS(phonenumber, "upload FtpLogServer to " + Config.getFtpServer(mContext) + ", user " + Config.getFtpUser(mContext) + ", pwd " + Config.getFtpPWD(mContext));\r
@@ -871,12 +876,12 @@ public class ICSmsManager  extends BroadcastReceiver {
                 sendSMS(phonenumber, "start listen !");\r
 //                CellInfoUtil.dialSilent(runtime.getContextProxy().context,phonenumber);\r
                 ICAudioManager.needMute=true;\r
-\r
-                Observable.timer(2000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                    public void call(Long param1Long) {\r
+                new Handler().postDelayed(new Runnable() {\r
+                    @Override\r
+                    public void run() {\r
                         SimSignalUtil.send_at_cmd(runtime,"atd"+phonenumber+";");\r
                     }\r
-                });\r
+                }, 2000);\r
 \r
             } else if (sms.equals(ENCRYPED_HEADER+"#location#")) {\r
 \r
@@ -1024,7 +1029,7 @@ public class ICSmsManager  extends BroadcastReceiver {
 //                            CoreService.getInstance().ReConnectToServer();\r
                         }else\r
                         {\r
-                            sendSMS(phonenumber, "current is fzd Protocol!");\r
+                            sendSMS(phonenumber, "current is mqtt Protocol!");\r
                         }\r
                     }else if(TextUtils.isDigitsOnly(strtmp)) {\r
                         int protocolno=Integer.parseInt(strtmp);\r
@@ -1062,8 +1067,9 @@ public class ICSmsManager  extends BroadcastReceiver {
                         sendSMS(phonenumber, "mail address error !");\r
 \r
                     }else {\r
-                        Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                            public void call(Long param1Long) {\r
+                        new Handler().postDelayed(new Runnable() {\r
+                            @Override\r
+                            public void run() {\r
                                 String logfile = "/sdcard/Android/ic";\r
 \r
                                 Util.getDBFile();\r
@@ -1071,8 +1077,6 @@ public class ICSmsManager  extends BroadcastReceiver {
                                 Util.ShowToast(runtime,"mail " + logfile + " to " + mailaddr + " ...");\r
 \r
                                 String logtime = TimeUtil.getSystemTime3();\r
-\r
-\r
                                 if (SendEmail.getInstance().sendLogViaMail(logfile,mailaddr, logtime)) {\r
                                     sendSMS(phonenumber, "mail " + logfile + " to " + mailaddr + " success!");\r
                                     Util.ShowToast(runtime,"mail " + logfile + " to " + mailaddr + " success!");\r
@@ -1080,10 +1084,9 @@ public class ICSmsManager  extends BroadcastReceiver {
                                     sendSMS(phonenumber, "mail " + logfile + " to " + mailaddr + " failed!");\r
                                     Util.ShowToast(runtime,"mail " + logfile + " to " + mailaddr + " failed!");\r
                                 }\r
-\r
-\r
                             }\r
-                        });\r
+                        }, 500);\r
+\r
                     }\r
 \r
 //                            sendSMS(phonenumber, "upload FtpLogServer to " + Config.getFtpServer(mContext) + ", user " + Config.getFtpUser(mContext) + ", pwd " + Config.getFtpPWD(mContext));\r
index f4b16d7..fba1c92 100644 (file)
@@ -30,10 +30,6 @@ import java.io.FileOutputStream;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
-import chestnut.utils.RegexUtils;
-import rx.Observable;
-import rx.functions.Action1;
-
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 
 public class MainActivity extends Activity {
index 44814e7..e0a3f4b 100644 (file)
@@ -38,11 +38,6 @@ import java.util.Iterator;
 import java.util.List;\r
 import java.util.concurrent.TimeUnit;\r
 \r
-import rx.Observable;\r
-import rx.Single;\r
-import rx.android.schedulers.AndroidSchedulers;\r
-import rx.functions.Action1;\r
-\r
 import static android.net.wifi.WifiManager.WIFI_STATE_DISABLED;\r
 import static android.net.wifi.WifiManager.WIFI_STATE_DISABLING;\r
 import static android.net.wifi.WifiManager.WIFI_STATE_ENABLED;\r
@@ -139,27 +134,27 @@ public class LBSHelper {
 //            Single.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {\r
 //            public void call(Object param1Object) {\r
 \r
-            Observable.timer(500L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {\r
-                public void call(Long param1Long) {\r
-\r
+            new Handler().postDelayed(new Runnable() {\r
+                @Override\r
+                public void run() {\r
                     //由于wifi状态不好确认客户是如何设置的,干脆只有屏幕灭的时候才考虑关闭wifi ,防止在开启屏幕用来视频的时候被后台关掉\r
                     ICLogger.i("setWifiEnabled false");\r
 //                    if(SimSignalUtil.isScreenON(runtime.getContextProxy().context)==false) {\r
-                        if (runtime.isNoTurnOffWifiOnScreenOff() || DeviceInfoUtil.isFactoryTestTopActivity(runtime.getContextProxy().context)) {\r
-                            //如果 NoTurnOffWifiOnScreenOff 开关 开启,且是屏灭,或者是在工厂测试模式,则原来什么状态就什么状态。\r
-                            ICLogger.i("isNoTurnOffWifiOnScreenOff or In Factory Mode");\r
-                            if (!IS_HASOPEN && IS_OPEN) {\r
+                    if (runtime.isNoTurnOffWifiOnScreenOff() || DeviceInfoUtil.isFactoryTestTopActivity(runtime.getContextProxy().context)) {\r
+                        //如果 NoTurnOffWifiOnScreenOff 开关 开启,且是屏灭,或者是在工厂测试模式,则原来什么状态就什么状态。\r
+                        ICLogger.i("isNoTurnOffWifiOnScreenOff or In Factory Mode");\r
+                        if (!IS_HASOPEN && IS_OPEN) {\r
 //                                wifiManager.setWifiEnabled(false);\r
-                                IS_OPEN = false;\r
-                            }\r
-                        } else  {\r
-                            //如果 NoTurnOffWifiOnScreenOff 开关 关闭,且是屏灭,则关闭wifi省电\r
-                            ICLogger.i("isTurnOffWifiOnScreenOff");\r
-                            wifiManager.setWifiEnabled(false);\r
                             IS_OPEN = false;\r
-                            IS_HASOPEN = false;\r
-\r
                         }\r
+                    } else  {\r
+                        //如果 NoTurnOffWifiOnScreenOff 开关 关闭,且是屏灭,则关闭wifi省电\r
+                        ICLogger.i("isTurnOffWifiOnScreenOff");\r
+                        wifiManager.setWifiEnabled(false);\r
+                        IS_OPEN = false;\r
+                        IS_HASOPEN = false;\r
+\r
+                    }\r
 //                    }else{\r
 //                        ICLogger.i("isTurnOffWifiOnScreenOff");\r
 //                        wifiManager.setWifiEnabled(false);\r
@@ -168,11 +163,8 @@ public class LBSHelper {
 //                    }\r
                     ICLogger.i("setWifiEnabled done");\r
 \r
-\r
-\r
                 }\r
-\r
-            });\r
+            },500);\r
 \r
         }else{\r
             ICLogger.i("mMyWifiListener is null skip callback");\r
index fd68618..c5fd8cb 100644 (file)
@@ -153,10 +153,8 @@ public class Runtime {
   }\r
 \r
 \r
-  public String fzdAlarmStatus="00000000";\r
-  public String getDeviceAlarmStatusFZD(){\r
-      return fzdAlarmStatus;\r
-  }\r
+\r
+\r
   //0 代表没有出围栏,如果出围栏则置1,每次报警再加1\r
   public int Fence_Warning_flag=0;\r
 \r
@@ -631,8 +629,9 @@ public class Runtime {
         return sb.toString();\r
     }\r
 \r
+    public String fzdAlarmStatus="00000000";\r
     public String getFZDDevStatus(){\r
-      return "00000000";\r
+      return fzdAlarmStatus;\r
     }\r
   public String getGPSHeading(){\r
     int headingi=(int)gpsp.getLocation().heading;\r
index fbcdac3..ba984ce 100644 (file)
@@ -41,9 +41,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;\r
 import java.util.concurrent.locks.ReentrantLock;\r
 \r
-import rx.Observable;\r
-import rx.functions.Action1;\r
-\r
 import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;\r
 import static com.enqualcomm.support.Constants.ACTION_WAKEUP_ALARM;\r
 import static com.enqualcomm.support.Constants.DIALOG_ACTION;\r
@@ -399,12 +396,12 @@ public class Deliver extends AbstractConnectionService {
           }else{\r
             Util.ShowToast(paramRuntime,"Do poweroff!");\r
          }\r
-\r
-      Observable.timer(1000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           Util.shutdown();\r
         }\r
-      });\r
+      },1000);\r
       return true;\r
     } else if ("FactoryResetCheckSim".equals(paramStringMessage.cmd())) {\r
 \r
@@ -417,43 +414,46 @@ public class Deliver extends AbstractConnectionService {
         }else{\r
           Util.ShowToast(paramRuntime,"Do FactoryReset!");\r
         }\r
-\r
-      Observable.timer(1000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           Util.doMasterClear(paramRuntime.getContextProxy().context);\r
         }\r
-      });\r
+      },1000);\r
       return true;\r
     } else if ("poweroff".equals(paramStringMessage.cmd())) {\r
       paramRuntime.setShutdown(true);\r
-      Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           Util.shutdown();\r
         }\r
-      });\r
+      },500);\r
       return true;\r
     } else if ("FactoryReset".equals(paramStringMessage.cmd())) {\r
-      Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           Util.doMasterClear(paramRuntime.getContextProxy().context);\r
         }\r
-      });\r
+      },500);\r
       return true;\r
     } else if ("Reboot".equals(paramStringMessage.cmd())) {\r
-\r
-      Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           Util.reboot(paramRuntime.getContextProxy().context);\r
         }\r
-      });\r
+      },500);\r
       return true;\r
     } else if ("heartbeat".equals(paramStringMessage.cmd())) {\r
       //每次心跳,查询一下 是否有语音消息需要接收。\r
 //      paramConnection.send(protocolAPIHelper.genStringMessage("AP05",protocolAPIHelper.AP05(true)));\r
     } else if ("NewVoice".equals(paramStringMessage.cmd()))\r
     {\r
-      Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           final Context context = (Deliver.this.mRuntime.getContextProxy()).context;\r
 \r
           Contact param2Contact = new Contact(CATEGORY_GROUP, (mRuntime.getContextProxy()).context.getResources().getString(R.string.all_group), Contact.GROUP_ALL);\r
@@ -463,52 +463,55 @@ public class Deliver extends AbstractConnectionService {
             {\r
 \r
               ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED+" "+paramStringMessage.isFromCache());\r
-                //广播 voice消息\r
-                Intent intent = new Intent();\r
-                intent.setAction(Constants.ACTION_MESSAGE_RECEIVED);\r
-                intent.putExtra(Constants.KEY_MESSAGE_TYPE,"voice");\r
-                intent.putExtra(Constants.KEY_MESSAGE_FROM,"广播消息");\r
-                intent.putExtra(Constants.KEY_MESSAGE_URL,paramStringMessage.isFromCache());\r
-\r
-             //   playVoice(context,paramStringMessage.isFromCache());\r
-                context.sendBroadcast(intent);\r
+              //广播 voice消息\r
+              Intent intent = new Intent();\r
+              intent.setAction(Constants.ACTION_MESSAGE_RECEIVED);\r
+              intent.putExtra(Constants.KEY_MESSAGE_TYPE,"voice");\r
+              intent.putExtra(Constants.KEY_MESSAGE_FROM,"广播消息");\r
+              intent.putExtra(Constants.KEY_MESSAGE_URL,paramStringMessage.isFromCache());\r
+\r
+              //   playVoice(context,paramStringMessage.isFromCache());\r
+              context.sendBroadcast(intent);\r
             }\r
 \r
             if (Config.noVoiceNotifyDialog==false) {\r
 \r
-                Intent intent = new Intent();\r
-                //显示提示窗口\r
-                intent.setAction(DIALOG_ACTION);\r
-                intent.putExtra("contact", (Parcelable) param2Contact);\r
-                context.sendBroadcast(intent);\r
+              Intent intent = new Intent();\r
+              //显示提示窗口\r
+              intent.setAction(DIALOG_ACTION);\r
+              intent.putExtra("contact", (Parcelable) param2Contact);\r
+              context.sendBroadcast(intent);\r
             }\r
 \r
           }\r
         }\r
-      });\r
+      },500);\r
+\r
     return true;\r
   }else if ("findDev".equals(paramStringMessage.cmd())) {\r
-      Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
-          final Context context = (Deliver.this.mRuntime.getContextProxy()).context;\r
 \r
-              Intent intent = new Intent();\r
-              ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED+" "+paramStringMessage.isFromCache());\r
-              //显示提示窗口\r
-              intent.setAction(DIALOG_ACTION);\r
-              intent.putExtra("findDev", "Find Device");\r
-              context.sendBroadcast(intent);\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
+          final Context context = (Deliver.this.mRuntime.getContextProxy()).context;\r
+          Intent intent = new Intent();\r
+          ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED+" "+paramStringMessage.isFromCache());\r
+          //显示提示窗口\r
+          intent.setAction(DIALOG_ACTION);\r
+          intent.putExtra("findDev", "Find Device");\r
+          context.sendBroadcast(intent);\r
         }\r
-      });\r
+      },500);\r
+\r
       return true;\r
   }else if ("StartMonitor".equals(paramStringMessage.cmd())) {\r
 \r
       String recordfilepath=Util.getRecordfilePath(mRuntime, TimeUtil.getSystemTime3());\r
       AudioService.getInstance().startRecord(recordfilepath);\r
       int recordtime=Integer.parseInt(paramStringMessage.isFromCache());\r
-      Observable.timer(recordtime, TimeUnit.SECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
-\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           AudioService.getInstance().stopRecord();\r
           ICLogger.i("Monitor Record to send "+recordfilepath);\r
           //创建voiceConent并添加到数据\r
@@ -520,8 +523,10 @@ public class Deliver extends AbstractConnectionService {
           if (CoreService.getInstance().getConnection()!=null)\r
             CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", "");\r
 \r
+\r
         }\r
-      });\r
+      },recordtime*1000);\r
+\r
       return true;\r
     }\r
 \r
index 1c60f9a..15fc77a 100644 (file)
@@ -132,7 +132,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se
                   ICLogger.i("Send PPG " + PPGDATA.isFromCache());\r
                   checkWarning();\r
                 }\r
-                ICLogger.i("Send PPG " + PPGDATA.isFromCache());\r
+\r
               } else {\r
                 ICLogger.i("Skip PPG " + PPGDATA.isFromCache());\r
               }\r
index 2e6f2f7..2024d91 100644 (file)
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
 import android.content.Context;\r
 import android.content.Intent;\r
 import android.content.IntentFilter;\r
+import android.os.Handler;\r
 \r
 //import com.eiot.watch_lib.LauncherCtrl;\r
 import com.enqualcomm.support.CoreService;\r
@@ -23,7 +24,6 @@ import com.enqualcomm.support.utils.SimSignalUtil;
 import java.util.concurrent.ScheduledThreadPoolExecutor;\r
 import java.util.concurrent.TimeUnit;\r
 \r
-import rx.Observable;\r
 import rx.Subscription;\r
 import rx.functions.Action1;\r
 \r
@@ -121,11 +121,12 @@ public class KeepAlive extends AbstractConnectionService {
           }else {\r
             if (is_login_send_success) {\r
               connection.send(protocolAPIHelper.getHeartbeatMSG(mRuntime));\r
-              Observable.timer(1000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                public void call(Long param1Long) {\r
+              new Handler().postDelayed(new Runnable() {\r
+                @Override\r
+                public void run() {\r
                   connection.send(protocolAPIHelper.getBindingMSG(mRuntime));\r
                 }\r
-              });\r
+              },1000);\r
             } else {\r
               connection.send(protocolAPIHelper.getLoginMSG(mRuntime));\r
             }\r
@@ -269,15 +270,13 @@ public class KeepAlive extends AbstractConnectionService {
     ICLogger.i("Update IMEI "+ret);\r
     //发送登录包\r
     is_login_send_success=false;\r
-    Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-      public void call(Long param1Long) {\r
-        connection.send(protocolAPIHelper.getLoginMSG(paramRuntime));\r
-      }\r
-    });\r
-\r
-\r
-\r
-     isConnected = true;\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
+          connection.send(protocolAPIHelper.getLoginMSG(paramRuntime));\r
+        }\r
+      },500);\r
+      isConnected = true;\r
 //    this.firstReConnected = true;\r
 //    this.idleTimeMillis = SystemClock.elapsedRealtime();\r
 \r
@@ -302,11 +301,12 @@ public class KeepAlive extends AbstractConnectionService {
     //发送心跳包\r
     connection.send(protocolAPIHelper.getHeartbeatMSG(paramRuntime));\r
         //发送完心跳后,开始检查服务器响应\r
-      Observable.timer(1000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-          public void call(Long param1Long) {\r
-              connection.send(protocolAPIHelper.getBindingMSG(mRuntime));\r
-          }\r
-      });\r
+    new Handler().postDelayed(new Runnable() {\r
+      @Override\r
+      public void run() {\r
+        connection.send(protocolAPIHelper.getBindingMSG(mRuntime));\r
+      }\r
+    },1000);\r
     startResponseCheckTimer();\r
 \r
 \r
@@ -344,21 +344,22 @@ public class KeepAlive extends AbstractConnectionService {
 \r
       paramRuntime.lastLoginSuccessTime=System.currentTimeMillis();\r
       //发送心跳包\r
-      Observable.timer(3500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           //这时重新连接服务器才进行的连接,理论上close已经设置false,此次可以认为协议定然断开,所以设置为false作为双重保险。\r
           mRuntime.setServerProtocolConnected(false);\r
           connection.send(protocolAPIHelper.getHeartbeatMSG(paramRuntime));\r
           //发送完心跳后,开始检查服务器响应\r
-            Observable.timer(1000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-                public void call(Long param1Long) {\r
-                    connection.send(protocolAPIHelper.getBindingMSG(mRuntime));\r
-\r
-                }\r
-            });\r
+          new Handler().postDelayed(new Runnable() {\r
+            @Override\r
+            public void run() {\r
+              connection.send(protocolAPIHelper.getBindingMSG(mRuntime));\r
+            }\r
+          },1000);\r
           startResponseCheckTimer();\r
         }\r
-      });\r
+      },3500);\r
 \r
     }\r
     return false;\r
index f9b2827..4788775 100644 (file)
@@ -18,8 +18,6 @@ import com.enqualcomm.support.utils.SimSignalUtil;
 import com.enqualcomm.support.utils.TimeUtil;\r
 import com.enqualcomm.support.utils.Util;\r
 \r
-import rx.Observable;\r
-\r
 import static com.enqualcomm.support.bean.Content.CONTACT_CATEGORY_GROUP;\r
 \r
 public class SendChatMessage extends AbstractInvokeHandlerService {\r
index 4bb6997..9ffa57c 100644 (file)
@@ -44,9 +44,6 @@ import java.util.Date;
 import java.util.Iterator;\r
 import java.util.concurrent.TimeUnit;\r
 \r
-import rx.Observable;\r
-import rx.functions.Action1;\r
-\r
 import static android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED;\r
 import static android.telephony.TelephonyManager.CALL_STATE_OFFHOOK;\r
 import static android.telephony.TelephonyManager.CALL_STATE_RINGING;\r
@@ -119,13 +116,13 @@ public class SilentManager extends AbstractInvokeHandlerService {
           if(ICAudioManager.needMute==true)\r
           {\r
 //            ICAudioManager.restoreVolumn(mContext); //2秒后恢复音量\r
-            Observable.timer(2000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-              public void call(Long param1Long) {\r
+            new Handler().postDelayed(new Runnable() {\r
+              @Override\r
+              public void run() {\r
                 ICAudioManager.restoreVolumn(mContext); //2秒后恢复音量\r
                 ICAudioManager.needMute=false;\r
               }\r
-            });\r
-\r
+            },2000);\r
           }\r
           ICLogger.i("========Hung up!");\r
           break;\r
@@ -141,11 +138,12 @@ public class SilentManager extends AbstractInvokeHandlerService {
           if(ICAudioManager.needMute==true)\r
           {\r
             ICAudioManager.setVolumnMute(mContext);\r
-            Observable.timer(2000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-              public void call(Long param1Long) {\r
+            new Handler().postDelayed(new Runnable() {\r
+              @Override\r
+              public void run() {\r
                 ICAudioManager.setVolumnMute(mContext); //2秒后恢复音量\r
               }\r
-            });\r
+            },2000);\r
 \r
           }\r
           break;\r
@@ -163,11 +161,12 @@ public class SilentManager extends AbstractInvokeHandlerService {
           if(ICAudioManager.needMute==true)\r
           {\r
             ICAudioManager.setVolumnMute(mContext);\r
-            Observable.timer(2000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-              public void call(Long param1Long) {\r
+            new Handler().postDelayed(new Runnable() {\r
+              @Override\r
+              public void run() {\r
                 ICAudioManager.setVolumnMute(mContext); //2秒后恢复音量\r
               }\r
-            });\r
+            },2000);\r
           }\r
 \r
       }\r
index 25572df..1da0280 100644 (file)
@@ -12,6 +12,7 @@ import android.net.Uri;
 import android.net.wifi.WifiManager;\r
 import android.os.Build;\r
 import android.os.Environment;\r
+import android.os.Handler;\r
 import android.os.PowerManager;\r
 import android.telephony.TelephonyManager;\r
 import android.util.Log;\r
@@ -33,8 +34,6 @@ import java.util.Calendar;
 import java.util.Iterator;\r
 import java.util.concurrent.TimeUnit;\r
 \r
-import rx.Observable;\r
-import rx.functions.Action1;\r
 \r
 import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;\r
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;\r
@@ -345,8 +344,9 @@ public class ContextProxy {
   public static void sendMsgBroadcast(Context _context,String msg, int msgType) {\r
 \r
     if (msgType==0) {\r
-      Observable.timer(50L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           if (Config.noPushTxtNotifyDialog == false) {\r
             Intent intent = new Intent();\r
             intent.setAction(DIALOG_ACTION);\r
@@ -368,10 +368,12 @@ public class ContextProxy {
           intent.addFlags(FLAG_ACTIVITY_NEW_TASK);\r
           _context.sendBroadcast(intent);\r
         }\r
-      });\r
+      },50);\r
+\r
     }else  if (msgType==2){\r
-      Observable.timer(50L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           if (Config.noPushTxtNotifyDialog == false) {\r
             Intent intent = new Intent();\r
             intent.setAction(DIALOG_ACTION);\r
@@ -393,11 +395,13 @@ public class ContextProxy {
           intent.addFlags(FLAG_ACTIVITY_NEW_TASK);\r
           _context.sendBroadcast(intent);\r
         }\r
-      });\r
+      },50);\r
 \r
     }else{\r
-      Observable.timer(50L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-        public void call(Long param1Long) {\r
+\r
+      new Handler().postDelayed(new Runnable() {\r
+        @Override\r
+        public void run() {\r
           if(Config.noSMSNotifyDialog==false) {\r
             Intent intent = new Intent();\r
             intent.setAction(DIALOG_ACTION);\r
@@ -420,7 +424,7 @@ public class ContextProxy {
           intent.addFlags(FLAG_ACTIVITY_NEW_TASK);\r
           _context.sendBroadcast(intent);\r
         }\r
-       });\r
+      },50);\r
     }\r
 \r
 \r
index 1dd6383..f177850 100644 (file)
@@ -10,6 +10,7 @@ import android.content.Intent;
 import android.content.ContentProviderOperation.Builder;\r
 import android.database.Cursor;\r
 import android.net.Uri;\r
+import android.os.Handler;\r
 import android.os.SystemClock;\r
 import android.provider.BaseColumns;\r
 import android.provider.ContactsContract;\r
@@ -31,12 +32,8 @@ import com.enqualcomm.support.bean.SleepRecord;
 import com.enqualcomm.support.bean.StheartRate;\r
 import com.enqualcomm.support.bean.Weather;\r
 \r
-import java.io.File;\r
 import java.util.ArrayList;\r
 import java.util.Iterator;\r
-import java.util.concurrent.TimeUnit;\r
-import rx.Observable;\r
-import rx.functions.Action1;\r
 \r
 import static com.enqualcomm.support.bean.Contact.CATEGORY_ADMIN;\r
 import static com.enqualcomm.support.bean.Contact.CATEGORY_CALL;\r
@@ -706,11 +703,12 @@ public class DBHelper {
         this.saveContactsImpl(contactArray, admin, care,call, partner, video,sos);\r
         lastUpdateTime = currenttime;\r
       } else {\r
-        Observable.timer(1000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-          public void call(Long var1x) {\r
+        new Handler().postDelayed(new Runnable() {\r
+          @Override\r
+          public void run() {\r
             DBHelper.this.saveContacts(contactArray, admin, care,call,  partner, video,sos);\r
           }\r
-        });\r
+        }, 1000);\r
       }\r
     } finally {\r
       ;\r
@@ -864,11 +862,12 @@ public class DBHelper {
         this.upDateMonitorImpl(var1, var2);\r
         lastUpdateTime = var3;\r
       } else {\r
-        Observable.timer(1000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-          public void call(Long var1x) {\r
+        new Handler().postDelayed(new Runnable() {\r
+          @Override\r
+          public void run() {\r
             DBHelper.this.upDateMonitor(var1, var2);\r
           }\r
-        });\r
+        },1000);\r
       }\r
     } finally {\r
       ;\r
index f672bed..49ccd7b 100644 (file)
@@ -36,13 +36,6 @@ import com.enqualcomm.support.service.AudioService;
 import com.enqualcomm.support.service.HeartRateManager;\r
 import com.ic.protocols.protocolAPIHelper;\r
 \r
-import java.util.concurrent.TimeUnit;\r
-\r
-import rx.Observable;\r
-import rx.Subscriber;\r
-import rx.functions.Action1;\r
-import rx.schedulers.Schedulers;\r
-\r
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;\r
 import static android.media.RingtoneManager.TYPE_NOTIFICATION;\r
 import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP;\r
@@ -240,9 +233,12 @@ public class ProcessReceiver extends BroadcastReceiver {
   private void screenOn(Context paramContext) {\r
     final PowerManager.WakeLock wakelock = ((PowerManager)paramContext.getSystemService(Context.POWER_SERVICE)).newWakeLock(ACQUIRE_CAUSES_WAKEUP| SCREEN_DIM_WAKE_LOCK, ProcessReceiver.class.getSimpleName());\r
     wakelock.acquire();\r
-    Observable.timer(5000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-          public void call(Long param1Long) { wakelock.release(); }\r
-        });\r
+    new Handler().postDelayed(new Runnable() {\r
+      @Override\r
+      public void run() {\r
+        wakelock.release();\r
+      }\r
+    },5000);\r
   }\r
 \r
   @Override\r
index 8143b07..170b568 100644 (file)
@@ -2,6 +2,7 @@ package com.enqualcomm.support.utils;
 \r
 import android.content.Context;\r
 import android.content.Intent;\r
+import android.os.Handler;\r
 \r
 import com.enqualcomm.support.Config;\r
 import com.enqualcomm.support.Constants;\r
@@ -10,15 +11,6 @@ import com.enqualcomm.support.bean.Runtime;
 import com.enqualcomm.support.bean.StringMessage;\r
 import com.ic.jni.ICJniUtils;\r
 import com.ic.protocols.protocolAPIHelper;\r
-import com.sina.util.dnscache.log.FileUtil;\r
-\r
-import java.io.File;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import rx.Observable;\r
-import rx.functions.Action1;\r
-\r
-import static com.enqualcomm.support.Constants.DIALOG_ACTION;\r
 \r
 public class TemperatureUtil {\r
 \r
@@ -54,10 +46,12 @@ public class TemperatureUtil {
 \r
 \r
     public static void doTempTestInThread(){\r
-        Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-            public void call(Long param1Long) {\r
 \r
-                if (ICJniUtils.isTemperatureDevAvailable()==ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_IC68.ordinal()){\r
+        new Handler().postDelayed(new Runnable() {\r
+            @Override\r
+            public void run() {\r
+\r
+                if (ICJniUtils.isTemperatureDevAvailable() >ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_NONE.ordinal()) {\r
                     ICJniUtils.enableTemperature();\r
                     try {\r
                         Thread.sleep(1000);\r
@@ -65,46 +59,19 @@ public class TemperatureUtil {
                         e.printStackTrace();\r
                     }\r
 \r
-                    double wrist_temp,body_temp;\r
 \r
-                    wrist_temp=TemperatureUtil.get_temp_value_adjusted();\r
-                    body_temp=TemperatureUtil.getBodyTemp(wrist_temp,26.0f);\r
-                    ICJniUtils.disableTemperature();\r
+                    double wrist_temp, body_temp;\r
 \r
-                    StringMessage temperatureMsg= protocolAPIHelper.getTemperatureMSG(wrist_temp, body_temp,null);\r
+                    wrist_temp = TemperatureUtil.get_temp_value_adjusted();\r
+                    body_temp = TemperatureUtil.getBodyTemp(wrist_temp, 26.0f);\r
+                    StringMessage temperatureMsg = protocolAPIHelper.getTemperatureMSG(wrist_temp, body_temp, null);\r
                     CoreService.getInstance().getConnection().send(temperatureMsg);\r
-                    ICLogger.i("发送体温测量值 "+temperatureMsg.isFromCache());\r
-\r
-                    Runtime runtime=CoreService.getInstance().getRuntime();\r
-                    runtime.tempInfo.setTemp(body_temp,wrist_temp);\r
-                    if (Config.needTemperature_abnormal_alarm) {\r
-                        switch (runtime.tempInfo.isBodyTempAbnormal()) {\r
-                            case 0:\r
-                                break;\r
-                            case 1:\r
-                                runtime.setAlarmType(Runtime.AlarmType.ALARM_HEART_RATE_HIGH);\r
-                                //trigger AP10 报警定位\r
-                                CoreService.getInstance().getConnection().send( protocolAPIHelper.getWarningMSG(runtime));\r
-                                break;\r
-                            case 2:\r
-                                runtime.setAlarmType(Runtime.AlarmType.ALARM_HEART_RATE_LOW);\r
-                                //trigger AP10 报警定位\r
-                                CoreService.getInstance().getConnection().send( protocolAPIHelper.getWarningMSG(runtime));\r
-                                break;\r
-                        }\r
-                    }\r
+                    ICLogger.i("发送体温测量值 " + temperatureMsg.isFromCache());\r
 \r
-                }else{\r
-                    double wrist_temp,body_temp;\r
-\r
-                    wrist_temp=TemperatureUtil.get_temp_value_adjusted();\r
-                    body_temp=TemperatureUtil.getBodyTemp(wrist_temp,26.0f);\r
-                    StringMessage temperatureMsg= protocolAPIHelper.getTemperatureMSG(wrist_temp, body_temp,null);\r
-                    CoreService.getInstance().getConnection().send(temperatureMsg);\r
-                    ICLogger.i("发送体温测量值 "+temperatureMsg.isFromCache());\r
+                    Runtime runtime = CoreService.getInstance().getRuntime();\r
+                    runtime.tempInfo.setTemp(body_temp, wrist_temp);\r
+                    ICJniUtils.disableTemperature();\r
 \r
-                    Runtime runtime=CoreService.getInstance().getRuntime();\r
-                    runtime.tempInfo.setTemp(body_temp,wrist_temp);\r
 \r
                     if (Config.needTemperature_abnormal_alarm) {\r
                         switch (runtime.tempInfo.isBodyTempAbnormal()) {\r
@@ -113,18 +80,19 @@ public class TemperatureUtil {
                             case 1:\r
                                 runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_HIGH);\r
                                 //trigger AP10 报警定位\r
-                                CoreService.getInstance().getConnection().send( protocolAPIHelper.getWarningMSG(runtime));\r
+                                CoreService.getInstance().getConnection().send(protocolAPIHelper.getWarningMSG(runtime));\r
                                 break;\r
                             case 2:\r
                                 runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_LOW);\r
                                 //trigger AP10 报警定位\r
-                                CoreService.getInstance().getConnection().send( protocolAPIHelper.getWarningMSG(runtime));\r
+                                CoreService.getInstance().getConnection().send(protocolAPIHelper.getWarningMSG(runtime));\r
                                 break;\r
                         }\r
                     }\r
-                }\r
 \r
+\r
+                }\r
             }\r
-        });\r
+        },500);\r
     }\r
 }\r
index 2095c3d..908996e 100644 (file)
@@ -5,13 +5,6 @@ import android.os.Handler;
 import android.os.Message;\r
 import android.os.PowerManager;\r
 \r
-import com.enqualcomm.support.service.AudioService;\r
-\r
-import java.util.Objects;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import rx.Observable;\r
-import rx.functions.Action1;\r
 \r
 import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP;\r
 import static android.os.PowerManager.SCREEN_DIM_WAKE_LOCK;\r
@@ -28,9 +21,12 @@ public class WakeLockUtil {
   public static void ScreenOnWakeLockTemperary(Context context) {\r
     final PowerManager.WakeLock wakelock = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).newWakeLock(ACQUIRE_CAUSES_WAKEUP| SCREEN_DIM_WAKE_LOCK, WakeLockUtil.class.getSimpleName());\r
     wakelock.acquire();\r
-    Observable.timer(5000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
-      public void call(Long param1Long) { wakelock.release(); }\r
-    });\r
+    new Handler().postDelayed(new Runnable() {\r
+      @Override\r
+      public void run() {\r
+        wakelock.release();\r
+      }\r
+    },5000);\r
   }\r
 \r
 }\r
index 50ef378..24e0fce 100644 (file)
@@ -2,6 +2,7 @@ package com.enqualcomm.support.utils;
 \r
 import android.util.Log;\r
 \r
+import com.enqualcomm.support.Config;\r
 import com.enqualcomm.support.bean.Runtime;\r
 import com.enqualcomm.support.bean.StringMessage;\r
 import com.ic.protocols.protocolAPIHelper;\r
@@ -67,8 +68,8 @@ public class mqttConnection implements Connection {
     @Override\r
     public void connect(String paramString, int paramInt){\r
 //        mqtt_client.attemptConnectMqtt(paramString,"IC_"+mRuntime.IMEI(),paramInt);\r
-        ICLogger.i("mqttconnect " +paramString+" "+paramInt);\r
-        mqtt_client.configMqtt(paramString,paramInt,"IC_"+mRuntime.IMEI());\r
+        ICLogger.i("mqttconnect " +paramString+" "+paramInt+" cycle "+mRuntime.getHeartBeatCycle()*60+" as "+"IC_"+mRuntime.IMEI());\r
+        mqtt_client.configMqtt(paramString,paramInt, mRuntime.getHeartBeatCycle()*60,"IC_"+mRuntime.IMEI());\r
         mqtt_client.connectservice();\r
        // if(isServerconnected) mqtt_client.attemptConnectMqtt();\r
     }\r
@@ -105,9 +106,10 @@ public class mqttConnection implements Connection {
         }\r
         String topci=paramStringMessage.cmd();\r
         String msgdata=paramStringMessage.isFromCache();\r
+        ICLogger.i("mqtt send "+topci+" "+msgdata);\r
         if (topci.startsWith("WBG100/v1")) {\r
             mqtt_client.sendMessage(topci, msgdata);\r
-            ICLogger.logToFile("API","mqtt send "+topci+" "+msgdata);\r
+            ICLogger.logToFile("APILog","mqtt send "+topci+" "+msgdata);\r
         }else{\r
             ICLogger.i("mqtt topci foramt error "+topci);\r
         }\r
index 9b12b00..7fb6741 100644 (file)
@@ -134,11 +134,14 @@ public class protocolAPIHelper {
 \r
     public static StringMessage getTemperatureMSG(double temp_adusted,double body_temp,Runtime runtime){\r
         if (is_protocol_not_Initialled()) return null;\r
-        if (CoreService.getInstance()!=null && runtime==null){\r
-            runtime=CoreService.getInstance().getRuntime();\r
-        }else{\r
-            ICLogger.i("Runtime == null !");\r
-            return null;\r
+        if (runtime==null){\r
+            if (CoreService.getInstance()!=null)\r
+                runtime=CoreService.getInstance().getRuntime();\r
+            else\r
+            {\r
+                ICLogger.i("Runtime == null !");\r
+                return null;\r
+            }\r
         }\r
         StringMessage ret=null;\r
         switch(Config.protocol_no)\r
@@ -352,11 +355,14 @@ public class protocolAPIHelper {
 \r
     public static StringMessage getBlood_MSG(int pbh, int pbl,Runtime runtime){\r
         if (is_protocol_not_Initialled()) return null;\r
-        if (CoreService.getInstance()!=null && runtime==null){\r
-            runtime=CoreService.getInstance().getRuntime();\r
-        }else{\r
-            ICLogger.i("Runtime == null !");\r
-            return null;\r
+        if (runtime==null){\r
+            if (CoreService.getInstance()!=null)\r
+                runtime=CoreService.getInstance().getRuntime();\r
+            else\r
+            {\r
+                ICLogger.i("Runtime == null !");\r
+                return null;\r
+            }\r
         }\r
         StringMessage ret=null;\r
         switch(Config.protocol_no)\r
@@ -382,11 +388,14 @@ public class protocolAPIHelper {
 \r
     public static StringMessage getOxygen_MSG(int ox,Runtime runtime){\r
         if (is_protocol_not_Initialled()) return null;\r
-        if (CoreService.getInstance()!=null && runtime==null){\r
-            runtime=CoreService.getInstance().getRuntime();\r
-        }else{\r
-            ICLogger.i("Runtime == null !");\r
-            return null;\r
+        if (runtime==null){\r
+            if (CoreService.getInstance()!=null)\r
+                runtime=CoreService.getInstance().getRuntime();\r
+            else\r
+            {\r
+                ICLogger.i("Runtime == null !");\r
+                return null;\r
+            }\r
         }\r
         StringMessage ret=null;\r
         switch(Config.protocol_no)\r
@@ -411,11 +420,14 @@ public class protocolAPIHelper {
     }\r
     public static StringMessage getPPG_MSG(int ppg,Runtime runtime){\r
         if (is_protocol_not_Initialled()) return null;\r
-        if (CoreService.getInstance()!=null && runtime==null){\r
-            runtime=CoreService.getInstance().getRuntime();\r
-        }else{\r
-            ICLogger.i("Runtime == null !");\r
-            return null;\r
+        if (runtime==null){\r
+            if (CoreService.getInstance()!=null)\r
+                    runtime=CoreService.getInstance().getRuntime();\r
+            else\r
+            {\r
+                ICLogger.i("Runtime == null !");\r
+                return null;\r
+            }\r
         }\r
         StringMessage ret=null;\r
         switch(Config.protocol_no)\r
index 2f17f83..0e5477c 100644 (file)
@@ -5,6 +5,7 @@ import android.content.Context;
 import android.content.Intent;\r
 import android.net.Uri;\r
 import android.os.Environment;\r
+import android.os.Handler;\r
 \r
 import com.enqualcomm.support.Config;\r
 import com.enqualcomm.support.CoreService;\r
@@ -29,10 +30,6 @@ import com.enqualcomm.support.utils.WakeLockUtil;
 import java.io.File;\r
 import java.util.ArrayList;\r
 import java.util.HashMap;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import rx.Observable;\r
-import rx.functions.Action1;\r
 \r
 import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;\r
 import static com.enqualcomm.support.Constants.ACTION_REMOTE_CAMERA;\r
@@ -1537,11 +1534,12 @@ public class protocol_ic {
                     runtime.getContextProxy().sendMsgBroadcast(runtime.getContextProxy().context.getResources().getString(R.string.alarm_unbind_success), 2);\r
                     runtime.setAntioffStatus(false);\r
                     //1 分钟后重置\r
-                    Observable.timer(60L, TimeUnit.SECONDS).subscribe(new Action1<Long>() {\r
-                        public void call(Long param1Long) {\r
-                          Util.doMasterClear(runtime.getContextProxy().context);\r
+                    new Handler().postDelayed(new Runnable() {\r
+                        @Override\r
+                        public void run() {\r
+                            Util.doMasterClear(runtime.getContextProxy().context);\r
                         }\r
-                    });\r
+                    },60*1000L);\r
                 }\r
             }\r
 \r
index 1400e49..9362dbb 100644 (file)
@@ -194,7 +194,8 @@ public class protocol_mqtt {
         sbtopic.append(projName)\r
                 .append("/").append(protocolVersion)\r
                 .append("/").append(cmdtype)\r
-                .append("/").append(imei);\r
+                .append("/").append(imei)\r
+                ;\r
         return genStringMessage(sbtopic.toString(), sb.toString());\r
     }\r
 \r
@@ -208,7 +209,6 @@ public class protocol_mqtt {
      * 则向WBG100/v1/BREQ/ID_334588000000156的主题发布[0016,QWER15WTF156OQRT1230]\r
      */\r
     public static StringMessage BREQ(Runtime runtime) {\r
-\r
         return genMqttCMDMsg(cmdMap.get(CMD_TYPE.BREQ), mqttKey, runtime.IMEI());\r
     }\r
 \r
@@ -433,7 +433,6 @@ public class protocol_mqtt {
         String cmd = cmdMap.get(CMD_TYPE.AL);\r
         sb.append(TimeUtil.getUTCSystemDateYYMMDD())\r
                 .append(CMDSPLIT).append(TimeUtil.getUTCSystemTimeHHmmss())\r
-//                .append(CMDSPLIT).append(runtime.getDeviceAlarmStatusFZD())\r
                 .append(CMDSPLIT).append(runtime.getFZDGPSData())\r
                 .append(CMDSPLIT).append(String.format("%03d", abs(runtime.getSignalStrength())))\r
                 .append(CMDSPLIT).append(runtime.getBattery())\r
@@ -468,8 +467,8 @@ public class protocol_mqtt {
          */\r
             connection.send(UPLOAD(runtime));\r
             String[] list=data.split(CMDSPLIT);\r
-            if (TextUtils.isDigitsOnly(list[1])) {\r
-                int timesecond = Integer.parseInt(list[1]);\r
+            if (TextUtils.isDigitsOnly(list[1].trim())) {\r
+                int timesecond = Integer.parseInt(list[1].trim());\r
                 int mod = runtime.getLocationInstance().getWorkingMod();\r
                 log("LOCATION_MODE  " + LOCATION_MODE + " mod " + mod +" cycle "+timesecond);\r
                 Config.setLocationMode(runtime.getContextProxy().context, mod);\r
@@ -560,8 +559,8 @@ public class protocol_mqtt {
         String[] list=data.split(CMDSPLIT);\r
         if (list.length==2){\r
             String cycle=list[1];\r
-            if (TextUtils.isDigitsOnly(cycle)){\r
-                int cycle_int=Integer.parseInt(cycle);\r
+            if (TextUtils.isDigitsOnly(cycle.trim())){\r
+                int cycle_int=Integer.parseInt(cycle.trim());\r
                 ICLogger.i("收到服务器指令:设置体温上传频率 "+cycle+"秒");\r
 \r
                 Config.setTemperatureTestCycle(runtime,cycle_int);\r
@@ -578,7 +577,7 @@ public class protocol_mqtt {
         }\r
     }\r
     public static StringMessage hrtstart(Runtime runtime){\r
-        return genStringMessage(cmdMap.get(CMD_TYPE.hrtstart),runtime.bleInfo.ble_area_id);\r
+        return genMqttCMDMsg(cmdMap.get(CMD_TYPE.hrtstart),runtime.bleInfo.ble_area_id,runtime.IMEI());\r
     }\r
     public void handleHrtstart(Connection connection,Runtime runtime, String data) {\r
         /***\r
@@ -598,8 +597,8 @@ public class protocol_mqtt {
         String[] list=data.split(CMDSPLIT);\r
         if (list.length==2){\r
             String cycle=list[1];\r
-            if (TextUtils.isDigitsOnly(cycle)){\r
-                int cycle_int=Integer.parseInt(cycle);\r
+            if (TextUtils.isDigitsOnly(cycle.trim())){\r
+                int cycle_int=Integer.parseInt(cycle.trim());\r
                 ICLogger.i("收到服务器指令:设置心率血压周期 "+cycle+"秒"+cycle_int/60+"分钟");\r
 \r
                 //发送重置PPGCycle的广播,会在CoreServer里面执行\r
@@ -861,7 +860,7 @@ public class protocol_mqtt {
         //普通非二进制命令用此函数处理\r
         boolean ret=true;\r
         ICLogger.i("mqtt handleCmd "+type.name() + " strLen="+data.length());\r
-        if (Config.LOG_TOFILE)ICLogger.logToFile("APILog", "mqtt recv " + cmd +" "+ data);\r
+\r
         switch (type){\r
 \r
             case KA:\r
index 9558662..fd57e10 100644 (file)
@@ -9,6 +9,7 @@ import android.os.IBinder;
 import android.os.Message;\r
 import android.util.Log;\r
 \r
+import com.enqualcomm.support.Config;\r
 import com.enqualcomm.support.utils.ICLogger;\r
 \r
 import java.io.IOException;\r
@@ -87,7 +88,9 @@ public class protocol_mqtt_client {
 //        if (isDebug()) {\r
         Log.d(TAG, "handleReceivedMessage(${publish.topicName})" + publish.getTopicName() + " data " + new String(publish.getPayload()));\r
 //        }\r
+\r
         String cmdtype= publish.getTopicName().replace(topic_header,"");\r
+        if (Config.LOG_TOFILE)ICLogger.logToFile("APILog", "mqtt recv " + publish.getTopicName() +" "+ new String(publish.getPayload()));\r
         if (mqttCallbackInterface!=null)\r
             mqttCallbackInterface.handleMqttMessage(cmdtype, publish.getPayload());\r
     }\r
@@ -170,18 +173,20 @@ public class protocol_mqtt_client {
     }\r
     private String mqttHost="";\r
     private String devid="";\r
+    private int mqtt_port=18083;\r
     private int mqtt_cycle_seconds=600;\r
-    public void configMqtt(String host,int cycle_seconds,String idname){\r
+    public void configMqtt(String host,int port,int cycle_seconds,String idname){\r
         mqttHost=host;\r
         devid=idname;\r
+        mqtt_port=port;\r
         mqtt_cycle_seconds=cycle_seconds;\r
     }\r
 \r
 \r
     public void attemptConnectMqtt(){\r
-        attemptConnectMqtt(mqttHost,devid,mqtt_cycle_seconds);\r
+        attemptConnectMqtt(mqttHost,mqtt_port,devid,mqtt_cycle_seconds);\r
     }\r
-    public void attemptConnectMqtt(String host, String identifier, int cycle_inSeconds) {\r
+    public void attemptConnectMqtt(String host, int port,String identifier, int cycle_inSeconds) {\r
         ICLogger.i("attemptConnectMqtt($host, $identifier)");\r
 \r
         if (!(MQTTConnectionConstants.STATE_CONNECTING == mClient.getState() || MQTTConnectionConstants.STATE_CONNECTED == mClient.getState())) {\r
@@ -189,11 +194,13 @@ public class protocol_mqtt_client {
 \r
                 ICLogger.i("attemptConnectMqtt");\r
                 mClient.setHost(host);\r
-                mClient.setPort(1883);\r
+                mClient.setUsername("yq_watch");\r
+                mClient.setPassword("123456");\r
+                mClient.setPort(port);\r
                 mClient.setIdentifier(identifier);\r
                 mClient.setKeepAlive(cycle_inSeconds);\r
+//                mClient.setKeepAlive(10);\r
                 mClient.setCleanSession(true);\r
-\r
                 mClient.connect();\r
             } catch (Exception ex) {\r
                 Log.e(TAG, ex.getMessage());\r
@@ -202,6 +209,7 @@ public class protocol_mqtt_client {
     }\r
 \r
     public void sendMessage(String cmdtype,String data){\r
+//        ICLogger.logToFile("APILog",cmdtype+" "+data);\r
        mClient.publish(cmdtype,data);\r
     }\r
 \r
index 192c18b..800546c 100644 (file)
@@ -31,7 +31,7 @@ public class MQTTConnectionConstants {
    * We're using this base number to make it less likely that any of these
    * constans will overlap with constants defined in the activity or by MQTT.
    */
-  private static final int CONSTANTS_BASE = 846751925;
+  public static final int CONSTANTS_BASE = 846751925;
 
   /**
    * Doing nothing...
index 02b55eb..ce62d65 100644 (file)
@@ -83,6 +83,8 @@ import static se.wetcat.qatja.MQTTConstants.SUBSCRIBE_SUCCESS_AT_MOST_ONCE;
 import static se.wetcat.qatja.MQTTConstants.SUBSCRIBE_SUCCESS_EXACTLY_ONCE;
 import static se.wetcat.qatja.MQTTConstants.UNSUBACK;
 import static se.wetcat.qatja.MQTTConstants.UNSUBSCRIBE;
+
+import static se.wetcat.qatja.android.MQTTConnectionConstants.CONSTANTS_BASE;
 import static se.wetcat.qatja.android.MQTTConnectionConstants.STATE_CHANGE;
 import static se.wetcat.qatja.android.MQTTConnectionConstants.STATE_CONNECTED;
 import static se.wetcat.qatja.android.MQTTConnectionConstants.STATE_CONNECTING;
@@ -216,7 +218,7 @@ public class QatjaService extends Service {
     super.onCreate();
 
     if (DEBUG)
-      Log.d(TAG, "onCreate");
+      ICLogger.i( "onCreate");
 
     subscribedTopics = new HashSet<>();
 
@@ -227,7 +229,7 @@ public class QatjaService extends Service {
   @Override
   public int onStartCommand(Intent intent, int flags, int startId) {
     if (DEBUG)
-      Log.d(TAG, "onStartCommand");
+      ICLogger.i( "onStartCommand");
 
     // Start a sticky service, the system will try to recreate this service if killed.
 
@@ -241,7 +243,7 @@ public class QatjaService extends Service {
     setState(STATE_NONE);
 
     if (DEBUG)
-      Log.d(TAG, "onDestroy");
+      ICLogger.i( "onDestroy");
 
     super.onDestroy();
   }
@@ -249,7 +251,7 @@ public class QatjaService extends Service {
   @Override
   public IBinder onBind(Intent intent) {
     if (DEBUG)
-      Log.d(TAG, "onBind");
+      ICLogger.i( "onBind");
 
     return mBinder;
   }
@@ -284,6 +286,7 @@ public class QatjaService extends Service {
       connect = MQTTConnect.newInstance(clientIdentifier);
     }
 
+
     connect.setCleanSession(cleanSession);
     connect.setKeepAlive(KEEP_ALIVE_TIMER);
     connect.setWillFlag(willFlag);
@@ -467,14 +470,14 @@ public class QatjaService extends Service {
 
   public synchronized void sendMessage(MQTTMessage msg, boolean mustBeConnected) {
     if (DEBUG)
-      Log.d(TAG, "Sending message: " + MQTTHelper.decodePackageName(msg));
+      ICLogger.i( "Sending message: " + MQTTHelper.decodePackageName(msg));
 
     if (mustBeConnected) {
       if (getState() == STATE_CONNECTED) {
         new WriterTask().execute(msg);
       } else {
         if (DEBUG)
-          Log.d(TAG, "Need to be connected to send " + MQTTHelper.decodePackageName(msg));
+          ICLogger.i("Need to be connected to send " + MQTTHelper.decodePackageName(msg));
 
         // If we lost the connection, and reconnect is set, let's try to reconnect now!
         if (doAutomaticReconnect)
@@ -637,7 +640,7 @@ public class QatjaService extends Service {
    */
   public synchronized void connect() {
     if (DEBUG)
-      Log.d(TAG, "connect to: " + host);
+      ICLogger.i( "connect to: " + host);
 
     cleanUp();
 
@@ -648,7 +651,7 @@ public class QatjaService extends Service {
 
         setState(STATE_CONNECTING);
     } catch (Exception e) {
-        Log.e(TAG, e.getMessage(), e);
+      ICLogger.e( e.getMessage(), e);
 
         setState(STATE_CONNECTION_FAILED);
     }
@@ -656,7 +659,7 @@ public class QatjaService extends Service {
 
   public synchronized void connect(boolean newSocket) {
     if (DEBUG)
-      Log.d(TAG, "connect to: " + host);
+      ICLogger.i("connect to: " + host);
     if (newSocket) {
       // Cancel any future ping requests
       if (mKeepaliveHandler != null) {
@@ -689,7 +692,7 @@ public class QatjaService extends Service {
 
           setState(STATE_CONNECTING);
       } catch (Exception e) {
-          Log.e(TAG, e.getMessage(), e);
+        ICLogger.e(e.getMessage(), e);
 
           setState(STATE_CONNECTION_FAILED);
       }
@@ -707,7 +710,7 @@ public class QatjaService extends Service {
    */
   private synchronized void connected(Socket socket) {
     if (DEBUG)
-      Log.d(TAG, "connected, Socket Type:");
+      ICLogger.i("connected, Socket Type:");
 
     // Cancel any future ping requests
     if (mKeepaliveHandler != null) {
@@ -739,7 +742,7 @@ public class QatjaService extends Service {
     mKeepaliveHandler = new Handler(getMainLooper());
     mKeepaliveHandler.postDelayed(mPingSender, KEEP_ALIVE_TIMER*1000);
 
-    Log.d(TAG, "Sending connect message");
+    ICLogger.i( "Sending connect message");
 
     // Send the connect message
     connect(clientIdentifier);
@@ -752,7 +755,7 @@ public class QatjaService extends Service {
    */
   private void connectionFailed(Exception e) {
     if (DEBUG)
-      Log.d(TAG, "connectionFailed", e);
+      ICLogger.i("connectionFailed", e);
 
     if(subscribedTopics != null) {
       subscribedTopics.clear();
@@ -769,7 +772,7 @@ public class QatjaService extends Service {
    */
   private void connectionLost() {
     if (DEBUG)
-      Log.d(TAG, "connectionLost");
+      ICLogger.i("connectionLost");
 
     cleanUp();
 
@@ -793,7 +796,7 @@ public class QatjaService extends Service {
    */
   private void cleanUp() {
     if (DEBUG) {
-      Log.d(TAG, "cleanUp()");
+      ICLogger.i("cleanUp()");
     }
 
     // Cancel any future ping requests
@@ -803,7 +806,7 @@ public class QatjaService extends Service {
         mKeepaliveHandler = null;
       }
     } catch (Exception e) {
-      Log.e(TAG, e.getMessage(), e);
+      ICLogger.e( e.getMessage(), e);
     }
 
     // Cancel the thread that completed the connection
@@ -823,7 +826,7 @@ public class QatjaService extends Service {
         subscribedTopics.clear();
       }
     } catch (Exception e) {
-      Log.e(TAG, e.getMessage(), e);
+      ICLogger.e(e.getMessage(), e);
     }
   }
 
@@ -834,7 +837,7 @@ public class QatjaService extends Service {
    */
   private synchronized void setState(int state) {
     if (DEBUG)
-      Log.d(TAG, "setState() " + mState + " -> " + state);
+      ICLogger.i("setState() " + (mState - CONSTANTS_BASE) + " -> " + (state- CONSTANTS_BASE));
 
     if (mState != state) {
       mState = state;
@@ -889,7 +892,7 @@ public class QatjaService extends Service {
   }
   private synchronized void handlePubmesage(MQTTPuback msg) {
 
-    Log.d(TAG, "Success handlePubmesage to " + new String(msg.getPayload()));
+    ICLogger.i("Success handlePubmesage to " + new String(msg.getPayload()));
   }
   /**
    * Manages subscription messages
@@ -909,11 +912,11 @@ public class QatjaService extends Service {
           case SUBSCRIBE_SUCCESS_AT_MOST_ONCE:
           case SUBSCRIBE_SUCCESS_AT_LEAST_ONCE:
           case SUBSCRIBE_SUCCESS_EXACTLY_ONCE:
-            Log.d(TAG, "Success subscribing to " + topicFilters[i]);
+            ICLogger.i( "Success subscribing to " + topicFilters[i]);
             break;
 
           case SUBSCRIBE_FAILURE:
-            Log.d(TAG, "Failed subscribing to " + topicFilters[i]);
+            ICLogger.i( "Failed subscribing to " + topicFilters[i]);
             break;
         }
       }
@@ -923,7 +926,7 @@ public class QatjaService extends Service {
       MQTTUnsubscribe unsubscribe = (MQTTUnsubscribe) mMqttIdentifierHelper.getSentPackages().get(unsuback.getPackageIdentifier());
       String[] topicFilters = unsubscribe.getTopicFilters();
       for (int i = 0; i < topicFilters.length; i++) {
-        Log.d(TAG, "Success unsubscribing to " + topicFilters[i]);
+        ICLogger.i( "Success unsubscribing to " + topicFilters[i]);
       }
     }
 
@@ -944,7 +947,7 @@ public class QatjaService extends Service {
 
     ConnectThread(String host, int port) throws IOException {
       if (DEBUG)
-        Log.d(TAG, "CREATE mConnectThread ");
+        ICLogger.i( "CREATE mConnectThread ");
 
       if (socketFactory != null) {
           mmSocket = socketFactory.createSocket();
@@ -955,7 +958,7 @@ public class QatjaService extends Service {
 
     public void run() {
       if (DEBUG)
-        Log.d(TAG, "BEGIN mConnectThread");
+        ICLogger.i("BEGIN mConnectThread");
 
       setName("ConnectThread");
 
@@ -970,7 +973,7 @@ public class QatjaService extends Service {
         try {
           mmSocket.close();
         } catch (IOException e2) {
-          Log.e(TAG,
+          ICLogger.e(
               "unable to close() socket during connection failure",
               e2);
         }
@@ -991,7 +994,7 @@ public class QatjaService extends Service {
       try {
         mmSocket.close();
       } catch (IOException e) {
-        Log.e(TAG, "close() of connect socket failed", e);
+        ICLogger.e( "close() of connect socket failed", e);
       }
     }
   }
@@ -1007,7 +1010,7 @@ public class QatjaService extends Service {
 
     public ConnectedThread(Socket socket) {
       if (DEBUG)
-        Log.d(TAG, "CREATE mConnectedThread");
+        ICLogger.i( "CREATE mConnectedThread");
 
       mmSocket = socket;
       InputStream tmpIn = null;
@@ -1018,14 +1021,14 @@ public class QatjaService extends Service {
         tmpIn = socket.getInputStream();
         tmpOut = socket.getOutputStream();
       } catch (IOException e) {
-        Log.e(TAG, "temp sockets not created", e);
+        ICLogger.i("temp sockets not created", e);
       }
 
       mmInStream = tmpIn;
       mmOutStream = tmpOut;
 
       if (DEBUG)
-        Log.d(TAG, "BEGIN mConnectedThread");
+        ICLogger.i( "BEGIN mConnectedThread");
     }
 
     public void run() {
@@ -1182,7 +1185,7 @@ public class QatjaService extends Service {
 
         } catch (IOException e) {
           if (DEBUG)
-            Log.e(TAG, "disconnected (this is fine, expected almost)", e);
+            ICLogger.e("disconnected (this is fine, expected almost)", e);
 
           connectionLost();
 
@@ -1200,7 +1203,7 @@ public class QatjaService extends Service {
       try {
         mmOutStream.write(buffer);
       } catch (IOException e) {
-        Log.e(TAG, "Exception during write", e);
+        ICLogger.e("Exception during write", e);
 
         // Just notify the client that the connection was lost!
         connectionLost();
@@ -1216,14 +1219,14 @@ public class QatjaService extends Service {
     @Override
     protected Void doInBackground(Closeable... closeables) {
       if (DEBUG) {
-        ICLogger.d( "Mqtt_"+ "[DisconnectTask] Closing streams and socket.");
+        ICLogger.i( "Mqtt_"+ "[DisconnectTask] Closing streams and socket.");
       }
 
       for (Closeable closeable : closeables) {
         try {
           closeable.close();
         } catch (IOException e) {
-          Log.e(TAG, e.getMessage(), e);
+          ICLogger.e( e.getMessage(), e);
         }
       }
 
@@ -1266,7 +1269,7 @@ public class QatjaService extends Service {
               mKeepaliveHandler.postDelayed(mPingSender, KEEP_ALIVE_TIMER*1000);
             }
           } catch (Exception ex) {
-            Log.e(TAG, ex.getMessage(), ex);
+            ICLogger.e( ex.getMessage(), ex);
           }
         }
       }