Procházet zdrojové kódy

处理mqtt概率读取的问题

cjb před 1 týdnem
rodič
revize
3584a035fe

+ 1 - 1
product/phone/src/main/ets/common/constants/CommonConstants.ets

@@ -69,7 +69,7 @@ export default class CommonConstants {
   static mqttSubscribeTopic1: string = 'station11/data/devices';
   static readonly mqttSubscribeTopic2: string = 'station11/data/devices';
   static mqttSubscribePublish: string = 'station11/cmd/devices';
-  static readonly mqttUrl: string = 'tcp://192.168.1.3:1883';
+  static readonly mqttUrl: string = 'mqtt://192.168.1.3:1883';
   // 默认随机ip
   static readonly STATION_DEFAULT_IP: string = '192.168.1.' + Math.floor(Math.random() * 90 + 10)
   static readonly mqttUserName: string = '';

+ 11 - 12
product/phone/src/main/ets/pages/EntryView.ets

@@ -100,18 +100,7 @@ struct EntryView {
   }
 
   async aboutToAppear() {
-    Log.showInfo(TAG, 'aboutToAppear');
-    this.mStage.onCreate();
-    this.navigationBarStatus = SettingsModel.getInstance().getValue();
-    this.getWindowSize();
-    this.updateScreenSize();
-
-    this.registerPageDesktopNavigatorStatusChangeEvent(this.mLocalEventListener);
-    //register orientation listener
-    this.mOrientationListener.on('change', this.onPortrait);
-
-    ElectricScrewdriverPresetModel.initTaskDB(getContext())
-    ElectricSolderingIronPresetModel.initTaskDB(getContext())
+    console.log('hhtest', 'aboutToAppear');
     // 获取工位ip
     this.stationIp = CommonConstants2.STATION_DEFAULT_IP
     try {
@@ -141,6 +130,16 @@ struct EntryView {
       }
       this.connectMQTT()
     }, 1000);
+    this.mStage.onCreate();
+    this.navigationBarStatus = SettingsModel.getInstance().getValue();
+    this.getWindowSize();
+    this.updateScreenSize();
+    this.registerPageDesktopNavigatorStatusChangeEvent(this.mLocalEventListener);
+    //register orientation listener
+    this.mOrientationListener.on('change', this.onPortrait);
+    ElectricScrewdriverPresetModel.initTaskDB(getContext())
+    ElectricSolderingIronPresetModel.initTaskDB(getContext())
+
   }
 
   registerPageDesktopNavigatorStatusChangeEvent(listener: LocalEventListener): void {