Browse Source

change hmi.proto and change ADCIntelligentShow_grpc.

yuchuli 3 years ago
parent
commit
c714203013
2 changed files with 69 additions and 1 deletions
  1. 1 0
      src/include/proto/hmi.proto
  2. 68 1
      src/ui/ADCIntelligentShow_grpc/adcintelligentshow.cpp

+ 1 - 0
src/include/proto/hmi.proto

@@ -10,5 +10,6 @@ message hmimsg
  optional bool mbchemen = 4;
  optional bool mbjinguang = 5;
  optional bool mbyuanguang = 6;
+ optional int32 mMode = 7; //0 Eco 1 Normal 2 Sport
 
 };

+ 68 - 1
src/ui/ADCIntelligentShow_grpc/adcintelligentshow.cpp

@@ -1088,12 +1088,79 @@ void ADCIntelligentShow::on_pushButton_go_clicked()
 
 void ADCIntelligentShow::onSwitchClick(int nswitch)
 {
-    qDebug("click");
+    iv::hmi::hmimsg xhmi;
+    xhmi.set_mbbochemode(false);
+    xhmi.set_mbbusmode(false);
+    if(mbRunning)
+        xhmi.set_mbpause(false);
+    else
+        xhmi.set_mbpause(true);
+
+    switch (nswitch) {
+    case 0:
+        xhmi.set_mbchemen(true);
+        break;
+    case 1:
+        xhmi.set_mbchemen(false);
+        break;
+    case 2:
+        xhmi.set_mbjinguang(true);
+        break;
+    case 3:
+        xhmi.set_mbjinguang(false);
+        break;
+    case 4:
+        xhmi.set_mbyuanguang(true);
+        break;
+    case 5:
+        xhmi.set_mbyuanguang(false);
+        break;
+    default:
+        break;
+    }
+    int nsize = xhmi.ByteSize();
+    std::shared_ptr<char> pstr = std::shared_ptr<char>(new char[nsize]);
+    if(xhmi.SerializeToArray(pstr.get(),1000))
+    {
+#ifndef Android
+        iv::modulecomm::ModuleSendMsg(mpapad,pstr.get(),nsize);
+#else
+        ggt->UpdateData(pstr.get(),nsize,"pad");
+#endif
+    }
+    else
+    {
+        std::cout<<"ADCIntelligentShow::on_pushButton_clicked serialize error."<<std::endl;
+    }
+    return;
 }
 
 void ADCIntelligentShow::onModeClick(int nMode)
 {
+    iv::hmi::hmimsg xhmi;
+    xhmi.set_mbbochemode(false);
+    xhmi.set_mbbusmode(false);
+    if(mbRunning)
+        xhmi.set_mbpause(false);
+    else
+        xhmi.set_mbpause(true);
 
+    xhmi.set_mmode(nMode);
+    int nsize = xhmi.ByteSize();
+    std::shared_ptr<char> pstr = std::shared_ptr<char>(new char[nsize]);
+    if(xhmi.SerializeToArray(pstr.get(),1000))
+    {
+#ifndef Android
+        iv::modulecomm::ModuleSendMsg(mpapad,pstr.get(),nsize);
+#else
+        ggt->UpdateData(pstr.get(),nsize,"pad");
+#endif
+    }
+    else
+    {
+        std::cout<<"ADCIntelligentShow::on_pushButton_clicked serialize error."<<std::endl;
+    }
+    return;
 }
 void ADCIntelligentShow::on_pushButton_Setting_clicked()
 {