添加净化器通信功能等

This commit is contained in:
wangxx1809 2024-05-17 15:57:36 +08:00
parent 1a8376d788
commit eced62afd4
14 changed files with 77 additions and 11 deletions

View File

@ -95,7 +95,7 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
switch (msg.dataType) {
case AXISMOVEFUNC:
if (!m_controller->m_ScannerCtrl->IsStandBy() && g_Admin == USER){
printf("没有准备好哦,无法操作\n"); return;
printf("振镜没有准备,无法操作\n"); return;
}
m_controller->m_Machine->CallAxisFunc(msg); break;
case VERSIONREQ: //获取版本信息
@ -117,6 +117,9 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
m_controller->m_Camera->CallFunc(msg,nullptr); break;
case CAMERAPARAMUPDATE:
m_controller->m_Camera->Update(msg); break;
case PURIFIERFUNC:
m_controller->m_Purifier->CallFunc(msg); break;
case REQUEST:
if (msg.nameKey == "36") {
printf("error,36 需要释放ScannerCtrl::Init()内部代码块...\n");

View File

@ -15,6 +15,7 @@ enum READTYPE {
REGISTFUNC, //注册函数集 一次请求,使用请求回复模式
CAMERAFUNC, //相机功能函数调用
CAMERAPARAMUPDATE, //相机参数更新
PURIFIERFUNC, //净化器接口功能
SETZEROPOS, //AxisState使用
AXISSTOPALL, //axis 运动急停

View File

@ -640,11 +640,9 @@ void Machine::CallAxisFunc(const ReadData& msg) {
MACHINEFUNC func = (MACHINEFUNC)stoi(msg.nameKey);
switch (func) {
case LOADIN:
//if (!m_controller->m_ScannerCtrl->IsStandBy() && g_Admin == USER)return;
LoadIn();
break; //载入
case LOADOUT:
//if (!m_controller->m_ScannerCtrl->IsStandBy() && g_Admin == USER)return;
LoadOut();
break; //载出
case INTERCEPTLOAD:

View File

@ -67,3 +67,18 @@ void BasePurifier::WorkRun()
Sleep(m_CycleTick);
}
}
void BasePurifier::CallFunc(const ReadData& rd, ::stream::ResponseAny** response) {
PurifierFunc func = (PurifierFunc)stoi(rd.nameKey);
switch (func) {
case STARTAUTODEOXYGEN:
StartAutoDeoxygen();
break;
case STOPAUTODEOXYGEN:
StopAutoDeoxygen();
break;
default:break;
}
}

View File

@ -6,6 +6,10 @@
#include "../config/bean/AlarmCfg.h"
#include "../Communication/BaseData.h"
enum PurifierFunc {
STARTAUTODEOXYGEN = 0,
STOPAUTODEOXYGEN,
};
class BasePurifier
{
@ -18,7 +22,7 @@ public:
virtual void StartAutoDeoxygen() = 0;
virtual void StopAutoDeoxygen() = 0;
virtual bool IsAutoDeoxygen() = 0;
virtual bool IsAutoDeoxygen() = 0; //判断的参数已传过去了,不需要在这里调用了
virtual void AutoCtrl() = 0;
virtual void AutoCtrlWhenPrint() = 0;
virtual void AutoCtrlWhenDoorOpen() = 0;
@ -30,8 +34,7 @@ public:
virtual double GetWindValue(double dvalue) { return dvalue; }
//virtual void DrawUI() = 0;
virtual void DrawConfig() {};
virtual string GetWindText() { return _(u8"循环风速:%.2f m/s"); }
virtual void BlowBackNotiry(){}
virtual string GetWindText() { return _(u8"循环风速:%.2f m/s"); } //客户端自己控制
virtual bool IsConnectAlarm() { return false; }
//MachineCfg::PulifierType GetType() {
// return m_Type;
@ -56,12 +59,13 @@ public:
virtual void SetParam(const ReadData& msg) {}
void CallFunc(const ReadData& rd, ::stream::ResponseAny** response = nullptr);
private:
static DWORD WINAPI WorkProc(BasePurifier* _this);
void WorkRun();
public:
bool m_PurifierWinShow;
bool m_PurifierWinShow; //不传 客户端自己控制
protected:
ExtCfg* m_ExtCfg;

Binary file not shown.

View File

@ -110,6 +110,7 @@ void DataHandle::Usage() {
printf(" 4: " COLOR_YELLOW "test scan control interface...\n" COLOR_RESET);
printf(" 5: " COLOR_YELLOW "test registration interface...\n" COLOR_RESET);
printf(" 6: " COLOR_YELLOW "test camera interface...\n" COLOR_RESET);
printf(" 7: " COLOR_YELLOW "test purifier interface...\n" COLOR_RESET);
printf(" 100: " COLOR_YELLOW "start test recv param interface...\n" COLOR_RESET);
}
@ -176,6 +177,8 @@ int DataHandle::Request(int index) {
RegistrationTest(); break;
case 6:
CameraTest(); break;
case 7:
PurifierTest(); break;
case 100:
ParamReadUsage();
while (printf("*请输入命令:") && std::getline(std::cin, userInput)) {
@ -338,3 +341,11 @@ void DataHandle::CameraTest() {
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"ShowFlag", to_string(1),iBOOL);
printf("CAMERAPARAMUPDATE update finish\n");
}
void DataHandle::PurifierTest() {
SetPushMsg(PURIFIERFUNC, to_string(STARTAUTODEOXYGEN));
printf("STARTAUTODEOXYGEN is called...\n");
SetPushMsg(PURIFIERFUNC, to_string(STOPAUTODEOXYGEN));
printf("STOPAUTODEOXYGEN is called...\n");
}

View File

@ -30,6 +30,7 @@ public:
void ScanCtrlTest(); //扫描控制测试
void RegistrationTest(); //注册功能测试
void CameraTest(); //相机功能测试
void PurifierTest(); //净化器功能测试
void Usage();
void ParamReadUsage();

View File

@ -77,3 +77,8 @@ enum CAMERAFUNC {
TAKEPHOTOS,
END2,
};
enum PurifierFunc {
STARTAUTODEOXYGEN = 0,
STOPAUTODEOXYGEN,
};

View File

@ -101,6 +101,7 @@ enum WRITETYPE {
REGISTFUNC, //注册函数集 一次请求,使用请求回复模式
CAMERAFUNC, //相机功能函数调用
CAMERAPARAMUPDATE, //相机参数更新
PURIFIERFUNC, //净化器接口功能
SETZEROPOS, //AxisState使用
AXISSTOPALL, //axis 运动急停

View File

@ -286,6 +286,7 @@
<ClInclude Include="UI\TextureBean.h" />
<ClInclude Include="UI\UIBean.h" />
<ClInclude Include="utils\Average.h" />
<ClInclude Include="utils\CheckDataType.h" />
<ClInclude Include="utils\CryptHelper.h" />
<ClInclude Include="utils\DataByte.h" />
<ClInclude Include="utils\dirent.h" />

View File

@ -518,6 +518,9 @@
<ClInclude Include="protobuf\stream.pb.h">
<Filter>protobuf</Filter>
</ClInclude>
<ClInclude Include="utils\CheckDataType.h">
<Filter>utils</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="protobuf\stream.proto">

View File

@ -12,6 +12,7 @@
#include <map>
#include "LanguageManager.h"
#include "../DataManage/DataHandle.h"
#include "../utils/CheckDataType.h"
string g_AppPath;
string g_AppDisk;
@ -76,7 +77,7 @@ int main(int argc, char** argv) {
unknowCmd = false;
if (userInput.empty()) continue;
if(dataHandle->Request(stoi(userInput)) < 0){
if(!CheckDataType::CheckToInt(userInput) || dataHandle->Request(stoi(userInput)) < 0){
printf("未识别的命令,请重新输入命令:");
unknowCmd = true;
}
@ -85,8 +86,6 @@ int main(int argc, char** argv) {
DELP(dataHandle);
DELP(sys);
return 0;
}

View File

@ -0,0 +1,24 @@
#pragma once
#include <string>
#include <stdexcept>
class CheckDataType
{
public:
static bool CheckToInt(const std::string& input){
try {
int ret = stoi(input);
return true;
}
catch (const std::invalid_argument& e) {
printf("input is not number...\n");
return false;
}
catch (const std::out_of_range& e) {
printf("input number is out of int range...\n");
return false;
}
}
};