fixed copy ic as s123 cause bugs.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 29 Jun 2021 02:14:26 +0000 (10:14 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 29 Jun 2021 02:14:26 +0000 (10:14 +0800)
20 files changed:
app/release/ICSer_V861_2106281209_release.apk [new file with mode: 0644]
app/release/ICSer_V879_2106282242_release.apk [new file with mode: 0644]
app/release/output.json
app/src/main/AndroidManifest.xml
app/src/main/java/com/enqualcomm/support/BootCompleteReceiver.java
app/src/main/java/com/enqualcomm/support/Constants.java
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/ICApplication.java
app/src/main/java/com/enqualcomm/support/bean/Runtime.java
app/src/main/java/com/enqualcomm/support/provider/FZDAlarmProvider.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/SilentManager.java
app/src/main/java/com/enqualcomm/support/utils/ICLogger.java
app/src/main/java/com/enqualcomm/support/utils/NetworkObservable.java
app/src/main/java/com/enqualcomm/support/utils/RxSocket.java
app/src/main/java/com/ic/protocols/protocolAPIHelper.java
app/src/main/java/com/ic/protocols/protocol_s123.java
app/version_code.properties
local.properties

diff --git a/app/release/ICSer_V861_2106281209_release.apk b/app/release/ICSer_V861_2106281209_release.apk
new file mode 100644 (file)
index 0000000..cead6b8
Binary files /dev/null and b/app/release/ICSer_V861_2106281209_release.apk differ
diff --git a/app/release/ICSer_V879_2106282242_release.apk b/app/release/ICSer_V879_2106282242_release.apk
new file mode 100644 (file)
index 0000000..3495ae5
Binary files /dev/null and b/app/release/ICSer_V879_2106282242_release.apk differ
index d943abc..23a4ee8 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":859,"versionName":"2106261553","enabled":true,"outputFile":"ICSer_V859_2106261553_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V859_2106261553_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":879,"versionName":"2106282242","enabled":true,"outputFile":"ICSer_V879_2106282242_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V879_2106282242_release.apk","properties":{}}]
\ No newline at end of file
index 91c42f4..60eda8a 100644 (file)
             android:authorities="com.ic.fzd.settings"
             android:exported="true" />
 
-
         <provider
             android:name=".provider.FZDAlarmProvider"
             android:authorities="com.ic.provider.alarm"
index f43d40f..5a2c616 100644 (file)
@@ -9,7 +9,7 @@ import com.enqualcomm.support.utils.ICLogger;
 public class BootCompleteReceiver extends BroadcastReceiver {\r
   public void onReceive(Context paramContext, Intent paramIntent) {\r
     ICLogger.i("监听到开机广播");\r
-    paramContext.startService(new Intent(paramContext, com.enqualcomm.support.CoreService.class));\r
+    paramContext.startService(new Intent(paramContext, CoreService.class));\r
   }\r
 }\r
 \r
index 4ca2376..5db4b0f 100644 (file)
@@ -31,7 +31,7 @@ public interface Constants {
 
     String ACTION_CALL_RING = "com.enqualcomm.support.phone.ring";
 
-    String ACTION_CARE_ALARM = "com.enqualcomm.support.ACTION_CARE_ALARM";
+    String ACTION_IC_ALARM = "com.ic.alarm.action.ALARM";
 
     String ACTION_CLOSE_UNREAD_MSG = "com.enqualcomm.support.CloseUnreadMsg";
 
index b2ea009..54658ae 100644 (file)
@@ -1,5 +1,6 @@
 package com.enqualcomm.support;
 
+import android.app.ActivityManager;
 import android.app.AlarmManager;
 import android.app.Notification;
 import android.app.PendingIntent;
@@ -20,6 +21,7 @@ import android.os.Messenger;
 import android.os.PowerManager;
 import android.os.SystemClock;
 import android.support.annotation.Nullable;
+import android.util.Log;
 import android.widget.Toast;
 
 import com.enqualcomm.support.adapter.LBSHelper;
@@ -71,6 +73,7 @@ import com.ic.protocols.protocol_fzd;
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Random;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
@@ -635,6 +638,22 @@ public class CoreService extends Service {
 
     private static boolean server_starting = true;
 
+
+    public static String getProcessName(Context cxt, int pid) {
+        ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
+        List<ActivityManager.RunningAppProcessInfo> runningApps = am.getRunningAppProcesses();
+        if (runningApps == null) {
+            return null;
+        }
+        for (ActivityManager.RunningAppProcessInfo procInfo : runningApps) {
+            if (procInfo.pid == pid) {
+                return procInfo.processName;
+            }
+        }
+        return null;
+    }
+
+
     @Override
     public void onCreate() {
         if (mHandler == null) {
@@ -643,7 +662,10 @@ public class CoreService extends Service {
             mHandler = new Handler(handlerThread.getLooper());
         }
         server_starting = true;
-        log("初始化网络协议服务");
+        String curProcessName = getProcessName(this, android.os.Process.myPid());
+        Log.d(TAG, "---> onCreate....");
+        log("process name == > " + curProcessName +
+                " 初始化网络协议服务 " + Thread.currentThread().getId());
         mProtocolServer = this;
         java.lang.Runtime.getRuntime().addShutdownHook(new Thread() {
             @Override
@@ -1520,7 +1542,6 @@ public class CoreService extends Service {
                     }
                     ICLogger.i("retry 第" + retry_connect_count + " 次 , 连接服务器!");
                     this.connection.connect(this.runtime.getSrvIP(), this.runtime.getPort());
-
                 }
             }
         } else {
@@ -1569,6 +1590,7 @@ public class CoreService extends Service {
     @Override
     public void onDestroy() {
         super.onDestroy();
+        ICLogger.d("onDestroy...");
         saveStepCount();
         this.connectionServiceChain.processDetach(this.connection, this.runtime);
         this.invokeHandlerServiceChain.processDetach(this.connection, this.runtime);
index 815b940..d7dcf50 100644 (file)
@@ -19,7 +19,6 @@ public class ICApplication extends Application {
 //    private static final boolean DEBUG = BuildConfig.DEBUG;\r
 \r
     private static ICApplication instance = null;\r
-\r
     public static Context sContext = null;\r
 \r
 \r
@@ -62,7 +61,6 @@ public class ICApplication extends Application {
     public void onConfigurationChanged(Configuration newConfig) {\r
         ICLogger.i("onConfigurationChanged");\r
         super.onConfigurationChanged(newConfig);\r
-\r
         for (Object keyObj : mConfigurationChangedHandlerHashMap.keySet()) {\r
             String key = (String) keyObj;\r
             ICLogger.i("WatchApplication" + " onConfigurationChanged, " + key);\r
index 3d80642..0cc4a95 100644 (file)
@@ -126,7 +126,7 @@ public class Runtime {
     }
 
     public boolean isServerProtocolConnected() {
-        // ICLogger.d("ServerHeartBeadReceived == > " + ServerHeartBeadReceived);
+        ICLogger.d("ServerHeartBeadReceived == > " + ServerHeartBeadReceived);
         return ServerHeartBeadReceived;
     }
 
index fce0328..416064b 100644 (file)
@@ -89,7 +89,6 @@ public class FZDAlarmProvider extends ContentProvider {
             long insert = writableDatabase.insert(FZDDatabaseHelper.tb_alarm, null, values);
             //设置闹钟
             if (getContext() != null) {
-                getContext().sendBroadcast(new Intent(ACTION_ALARM_ALARM_CHANGE));
                 getContext().getContentResolver().notifyChange(uri, null);
             }
             return Uri.parse(AUTHORITY + "/" + PATH + "/" + insert);
index f826fad..5633169 100644 (file)
@@ -123,7 +123,6 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
         Intent intent = new Intent();
         intent.setAction(ACTION_HEART_RATE);
         ICApplication.sContext.bindService(intent, mRemoteConnection, Context.BIND_AUTO_CREATE);
-
     }
 
     public void init(Runtime runtime) {
index d6fa200..ef7356d 100644 (file)
@@ -361,7 +361,6 @@ public class KeepAlive extends AbstractConnectionService {
                 CoreService.getInstance().setLocationAlarm(paramRuntime.getLocationInstance().getWorkingMod());
             }
         } else if (paramStringMessage.cmd().equals("login")) {
-
             //广播服务器连接成功的消息
             paramRuntime.getContextProxy().sendBroadcastServerConnectionChanged(true);
             //login成功后,上传当前版本号
index 10fe971..25bd90b 100644 (file)
@@ -47,7 +47,7 @@ import static android.telephony.TelephonyManager.CALL_STATE_OFFHOOK;
 import static android.telephony.TelephonyManager.CALL_STATE_RINGING;
 import static com.enqualcomm.support.Constants.ACTION_ALARM_ALARM_CHANGE;
 import static com.enqualcomm.support.Constants.ACTION_ANTIOFF_ALARM_CHANGE;
-import static com.enqualcomm.support.Constants.ACTION_CARE_ALARM;
+import static com.enqualcomm.support.Constants.ACTION_IC_ALARM;
 import static com.enqualcomm.support.Constants.ACTION_CLOSE_UNREAD_MSG;
 import static com.enqualcomm.support.Constants.ACTION_NOTICE_ALARM_CHANGE;
 import static com.enqualcomm.support.Constants.OTHER_ALARM_END;
@@ -241,7 +241,7 @@ public class SilentManager extends AbstractInvokeHandlerService {
 
     private PendingIntent getPendingIntent(String args, boolean repeat) {
         Intent intent = new Intent(this.mContext, CoreService.class);
-        intent.setAction(ACTION_CARE_ALARM);
+        intent.setAction(ACTION_IC_ALARM);
         intent.putExtra("IS_REPEAT", repeat);
         intent.setData(Uri.parse(args));
         return PendingIntent.getService(this.mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
@@ -264,7 +264,7 @@ public class SilentManager extends AbstractInvokeHandlerService {
         args.append(dayOfWeek);
         week = args.toString();
         Intent intent = new Intent(this.mContext, CoreService.class);
-        intent.setAction(ACTION_CARE_ALARM);
+        intent.setAction(ACTION_IC_ALARM);
         intent.putExtra("IS_REPEAT", repeat);
         intent.putExtra("TIME_STAMP", tmpTimeInMillis);
         intent.setData(Uri.parse(week));
@@ -635,7 +635,8 @@ public class SilentManager extends AbstractInvokeHandlerService {
      * @return
      */
     private List<Alarm> updateIcAlarm() {
-        List<Alarm> alarmList = this.mDbHelper.queryAlarm();
+        List<Alarm> alarmList = this.mDbHelper.queryIcAlarm();
+        ICLogger.d("this.mInSilent == > " + this.mInSilent);
         if (!this.mInSilent) {
             if (this.alarms != null) {
                 this.cancelAlarm(this.alarms);
@@ -646,6 +647,7 @@ public class SilentManager extends AbstractInvokeHandlerService {
                 e.printStackTrace();
             }
         }
+        ICLogger.d("updateIcAlarm == > " + alarmList.size());
         return alarmList;
     }
 
@@ -729,10 +731,6 @@ public class SilentManager extends AbstractInvokeHandlerService {
                 } else {
                     //只是一次的闹铃
                     long tmpTimeInMillis;
-//          int dayofweek = weeklist[i] - 47;
-//          calendar.set(Calendar.DAY_OF_WEEK, dayofweek);
-//          tmpTimeInMillis = calendar.getTimeInMillis();
-
                     Date date = new Date(System.currentTimeMillis());
                     ICLogger.i("date " + date.toLocaleString());
                     Calendar c = Calendar.getInstance();
@@ -847,7 +845,7 @@ public class SilentManager extends AbstractInvokeHandlerService {
         String action = intent.getAction();
         ICLogger.d("action == > " + action);
         //如果是循环的,那么再设置下一次
-        if (ACTION_CARE_ALARM.equals(action)) {
+        if (ACTION_IC_ALARM.equals(action)) {
             String alarmTime = intent.getDataString();  //alarm:ST00.43,W,CON,闹铃,2
             ICLogger.d("alarmTime == > " + alarmTime);
             String currentTime = TimeUtil.getSystemTime();
@@ -875,6 +873,7 @@ public class SilentManager extends AbstractInvokeHandlerService {
                     Intent targetIntent = new Intent("com.ic.alarm.action.ALARM_RING",
                             Uri.parse(alarmTime));
                     targetIntent.putExtra("closeAlarm", 0);
+                    targetIntent.addCategory(Intent.CATEGORY_DEFAULT);
                     targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                     this.mContext.startActivity(targetIntent);
                 } catch (Exception e) {
index 6072ec3..501c347 100644 (file)
@@ -2,324 +2,318 @@ package com.enqualcomm.support.utils;
 
 import android.content.Context;
 
-import com.enqualcomm.support.ICApplication;
-
-import org.apache.log4j.Appender;
-import org.apache.log4j.FileAppender;
-import org.apache.log4j.Layout;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
 import org.apache.log4j.RollingFileAppender;
-import org.apache.log4j.spi.ErrorHandler;
-import org.apache.log4j.spi.Filter;
-import org.apache.log4j.spi.LoggingEvent;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.PrintStream;
 
 import de.mindpipe.android.logging.log4j.LogConfigurator;
 
 
-
 public class ICLogger {
 
     private static boolean isInitConfig = false;
-    private static Context mContext=null;
-
-  private static Logger Log = null;
-  private static Logger GPS = null;
-  private static Logger Nmea = null;
-  private static Logger APILog = null;
-  private static Logger alarmCycle = null;
-  private static Logger Battery = null;
-  private static Logger LBS = null;
-  //  private static java.util.logging.Logger originLog= java.util.logging.Logger.getLogger(ICLogger.class.getSimpleName());
-  private static final boolean DEBUG = true;   //BuildConfig.DEBUG;
-
-  public static void setContext(Context context){
-    mContext=context;
-  }
-  private static String getFunctionName() {
-    StackTraceElement[] currentStack = Thread.currentThread().getStackTrace();
-    if (currentStack == null) {
-      return null;
-    } else {
-      int stackLen = currentStack.length;
-
-      for(int i = 0; i < stackLen; ++i) {
-        StackTraceElement stackElement = currentStack[i];
-        if (!stackElement.isNativeMethod() && !stackElement.getClassName().equals(Thread.class.getName()) && !stackElement.getClassName().equals(ICLogger.class.getName())) {
-          StringBuilder sb = new StringBuilder();
-          sb.append("[ ");
-          sb.append(Thread.currentThread().getName());
-          sb.append(": ");
-          sb.append(stackElement.getFileName());
-          sb.append(":");
-          sb.append(stackElement.getLineNumber());
-          sb.append(" ");
-          sb.append(stackElement.getMethodName());
-          sb.append(" ]");
-          return sb.toString();
-        }
-      }
+    private static Context mContext = null;
+
+    private static Logger Log = null;
+    private static Logger GPS = null;
+    private static Logger Nmea = null;
+    private static Logger APILog = null;
+    private static Logger alarmCycle = null;
+    private static Logger Battery = null;
+    private static Logger LBS = null;
+    //  private static java.util.logging.Logger originLog= java.util.logging.Logger.getLogger(ICLogger.class.getSimpleName());
+    private static final boolean DEBUG = true;    //BuildConfig.DEBUG;
+
+    public static void setContext(Context context) {
+        mContext = context;
+    }
 
-      return null;
+    private static String getFunctionName() {
+        StackTraceElement[] currentStack = Thread.currentThread().getStackTrace();
+        if (currentStack == null) {
+            return null;
+        } else {
+            int stackLen = currentStack.length;
+
+            for (int i = 0; i < stackLen; ++i) {
+                StackTraceElement stackElement = currentStack[i];
+                if (!stackElement.isNativeMethod() && !stackElement.getClassName().equals(Thread.class.getName()) && !stackElement.getClassName().equals(ICLogger.class.getName())) {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append("[ ");
+                    sb.append(Thread.currentThread().getName());
+                    sb.append(": ");
+                    sb.append(stackElement.getFileName());
+                    sb.append(":");
+                    sb.append(stackElement.getLineNumber());
+                    sb.append(" ");
+                    sb.append(stackElement.getMethodName());
+                    sb.append(" ]");
+                    return sb.toString();
+                }
+            }
+
+            return null;
+        }
     }
-  }
-
-  /**
-   初始化与配置Logger   Log4j
-   日志信息格式中符号所代表的含义
-   (1)-X号: X信息输出时左对齐。
-   (2)%p: 输出日志信息优先级,即DEBUG,INFO,WARN,ERROR,FATAL。
-   (3)%d: 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,比如:%d{yyy MMM dd HH:mm:ss,SSS},输出类似:2002年10月18日 22:10:28,921。
-   (4)%r: 输出自应用启动到输出该log信息耗费的毫秒数。
-   (5)%c: 输出日志信息所属的类目,通常就是所在类的全名。
-   (6)%t: 输出产生该日志事件的线程名。
-   (7)%l: 输出日志事件的发生位置,相当于%C.%M(%F:%L)的组合,包括类目名、发生的线程,以及在代码中的行数。举例:Testlog4.main(TestLog4.java:10)。
-   (8)%x: 输出和当前线程相关联的NDC(嵌套诊断环境),尤其用到像java servlets这样的多客户多线程的应用中。
-   (9)%%: 输出一个"%"字符。
-   (10)%F: 输出日志消息产生时所在的文件名称。
-   (11)%L: 输出代码中的行号。
-   (12)%m: 输出代码中指定的消息,产生的日志具体信息。
-   (13)%n: 输出一个回车换行符,Windows平台为"\r\n",Unix平台为"\n"输出日志信息换行。
-   可以在%与模式字符之间加上修饰符来控制其最小宽度、最大宽度、和文本的对齐方式。如:
-   (1)%20c:指定输出category的名称,最小的宽度是20,如果category的名称小于20的话,默认的情况下右对齐。
-   (2)%-20c:指定输出category的名称,最小的宽度是20,如果category的名称小于20的话,"-"号指定左对齐。
-   (3)%.30c:指定输出category的名称,最大的宽度是30,如果category的名称大于30的话,就会将左边多出的字符截掉,但小于30的话也不会有空格。
-   (4)%20.30c:如果category的名称小于20就补空格,并且右对齐,如果其名称长于30字符,就从左边交远销出的字符截掉。
-   */
+
+    /**
+     * 初始化与配置Logger   Log4j
+     * 日志信息格式中符号所代表的含义
+     * (1)-X号: X信息输出时左对齐。
+     * (2)%p: 输出日志信息优先级,即DEBUG,INFO,WARN,ERROR,FATAL。
+     * (3)%d: 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,比如:%d{yyy MMM dd HH:mm:ss,SSS},输出类似:2002年10月18日 22:10:28,921。
+     * (4)%r: 输出自应用启动到输出该log信息耗费的毫秒数。
+     * (5)%c: 输出日志信息所属的类目,通常就是所在类的全名。
+     * (6)%t: 输出产生该日志事件的线程名。
+     * (7)%l: 输出日志事件的发生位置,相当于%C.%M(%F:%L)的组合,包括类目名、发生的线程,以及在代码中的行数。举例:Testlog4.main(TestLog4.java:10)。
+     * (8)%x: 输出和当前线程相关联的NDC(嵌套诊断环境),尤其用到像java servlets这样的多客户多线程的应用中。
+     * (9)%%: 输出一个"%"字符。
+     * (10)%F: 输出日志消息产生时所在的文件名称。
+     * (11)%L: 输出代码中的行号。
+     * (12)%m: 输出代码中指定的消息,产生的日志具体信息。
+     * (13)%n: 输出一个回车换行符,Windows平台为"\r\n",Unix平台为"\n"输出日志信息换行。
+     * 可以在%与模式字符之间加上修饰符来控制其最小宽度、最大宽度、和文本的对齐方式。如:
+     * (1)%20c:指定输出category的名称,最小的宽度是20,如果category的名称小于20的话,默认的情况下右对齐。
+     * (2)%-20c:指定输出category的名称,最小的宽度是20,如果category的名称小于20的话,"-"号指定左对齐。
+     * (3)%.30c:指定输出category的名称,最大的宽度是30,如果category的名称大于30的话,就会将左边多出的字符截掉,但小于30的话也不会有空格。
+     * (4)%20.30c:如果category的名称小于20就补空格,并且右对齐,如果其名称长于30字符,就从左边交远销出的字符截掉。
+     */
     private static void initConfig() {
-      if (!isInitConfig) {
+        if (!isInitConfig) {
 
-        LogConfigurator logConfigurator = new LogConfigurator();
+            LogConfigurator logConfigurator = new LogConfigurator();
 
-        String filename=StorageUtils.getExternalStorageLogDir()+ File.separator + "log.txt";
-        logConfigurator.setFileName(filename);                         // 日志存储路径,如果该路径没有会自动创建文件
-        logConfigurator.setRootLevel(Level.ALL);
+            String filename = StorageUtils.getExternalStorageLogDir() + File.separator + "log.txt";
+            logConfigurator.setFileName(filename);                // 日志存储路径,如果该路径没有会自动创建文件
+            logConfigurator.setRootLevel(Level.ALL);
 
-        logConfigurator.setLevel("log", Level.ALL);
+            logConfigurator.setLevel("log", Level.ALL);
 //        logConfigurator.setFilePattern("%d %-5p [%c{2}]-[%L] %m%n");// 设置文件输出模式
-        logConfigurator.setFilePattern("%d %m%n ");// 设置文件输出模式
+            logConfigurator.setFilePattern("%d %m%n ");// 设置文件输出模式
 //        02-29 16:28:38.195 4629-4658/com.enqualcomm.support E/com.enqualcomm.support.utils.ICLogger:
-        logConfigurator.setMaxBackupSize(2); // 设置最大备份数量
-        logConfigurator.setMaxFileSize(1024 * 1024 * 20);// 设置最大文件大小  20MB
-        logConfigurator.setImmediateFlush(true);// 设置是否立即刷新
-        logConfigurator.setUseFileAppender(true); // 设置用户文件输出器
-        logConfigurator.setInternalDebugging(false); //控制console是否输出
-        logConfigurator.setUseLogCatAppender(true);
-        logConfigurator.setLogCatPattern("%m%n");
-        logConfigurator.configure();// 设置提交
+            logConfigurator.setMaxBackupSize(2); // 设置最大备份数量
+            logConfigurator.setMaxFileSize(1024 * 1024 * 20);// 设置最大文件大小  20MB
+            logConfigurator.setImmediateFlush(true);// 设置是否立即刷新
+            logConfigurator.setUseFileAppender(true); // 设置用户文件输出器
+            logConfigurator.setInternalDebugging(false); //控制console是否输出
+            logConfigurator.setUseLogCatAppender(true);
+            logConfigurator.setLogCatPattern("%m%n");
+            logConfigurator.configure();// 设置提交
 
 
 //        String logfilelist[]={"Log","GPS","Nmea","APILog","alarmCycle","Battery","LBS"};
 
-        //Log 和log目前是同一个配置
-        Log = Logger.getLogger("log");
-        Log.info("init Logger "+Log.getName());
+            //Log 和log目前是同一个配置
+            Log = Logger.getLogger("log");
+            Log.info("init Logger " + Log.getName());
 //        Log.addAppender( getRollingFileAppender("log","%d %m%n "));
 //        Log.info("init Logger "+Log.getName()+" "+((RollingFileAppender)Log.getAppender("log")).getFile());
 
-        GPS = Logger.getLogger("GPS");
-        GPS.addAppender( getRollingFileAppender("GPS","%d %m%n "));
-        GPS.info("init Logger "+GPS.getName()+" "+((RollingFileAppender)GPS.getAppender("GPS")).getFile());
+            GPS = Logger.getLogger("GPS");
+            GPS.addAppender(getRollingFileAppender("GPS", "%d %m%n "));
+            GPS.info("init Logger " + GPS.getName() + " " + ((RollingFileAppender) GPS.getAppender("GPS")).getFile());
 
-        Nmea = Logger.getLogger("Nmea");
-        Nmea.addAppender( getRollingFileAppender("Nmea","%m%n"));
-        Nmea.info("init Logger "+Nmea.getName()+" "+((RollingFileAppender)Nmea.getAppender("Nmea")).getFile());
+            Nmea = Logger.getLogger("Nmea");
+            Nmea.addAppender(getRollingFileAppender("Nmea", "%m%n"));
+            Nmea.info("init Logger " + Nmea.getName() + " " + ((RollingFileAppender) Nmea.getAppender("Nmea")).getFile());
 
-        APILog = Logger.getLogger("APILog");
-        APILog.addAppender( getRollingFileAppender("APILog","%d %m%n "));
-        APILog.info("init Logger "+APILog.getName()+" "+((RollingFileAppender)APILog.getAppender("APILog")).getFile());
+            APILog = Logger.getLogger("APILog");
+            APILog.addAppender(getRollingFileAppender("APILog", "%d %m%n "));
+            APILog.info("init Logger " + APILog.getName() + " " + ((RollingFileAppender) APILog.getAppender("APILog")).getFile());
 
-        alarmCycle = Logger.getLogger("alarmCycle");
-        alarmCycle.addAppender( getRollingFileAppender("alarmCycle","%d %m%n "));
-        alarmCycle.info("init Logger "+alarmCycle.getName()+" "+((RollingFileAppender)alarmCycle.getAppender("alarmCycle")).getFile());
+            alarmCycle = Logger.getLogger("alarmCycle");
+            alarmCycle.addAppender(getRollingFileAppender("alarmCycle", "%d %m%n "));
+            alarmCycle.info("init Logger " + alarmCycle.getName() + " " + ((RollingFileAppender) alarmCycle.getAppender("alarmCycle")).getFile());
 
-        Battery = Logger.getLogger("Battery");
-        Battery.addAppender( getRollingFileAppender("Battery","%d %m%n "));
-        Battery.info("init Logger "+Battery.getName()+" "+((RollingFileAppender)Battery.getAppender("Battery")).getFile());
+            Battery = Logger.getLogger("Battery");
+            Battery.addAppender(getRollingFileAppender("Battery", "%d %m%n "));
+            Battery.info("init Logger " + Battery.getName() + " " + ((RollingFileAppender) Battery.getAppender("Battery")).getFile());
 
 
-        LBS = Logger.getLogger("LBS");
-        LBS.addAppender( getRollingFileAppender("LBS","%d %m%n "));
-        LBS.info("init Logger "+LBS.getName()+" "+((RollingFileAppender)LBS.getAppender("LBS")).getFile());
-        isInitConfig = true;
-      }
+            LBS = Logger.getLogger("LBS");
+            LBS.addAppender(getRollingFileAppender("LBS", "%d %m%n "));
+            LBS.info("init Logger " + LBS.getName() + " " + ((RollingFileAppender) LBS.getAppender("LBS")).getFile());
+            isInitConfig = true;
+        }
     }
 
-    public static void logRAWtoFile(String filename,String msg){
-      if (filename.equals("Nmea")){
-        Nmea.info(msg);
-      }else if  (filename.equals("LBS")) {
-        LBS.info(msg);
-      }else if  (filename.equals("GPS")) {
-        GPS.info(msg);
-      }else if  (filename.equals("APILog")) {
-        APILog.info(msg);
-      }else if  (filename.equals("alarmCycle")) {
-        alarmCycle.info(msg);
-      }else if  (filename.equals("Battery")) {
-        Battery.info(msg);
-      }else {
-        Log.info(msg);
-      }
+    public static void logRAWtoFile(String filename, String msg) {
+        if (filename.equals("Nmea")) {
+            Nmea.info(msg);
+        } else if (filename.equals("LBS")) {
+            LBS.info(msg);
+        } else if (filename.equals("GPS")) {
+            GPS.info(msg);
+        } else if (filename.equals("APILog")) {
+            APILog.info(msg);
+        } else if (filename.equals("alarmCycle")) {
+            alarmCycle.info(msg);
+        } else if (filename.equals("Battery")) {
+            Battery.info(msg);
+        } else {
+            Log.info(msg);
+        }
     }
-  public static void logToFile(String filename,String msg){
-    if (filename.equals("Nmea")){
-      Nmea.info(msg);
-    }else if  (filename.equals("LBS")) {
-      LBS.info(msg);
-    }else if  (filename.equals("GPS")) {
-      GPS.info(msg);
-    }else if  (filename.equals("APILog")) {
-      APILog.info(msg);
-    }else if  (filename.equals("alarmCycle")) {
-      alarmCycle.info(msg);
-    }else if  (filename.equals("Battery")) {
-      Battery.info(msg);
-    }else {
-      Log.info(msg);
+
+    public static void logToFile(String filename, String msg) {
+        if (filename.equals("Nmea")) {
+            Nmea.info(msg);
+        } else if (filename.equals("LBS")) {
+            LBS.info(msg);
+        } else if (filename.equals("GPS")) {
+            GPS.info(msg);
+        } else if (filename.equals("APILog")) {
+            APILog.info(msg);
+        } else if (filename.equals("alarmCycle")) {
+            alarmCycle.info(msg);
+        } else if (filename.equals("Battery")) {
+            Battery.info(msg);
+        } else {
+            Log.info(msg);
+        }
     }
-  }
-    private static  RollingFileAppender getRollingFileAppender(String name,String layoutpattern){
-      PatternLayout fileLayout = new PatternLayout(layoutpattern);
-      String filename=StorageUtils.getExternalStorageLogDir()+ File.separator + name+".txt";
-      RollingFileAppender rollingFileAppender= null;
-      try {
-        rollingFileAppender = new RollingFileAppender(fileLayout,filename);
-      } catch (IOException e) {
-        e.printStackTrace();
-        ICLogger.e(e.getMessage(),e);
-        return null;
-      }
-      rollingFileAppender.setName(name);
-      rollingFileAppender.setMaxBackupIndex(2);  //最多3个备份文件
-      rollingFileAppender.setMaximumFileSize(10*1024*1024); //10M 大小
-      rollingFileAppender.setImmediateFlush(true);
-
-      return rollingFileAppender;
+
+    private static RollingFileAppender getRollingFileAppender(String name, String layoutpattern) {
+        PatternLayout fileLayout = new PatternLayout(layoutpattern);
+        String filename = StorageUtils.getExternalStorageLogDir() + File.separator + name + ".txt";
+        RollingFileAppender rollingFileAppender = null;
+        try {
+            rollingFileAppender = new RollingFileAppender(fileLayout, filename);
+        } catch (IOException e) {
+            e.printStackTrace();
+            ICLogger.e(e.getMessage(), e);
+            return null;
+        }
+        rollingFileAppender.setName(name);
+        rollingFileAppender.setMaxBackupIndex(2);  //最多3个备份文件
+        rollingFileAppender.setMaximumFileSize(10 * 1024 * 1024); //10M 大小
+        rollingFileAppender.setImmediateFlush(true);
+
+        return rollingFileAppender;
     }
 
     public static void v(String msg) {
-      initConfig();
-      if (Log!=null)
-        Log.debug(buildMessage(msg));
+        initConfig();
+        if (Log != null)
+            Log.debug(buildMessage(msg));
     }
 
     public static void v(String msg, Throwable thr) {
-      initConfig();
-      if (Log!=null)
-        Log.debug(buildMessage(msg), thr);
+        initConfig();
+        if (Log != null)
+            Log.debug(buildMessage(msg), thr);
     }
 
     public static void d(String msg) {
-      initConfig();
-      if (Log!=null)
-        Log.debug(buildMessage(msg));
+        initConfig();
+        if (Log != null)
+            Log.debug(buildMessage(msg));
     }
 
     public static void d(String msg, Throwable thr) {
-      initConfig();
-      if (Log!=null)
-        Log.debug(buildMessage(msg), thr);
+        initConfig();
+        if (Log != null)
+            Log.debug(buildMessage(msg), thr);
     }
 
     public static void i(String msg) {
-      initConfig();
-      if (Log!=null)
-        Log.info(buildMessage(msg));
+        initConfig();
+        if (Log != null)
+            Log.info(buildMessage(msg));
     }
 
     public static void i(String msg, Throwable thr) {
-      initConfig();
-      if (Log!=null)
-        Log.info(buildMessage(msg), thr);
+        initConfig();
+        if (Log != null)
+            Log.info(buildMessage(msg), thr);
     }
 
     public static void w(String msg) {
-      initConfig();
-      if (Log!=null)
-        Log.warn(buildMessage(msg));
+        initConfig();
+        if (Log != null)
+            Log.warn(buildMessage(msg));
     }
 
     public static void w(String msg, Throwable thr) {
-      initConfig();
-      if (Log!=null)
-        Log.warn(buildMessage(msg), thr);
+        initConfig();
+        if (Log != null)
+            Log.warn(buildMessage(msg), thr);
     }
 
     public static void w(Throwable thr) {
-      initConfig();
-      if (Log!=null)
-        Log.warn(buildMessage(""), thr);
+        initConfig();
+        if (Log != null)
+            Log.warn(buildMessage(""), thr);
     }
 
     public static void e(String msg) {
-      initConfig();
-      if (Log!=null)
-        Log.error(buildMessage(msg));
+        initConfig();
+        if (Log != null)
+            Log.error(buildMessage(msg));
     }
 
     public static void e(String msg, Throwable thr) {
-      initConfig();
-      if (Log!=null)
-        Log.error(buildMessage(msg), thr);
+        initConfig();
+        if (Log != null)
+            Log.error(buildMessage(msg), thr);
     }
 
-    public static void PrintExceptionStackTrace(Exception e){
-
-      StringBuffer sb=new StringBuffer();
-      sb.append(e.getMessage()).append("\n");
-      e.printStackTrace(new PrintStream(new OutputStream() {
-        @Override
-        public void write(int b) throws IOException {
-          sb.append((char)b);
-        }
-      }));
-      i(sb.toString());
+    public static void PrintExceptionStackTrace(Exception e) {
+
+        StringBuffer sb = new StringBuffer();
+        sb.append(e.getMessage()).append("\n");
+        e.printStackTrace(new PrintStream(new OutputStream() {
+            @Override
+            public void write(int b) throws IOException {
+                sb.append((char) b);
+            }
+        }));
+        i(sb.toString());
     }
 
     /**
      * 生成消息
+     *
      * @param msg
      * @return
      */
     protected static String buildMessage(String msg) {
-      initConfig();
-      if (DEBUG && msg !=null) {
-        String var1 = getFunctionName();
-        if (var1 != null) {
-          StringBuilder sb = new StringBuilder();
-          sb.append(var1);
-          sb.append(" - ");
-          sb.append(msg);
-          return sb.toString();
-        }else{
-          return "functionName is null";
+        initConfig();
+        if (DEBUG && msg != null) {
+            String var1 = getFunctionName();
+            if (var1 != null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(var1);
+                sb.append(" - ");
+                sb.append(msg);
+                return sb.toString();
+            } else {
+                return "functionName is null";
+            }
+        } else {
+            return "msg is null";
         }
-      }else{
-        return "msg is null";
-      }
     }
-  public static  void log(String TAG, String msg) {
-    if (DEBUG) {
-      if (Log!=null)Log.debug(TAG+ " "+msg);
 
+    public static void log(String TAG, String msg) {
+        if (DEBUG) {
+            if (Log != null) Log.debug(TAG + " " + msg);
+        }
     }
-  }
 
-  public static void log(String TAG,String funcName, String msg) {
-    if (DEBUG) {
-      if (Log!=null)
-        Log.debug(TAG + " [" + funcName + "]" + msg);
+    public static void log(String TAG, String funcName, String msg) {
+        if (DEBUG) {
+            if (Log != null)
+                Log.debug(TAG + " [" + funcName + "]" + msg);
 
+        }
     }
-  }
 
 }
 
index 632ded2..bb3bc95 100644 (file)
@@ -1,88 +1,89 @@
 package com.enqualcomm.support.utils;\r
 \r
-        import android.content.BroadcastReceiver;\r
-        import android.content.Context;\r
-        import android.content.Intent;\r
-        import android.content.IntentFilter;\r
-        import android.net.ConnectivityManager;\r
-        import android.net.Network;\r
-        import android.net.NetworkInfo;\r
-        import com.enqualcomm.support.service.KeepAlive;\r
-        import rx.Observable;\r
-        import rx.subjects.BehaviorSubject;\r
+import android.content.BroadcastReceiver;\r
+import android.content.Context;\r
+import android.content.Intent;\r
+import android.content.IntentFilter;\r
+import android.net.ConnectivityManager;\r
+import android.net.NetworkInfo;\r
+\r
+import com.enqualcomm.support.service.KeepAlive;\r
+\r
+import rx.Observable;\r
+import rx.subjects.BehaviorSubject;\r
 \r
 public class NetworkObservable {\r
-  static String lastActivType="off";\r
-  BroadcastReceiver mNetStateBroadcastReceiver = new BroadcastReceiver() {\r
-    public void onReceive(Context context, Intent intent) {\r
-      NetworkInfo networkInfo = ((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();\r
+    static String lastActivType = "off";\r
+    BroadcastReceiver mNetStateBroadcastReceiver = new BroadcastReceiver() {\r
+        public void onReceive(Context context, Intent intent) {\r
+            NetworkInfo networkInfo = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();\r
 //      NetworkInfo wifiinfo=((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE)).getNetworkInfo(ConnectivityManager.TYPE_WIFI);\r
 //      NetworkInfo mobileinfo=((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE)).getNetworkInfo(ConnectivityManager.TYPE_MOBILE);\r
 //      ICLogger.i("active network type = "+wifiinfo.getTypeName()+", status="+wifiinfo.getState().name());\r
 //      ICLogger.i("active network type = "+mobileinfo.getTypeName()+", status="+mobileinfo.getState().name());\r
-       if (networkInfo != null && networkInfo.isAvailable()) {\r
-         if (lastActivType!=networkInfo.getTypeName()){\r
-           lastActivType=networkInfo.getTypeName();\r
-           active_network_changed=true;\r
-         }else{\r
-           active_network_changed=false;\r
-         }\r
-        StringBuilder var4 = new StringBuilder();\r
+            if (networkInfo != null && networkInfo.isAvailable()) {\r
+                if (lastActivType != networkInfo.getTypeName()) {\r
+                    lastActivType = networkInfo.getTypeName();\r
+                    active_network_changed = true;\r
+                } else {\r
+                    active_network_changed = false;\r
+                }\r
+                StringBuilder var4 = new StringBuilder();\r
+\r
+                var4.append("BroadcastReceiver---网络连接成功  KeepAlive.isConnected=");\r
+                var4.append(KeepAlive.isConnected);\r
+                var4.append(",active_network_changed=");\r
+                var4.append(active_network_changed);\r
+                var4.append(",network_is_from_no_to_yes=");\r
+                var4.append(network_is_from_no_to_yes);\r
+                var4.append(",network_type=").append(networkInfo.getTypeName());\r
+                ICLogger.i(var4.toString());\r
+                if (!KeepAlive.isConnected && !network_is_from_no_to_yes) {\r
+                    //如果serversocket 未连接成功,且之前网络未断开重连\r
+                    if (active_network_changed) {\r
+                        //如果之前一次是网络断开,则重连\r
+                        objectPublishSubject.onNext(2);\r
+                    } else {\r
+                        //如果之前网络正常,则无需重连\r
+                        objectPublishSubject.onNext(1);\r
+                    }\r
+                } else if (network_is_from_no_to_yes) {\r
+                    //如果是断网重连,则证明需要重连\r
+                    objectPublishSubject.onNext(3);\r
+                } else if (KeepAlive.isConnected) {\r
+                    //如果网络实际连接的,就无需重连\r
+                    active_network_changed = false;\r
+                }\r
+                //下次在有新状态,无需重连\r
+                network_is_from_no_to_yes = false;\r
+            } else {\r
+                ICLogger.i("网络断开");\r
+                lastActivType = "off";\r
+                network_is_from_no_to_yes = true; //断网了,则下次变化必然是 FromNoToYes,需要重连 所以为 True\r
+                objectPublishSubject.onNext(0); //发送断网消息。\r
+            }\r
 \r
-        var4.append("BroadcastReceiver---网络连接成功  KeepAlive.isConnected=");\r
-        var4.append(KeepAlive.isConnected);\r
-        var4.append(",active_network_changed=");\r
-        var4.append(active_network_changed);\r
-        var4.append(",network_is_from_no_to_yes=");\r
-        var4.append(network_is_from_no_to_yes);\r
-        var4.append(",network_type=").append(networkInfo.getTypeName());\r
-        ICLogger.i(var4.toString());\r
-        if (!KeepAlive.isConnected && !network_is_from_no_to_yes) {\r
-          //如果serversocket 未连接成功,且之前网络未断开重连\r
-          if (active_network_changed) {\r
-            //如果之前一次是网络断开,则重连\r
-            objectPublishSubject.onNext(2);\r
-          } else {\r
-            //如果之前网络正常,则无需重连\r
-            objectPublishSubject.onNext(1);\r
-          }\r
-        } else if (network_is_from_no_to_yes) {\r
-          //如果是断网重连,则证明需要重连\r
-          objectPublishSubject.onNext(3);\r
-        } else if (KeepAlive.isConnected) {\r
-          //如果网络实际连接的,就无需重连\r
-          active_network_changed = false;\r
         }\r
-        //下次在有新状态,无需重连\r
-        network_is_from_no_to_yes = false;\r
-      } else {\r
-        ICLogger.i("网络断开");\r
-        lastActivType="off";\r
-        network_is_from_no_to_yes = true; //断网了,则下次变化必然是 FromNoToYes,需要重连 所以为 True\r
-        objectPublishSubject.onNext(0); //发送断网消息。\r
-      }\r
+    };\r
+    private boolean active_network_changed = false;\r
+    private boolean network_is_from_no_to_yes = true;\r
+    BehaviorSubject<Integer> objectPublishSubject = BehaviorSubject.create();\r
 \r
+    public NetworkObservable() {\r
     }\r
-  };\r
-  private boolean active_network_changed = false;\r
-  private boolean network_is_from_no_to_yes = true;\r
-  BehaviorSubject<Integer> objectPublishSubject = BehaviorSubject.create();\r
-\r
-  public NetworkObservable() {\r
-  }\r
 \r
-  public Observable<Integer> onChange() {\r
-    return this.objectPublishSubject.distinctUntilChanged();\r
-  }\r
+    public Observable<Integer> onChange() {\r
+        return this.objectPublishSubject.distinctUntilChanged();\r
+    }\r
 \r
-  public void register(Context var1) {\r
-    IntentFilter var2 = new IntentFilter();\r
-    var2.addAction("android.net.conn.CONNECTIVITY_CHANGE");\r
-    var1.registerReceiver(this.mNetStateBroadcastReceiver, var2);\r
-  }\r
+    public void register(Context var1) {\r
+        IntentFilter var2 = new IntentFilter();\r
+        var2.addAction("android.net.conn.CONNECTIVITY_CHANGE");\r
+        var1.registerReceiver(this.mNetStateBroadcastReceiver, var2);\r
+    }\r
 \r
-  public void unregister(Context var1) {\r
-    var1.unregisterReceiver(this.mNetStateBroadcastReceiver);\r
-  }\r
+    public void unregister(Context var1) {\r
+        var1.unregisterReceiver(this.mNetStateBroadcastReceiver);\r
+    }\r
 }\r
 \r
index 7da9b62..6401f14 100644 (file)
@@ -184,7 +184,8 @@ public class RxSocket {
             @Override
             public void call(Subscriber<? super Boolean> subscriber) {
                 try {
-                    if (socketStatus == SocketStatus.DIS_CONNECT || socketStatus == SocketStatus.DIS_CONNECT_BY_SERVERSIDE) {
+                    if (socketStatus == SocketStatus.DIS_CONNECT
+                            || socketStatus == SocketStatus.DIS_CONNECT_BY_SERVERSIDE) {
                         subscriber.onNext(true);
                         subscriber.onCompleted();
                     } else {
@@ -299,10 +300,12 @@ public class RxSocket {
 
         @Override
         public void run() {
-            ICLogger.log(TAG, "ReadThread:" + "start");
+            ICLogger.log(TAG, "ReadThread:" + "start == > " +
+                    isReadThreadAlive + " ip == > " + ip + " port == > " + port);
             while (isReadThreadAlive) {
                 //连接
-                if (socketStatus == SocketStatus.DIS_CONNECT || socketStatus == SocketStatus.DIS_CONNECT_BY_SERVERSIDE) {
+                if (socketStatus == SocketStatus.DIS_CONNECT ||
+                        socketStatus == SocketStatus.DIS_CONNECT_BY_SERVERSIDE) {
                     try {
                         Thread.sleep(10);
                         if (selectionKey != null) selectionKey.cancel();
index be327e5..6b45dcc 100644 (file)
@@ -188,7 +188,7 @@ public class protocolAPIHelper {
         return ret;
     }
 
-    public static StringMessage getDeviceVersion(Runtime runtime){
+    public static StringMessage getDeviceVersion(Runtime runtime) {
         if (is_protocol_not_Initialled()) return null;
         StringMessage ret = null;
         switch (Config.protocol_no) {
@@ -218,6 +218,7 @@ public class protocolAPIHelper {
 
 
     }
+
     public static StringMessage getSyncTimeMSG(Runtime runtime) {
         if (is_protocol_not_Initialled()) return null;
         StringMessage ret = null;
@@ -257,7 +258,7 @@ public class protocolAPIHelper {
                 return null;
             }
         }
-        if(temp_adusted<=0 && body_temp<=0){
+        if (temp_adusted <= 0 && body_temp <= 0) {
             ICLogger.i("腕温,体温都 <= 0 跳过上传消息 !");
             return null;
         }
@@ -279,7 +280,7 @@ public class protocolAPIHelper {
                 ret = protocol_mqtt.temp(body_temp, runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.APTP(temp_adusted, body_temp, tempout);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -308,7 +309,8 @@ public class protocolAPIHelper {
                 ret = protocol_anan.APCH(charging);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                if (Config.custom_name.equals("VitracK"))
+                    ret = protocol_ic.APCH(charging);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -341,7 +343,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.AP10(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.AP10(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -373,7 +375,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.AP00(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.AP00(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -405,7 +407,8 @@ public class protocolAPIHelper {
                 ret = protocol_anan.AP03(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                //ret = protocol_s123.AP00(runtime);
+                ret = protocol_ic.AP03(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -437,7 +440,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.AP01(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.AP01(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -469,7 +472,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.AP02(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.AP02(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -510,7 +513,16 @@ public class protocolAPIHelper {
                 ret = protocol_anan.AP07(packetTime, count, index, datalen, amrdata);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                /***
+                 *          * 1 语音——   1.监听语音      *   2.SOS语音      *      3.扩展
+                 *          * 2 图片——   1.签到图片      *   2.指令图片      *   3.设备图片      *   4.扩展
+                 */
+                if (filetype == 1 && datatype == 3) {
+                    //对讲用的类型
+                    ret = protocol_ic.AP07(packetTime, count, index, datalen, amrdata);
+                } else {
+                    ret = protocol_ic.APTU(packetTime, filetype, datatype, count, index, datalen, amrdata);
+                }
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -523,7 +535,7 @@ public class protocolAPIHelper {
         if (is_protocol_not_Initialled()) return null;
         StringMessage ret = null;
 
-        if(runtime==null || runtime.getHRS().getPPG()<=0 ){
+        if (runtime == null || runtime.getHRS().getPPG() <= 0) {
             ICLogger.d(" 心率 值 <=0 跳过异常数据!");
             return null;
         }
@@ -548,7 +560,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.APHT(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.APHP(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -560,7 +572,7 @@ public class protocolAPIHelper {
     public static StringMessage getPPG_ECG_MSG(Runtime runtime, int ppg, int bph, int bpl) {
         if (is_protocol_not_Initialled()) return null;
         StringMessage ret = null;
-        if(runtime==null || runtime.getHRS().getPPG()<=0 ){
+        if (runtime == null || runtime.getHRS().getPPG() <= 0) {
             ICLogger.d(" 心率 值 <=0 跳过异常数据!");
             return null;
         }
@@ -584,7 +596,7 @@ public class protocolAPIHelper {
                 ret = protocol_anan.APHT(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.APHT(ppg, bph, bpl);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -726,7 +738,7 @@ public class protocolAPIHelper {
                 ret = null;
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.APHP(ppg, bph, bpl, spo2);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -759,7 +771,7 @@ public class protocolAPIHelper {
                 //ret = protocol_anan.APTQ(runtime);
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.APTQ(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -791,10 +803,10 @@ public class protocolAPIHelper {
                 ret = protocol_anan.defaultServerIp;
                 break;
             case Config.PROTOCOL_S123:
-                ret =  protocol_s123.defaultServerIP;
+                ret = protocol_s123.defaultServerIP;
                 break;
             case Config.PROTOCOL_GATOR:
-                ret =  protocol_gator.defaultServerIP;
+                ret = protocol_gator.defaultServerIP;
                 break;
         }
         ICLogger.d("ip ==> " + ret);
@@ -857,7 +869,11 @@ public class protocolAPIHelper {
                 ret = null;
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                if (Config.getProtocolServerHost(runtime.getContextProxy().context).equals(protocol_jiai.defaultServerIP)) {
+                    ret = null;
+                } else {
+                    ret = protocol_ic.APSL(sr.getCurrentDate(), sr.getDeepsleep_minutes(), sr.getLightsleep_minutes(), sr.getScore());
+                }
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
@@ -949,7 +965,7 @@ public class protocolAPIHelper {
                 ret = null;
                 break;
             case Config.PROTOCOL_S123:
-                ret = null;
+                ret = protocol_ic.APBR(runtime);
                 break;
             case Config.PROTOCOL_GATOR:
                 ret = null;
index e3f5795..2f5e7b9 100644 (file)
@@ -46,6 +46,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 
+import static com.enqualcomm.support.Constants.ACTION_ALARM_ALARM_CHANGE;
 import static com.enqualcomm.support.Constants.DIALOG_ACTION;
 import static com.enqualcomm.support.Constants.FROM_SERVER;
 import static com.enqualcomm.support.LocationClient.LOCATION_MODE;
@@ -66,8 +67,8 @@ import static java.lang.Math.abs;
  * customserverport=8083
  */
 public class protocol_s123 {
-    private static final String TAG = "ICSrv." + protocol_s123.class.getSimpleName();
 
+    private static final String TAG = "ICSrv." + protocol_s123.class.getSimpleName();
     private static final String CMDHEADER = "IW";
     private static final String CMDEND = "#";
     private static final String CMDSPLIT = ",";
@@ -971,20 +972,20 @@ public class protocol_s123 {
 
     //设置闹钟
     public void handleBP85(String cmd, Connection connection, Runtime runtime) {
-//        IWBP85,867155030001063,155312,1,1,0235,12,1,1
-//        IWBP85,867155030002145,945166,1,0,
-//        IWBP85,867155030001064,265960,1,1,1130,,1,1
-//        IWBP85,353456789012345,080835,1,3, 0900,135,1,1@0900 ,135,1,2@0900 ,135,1,3#
-//353456789012345:IMEI号,设备唯一ID
-//080835 :指令流水号
-//1: 表示闹钟总开关,1为开,0 为关
-//3: 表示闹钟个数
-//0900 ,135,1,1,表示一组闹钟,0900表示早上09:00, 135表示周一周三周五,使用24小时制
-//1表示该组闹钟开启或关闭状态   1表示开启  0表示关闭
-//1表示吃药提醒
-//2 表示喝水提醒
-//3 表示久坐提醒
-//多组闹钟之间用”@”符号分隔
+        //        IWBP85,867155030001063,155312,1,1,0235,12,1,1
+        //        IWBP85,867155030002145,945166,1,0,
+        //        IWBP85,867155030001064,265960,1,1,1130,,1,1
+        //        IWBP85,353456789012345,080835,1,3, 0900,135,1,1@0900 ,135,1,2@0900 ,135,1,3#
+        //353456789012345:IMEI号,设备唯一ID
+        //080835 :指令流水号
+        //1: 表示闹钟总开关,1为开,0 为关
+        //3: 表示闹钟个数
+        //0900 ,135,1,1,表示一组闹钟,0900表示早上09:00, 135表示周一周三周五,使用24小时制
+        //1表示该组闹钟开启或关闭状态   1表示开启  0表示关闭
+        //1表示吃药提醒
+        //2 表示喝水提醒
+        //3 表示久坐提醒
+        //多组闹钟之间用”@”符号分隔
 
         String imei = "", cmdindex = "0"/*指令流水号*/;
         int all_alarmswitch = 0 /*总开关 1为开,0 为关*/,
@@ -3462,8 +3463,6 @@ public class protocol_s123 {
                 Alarm alarmItem = new Alarm("ST" + alarmTime.substring(0, 2) + "." + alarmTime.substring(2),
                         "W" + weekItem, "CON", "1".equals(isOpen) ? "ON" : "OFF", alarmName);
                 ICLogger.d("alarmItem == > " + alarmName);
-                //设置闹钟
-                //TODO:
                 //入库
                 ContentValues contentValues = new ContentValues();
                 contentValues.put(FZDDatabaseHelper.alarm_name, alarmItem.name);
@@ -3475,6 +3474,8 @@ public class protocol_s123 {
                 contentValues.put(FZDDatabaseHelper.createTime, System.currentTimeMillis());
                 resolver.insert(Uri.parse(FZDAlarmProvider.ALARMS), contentValues);
             }
+            //设置闹钟
+            mRuntime.getContextProxy().context.sendBroadcast(new Intent(ACTION_ALARM_ALARM_CHANGE));
         } catch (Exception e) {
             e.printStackTrace();
         }
index d9042ad..5f2d7c3 100644 (file)
@@ -1,5 +1,5 @@
-#Sat Jun 26 15:53:09 CST 2021\r
+#Mon Jun 28 22:42:14 CST 2021\r
 >>>>>>>=b405d1184f3616d4e894d199cee0eb91613a68db\r
-VERSION_CODE=859\r
+VERSION_CODE=879\r
 =\=\=\=\=\=\=\r
 <<<<<<<=HEAD\r
index 0cdc2a6..70a3feb 100644 (file)
@@ -5,4 +5,4 @@
 # For customization when using a Version Control System, please read the\r
 # header note.\r
 #Sat Jun 26 13:03:49 CST 2021\r
-sdk.dir=C\:\\Users\\incar\\AppData\\Local\\Android\\Sdk\r
+sdk.dir=E\:\\Android\\Sdk
\ No newline at end of file