Browse Source

更新PLC地址位置9

调味吧台第二版
fyf 1 year ago
parent
commit
94f92e97f2
3 changed files with 24 additions and 2 deletions
  1. +4
    -2
      app/src/main/java/com/example/bpa/MainActivity.java
  2. +1
    -0
      app/src/main/java/com/example/bpa/app/ICSApp.java
  3. +19
    -0
      app/src/main/java/com/example/bpa/helper/NetworkUtils.java

+ 4
- 2
app/src/main/java/com/example/bpa/MainActivity.java View File

@@ -44,6 +44,7 @@ import com.example.bpa.helper.MQTT;
import com.example.bpa.helper.MessageLog; import com.example.bpa.helper.MessageLog;
import com.example.bpa.helper.ModbusTcpHelper; import com.example.bpa.helper.ModbusTcpHelper;
import com.example.bpa.helper.ModbusTcpServer; import com.example.bpa.helper.ModbusTcpServer;
import com.example.bpa.helper.NetworkUtils;
import com.example.bpa.helper.Speech; import com.example.bpa.helper.Speech;
import com.example.bpa.helper.T; import com.example.bpa.helper.T;
import com.example.bpa.helper.ThreadManager; import com.example.bpa.helper.ThreadManager;
@@ -175,6 +176,9 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen
* 初始化业务 * 初始化业务
*/ */
private void initBusiness() { private void initBusiness() {
//1.同步时间
NetworkUtils.SynchronizationTime();

Main.getInstance().ToggleEnvironment(); Main.getInstance().ToggleEnvironment();
//PLC数据监控 //PLC数据监控
ReconnectModbus(); ReconnectModbus();
@@ -183,8 +187,6 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen
OrderServer.Get().MqttInit(); OrderServer.Get().MqttInit();
//消息中心 //消息中心
RegisterMessage(); RegisterMessage();


} }


/** /**


+ 1
- 0
app/src/main/java/com/example/bpa/app/ICSApp.java View File

@@ -39,6 +39,7 @@ public class ICSApp extends Application {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
NetworkUtils.exec3("ip rule add from all lookup main pref 9999"); NetworkUtils.exec3("ip rule add from all lookup main pref 9999");
NetworkUtils.SynchronizationTime();//同步时间
ConfigName.getInstance().dishesCon = this; ConfigName.getInstance().dishesCon = this;
ConfigName.getInstance().app = this; ConfigName.getInstance().app = this;
} }


+ 19
- 0
app/src/main/java/com/example/bpa/helper/NetworkUtils.java View File

@@ -173,6 +173,25 @@ public class NetworkUtils {
} }




/**
* 同步时间
*/
public static void SynchronizationTime()
{
new Thread(new Runnable() {
@Override
public void run() {
try {
exec3("settings put global auto_time 0");
Thread.sleep(500);
exec3("settings put global auto_time 1");
} catch (InterruptedException e) {

}
}
}).start();
}

/** /**
* 发送 * 发送
* @param cmds * @param cmds


Loading…
Cancel
Save