添加净化器通信功能等
This commit is contained in:
parent
1a8376d788
commit
eced62afd4
@ -95,7 +95,7 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
|
|||||||
switch (msg.dataType) {
|
switch (msg.dataType) {
|
||||||
case AXISMOVEFUNC:
|
case AXISMOVEFUNC:
|
||||||
if (!m_controller->m_ScannerCtrl->IsStandBy() && g_Admin == USER){
|
if (!m_controller->m_ScannerCtrl->IsStandBy() && g_Admin == USER){
|
||||||
printf("没有准备好哦,无法操作\n"); return;
|
printf("振镜没有准备,无法操作\n"); return;
|
||||||
}
|
}
|
||||||
m_controller->m_Machine->CallAxisFunc(msg); break;
|
m_controller->m_Machine->CallAxisFunc(msg); break;
|
||||||
case VERSIONREQ: //获取版本信息
|
case VERSIONREQ: //获取版本信息
|
||||||
@ -117,6 +117,9 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
|
|||||||
m_controller->m_Camera->CallFunc(msg,nullptr); break;
|
m_controller->m_Camera->CallFunc(msg,nullptr); break;
|
||||||
case CAMERAPARAMUPDATE:
|
case CAMERAPARAMUPDATE:
|
||||||
m_controller->m_Camera->Update(msg); break;
|
m_controller->m_Camera->Update(msg); break;
|
||||||
|
case PURIFIERFUNC:
|
||||||
|
m_controller->m_Purifier->CallFunc(msg); break;
|
||||||
|
|
||||||
case REQUEST:
|
case REQUEST:
|
||||||
if (msg.nameKey == "36") {
|
if (msg.nameKey == "36") {
|
||||||
printf("error,36 需要释放ScannerCtrl::Init()内部代码块...\n");
|
printf("error,36 需要释放ScannerCtrl::Init()内部代码块...\n");
|
||||||
|
@ -15,6 +15,7 @@ enum READTYPE {
|
|||||||
REGISTFUNC, //注册函数集 一次请求,使用请求回复模式
|
REGISTFUNC, //注册函数集 一次请求,使用请求回复模式
|
||||||
CAMERAFUNC, //相机功能函数调用
|
CAMERAFUNC, //相机功能函数调用
|
||||||
CAMERAPARAMUPDATE, //相机参数更新
|
CAMERAPARAMUPDATE, //相机参数更新
|
||||||
|
PURIFIERFUNC, //净化器接口功能
|
||||||
|
|
||||||
SETZEROPOS, //AxisState使用
|
SETZEROPOS, //AxisState使用
|
||||||
AXISSTOPALL, //axis 运动急停
|
AXISSTOPALL, //axis 运动急停
|
||||||
|
@ -636,15 +636,13 @@ void Machine::ArmAxisMove(AxisConfig::ActiveDirect adr, bool isContinue, bool is
|
|||||||
|
|
||||||
|
|
||||||
//轴运动函数
|
//轴运动函数
|
||||||
void Machine::CallAxisFunc(const ReadData& msg) {
|
void Machine::CallAxisFunc(const ReadData& msg) {
|
||||||
MACHINEFUNC func = (MACHINEFUNC)stoi(msg.nameKey);
|
MACHINEFUNC func = (MACHINEFUNC)stoi(msg.nameKey);
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case LOADIN:
|
case LOADIN:
|
||||||
//if (!m_controller->m_ScannerCtrl->IsStandBy() && g_Admin == USER)return;
|
|
||||||
LoadIn();
|
LoadIn();
|
||||||
break; //载入
|
break; //载入
|
||||||
case LOADOUT:
|
case LOADOUT:
|
||||||
//if (!m_controller->m_ScannerCtrl->IsStandBy() && g_Admin == USER)return;
|
|
||||||
LoadOut();
|
LoadOut();
|
||||||
break; //载出
|
break; //载出
|
||||||
case INTERCEPTLOAD:
|
case INTERCEPTLOAD:
|
||||||
|
@ -66,4 +66,19 @@ void BasePurifier::WorkRun()
|
|||||||
|
|
||||||
Sleep(m_CycleTick);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6,6 +6,10 @@
|
|||||||
#include "../config/bean/AlarmCfg.h"
|
#include "../config/bean/AlarmCfg.h"
|
||||||
#include "../Communication/BaseData.h"
|
#include "../Communication/BaseData.h"
|
||||||
|
|
||||||
|
enum PurifierFunc {
|
||||||
|
STARTAUTODEOXYGEN = 0,
|
||||||
|
STOPAUTODEOXYGEN,
|
||||||
|
};
|
||||||
|
|
||||||
class BasePurifier
|
class BasePurifier
|
||||||
{
|
{
|
||||||
@ -18,7 +22,7 @@ public:
|
|||||||
|
|
||||||
virtual void StartAutoDeoxygen() = 0;
|
virtual void StartAutoDeoxygen() = 0;
|
||||||
virtual void StopAutoDeoxygen() = 0;
|
virtual void StopAutoDeoxygen() = 0;
|
||||||
virtual bool IsAutoDeoxygen() = 0;
|
virtual bool IsAutoDeoxygen() = 0; //判断的参数已传过去了,不需要在这里调用了
|
||||||
virtual void AutoCtrl() = 0;
|
virtual void AutoCtrl() = 0;
|
||||||
virtual void AutoCtrlWhenPrint() = 0;
|
virtual void AutoCtrlWhenPrint() = 0;
|
||||||
virtual void AutoCtrlWhenDoorOpen() = 0;
|
virtual void AutoCtrlWhenDoorOpen() = 0;
|
||||||
@ -30,8 +34,7 @@ public:
|
|||||||
virtual double GetWindValue(double dvalue) { return dvalue; }
|
virtual double GetWindValue(double dvalue) { return dvalue; }
|
||||||
//virtual void DrawUI() = 0;
|
//virtual void DrawUI() = 0;
|
||||||
virtual void DrawConfig() {};
|
virtual void DrawConfig() {};
|
||||||
virtual string GetWindText() { return _(u8"循环风速:%.2f m/s"); }
|
virtual string GetWindText() { return _(u8"循环风速:%.2f m/s"); } //客户端自己控制
|
||||||
virtual void BlowBackNotiry(){}
|
|
||||||
virtual bool IsConnectAlarm() { return false; }
|
virtual bool IsConnectAlarm() { return false; }
|
||||||
//MachineCfg::PulifierType GetType() {
|
//MachineCfg::PulifierType GetType() {
|
||||||
// return m_Type;
|
// return m_Type;
|
||||||
@ -56,12 +59,13 @@ public:
|
|||||||
|
|
||||||
virtual void SetParam(const ReadData& msg) {}
|
virtual void SetParam(const ReadData& msg) {}
|
||||||
|
|
||||||
|
void CallFunc(const ReadData& rd, ::stream::ResponseAny** response = nullptr);
|
||||||
private:
|
private:
|
||||||
static DWORD WINAPI WorkProc(BasePurifier* _this);
|
static DWORD WINAPI WorkProc(BasePurifier* _this);
|
||||||
void WorkRun();
|
void WorkRun();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool m_PurifierWinShow;
|
bool m_PurifierWinShow; //不传 客户端自己控制
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ExtCfg* m_ExtCfg;
|
ExtCfg* m_ExtCfg;
|
||||||
|
Binary file not shown.
@ -110,6 +110,7 @@ void DataHandle::Usage() {
|
|||||||
printf(" 4: " COLOR_YELLOW "test scan control interface...\n" COLOR_RESET);
|
printf(" 4: " COLOR_YELLOW "test scan control interface...\n" COLOR_RESET);
|
||||||
printf(" 5: " COLOR_YELLOW "test registration 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(" 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);
|
printf(" 100: " COLOR_YELLOW "start test recv param interface...\n" COLOR_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +177,8 @@ int DataHandle::Request(int index) {
|
|||||||
RegistrationTest(); break;
|
RegistrationTest(); break;
|
||||||
case 6:
|
case 6:
|
||||||
CameraTest(); break;
|
CameraTest(); break;
|
||||||
|
case 7:
|
||||||
|
PurifierTest(); break;
|
||||||
case 100:
|
case 100:
|
||||||
ParamReadUsage();
|
ParamReadUsage();
|
||||||
while (printf("*请输入命令:") && std::getline(std::cin, userInput)) {
|
while (printf("*请输入命令:") && std::getline(std::cin, userInput)) {
|
||||||
@ -337,4 +340,12 @@ void DataHandle::CameraTest() {
|
|||||||
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"LastMouRefImgPosY", to_string(100),iINT);
|
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"LastMouRefImgPosY", to_string(100),iINT);
|
||||||
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"ShowFlag", to_string(1),iBOOL);
|
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"ShowFlag", to_string(1),iBOOL);
|
||||||
printf("CAMERAPARAMUPDATE update finish\n");
|
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");
|
||||||
}
|
}
|
@ -30,6 +30,7 @@ public:
|
|||||||
void ScanCtrlTest(); //扫描控制测试
|
void ScanCtrlTest(); //扫描控制测试
|
||||||
void RegistrationTest(); //注册功能测试
|
void RegistrationTest(); //注册功能测试
|
||||||
void CameraTest(); //相机功能测试
|
void CameraTest(); //相机功能测试
|
||||||
|
void PurifierTest(); //净化器功能测试
|
||||||
|
|
||||||
void Usage();
|
void Usage();
|
||||||
void ParamReadUsage();
|
void ParamReadUsage();
|
||||||
|
@ -76,4 +76,9 @@ enum CAMERAFUNC {
|
|||||||
|
|
||||||
TAKEPHOTOS,
|
TAKEPHOTOS,
|
||||||
END2,
|
END2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum PurifierFunc {
|
||||||
|
STARTAUTODEOXYGEN = 0,
|
||||||
|
STOPAUTODEOXYGEN,
|
||||||
};
|
};
|
@ -101,6 +101,7 @@ enum WRITETYPE {
|
|||||||
REGISTFUNC, //注册函数集 一次请求,使用请求回复模式
|
REGISTFUNC, //注册函数集 一次请求,使用请求回复模式
|
||||||
CAMERAFUNC, //相机功能函数调用
|
CAMERAFUNC, //相机功能函数调用
|
||||||
CAMERAPARAMUPDATE, //相机参数更新
|
CAMERAPARAMUPDATE, //相机参数更新
|
||||||
|
PURIFIERFUNC, //净化器接口功能
|
||||||
|
|
||||||
SETZEROPOS, //AxisState使用
|
SETZEROPOS, //AxisState使用
|
||||||
AXISSTOPALL, //axis 运动急停
|
AXISSTOPALL, //axis 运动急停
|
||||||
|
@ -286,6 +286,7 @@
|
|||||||
<ClInclude Include="UI\TextureBean.h" />
|
<ClInclude Include="UI\TextureBean.h" />
|
||||||
<ClInclude Include="UI\UIBean.h" />
|
<ClInclude Include="UI\UIBean.h" />
|
||||||
<ClInclude Include="utils\Average.h" />
|
<ClInclude Include="utils\Average.h" />
|
||||||
|
<ClInclude Include="utils\CheckDataType.h" />
|
||||||
<ClInclude Include="utils\CryptHelper.h" />
|
<ClInclude Include="utils\CryptHelper.h" />
|
||||||
<ClInclude Include="utils\DataByte.h" />
|
<ClInclude Include="utils\DataByte.h" />
|
||||||
<ClInclude Include="utils\dirent.h" />
|
<ClInclude Include="utils\dirent.h" />
|
||||||
|
@ -518,6 +518,9 @@
|
|||||||
<ClInclude Include="protobuf\stream.pb.h">
|
<ClInclude Include="protobuf\stream.pb.h">
|
||||||
<Filter>protobuf</Filter>
|
<Filter>protobuf</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="utils\CheckDataType.h">
|
||||||
|
<Filter>utils</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="protobuf\stream.proto">
|
<None Include="protobuf\stream.proto">
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include "LanguageManager.h"
|
#include "LanguageManager.h"
|
||||||
#include "../DataManage/DataHandle.h"
|
#include "../DataManage/DataHandle.h"
|
||||||
|
#include "../utils/CheckDataType.h"
|
||||||
|
|
||||||
string g_AppPath;
|
string g_AppPath;
|
||||||
string g_AppDisk;
|
string g_AppDisk;
|
||||||
@ -76,7 +77,7 @@ int main(int argc, char** argv) {
|
|||||||
unknowCmd = false;
|
unknowCmd = false;
|
||||||
if (userInput.empty()) continue;
|
if (userInput.empty()) continue;
|
||||||
|
|
||||||
if(dataHandle->Request(stoi(userInput)) < 0){
|
if(!CheckDataType::CheckToInt(userInput) || dataHandle->Request(stoi(userInput)) < 0){
|
||||||
printf("未识别的命令,请重新输入命令:");
|
printf("未识别的命令,请重新输入命令:");
|
||||||
unknowCmd = true;
|
unknowCmd = true;
|
||||||
}
|
}
|
||||||
@ -85,8 +86,6 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
DELP(dataHandle);
|
DELP(dataHandle);
|
||||||
DELP(sys);
|
DELP(sys);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
TestClient/utils/CheckDataType.h
Normal file
24
TestClient/utils/CheckDataType.h
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user