mqtt core 源码加入代码中
authorsnickersun <scy@incartech.cn>
Fri, 4 Sep 2020 11:53:19 +0000 (19:53 +0800)
committersnickersun <scy@incartech.cn>
Fri, 4 Sep 2020 11:53:19 +0000 (19:53 +0800)
app/build.gradle
app/src/main/java/com/enqualcomm/support/utils/mqttConnection.java
app/src/main/java/com/ic/protocols/protocol_mqtt_client.java
app/src/main/java/se/wetcat/qatja/android/QatjaService.java
app/version_code.properties
core [new submodule]
dNSCache/build.gradle
dNSCache/dNSCache.iml

index 140dfff..964a8d3 100644 (file)
@@ -1,5 +1,6 @@
 apply plugin: 'com.android.application'
 //apply plugin: 'me.tatarka.retrolambda'
+
 // APK 名称
 static def getApkBaseName() {
     return "ICSer"
@@ -59,10 +60,6 @@ android {
 //            minifyEnabled true
 //            useProguard false
         }
-        compileOptions {
-            sourceCompatibility JavaVersion.VERSION_1_8
-            targetCompatibility JavaVersion.VERSION_1_8
-        }
         // 适用 gradle 3.0 及以上版本
         android.applicationVariants.all { variant ->
             variant.outputs.all {
@@ -73,15 +70,9 @@ android {
                 }
             }
         }
-        lintOptions {
-            checkReleaseBuilds false
-            // Or, if you prefer, you can continue to check for errors in release builds,
-            // but continue the build even when errors are found:
-            abortOnError false
-        }
-        dexOptions {
-            incremental true
-            javaMaxHeapSize "4g"
+        compileOptions {
+            targetCompatibility JavaVersion.VERSION_1_8
+            sourceCompatibility JavaVersion.VERSION_1_8
         }
     }
 //    sourceSets.main {
@@ -90,6 +81,8 @@ android {
 //    }
 }
 dependencies {
+    implementation project(path: ':core')
+    implementation project(path: ':dNSCache')
     compileOnly files ('libs/frameworks-full-debug.jar')
     provided files ('libs/telephony_common-full-debug.jar')
 
@@ -101,13 +94,12 @@ dependencies {
     implementation 'com.android.support:appcompat-v7:25.1.0'
     implementation 'com.github.ChestnutPlus:TestModules:v1.0.16'
     testCompile 'junit:junit:4.12'
-    implementation project(path: ':dNSCache')
     implementation 'com.android.support:recyclerview-v7:25.1.0'
     compile files ('libs/android-logging-log4j-1.0.3.jar','libs/ftp4j-1.7.2.jar','libs/log4j-1.2.17.jar','libs/okio-2.4.3.jar' )
     compile files ('libs/mail.jar' )
     compile files ('libs/activation.jar','libs/additionnal.jar' )
 
-    implementation 'se.wetcat.qatja:core:1.0.4'
+//    implementation 'se.wetcat.qatja:core:1.0.4'
 //    implementation "androidx.recyclerview:recyclerview:1.1.0
 }
 
index 24e0fce..84fbbc8 100644 (file)
@@ -66,10 +66,10 @@ public class mqttConnection implements Connection {
     }\r
 \r
     @Override\r
-    public void connect(String paramString, int paramInt){\r
+    public void connect(String serverip, int serverport){\r
 //        mqtt_client.attemptConnectMqtt(paramString,"IC_"+mRuntime.IMEI(),paramInt);\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
+        ICLogger.i("mqttconnect " +serverip+" "+serverport+" cycle "+mRuntime.getHeartBeatCycle()*60+" as "+"IC_"+mRuntime.IMEI());\r
+        mqtt_client.configMqtt(serverip,serverport, mRuntime.getHeartBeatCycle()*60,"IC_"+mRuntime.IMEI());\r
         mqtt_client.connectservice();\r
        // if(isServerconnected) mqtt_client.attemptConnectMqtt();\r
     }\r
index c4d27f9..bc834c4 100644 (file)
@@ -170,7 +170,7 @@ public class protocol_mqtt_client {
     }\r
     private String mqttHost="";\r
     private String devid="";\r
-    private int mqtt_port=18083;\r
+    private int mqtt_port=8083;\r
     private int mqtt_cycle_seconds=600;\r
     public void configMqtt(String host,int port,int cycle_seconds,String idname){\r
         mqttHost=host;\r
@@ -184,7 +184,7 @@ public class protocol_mqtt_client {
         attemptConnectMqtt(mqttHost,mqtt_port,devid,mqtt_cycle_seconds);\r
     }\r
     public void attemptConnectMqtt(String host, int port,String identifier, int cycle_inSeconds) {\r
-        ICLogger.i("attemptConnectMqtt($host, $identifier)");\r
+        ICLogger.i("attemptConnectMqtt("+host+", "+port+" "+identifier+" "+cycle_inSeconds);\r
 \r
         if (!(MQTTConnectionConstants.STATE_CONNECTING == mClient.getState() || MQTTConnectionConstants.STATE_CONNECTED == mClient.getState())) {\r
             try {\r
index deedd0a..7e80713 100644 (file)
@@ -298,6 +298,7 @@ public class QatjaService extends Service {
     if (protocolName != null)
       connect.setProtocolName(protocolName);
 
+    ICLogger.i(connect.toString());
     sendMessage(connect, false);
   }
 
@@ -640,7 +641,7 @@ public class QatjaService extends Service {
    */
   public synchronized void connect() {
     if (DEBUG)
-      ICLogger.i( "connect to: " + host);
+      ICLogger.i( "mqtt connect to: " + host);
 
     cleanUp();
 
@@ -837,7 +838,7 @@ public class QatjaService extends Service {
    */
   private synchronized void setState(int state) {
     if (DEBUG)
-      ICLogger.i("setState() " + (mState - CONSTANTS_BASE) + " -> " + (state- CONSTANTS_BASE));
+      ICLogger.i("mqtt setState() " + (mState - CONSTANTS_BASE) + " -> " + (state- CONSTANTS_BASE));
 
     if (mState != state) {
       mState = state;
index 702d1ca..60eafa3 100644 (file)
@@ -1,2 +1,2 @@
-#Sat Aug 29 15:32:52 CST 2020\r
-VERSION_CODE=509\r
+#Tue Sep 01 11:24:02 CST 2020\r
+VERSION_CODE=510\r
diff --git a/core b/core
new file mode 160000 (submodule)
index 0000000..b6b76d5
--- /dev/null
+++ b/core
@@ -0,0 +1 @@
+Subproject commit b6b76d5e81e7d87cfca5b1bd72c57d351461640c
index f62c888..cacb757 100644 (file)
@@ -26,10 +26,11 @@ android {
 //            minifyEnabled true\r
 //            useProguard false\r
         }\r
-        compileOptions {\r
-            sourceCompatibility JavaVersion.VERSION_1_8\r
-            targetCompatibility JavaVersion.VERSION_1_8\r
-        }\r
+\r
+    }\r
+    compileOptions {\r
+        sourceCompatibility JavaVersion.VERSION_1_8\r
+        targetCompatibility JavaVersion.VERSION_1_8\r
     }\r
 }\r
 \r
index fb85dbc..4e8c3eb 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
-<module external.linked.project.id=":dNSCache" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">\r
+<module external.linked.project.id=":dNSCache" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="icsupport" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">\r
   <component name="FacetManager">\r
     <facet type="android-gradle" name="Android-Gradle">\r
       <configuration>\r