diff --git a/PrintS/Config/ConfigManager.cpp b/PrintS/Config/ConfigManager.cpp index 4cb260f..c3d224d 100644 --- a/PrintS/Config/ConfigManager.cpp +++ b/PrintS/Config/ConfigManager.cpp @@ -490,6 +490,34 @@ void ConfigManager::SendCfgToClients() { ++commuCfgitem; } + list lst; + auto start = m_AlarmCfgWrapper->m_StopAlarmCfgMap.begin(); + while (start != m_AlarmCfgWrapper->m_StopAlarmCfgMap.end()) { + lst.emplace_back(Item{ start->first,"",UNKNOW,(*start).second->m_Content, (*start).second->m_IsEnable, + (*start).second->m_IsAlarm, (*start).second->m_IsShow }); + ++start; + } + ClientWrapper::Instance()->PushAllClient(WriteData(STOPALARMCFGPARAM, lst)); + + lst.clear(); + start = m_AlarmCfgWrapper->m_PauseAlarmCfgMap.begin(); + while (start != m_AlarmCfgWrapper->m_PauseAlarmCfgMap.end()) { + lst.emplace_back(Item{ start->first,"",UNKNOW,(*start).second->m_Content, (*start).second->m_IsEnable, + (*start).second->m_IsAlarm, (*start).second->m_IsShow }); + ++start; + } + ClientWrapper::Instance()->PushAllClient(WriteData(PAUSEALARMCFGPARAM, lst)); + + lst.clear(); + start = m_AlarmCfgWrapper->m_WarnAlarmCfgMap.begin(); + while (start != m_AlarmCfgWrapper->m_WarnAlarmCfgMap.end()) { + lst.emplace_back(Item{ start->first,"",UNKNOW,(*start).second->m_Content, (*start).second->m_IsEnable, + (*start).second->m_IsAlarm, (*start).second->m_IsShow }); + ++start; + } + ClientWrapper::Instance()->PushAllClient(WriteData(WARNALARMCFGPARAM, lst)); + + int index = 0; auto item = m_ScannerControlCfgDao->m_ScannerControlCfgMap.begin(); while (item != m_ScannerControlCfgDao->m_ScannerControlCfgMap.end()) { @@ -588,6 +616,8 @@ void ConfigManager::UpdateCfg(const ReadData& rd) { m_PowderEstimateCfg.Update(rd,POWDERESTIMATECFGPARAM); break; case COMMUNICATIONCFG: UpdateCommunicationCfg(rd); break; + case ALARMCFG: + m_AlarmCfgWrapper->UpdateCfg(rd.nameKey, (bool)ConverType::TryToI(rd.strValue)); break; default: break; diff --git a/PrintS/Config/ConfigManager.h b/PrintS/Config/ConfigManager.h index 95e45fd..099ed1b 100644 --- a/PrintS/Config/ConfigManager.h +++ b/PrintS/Config/ConfigManager.h @@ -96,7 +96,7 @@ public: ParamLimitCfg* GetParamLimitCfg() { return &m_ParamLimitCfg; } //已传 MachineCfg* GetMachineCfg() { return &m_MachineCfg; } //已传 Machine* GetMachine() { return m_Machine; } //不用传 - AlarmCfgWrapper* GetAlarmCfg() { return m_AlarmCfgWrapper; } + AlarmCfgWrapper* GetAlarmCfg() { return m_AlarmCfgWrapper; } //已传 RecoatCheckCfg* GetRecoatCheckCfg() { return &m_RecoatCheckCfg; } //已传 diff --git a/PrintS/Config/bean/AlarmCfg.cpp b/PrintS/Config/bean/AlarmCfg.cpp index b0a9f27..c675145 100644 --- a/PrintS/Config/bean/AlarmCfg.cpp +++ b/PrintS/Config/bean/AlarmCfg.cpp @@ -3,13 +3,11 @@ #include "../../LanguageManager.h" #include "../../Toast.h" -AlarmCfg::AlarmCfg() -:m_IsAlarm(false) -, m_IsShow(true) -, m_AlarmInfo("") -, m_AlarmContinueTick(0) -, m_CheckAlarmSetTick(40) -, m_Shielding(false) +AlarmCfg::AlarmCfg() //这个不用加m_baseMp + : m_IsEnable(false) + , m_IsAlarm(false) + , m_IsShow(true) + , m_CheckAlarmSetTick(40) { } @@ -18,18 +16,18 @@ AlarmCfg::~AlarmCfg() } AlarmCfg::AlarmCfg(string code, string content, int type) - :m_Code(code) + : m_Code(code) , m_Content(content) , m_Type(type) - , m_IsAlarm(false) , m_IsEnable(true) + , m_IsAlarm(false) , m_IsShow(true) - , m_AlarmInfo("") - , m_AlarmContinueTick(0) , m_CheckAlarmSetTick(40) - , m_Shielding(false) { - + //size_t ptrSize = sizeof(nullptr); //指针大小 + //void* startPtr = &m_startFlag + 1; + //size_t count = ((size_t)&m_endFlag - (size_t)startPtr) / ptrSize; + //InsertMp(startPtr, count, "_"+code); } string AlarmCfg::GetUpdateSql() @@ -50,7 +48,7 @@ string AlarmCfg::GetUpdateSql() void AlarmCfg::SetUse(bool isUse) { m_IsShow = isUse; - if (!isUse)m_IsEnable = isUse; + if (!isUse) m_IsEnable =isUse; } string AlarmCfg::GetTypeInfo(int t) @@ -311,4 +309,21 @@ void AlarmCfgWrapper::Init() { void AlarmCfgWrapper::InitShowVec() { +} + +void AlarmCfgWrapper::UpdateCfg(const string& key, bool isEnable) { + do { + if (m_StopAlarmCfgMap.find(key) != m_StopAlarmCfgMap.end()) { + m_StopAlarmCfgMap[key]->m_IsEnable = isEnable; + break; + } + if (m_PauseAlarmCfgMap.find(key) != m_PauseAlarmCfgMap.end()) { + m_PauseAlarmCfgMap[key]->m_IsEnable = isEnable; + break; + } + if (m_WarnAlarmCfgMap.find(key) != m_WarnAlarmCfgMap.end()) { + m_WarnAlarmCfgMap[key]->m_IsEnable = isEnable; + break; + } + } while (false); } \ No newline at end of file diff --git a/PrintS/Config/bean/AlarmCfg.h b/PrintS/Config/bean/AlarmCfg.h index 9d33b02..204ef0f 100644 --- a/PrintS/Config/bean/AlarmCfg.h +++ b/PrintS/Config/bean/AlarmCfg.h @@ -12,7 +12,7 @@ using namespace std; #define ALARM_TYPE_WARN 2 #define ALARM_TYPE_AUTO_PAUSE 3 -class AlarmCfg +class AlarmCfg { public: AlarmCfg(); @@ -25,15 +25,14 @@ public: int m_id; int m_Type; string m_Code; - string m_Content; - bool m_IsEnable; - bool m_IsAlarm; - bool m_IsShow; + string m_Content; //传 + bool m_IsEnable; //传 + bool m_IsAlarm; //传 + bool m_IsShow; //传 string m_AlarmInfo; unsigned int m_AlarmContinueTick; unsigned int m_CheckAlarmSetTick; bool m_Shielding; - public: static const string TABLE_NAME; static const string FIELD_ID; @@ -49,6 +48,7 @@ public: ~AlarmCfgWrapper(); void Init(); + void UpdateCfg(const string& key, bool isEnable); private: void InitShowVec(); public: @@ -56,7 +56,7 @@ public: map m_PauseAlarmCfgMap; map m_WarnAlarmCfgMap; - map m_AllAlarmMap; + map m_AllAlarmMap; //是上面3个map之和 vector m_StopAlarmShowVec; map m_ScannerComAlarmMap; diff --git a/PrintS/Config/dao/AlarmCfgDao.cpp b/PrintS/Config/dao/AlarmCfgDao.cpp index d24f0ef..0abf1ed 100644 --- a/PrintS/Config/dao/AlarmCfgDao.cpp +++ b/PrintS/Config/dao/AlarmCfgDao.cpp @@ -61,7 +61,6 @@ void AlarmCfgDao::InitBeforeFind() AlarmCfg* ScannerPowerExceptionAlarm = new AlarmCfg("ScannerPowerExceptionAlarm", u8"振镜电源异常报警", ALARM_TYPE_STOP); cfg->m_StopAlarmCfgMap[ScannerPowerExceptionAlarm->m_Code] = ScannerPowerExceptionAlarm; - AlarmCfg* HeatingPowerAirSwitchAlarm = new AlarmCfg("HeatingPowerAirSwitchAlarm", u8"加热电源空开报警", ALARM_TYPE_STOP); cfg->m_StopAlarmCfgMap[HeatingPowerAirSwitchAlarm->m_Code] = HeatingPowerAirSwitchAlarm; @@ -95,7 +94,6 @@ void AlarmCfgDao::InitBeforeFind() AlarmCfg* Laser8Alarm = new AlarmCfg("Laser8Alarm", u8"激光器8报警", ALARM_TYPE_STOP); cfg->m_StopAlarmCfgMap[Laser8Alarm->m_Code] = Laser8Alarm; - AlarmCfg* Laser1ComAlarm = new AlarmCfg("Laser1ComAlarm", u8"激光器1通讯报警", ALARM_TYPE_STOP); cfg->m_StopAlarmCfgMap[Laser1ComAlarm->m_Code] = Laser1ComAlarm; diff --git a/PrintS/DataManage/DataHandle.cpp b/PrintS/DataManage/DataHandle.cpp index 5ef3d6e..dd212d9 100644 --- a/PrintS/DataManage/DataHandle.cpp +++ b/PrintS/DataManage/DataHandle.cpp @@ -118,6 +118,7 @@ void DataHandle::DataCallBackHandle(const ReadData& msg, const std::list& case RECOATCHECKCFG: case POWDERESTIMATECFG: case COMMUNICATIONCFG: + case ALARMCFG: ConfigManager::GetInstance()->UpdateCfg(msg); break; case REQUEST: diff --git a/PrintS/DataManage/RWData.h b/PrintS/DataManage/RWData.h index 4aa0c77..37bcd48 100644 --- a/PrintS/DataManage/RWData.h +++ b/PrintS/DataManage/RWData.h @@ -33,6 +33,7 @@ enum READTYPE { RECOATCHECKCFG, POWDERESTIMATECFG, COMMUNICATIONCFG, + ALARMCFG, LOADPARAM, //装载参数 @@ -111,6 +112,11 @@ enum WRITETYPE { POWDERESTIMATECFGPARAM, //PowderEstimateCfg 参数 COMMUNICATIONCFGPARAM, //CommunicationCfg 参数 + STOPALARMCFGPARAM, //AlarmCfgWrapper stop参数 + PAUSEALARMCFGPARAM, //AlarmCfgWrapper pause参数 + WARNALARMCFGPARAM, //AlarmCfgWrapper warn参数 + + MOLDCFGPARAM, LOADCFGPARAM, ARMCFGPARAM, @@ -133,6 +139,11 @@ struct Item { std::string nameKey; //参数key std::string strValue; //value DATATYPE valueType; //数据类型 + + std::string content; //alarmcfgwrapper使用 + bool isEnable; + bool isAlarm; + bool isShow; }; class ClientInfo; diff --git a/PrintS/DataManage/StreamServer.cpp b/PrintS/DataManage/StreamServer.cpp index f2e9942..935ea0d 100644 --- a/PrintS/DataManage/StreamServer.cpp +++ b/PrintS/DataManage/StreamServer.cpp @@ -90,6 +90,11 @@ Status StreamServer::AllStream(ServerContext* context, grpc::ServerReaderWriter< paramInfo->set_namekey((*wd).nameKey); paramInfo->set_strvalue((*wd).strValue); paramInfo->set_valuetype((stream::TYPE)(*wd).valueType); + + paramInfo->set_context(wd->content); + paramInfo->set_isenable(wd->isEnable); + paramInfo->set_isalarm(wd->isAlarm); + paramInfo->set_isshow(wd->isShow); } stream->Write(response); } diff --git a/PrintS/PrintS.vcxproj b/PrintS/PrintS.vcxproj index 291c6d7..493a994 100644 --- a/PrintS/PrintS.vcxproj +++ b/PrintS/PrintS.vcxproj @@ -132,6 +132,9 @@ 4996 OldStyle /D "_CRT_SECURE_NO_WARNINGS" /D "_WINSOCK_DEPRECATED_NO_WARNINGS" %(AdditionalOptions) + + + true Console diff --git a/PrintS/output/Release/config.hbd b/PrintS/output/Release/config.hbd index a54a2ec..a30fe96 100644 Binary files a/PrintS/output/Release/config.hbd and b/PrintS/output/Release/config.hbd differ diff --git a/PrintS/output/Release/log/2024.hbd b/PrintS/output/Release/log/2024.hbd index 7a42773..9d3fdc8 100644 Binary files a/PrintS/output/Release/log/2024.hbd and b/PrintS/output/Release/log/2024.hbd differ diff --git a/PrintS/protobuf/stream.pb.cc b/PrintS/protobuf/stream.pb.cc index 327a184..2cc1ee5 100644 --- a/PrintS/protobuf/stream.pb.cc +++ b/PrintS/protobuf/stream.pb.cc @@ -32,7 +32,14 @@ PROTOBUF_CONSTEXPR ParamInfo::ParamInfo(::_pbi::ConstantInitialized) &::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}, }, + /*decltype(_impl_.context_)*/ { + &::_pbi::fixed_address_empty_string, + ::_pbi::ConstantInitialized{}, + }, /*decltype(_impl_.valuetype_)*/ 0, + /*decltype(_impl_.isenable_)*/ false, + /*decltype(_impl_.isalarm_)*/ false, + /*decltype(_impl_.isshow_)*/ false, /*decltype(_impl_._cached_size_)*/ {}, } {} struct ParamInfoDefaultTypeInternal { @@ -272,6 +279,10 @@ const ::uint32_t TableStruct_stream_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.namekey_), PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.strvalue_), PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.valuetype_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.context_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.isenable_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.isalarm_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.isshow_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::stream::RequestInfo, _internal_metadata_), ~0u, // no _extensions_ @@ -400,17 +411,17 @@ const ::uint32_t TableStruct_stream_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::stream::ParamInfo)}, - {11, -1, -1, sizeof(::stream::RequestInfo)}, - {25, -1, -1, sizeof(::stream::ResponseInfo)}, - {36, 45, -1, sizeof(::stream::ResponseAny)}, - {46, -1, -1, sizeof(::stream::LayerData)}, - {59, -1, -1, sizeof(::stream::LayerDataBlock)}, - {73, -1, -1, sizeof(::stream::VectorDataBlock)}, - {85, -1, -1, sizeof(::stream::ChainDataBlock)}, - {95, -1, -1, sizeof(::stream::Point)}, - {105, -1, -1, sizeof(::stream::RegResponce)}, - {114, -1, -1, sizeof(::stream::ImgInfoResponce)}, - {125, -1, -1, sizeof(::stream::ComResponce)}, + {15, -1, -1, sizeof(::stream::RequestInfo)}, + {29, -1, -1, sizeof(::stream::ResponseInfo)}, + {40, 49, -1, sizeof(::stream::ResponseAny)}, + {50, -1, -1, sizeof(::stream::LayerData)}, + {63, -1, -1, sizeof(::stream::LayerDataBlock)}, + {77, -1, -1, sizeof(::stream::VectorDataBlock)}, + {89, -1, -1, sizeof(::stream::ChainDataBlock)}, + {99, -1, -1, sizeof(::stream::Point)}, + {109, -1, -1, sizeof(::stream::RegResponce)}, + {118, -1, -1, sizeof(::stream::ImgInfoResponce)}, + {129, -1, -1, sizeof(::stream::ComResponce)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -429,45 +440,47 @@ static const ::_pb::Message* const file_default_instances[] = { }; const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { "\n\014stream.proto\022\006stream\032\031google/protobuf/" - "any.proto\"O\n\tParamInfo\022\017\n\007nameKey\030\001 \001(\014\022" - "\020\n\010strValue\030\002 \001(\014\022\037\n\tvalueType\030\003 \001(\0162\014.s" - "tream.TYPE\"\254\001\n\013RequestInfo\022\020\n\010dataType\030\001" - " \001(\r\022\017\n\007nameKey\030\002 \001(\014\022\020\n\010strValue\030\003 \001(\014\022" - "\037\n\tvalueType\030\004 \001(\0162\014.stream.TYPE\022&\n\nhand" - "leType\030\005 \001(\0162\022.stream.DATAHANDLE\022\037\n\004item" - "\030\006 \003(\0132\021.stream.ParamInfo\"Q\n\014ResponseInf" - "o\022\020\n\010dataType\030\001 \001(\r\022\016\n\006result\030\002 \001(\010\022\037\n\004i" - "tem\030\003 \003(\0132\021.stream.ParamInfo\"1\n\013Response" - "Any\022\"\n\004data\030\001 \001(\0132\024.google.protobuf.Any\"" - "\210\001\n\tLayerData\022\023\n\013zCooldinate\030\001 \001(\002\022\016\n\006po" - "wder\030\002 \001(\002\022\026\n\016layerThickness\030\003 \001(\002\022.\n\016la" - "yerDataBlock\030\004 \003(\0132\026.stream.LayerDataBlo" - "ck\022\016\n\006result\030\005 \001(\010\"\266\001\n\016LayerDataBlock\022\021\n" - "\telementId\030\001 \001(\005\022\026\n\016elementParamId\030\002 \001(\005" - "\022\021\n\tblockType\030\003 \001(\r\022*\n\tvecBlocks\030\004 \003(\0132\027" - ".stream.VectorDataBlock\022+\n\013chainBlocks\030\005" - " \003(\0132\026.stream.ChainDataBlock\022\r\n\005order\030\006 " - "\001(\r\"M\n\017VectorDataBlock\022\016\n\006startX\030\001 \001(\002\022\016" - "\n\006startY\030\002 \001(\002\022\014\n\004endX\030\003 \001(\002\022\014\n\004endY\030\004 \001" - "(\002\"A\n\016ChainDataBlock\022\016\n\006dotNum\030\001 \001(\r\022\037\n\010" - "pointVec\030\002 \003(\0132\r.stream.Point\"#\n\005Point\022\014" - "\n\004xPos\030\001 \001(\002\022\014\n\004yPos\030\002 \001(\002\"\033\n\013RegResponc" - "e\022\014\n\004data\030\001 \001(\005\"D\n\017ImgInfoResponce\022\022\n\nle" - "velImage\030\001 \001(\r\022\r\n\005width\030\002 \001(\005\022\016\n\006height\030" - "\003 \001(\005\"\033\n\013ComResponce\022\014\n\004data\030\001 \001(\014*\223\001\n\004T" - "YPE\022\t\n\005iBOOL\020\000\022\n\n\006iSHORT\020\001\022\013\n\007iUSHORT\020\002\022" - "\010\n\004iINT\020\003\022\t\n\005iUINT\020\004\022\n\n\006iFLOAT\020\005\022\013\n\007iSTR" - "ING\020\006\022\t\n\005iCHAR\020\007\022\n\n\006iUCHAR\020\010\022\t\n\005iWORD\020\t\022" - "\013\n\007iDOUBLE\020\n\022\n\n\006iTIMET\020\013**\n\nDATAHANDLE\022\n" - "\n\006UPDATE\020\000\022\007\n\003ADD\020\001\022\007\n\003DEL\020\0022\372\001\n\006Stream\022" - "4\n\006Simple\022\023.stream.RequestInfo\032\023.stream." - "ResponseAny\"\000\022=\n\014ServerStream\022\023.stream.R" - "equestInfo\032\024.stream.ResponseInfo\"\0000\001\022=\n\014" - "ClientStream\022\023.stream.RequestInfo\032\024.stre" - "am.ResponseInfo\"\000(\001\022<\n\tAllStream\022\023.strea" - "m.RequestInfo\032\024.stream.ResponseInfo\"\000(\0010" - "\001B-\n\027io.grpc.examples.streamB\013StreamProt" - "oP\001\242\002\002STb\006proto3" + "any.proto\"\223\001\n\tParamInfo\022\017\n\007nameKey\030\001 \001(\014" + "\022\020\n\010strValue\030\002 \001(\014\022\037\n\tvalueType\030\003 \001(\0162\014." + "stream.TYPE\022\017\n\007context\030\004 \001(\014\022\020\n\010isEnable" + "\030\005 \001(\010\022\017\n\007isAlarm\030\006 \001(\010\022\016\n\006isShow\030\007 \001(\010\"" + "\254\001\n\013RequestInfo\022\020\n\010dataType\030\001 \001(\r\022\017\n\007nam" + "eKey\030\002 \001(\014\022\020\n\010strValue\030\003 \001(\014\022\037\n\tvalueTyp" + "e\030\004 \001(\0162\014.stream.TYPE\022&\n\nhandleType\030\005 \001(" + "\0162\022.stream.DATAHANDLE\022\037\n\004item\030\006 \003(\0132\021.st" + "ream.ParamInfo\"Q\n\014ResponseInfo\022\020\n\010dataTy" + "pe\030\001 \001(\r\022\016\n\006result\030\002 \001(\010\022\037\n\004item\030\003 \003(\0132\021" + ".stream.ParamInfo\"1\n\013ResponseAny\022\"\n\004data" + "\030\001 \001(\0132\024.google.protobuf.Any\"\210\001\n\tLayerDa" + "ta\022\023\n\013zCooldinate\030\001 \001(\002\022\016\n\006powder\030\002 \001(\002\022" + "\026\n\016layerThickness\030\003 \001(\002\022.\n\016layerDataBloc" + "k\030\004 \003(\0132\026.stream.LayerDataBlock\022\016\n\006resul" + "t\030\005 \001(\010\"\266\001\n\016LayerDataBlock\022\021\n\telementId\030" + "\001 \001(\005\022\026\n\016elementParamId\030\002 \001(\005\022\021\n\tblockTy" + "pe\030\003 \001(\r\022*\n\tvecBlocks\030\004 \003(\0132\027.stream.Vec" + "torDataBlock\022+\n\013chainBlocks\030\005 \003(\0132\026.stre" + "am.ChainDataBlock\022\r\n\005order\030\006 \001(\r\"M\n\017Vect" + "orDataBlock\022\016\n\006startX\030\001 \001(\002\022\016\n\006startY\030\002 " + "\001(\002\022\014\n\004endX\030\003 \001(\002\022\014\n\004endY\030\004 \001(\002\"A\n\016Chain" + "DataBlock\022\016\n\006dotNum\030\001 \001(\r\022\037\n\010pointVec\030\002 " + "\003(\0132\r.stream.Point\"#\n\005Point\022\014\n\004xPos\030\001 \001(" + "\002\022\014\n\004yPos\030\002 \001(\002\"\033\n\013RegResponce\022\014\n\004data\030\001" + " \001(\005\"D\n\017ImgInfoResponce\022\022\n\nlevelImage\030\001 " + "\001(\r\022\r\n\005width\030\002 \001(\005\022\016\n\006height\030\003 \001(\005\"\033\n\013Co" + "mResponce\022\014\n\004data\030\001 \001(\014*\223\001\n\004TYPE\022\t\n\005iBOO" + "L\020\000\022\n\n\006iSHORT\020\001\022\013\n\007iUSHORT\020\002\022\010\n\004iINT\020\003\022\t" + "\n\005iUINT\020\004\022\n\n\006iFLOAT\020\005\022\013\n\007iSTRING\020\006\022\t\n\005iC" + "HAR\020\007\022\n\n\006iUCHAR\020\010\022\t\n\005iWORD\020\t\022\013\n\007iDOUBLE\020" + "\n\022\n\n\006iTIMET\020\013**\n\nDATAHANDLE\022\n\n\006UPDATE\020\000\022" + "\007\n\003ADD\020\001\022\007\n\003DEL\020\0022\372\001\n\006Stream\0224\n\006Simple\022\023" + ".stream.RequestInfo\032\023.stream.ResponseAny" + "\"\000\022=\n\014ServerStream\022\023.stream.RequestInfo\032" + "\024.stream.ResponseInfo\"\0000\001\022=\n\014ClientStrea" + "m\022\023.stream.RequestInfo\032\024.stream.Response" + "Info\"\000(\001\022<\n\tAllStream\022\023.stream.RequestIn" + "fo\032\024.stream.ResponseInfo\"\000(\0010\001B-\n\027io.grp" + "c.examples.streamB\013StreamProtoP\001\242\002\002STb\006p" + "roto3" }; static const ::_pbi::DescriptorTable* const descriptor_table_stream_2eproto_deps[1] = { @@ -477,7 +490,7 @@ static ::absl::once_flag descriptor_table_stream_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_stream_2eproto = { false, false, - 1576, + 1645, descriptor_table_protodef_stream_2eproto, "stream.proto", &descriptor_table_stream_2eproto_once, @@ -564,7 +577,11 @@ ParamInfo::ParamInfo(const ParamInfo& from) : ::google::protobuf::Message() { new (&_impl_) Impl_{ decltype(_impl_.namekey_){}, decltype(_impl_.strvalue_){}, + decltype(_impl_.context_){}, decltype(_impl_.valuetype_){}, + decltype(_impl_.isenable_){}, + decltype(_impl_.isalarm_){}, + decltype(_impl_.isshow_){}, /*decltype(_impl_._cached_size_)*/ {}, }; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( @@ -583,7 +600,16 @@ ParamInfo::ParamInfo(const ParamInfo& from) : ::google::protobuf::Message() { if (!from._internal_strvalue().empty()) { _this->_impl_.strvalue_.Set(from._internal_strvalue(), _this->GetArenaForAllocation()); } - _this->_impl_.valuetype_ = from._impl_.valuetype_; + _impl_.context_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.context_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_context().empty()) { + _this->_impl_.context_.Set(from._internal_context(), _this->GetArenaForAllocation()); + } + ::memcpy(&_impl_.valuetype_, &from._impl_.valuetype_, + static_cast<::size_t>(reinterpret_cast(&_impl_.isshow_) - + reinterpret_cast(&_impl_.valuetype_)) + sizeof(_impl_.isshow_)); // @@protoc_insertion_point(copy_constructor:stream.ParamInfo) } @@ -592,7 +618,11 @@ inline void ParamInfo::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_{ decltype(_impl_.namekey_){}, decltype(_impl_.strvalue_){}, + decltype(_impl_.context_){}, decltype(_impl_.valuetype_){0}, + decltype(_impl_.isenable_){false}, + decltype(_impl_.isalarm_){false}, + decltype(_impl_.isshow_){false}, /*decltype(_impl_._cached_size_)*/ {}, }; _impl_.namekey_.InitDefault(); @@ -603,6 +633,10 @@ inline void ParamInfo::SharedCtor(::_pb::Arena* arena) { #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING _impl_.strvalue_.Set("", GetArenaForAllocation()); #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.context_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.context_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } ParamInfo::~ParamInfo() { // @@protoc_insertion_point(destructor:stream.ParamInfo) @@ -613,6 +647,7 @@ inline void ParamInfo::SharedDtor() { ABSL_DCHECK(GetArenaForAllocation() == nullptr); _impl_.namekey_.Destroy(); _impl_.strvalue_.Destroy(); + _impl_.context_.Destroy(); } void ParamInfo::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); @@ -626,7 +661,10 @@ PROTOBUF_NOINLINE void ParamInfo::Clear() { _impl_.namekey_.ClearToEmpty(); _impl_.strvalue_.ClearToEmpty(); - _impl_.valuetype_ = 0; + _impl_.context_.ClearToEmpty(); + ::memset(&_impl_.valuetype_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.isshow_) - + reinterpret_cast(&_impl_.valuetype_)) + sizeof(_impl_.isshow_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -638,15 +676,15 @@ const char* ParamInfo::_InternalParse( PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { +const ::_pbi::TcParseTable<3, 7, 0, 0, 2> ParamInfo::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 3, 24, // max_field_number, fast_idx_mask + 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967288, // skipmap + 4294967168, // skipmap offsetof(decltype(_table_), field_entries), - 3, // num_field_entries + 7, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries &_ParamInfo_default_instance_._instance, @@ -662,6 +700,18 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { // .stream.TYPE valueType = 3; {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(ParamInfo, _impl_.valuetype_), 63>(), {24, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.valuetype_)}}, + // bytes context = 4; + {::_pbi::TcParser::FastBS1, + {34, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.context_)}}, + // bool isEnable = 5; + {::_pbi::TcParser::SingularVarintNoZag1(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isenable_)}}, + // bool isAlarm = 6; + {::_pbi::TcParser::SingularVarintNoZag1(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isalarm_)}}, + // bool isShow = 7; + {::_pbi::TcParser::SingularVarintNoZag1(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isshow_)}}, }}, {{ 65535, 65535 }}, {{ @@ -674,6 +724,18 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { // .stream.TYPE valueType = 3; {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.valuetype_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // bytes context = 4; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.context_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)}, + // bool isEnable = 5; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isenable_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool isAlarm = 6; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isalarm_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool isShow = 7; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isshow_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, }}, // no aux_entries {{ @@ -706,6 +768,33 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { 3, this->_internal_valuetype(), target); } + // bytes context = 4; + if (!this->_internal_context().empty()) { + const std::string& _s = this->_internal_context(); + target = stream->WriteBytesMaybeAliased(4, _s, target); + } + + // bool isEnable = 5; + if (this->_internal_isenable() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this->_internal_isenable(), target); + } + + // bool isAlarm = 6; + if (this->_internal_isalarm() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this->_internal_isalarm(), target); + } + + // bool isShow = 7; + if (this->_internal_isshow() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 7, this->_internal_isshow(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -735,12 +824,33 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { this->_internal_strvalue()); } + // bytes context = 4; + if (!this->_internal_context().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->_internal_context()); + } + // .stream.TYPE valueType = 3; if (this->_internal_valuetype() != 0) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_valuetype()); } + // bool isEnable = 5; + if (this->_internal_isenable() != 0) { + total_size += 2; + } + + // bool isAlarm = 6; + if (this->_internal_isalarm() != 0) { + total_size += 2; + } + + // bool isShow = 7; + if (this->_internal_isshow() != 0) { + total_size += 2; + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -765,9 +875,21 @@ void ParamInfo::MergeImpl(::google::protobuf::Message& to_msg, const ::google::p if (!from._internal_strvalue().empty()) { _this->_internal_set_strvalue(from._internal_strvalue()); } + if (!from._internal_context().empty()) { + _this->_internal_set_context(from._internal_context()); + } if (from._internal_valuetype() != 0) { _this->_internal_set_valuetype(from._internal_valuetype()); } + if (from._internal_isenable() != 0) { + _this->_internal_set_isenable(from._internal_isenable()); + } + if (from._internal_isalarm() != 0) { + _this->_internal_set_isalarm(from._internal_isalarm()); + } + if (from._internal_isshow() != 0) { + _this->_internal_set_isshow(from._internal_isshow()); + } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -791,7 +913,14 @@ void ParamInfo::InternalSwap(ParamInfo* other) { &other->_impl_.namekey_, rhs_arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.strvalue_, lhs_arena, &other->_impl_.strvalue_, rhs_arena); - swap(_impl_.valuetype_, other->_impl_.valuetype_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.context_, lhs_arena, + &other->_impl_.context_, rhs_arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isshow_) + + sizeof(ParamInfo::_impl_.isshow_) + - PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.valuetype_)>( + reinterpret_cast(&_impl_.valuetype_), + reinterpret_cast(&other->_impl_.valuetype_)); } ::google::protobuf::Metadata ParamInfo::GetMetadata() const { diff --git a/PrintS/protobuf/stream.pb.h b/PrintS/protobuf/stream.pb.h index e627cb2..50f06fd 100644 --- a/PrintS/protobuf/stream.pb.h +++ b/PrintS/protobuf/stream.pb.h @@ -310,7 +310,11 @@ class ParamInfo final : enum : int { kNameKeyFieldNumber = 1, kStrValueFieldNumber = 2, + kContextFieldNumber = 4, kValueTypeFieldNumber = 3, + kIsEnableFieldNumber = 5, + kIsAlarmFieldNumber = 6, + kIsShowFieldNumber = 7, }; // bytes nameKey = 1; void clear_namekey() ; @@ -343,6 +347,22 @@ class ParamInfo final : const std::string& value); std::string* _internal_mutable_strvalue(); + public: + // bytes context = 4; + void clear_context() ; + const std::string& context() const; + template + void set_context(Arg_&& arg, Args_... args); + std::string* mutable_context(); + PROTOBUF_NODISCARD std::string* release_context(); + void set_allocated_context(std::string* ptr); + + private: + const std::string& _internal_context() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_context( + const std::string& value); + std::string* _internal_mutable_context(); + public: // .stream.TYPE valueType = 3; void clear_valuetype() ; @@ -353,20 +373,54 @@ class ParamInfo final : ::stream::TYPE _internal_valuetype() const; void _internal_set_valuetype(::stream::TYPE value); + public: + // bool isEnable = 5; + void clear_isenable() ; + bool isenable() const; + void set_isenable(bool value); + + private: + bool _internal_isenable() const; + void _internal_set_isenable(bool value); + + public: + // bool isAlarm = 6; + void clear_isalarm() ; + bool isalarm() const; + void set_isalarm(bool value); + + private: + bool _internal_isalarm() const; + void _internal_set_isalarm(bool value); + + public: + // bool isShow = 7; + void clear_isshow() ; + bool isshow() const; + void set_isshow(bool value); + + private: + bool _internal_isshow() const; + void _internal_set_isshow(bool value); + public: // @@protoc_insertion_point(class_scope:stream.ParamInfo) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 3, 0, 0, 2> _table_; + static const ::google::protobuf::internal::TcParseTable<3, 7, 0, 0, 2> _table_; template friend class ::google::protobuf::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::google::protobuf::internal::ArenaStringPtr namekey_; ::google::protobuf::internal::ArenaStringPtr strvalue_; + ::google::protobuf::internal::ArenaStringPtr context_; int valuetype_; + bool isenable_; + bool isalarm_; + bool isshow_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -2600,6 +2654,123 @@ inline void ParamInfo::_internal_set_valuetype(::stream::TYPE value) { _impl_.valuetype_ = value; } +// bytes context = 4; +inline void ParamInfo::clear_context() { + _impl_.context_.ClearToEmpty(); +} +inline const std::string& ParamInfo::context() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.context) + return _internal_context(); +} +template +inline PROTOBUF_ALWAYS_INLINE void ParamInfo::set_context(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.context_.SetBytes(static_cast(arg), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:stream.ParamInfo.context) +} +inline std::string* ParamInfo::mutable_context() { + std::string* _s = _internal_mutable_context(); + // @@protoc_insertion_point(field_mutable:stream.ParamInfo.context) + return _s; +} +inline const std::string& ParamInfo::_internal_context() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.context_.Get(); +} +inline void ParamInfo::_internal_set_context(const std::string& value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.context_.Set(value, GetArenaForAllocation()); +} +inline std::string* ParamInfo::_internal_mutable_context() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + return _impl_.context_.Mutable( GetArenaForAllocation()); +} +inline std::string* ParamInfo::release_context() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:stream.ParamInfo.context) + return _impl_.context_.Release(); +} +inline void ParamInfo::set_allocated_context(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.context_.SetAllocated(value, GetArenaForAllocation()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.context_.IsDefault()) { + _impl_.context_.Set("", GetArenaForAllocation()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:stream.ParamInfo.context) +} + +// bool isEnable = 5; +inline void ParamInfo::clear_isenable() { + _impl_.isenable_ = false; +} +inline bool ParamInfo::isenable() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.isEnable) + return _internal_isenable(); +} +inline void ParamInfo::set_isenable(bool value) { + _internal_set_isenable(value); + // @@protoc_insertion_point(field_set:stream.ParamInfo.isEnable) +} +inline bool ParamInfo::_internal_isenable() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.isenable_; +} +inline void ParamInfo::_internal_set_isenable(bool value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.isenable_ = value; +} + +// bool isAlarm = 6; +inline void ParamInfo::clear_isalarm() { + _impl_.isalarm_ = false; +} +inline bool ParamInfo::isalarm() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.isAlarm) + return _internal_isalarm(); +} +inline void ParamInfo::set_isalarm(bool value) { + _internal_set_isalarm(value); + // @@protoc_insertion_point(field_set:stream.ParamInfo.isAlarm) +} +inline bool ParamInfo::_internal_isalarm() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.isalarm_; +} +inline void ParamInfo::_internal_set_isalarm(bool value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.isalarm_ = value; +} + +// bool isShow = 7; +inline void ParamInfo::clear_isshow() { + _impl_.isshow_ = false; +} +inline bool ParamInfo::isshow() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.isShow) + return _internal_isshow(); +} +inline void ParamInfo::set_isshow(bool value) { + _internal_set_isshow(value); + // @@protoc_insertion_point(field_set:stream.ParamInfo.isShow) +} +inline bool ParamInfo::_internal_isshow() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.isshow_; +} +inline void ParamInfo::_internal_set_isshow(bool value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.isshow_ = value; +} + // ------------------------------------------------------------------- // RequestInfo diff --git a/PrintS/protobuf/stream.proto b/PrintS/protobuf/stream.proto index 270abb1..6a1d0a3 100644 --- a/PrintS/protobuf/stream.proto +++ b/PrintS/protobuf/stream.proto @@ -38,8 +38,12 @@ enum DATAHANDLE { message ParamInfo{ bytes nameKey = 1; //参数key bytes strValue = 2; //value - //bool isOutput = 2; //是否只读 TYPE valueType = 3; //数据类型 + + bytes context = 4; //alarmcfg 使用 + bool isEnable = 5; + bool isAlarm = 6; + bool isShow = 7; } message RequestInfo { //读 diff --git a/TestClient/DataManage/DataHandle.cpp b/TestClient/DataManage/DataHandle.cpp index 0211368..d08f40d 100644 --- a/TestClient/DataManage/DataHandle.cpp +++ b/TestClient/DataManage/DataHandle.cpp @@ -82,11 +82,19 @@ void DataHandle::PrintValue(const ReadData& msg){ while (it != msg.its.end()) { it->nameKey; string valueType = m_dataTypeMp[(*it).valueType]; - printf("接收:dataType:%d,nameKey:%*s, strvalue:%*s, valueType:%s\n", - msg.dataType, 33, it->nameKey.data(), 13, it->strValue.data(), valueType.data()); + if (msg.dataType >= STOPALARMCFGPARAM && msg.dataType <= WARNALARMCFGPARAM) { + printf("接收:dataType:%d,nameKey:%*s, strvalue:%*s, valueType:%s,content:%s,isEnable:%d,isAlarm:%d,isShow:%d\n", + msg.dataType, 33, it->nameKey.data(), 13, it->strValue.data(), valueType.data(), + it->content.c_str(), it->isEnable, it->isAlarm, it->isShow); + } + else { + printf("接收:dataType:%d,nameKey:%*s, strvalue:%*s, valueType:%s\n", + msg.dataType, 33, it->nameKey.data(), 13, it->strValue.data(), valueType.data()); + } ++it; } printf("共有参数%zd个...\n", msg.its.size()); + if(m_printIndex == LASERPARAM || m_printIndex == XYSCANSTATE){ static int count = 0; ++count; @@ -170,18 +178,21 @@ void DataHandle::ParamReadUsage() { printf(" 33: " COLOR_YELLOW "print recoatcheck cfg param data...\n" COLOR_RESET); printf(" 34: " COLOR_YELLOW "print powderestimate cfg param data...\n" COLOR_RESET); printf(" 35: " COLOR_YELLOW "print communication cfg param data...\n" COLOR_RESET); + printf(" 36: " COLOR_YELLOW "print stopalarm cfg param data...\n" COLOR_RESET); + printf(" 37: " COLOR_YELLOW "print pausealarm cfg param data...\n" COLOR_RESET); + printf(" 38: " COLOR_YELLOW "print warnalarm cfg param data...\n" COLOR_RESET); - printf(" 36: " COLOR_YELLOW "print moldcfg param data...\n" COLOR_RESET); - printf(" 37: " COLOR_YELLOW "print loadcfg param data...\n" COLOR_RESET); - printf(" 38: " COLOR_YELLOW "print armcfgparam data...\n" COLOR_RESET); - printf(" 39: " COLOR_YELLOW "print supplycfgparam data...\n" COLOR_RESET); - printf(" 40: " COLOR_YELLOW "print cleancfgparam data...\n" COLOR_RESET); - printf(" 41: " COLOR_YELLOW "print elecfgparam data...\n" COLOR_RESET); - printf(" 42: " COLOR_YELLOW "print loadparamrsp data...\n" COLOR_RESET); - printf(" 43: " COLOR_YELLOW "print scan ctrl state data...\n" COLOR_RESET); - printf(" 44: " COLOR_YELLOW "print scan ctrl Param data...\n" COLOR_RESET); - printf(" 45: " COLOR_YELLOW "print xy scan state data...\n" COLOR_RESET); - printf(" 46: " COLOR_YELLOW "print camera param data...\n" COLOR_RESET); + printf(" 39: " COLOR_YELLOW "print moldcfg param data...\n" COLOR_RESET); + printf(" 40: " COLOR_YELLOW "print loadcfg param data...\n" COLOR_RESET); + printf(" 41: " COLOR_YELLOW "print armcfgparam data...\n" COLOR_RESET); + printf(" 42: " COLOR_YELLOW "print supplycfgparam data...\n" COLOR_RESET); + printf(" 43: " COLOR_YELLOW "print cleancfgparam data...\n" COLOR_RESET); + printf(" 44: " COLOR_YELLOW "print elecfgparam data...\n" COLOR_RESET); + printf(" 45: " COLOR_YELLOW "print loadparamrsp data...\n" COLOR_RESET); + printf(" 46: " COLOR_YELLOW "print scan ctrl state data...\n" COLOR_RESET); + printf(" 47: " COLOR_YELLOW "print scan ctrl Param data...\n" COLOR_RESET); + printf(" 48: " COLOR_YELLOW "print xy scan state data...\n" COLOR_RESET); + printf(" 49: " COLOR_YELLOW "print camera param data...\n" COLOR_RESET); } int DataHandle::Request(int index) { @@ -309,6 +320,15 @@ void DataHandle::UpdateParam(const string& input) { case COMMUNICATIONCFGPARAM: PushMsg(COMMUNICATIONCFG, "Type_XT_PURIFIER", to_string(4), iINT); //CommunicationCfg test break; + case STOPALARMCFGPARAM: //AlarmCfgWrapper stop参数 + PushMsg(ALARMCFG, "WindOverLimitAlarm", to_string(0), iINT); + break; + case PAUSEALARMCFGPARAM: //AlarmCfgWrapper pause参数 + PushMsg(ALARMCFG, "HeatingDisconnectAlarm", to_string(0), iINT); + break; + case WARNALARMCFGPARAM: //AlarmCfgWrapper warn参数 + PushMsg(ALARMCFG, "SupplyPipeBlockWarn", to_string(0), iINT); + break; case ELECFGPARAM: break; case LOADPARAMRSP: diff --git a/TestClient/DataManage/RWData.h b/TestClient/DataManage/RWData.h index 3a77770..c01d057 100644 --- a/TestClient/DataManage/RWData.h +++ b/TestClient/DataManage/RWData.h @@ -47,6 +47,9 @@ enum READTYPE { RECOATCHECKCFGPARAM, //RecoatCheckCfg 参数 POWDERESTIMATECFGPARAM, //PowderestimateCfg 参数 COMMUNICATIONCFGPARAM, //CommunicationCfg 参数 + STOPALARMCFGPARAM, //AlarmCfgWrapper stop参数 + PAUSEALARMCFGPARAM, //AlarmCfgWrapper pause参数 + WARNALARMCFGPARAM, //AlarmCfgWrapper warn参数 MOLDCFGPARAM, LOADCFGPARAM, @@ -89,6 +92,11 @@ struct Item { std::string strValue; //value //bool isOutPut; //是否只读 false:只读 DATATYPE valueType; //数据类型 + + std::string content; //alarmcfgwrapper使用 + bool isEnable; + bool isAlarm; + bool isShow; }; struct ReadData { @@ -129,9 +137,9 @@ enum WRITETYPE { RECOATCHECKCFG, POWDERESTIMATECFG, COMMUNICATIONCFG, + ALARMCFG, LOADPARAM, //装载参数 - SCANCTRLFUNC, //振镜控制函数 REQUEST = 100, //获取配置信息 test用 diff --git a/TestClient/DataManage/StreamClient.cpp b/TestClient/DataManage/StreamClient.cpp index 7f2df7e..c66f37c 100644 --- a/TestClient/DataManage/StreamClient.cpp +++ b/TestClient/DataManage/StreamClient.cpp @@ -73,7 +73,8 @@ void StreamClient::AllStream() { readData.dataType = (READTYPE)readInfo.datatype(); for (const ::stream::ParamInfo& it : readInfo.item()) { - readData.its.emplace_back(Item{ it.namekey(),it.strvalue(),(DATATYPE)it.valuetype()}); + readData.its.emplace_back(Item{ it.namekey(),it.strvalue(),(DATATYPE)it.valuetype() + ,it.context(),it.isenable(),it.isalarm(),it.isshow()}); //printf("接收到服务端消息:dataType:%d,nameKey:%s, strvalue:%s,valueType:%d\n", // readData.dataType, it.namekey().data(), it.strvalue().c_str(), it.valuetype()); } diff --git a/TestClient/PrintC.vcxproj b/TestClient/PrintC.vcxproj index 664cb1f..80d8948 100644 --- a/TestClient/PrintC.vcxproj +++ b/TestClient/PrintC.vcxproj @@ -127,6 +127,7 @@ 4996 Disabled + true Console diff --git a/TestClient/protobuf/stream.pb.cc b/TestClient/protobuf/stream.pb.cc index 327a184..2cc1ee5 100644 --- a/TestClient/protobuf/stream.pb.cc +++ b/TestClient/protobuf/stream.pb.cc @@ -32,7 +32,14 @@ PROTOBUF_CONSTEXPR ParamInfo::ParamInfo(::_pbi::ConstantInitialized) &::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}, }, + /*decltype(_impl_.context_)*/ { + &::_pbi::fixed_address_empty_string, + ::_pbi::ConstantInitialized{}, + }, /*decltype(_impl_.valuetype_)*/ 0, + /*decltype(_impl_.isenable_)*/ false, + /*decltype(_impl_.isalarm_)*/ false, + /*decltype(_impl_.isshow_)*/ false, /*decltype(_impl_._cached_size_)*/ {}, } {} struct ParamInfoDefaultTypeInternal { @@ -272,6 +279,10 @@ const ::uint32_t TableStruct_stream_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.namekey_), PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.strvalue_), PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.valuetype_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.context_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.isenable_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.isalarm_), + PROTOBUF_FIELD_OFFSET(::stream::ParamInfo, _impl_.isshow_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::stream::RequestInfo, _internal_metadata_), ~0u, // no _extensions_ @@ -400,17 +411,17 @@ const ::uint32_t TableStruct_stream_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::stream::ParamInfo)}, - {11, -1, -1, sizeof(::stream::RequestInfo)}, - {25, -1, -1, sizeof(::stream::ResponseInfo)}, - {36, 45, -1, sizeof(::stream::ResponseAny)}, - {46, -1, -1, sizeof(::stream::LayerData)}, - {59, -1, -1, sizeof(::stream::LayerDataBlock)}, - {73, -1, -1, sizeof(::stream::VectorDataBlock)}, - {85, -1, -1, sizeof(::stream::ChainDataBlock)}, - {95, -1, -1, sizeof(::stream::Point)}, - {105, -1, -1, sizeof(::stream::RegResponce)}, - {114, -1, -1, sizeof(::stream::ImgInfoResponce)}, - {125, -1, -1, sizeof(::stream::ComResponce)}, + {15, -1, -1, sizeof(::stream::RequestInfo)}, + {29, -1, -1, sizeof(::stream::ResponseInfo)}, + {40, 49, -1, sizeof(::stream::ResponseAny)}, + {50, -1, -1, sizeof(::stream::LayerData)}, + {63, -1, -1, sizeof(::stream::LayerDataBlock)}, + {77, -1, -1, sizeof(::stream::VectorDataBlock)}, + {89, -1, -1, sizeof(::stream::ChainDataBlock)}, + {99, -1, -1, sizeof(::stream::Point)}, + {109, -1, -1, sizeof(::stream::RegResponce)}, + {118, -1, -1, sizeof(::stream::ImgInfoResponce)}, + {129, -1, -1, sizeof(::stream::ComResponce)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -429,45 +440,47 @@ static const ::_pb::Message* const file_default_instances[] = { }; const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { "\n\014stream.proto\022\006stream\032\031google/protobuf/" - "any.proto\"O\n\tParamInfo\022\017\n\007nameKey\030\001 \001(\014\022" - "\020\n\010strValue\030\002 \001(\014\022\037\n\tvalueType\030\003 \001(\0162\014.s" - "tream.TYPE\"\254\001\n\013RequestInfo\022\020\n\010dataType\030\001" - " \001(\r\022\017\n\007nameKey\030\002 \001(\014\022\020\n\010strValue\030\003 \001(\014\022" - "\037\n\tvalueType\030\004 \001(\0162\014.stream.TYPE\022&\n\nhand" - "leType\030\005 \001(\0162\022.stream.DATAHANDLE\022\037\n\004item" - "\030\006 \003(\0132\021.stream.ParamInfo\"Q\n\014ResponseInf" - "o\022\020\n\010dataType\030\001 \001(\r\022\016\n\006result\030\002 \001(\010\022\037\n\004i" - "tem\030\003 \003(\0132\021.stream.ParamInfo\"1\n\013Response" - "Any\022\"\n\004data\030\001 \001(\0132\024.google.protobuf.Any\"" - "\210\001\n\tLayerData\022\023\n\013zCooldinate\030\001 \001(\002\022\016\n\006po" - "wder\030\002 \001(\002\022\026\n\016layerThickness\030\003 \001(\002\022.\n\016la" - "yerDataBlock\030\004 \003(\0132\026.stream.LayerDataBlo" - "ck\022\016\n\006result\030\005 \001(\010\"\266\001\n\016LayerDataBlock\022\021\n" - "\telementId\030\001 \001(\005\022\026\n\016elementParamId\030\002 \001(\005" - "\022\021\n\tblockType\030\003 \001(\r\022*\n\tvecBlocks\030\004 \003(\0132\027" - ".stream.VectorDataBlock\022+\n\013chainBlocks\030\005" - " \003(\0132\026.stream.ChainDataBlock\022\r\n\005order\030\006 " - "\001(\r\"M\n\017VectorDataBlock\022\016\n\006startX\030\001 \001(\002\022\016" - "\n\006startY\030\002 \001(\002\022\014\n\004endX\030\003 \001(\002\022\014\n\004endY\030\004 \001" - "(\002\"A\n\016ChainDataBlock\022\016\n\006dotNum\030\001 \001(\r\022\037\n\010" - "pointVec\030\002 \003(\0132\r.stream.Point\"#\n\005Point\022\014" - "\n\004xPos\030\001 \001(\002\022\014\n\004yPos\030\002 \001(\002\"\033\n\013RegResponc" - "e\022\014\n\004data\030\001 \001(\005\"D\n\017ImgInfoResponce\022\022\n\nle" - "velImage\030\001 \001(\r\022\r\n\005width\030\002 \001(\005\022\016\n\006height\030" - "\003 \001(\005\"\033\n\013ComResponce\022\014\n\004data\030\001 \001(\014*\223\001\n\004T" - "YPE\022\t\n\005iBOOL\020\000\022\n\n\006iSHORT\020\001\022\013\n\007iUSHORT\020\002\022" - "\010\n\004iINT\020\003\022\t\n\005iUINT\020\004\022\n\n\006iFLOAT\020\005\022\013\n\007iSTR" - "ING\020\006\022\t\n\005iCHAR\020\007\022\n\n\006iUCHAR\020\010\022\t\n\005iWORD\020\t\022" - "\013\n\007iDOUBLE\020\n\022\n\n\006iTIMET\020\013**\n\nDATAHANDLE\022\n" - "\n\006UPDATE\020\000\022\007\n\003ADD\020\001\022\007\n\003DEL\020\0022\372\001\n\006Stream\022" - "4\n\006Simple\022\023.stream.RequestInfo\032\023.stream." - "ResponseAny\"\000\022=\n\014ServerStream\022\023.stream.R" - "equestInfo\032\024.stream.ResponseInfo\"\0000\001\022=\n\014" - "ClientStream\022\023.stream.RequestInfo\032\024.stre" - "am.ResponseInfo\"\000(\001\022<\n\tAllStream\022\023.strea" - "m.RequestInfo\032\024.stream.ResponseInfo\"\000(\0010" - "\001B-\n\027io.grpc.examples.streamB\013StreamProt" - "oP\001\242\002\002STb\006proto3" + "any.proto\"\223\001\n\tParamInfo\022\017\n\007nameKey\030\001 \001(\014" + "\022\020\n\010strValue\030\002 \001(\014\022\037\n\tvalueType\030\003 \001(\0162\014." + "stream.TYPE\022\017\n\007context\030\004 \001(\014\022\020\n\010isEnable" + "\030\005 \001(\010\022\017\n\007isAlarm\030\006 \001(\010\022\016\n\006isShow\030\007 \001(\010\"" + "\254\001\n\013RequestInfo\022\020\n\010dataType\030\001 \001(\r\022\017\n\007nam" + "eKey\030\002 \001(\014\022\020\n\010strValue\030\003 \001(\014\022\037\n\tvalueTyp" + "e\030\004 \001(\0162\014.stream.TYPE\022&\n\nhandleType\030\005 \001(" + "\0162\022.stream.DATAHANDLE\022\037\n\004item\030\006 \003(\0132\021.st" + "ream.ParamInfo\"Q\n\014ResponseInfo\022\020\n\010dataTy" + "pe\030\001 \001(\r\022\016\n\006result\030\002 \001(\010\022\037\n\004item\030\003 \003(\0132\021" + ".stream.ParamInfo\"1\n\013ResponseAny\022\"\n\004data" + "\030\001 \001(\0132\024.google.protobuf.Any\"\210\001\n\tLayerDa" + "ta\022\023\n\013zCooldinate\030\001 \001(\002\022\016\n\006powder\030\002 \001(\002\022" + "\026\n\016layerThickness\030\003 \001(\002\022.\n\016layerDataBloc" + "k\030\004 \003(\0132\026.stream.LayerDataBlock\022\016\n\006resul" + "t\030\005 \001(\010\"\266\001\n\016LayerDataBlock\022\021\n\telementId\030" + "\001 \001(\005\022\026\n\016elementParamId\030\002 \001(\005\022\021\n\tblockTy" + "pe\030\003 \001(\r\022*\n\tvecBlocks\030\004 \003(\0132\027.stream.Vec" + "torDataBlock\022+\n\013chainBlocks\030\005 \003(\0132\026.stre" + "am.ChainDataBlock\022\r\n\005order\030\006 \001(\r\"M\n\017Vect" + "orDataBlock\022\016\n\006startX\030\001 \001(\002\022\016\n\006startY\030\002 " + "\001(\002\022\014\n\004endX\030\003 \001(\002\022\014\n\004endY\030\004 \001(\002\"A\n\016Chain" + "DataBlock\022\016\n\006dotNum\030\001 \001(\r\022\037\n\010pointVec\030\002 " + "\003(\0132\r.stream.Point\"#\n\005Point\022\014\n\004xPos\030\001 \001(" + "\002\022\014\n\004yPos\030\002 \001(\002\"\033\n\013RegResponce\022\014\n\004data\030\001" + " \001(\005\"D\n\017ImgInfoResponce\022\022\n\nlevelImage\030\001 " + "\001(\r\022\r\n\005width\030\002 \001(\005\022\016\n\006height\030\003 \001(\005\"\033\n\013Co" + "mResponce\022\014\n\004data\030\001 \001(\014*\223\001\n\004TYPE\022\t\n\005iBOO" + "L\020\000\022\n\n\006iSHORT\020\001\022\013\n\007iUSHORT\020\002\022\010\n\004iINT\020\003\022\t" + "\n\005iUINT\020\004\022\n\n\006iFLOAT\020\005\022\013\n\007iSTRING\020\006\022\t\n\005iC" + "HAR\020\007\022\n\n\006iUCHAR\020\010\022\t\n\005iWORD\020\t\022\013\n\007iDOUBLE\020" + "\n\022\n\n\006iTIMET\020\013**\n\nDATAHANDLE\022\n\n\006UPDATE\020\000\022" + "\007\n\003ADD\020\001\022\007\n\003DEL\020\0022\372\001\n\006Stream\0224\n\006Simple\022\023" + ".stream.RequestInfo\032\023.stream.ResponseAny" + "\"\000\022=\n\014ServerStream\022\023.stream.RequestInfo\032" + "\024.stream.ResponseInfo\"\0000\001\022=\n\014ClientStrea" + "m\022\023.stream.RequestInfo\032\024.stream.Response" + "Info\"\000(\001\022<\n\tAllStream\022\023.stream.RequestIn" + "fo\032\024.stream.ResponseInfo\"\000(\0010\001B-\n\027io.grp" + "c.examples.streamB\013StreamProtoP\001\242\002\002STb\006p" + "roto3" }; static const ::_pbi::DescriptorTable* const descriptor_table_stream_2eproto_deps[1] = { @@ -477,7 +490,7 @@ static ::absl::once_flag descriptor_table_stream_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_stream_2eproto = { false, false, - 1576, + 1645, descriptor_table_protodef_stream_2eproto, "stream.proto", &descriptor_table_stream_2eproto_once, @@ -564,7 +577,11 @@ ParamInfo::ParamInfo(const ParamInfo& from) : ::google::protobuf::Message() { new (&_impl_) Impl_{ decltype(_impl_.namekey_){}, decltype(_impl_.strvalue_){}, + decltype(_impl_.context_){}, decltype(_impl_.valuetype_){}, + decltype(_impl_.isenable_){}, + decltype(_impl_.isalarm_){}, + decltype(_impl_.isshow_){}, /*decltype(_impl_._cached_size_)*/ {}, }; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( @@ -583,7 +600,16 @@ ParamInfo::ParamInfo(const ParamInfo& from) : ::google::protobuf::Message() { if (!from._internal_strvalue().empty()) { _this->_impl_.strvalue_.Set(from._internal_strvalue(), _this->GetArenaForAllocation()); } - _this->_impl_.valuetype_ = from._impl_.valuetype_; + _impl_.context_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.context_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_context().empty()) { + _this->_impl_.context_.Set(from._internal_context(), _this->GetArenaForAllocation()); + } + ::memcpy(&_impl_.valuetype_, &from._impl_.valuetype_, + static_cast<::size_t>(reinterpret_cast(&_impl_.isshow_) - + reinterpret_cast(&_impl_.valuetype_)) + sizeof(_impl_.isshow_)); // @@protoc_insertion_point(copy_constructor:stream.ParamInfo) } @@ -592,7 +618,11 @@ inline void ParamInfo::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_{ decltype(_impl_.namekey_){}, decltype(_impl_.strvalue_){}, + decltype(_impl_.context_){}, decltype(_impl_.valuetype_){0}, + decltype(_impl_.isenable_){false}, + decltype(_impl_.isalarm_){false}, + decltype(_impl_.isshow_){false}, /*decltype(_impl_._cached_size_)*/ {}, }; _impl_.namekey_.InitDefault(); @@ -603,6 +633,10 @@ inline void ParamInfo::SharedCtor(::_pb::Arena* arena) { #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING _impl_.strvalue_.Set("", GetArenaForAllocation()); #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.context_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.context_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } ParamInfo::~ParamInfo() { // @@protoc_insertion_point(destructor:stream.ParamInfo) @@ -613,6 +647,7 @@ inline void ParamInfo::SharedDtor() { ABSL_DCHECK(GetArenaForAllocation() == nullptr); _impl_.namekey_.Destroy(); _impl_.strvalue_.Destroy(); + _impl_.context_.Destroy(); } void ParamInfo::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); @@ -626,7 +661,10 @@ PROTOBUF_NOINLINE void ParamInfo::Clear() { _impl_.namekey_.ClearToEmpty(); _impl_.strvalue_.ClearToEmpty(); - _impl_.valuetype_ = 0; + _impl_.context_.ClearToEmpty(); + ::memset(&_impl_.valuetype_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.isshow_) - + reinterpret_cast(&_impl_.valuetype_)) + sizeof(_impl_.isshow_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } @@ -638,15 +676,15 @@ const char* ParamInfo::_InternalParse( PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { +const ::_pbi::TcParseTable<3, 7, 0, 0, 2> ParamInfo::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 3, 24, // max_field_number, fast_idx_mask + 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967288, // skipmap + 4294967168, // skipmap offsetof(decltype(_table_), field_entries), - 3, // num_field_entries + 7, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries &_ParamInfo_default_instance_._instance, @@ -662,6 +700,18 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { // .stream.TYPE valueType = 3; {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(ParamInfo, _impl_.valuetype_), 63>(), {24, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.valuetype_)}}, + // bytes context = 4; + {::_pbi::TcParser::FastBS1, + {34, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.context_)}}, + // bool isEnable = 5; + {::_pbi::TcParser::SingularVarintNoZag1(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isenable_)}}, + // bool isAlarm = 6; + {::_pbi::TcParser::SingularVarintNoZag1(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isalarm_)}}, + // bool isShow = 7; + {::_pbi::TcParser::SingularVarintNoZag1(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isshow_)}}, }}, {{ 65535, 65535 }}, {{ @@ -674,6 +724,18 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { // .stream.TYPE valueType = 3; {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.valuetype_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // bytes context = 4; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.context_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)}, + // bool isEnable = 5; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isenable_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool isAlarm = 6; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isalarm_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool isShow = 7; + {PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isshow_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, }}, // no aux_entries {{ @@ -706,6 +768,33 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { 3, this->_internal_valuetype(), target); } + // bytes context = 4; + if (!this->_internal_context().empty()) { + const std::string& _s = this->_internal_context(); + target = stream->WriteBytesMaybeAliased(4, _s, target); + } + + // bool isEnable = 5; + if (this->_internal_isenable() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this->_internal_isenable(), target); + } + + // bool isAlarm = 6; + if (this->_internal_isalarm() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this->_internal_isalarm(), target); + } + + // bool isShow = 7; + if (this->_internal_isshow() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 7, this->_internal_isshow(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -735,12 +824,33 @@ const ::_pbi::TcParseTable<2, 3, 0, 0, 2> ParamInfo::_table_ = { this->_internal_strvalue()); } + // bytes context = 4; + if (!this->_internal_context().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->_internal_context()); + } + // .stream.TYPE valueType = 3; if (this->_internal_valuetype() != 0) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_valuetype()); } + // bool isEnable = 5; + if (this->_internal_isenable() != 0) { + total_size += 2; + } + + // bool isAlarm = 6; + if (this->_internal_isalarm() != 0) { + total_size += 2; + } + + // bool isShow = 7; + if (this->_internal_isshow() != 0) { + total_size += 2; + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -765,9 +875,21 @@ void ParamInfo::MergeImpl(::google::protobuf::Message& to_msg, const ::google::p if (!from._internal_strvalue().empty()) { _this->_internal_set_strvalue(from._internal_strvalue()); } + if (!from._internal_context().empty()) { + _this->_internal_set_context(from._internal_context()); + } if (from._internal_valuetype() != 0) { _this->_internal_set_valuetype(from._internal_valuetype()); } + if (from._internal_isenable() != 0) { + _this->_internal_set_isenable(from._internal_isenable()); + } + if (from._internal_isalarm() != 0) { + _this->_internal_set_isalarm(from._internal_isalarm()); + } + if (from._internal_isshow() != 0) { + _this->_internal_set_isshow(from._internal_isshow()); + } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -791,7 +913,14 @@ void ParamInfo::InternalSwap(ParamInfo* other) { &other->_impl_.namekey_, rhs_arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.strvalue_, lhs_arena, &other->_impl_.strvalue_, rhs_arena); - swap(_impl_.valuetype_, other->_impl_.valuetype_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.context_, lhs_arena, + &other->_impl_.context_, rhs_arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.isshow_) + + sizeof(ParamInfo::_impl_.isshow_) + - PROTOBUF_FIELD_OFFSET(ParamInfo, _impl_.valuetype_)>( + reinterpret_cast(&_impl_.valuetype_), + reinterpret_cast(&other->_impl_.valuetype_)); } ::google::protobuf::Metadata ParamInfo::GetMetadata() const { diff --git a/TestClient/protobuf/stream.pb.h b/TestClient/protobuf/stream.pb.h index e627cb2..50f06fd 100644 --- a/TestClient/protobuf/stream.pb.h +++ b/TestClient/protobuf/stream.pb.h @@ -310,7 +310,11 @@ class ParamInfo final : enum : int { kNameKeyFieldNumber = 1, kStrValueFieldNumber = 2, + kContextFieldNumber = 4, kValueTypeFieldNumber = 3, + kIsEnableFieldNumber = 5, + kIsAlarmFieldNumber = 6, + kIsShowFieldNumber = 7, }; // bytes nameKey = 1; void clear_namekey() ; @@ -343,6 +347,22 @@ class ParamInfo final : const std::string& value); std::string* _internal_mutable_strvalue(); + public: + // bytes context = 4; + void clear_context() ; + const std::string& context() const; + template + void set_context(Arg_&& arg, Args_... args); + std::string* mutable_context(); + PROTOBUF_NODISCARD std::string* release_context(); + void set_allocated_context(std::string* ptr); + + private: + const std::string& _internal_context() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_context( + const std::string& value); + std::string* _internal_mutable_context(); + public: // .stream.TYPE valueType = 3; void clear_valuetype() ; @@ -353,20 +373,54 @@ class ParamInfo final : ::stream::TYPE _internal_valuetype() const; void _internal_set_valuetype(::stream::TYPE value); + public: + // bool isEnable = 5; + void clear_isenable() ; + bool isenable() const; + void set_isenable(bool value); + + private: + bool _internal_isenable() const; + void _internal_set_isenable(bool value); + + public: + // bool isAlarm = 6; + void clear_isalarm() ; + bool isalarm() const; + void set_isalarm(bool value); + + private: + bool _internal_isalarm() const; + void _internal_set_isalarm(bool value); + + public: + // bool isShow = 7; + void clear_isshow() ; + bool isshow() const; + void set_isshow(bool value); + + private: + bool _internal_isshow() const; + void _internal_set_isshow(bool value); + public: // @@protoc_insertion_point(class_scope:stream.ParamInfo) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 3, 0, 0, 2> _table_; + static const ::google::protobuf::internal::TcParseTable<3, 7, 0, 0, 2> _table_; template friend class ::google::protobuf::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::google::protobuf::internal::ArenaStringPtr namekey_; ::google::protobuf::internal::ArenaStringPtr strvalue_; + ::google::protobuf::internal::ArenaStringPtr context_; int valuetype_; + bool isenable_; + bool isalarm_; + bool isshow_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -2600,6 +2654,123 @@ inline void ParamInfo::_internal_set_valuetype(::stream::TYPE value) { _impl_.valuetype_ = value; } +// bytes context = 4; +inline void ParamInfo::clear_context() { + _impl_.context_.ClearToEmpty(); +} +inline const std::string& ParamInfo::context() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.context) + return _internal_context(); +} +template +inline PROTOBUF_ALWAYS_INLINE void ParamInfo::set_context(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.context_.SetBytes(static_cast(arg), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:stream.ParamInfo.context) +} +inline std::string* ParamInfo::mutable_context() { + std::string* _s = _internal_mutable_context(); + // @@protoc_insertion_point(field_mutable:stream.ParamInfo.context) + return _s; +} +inline const std::string& ParamInfo::_internal_context() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.context_.Get(); +} +inline void ParamInfo::_internal_set_context(const std::string& value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.context_.Set(value, GetArenaForAllocation()); +} +inline std::string* ParamInfo::_internal_mutable_context() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + return _impl_.context_.Mutable( GetArenaForAllocation()); +} +inline std::string* ParamInfo::release_context() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:stream.ParamInfo.context) + return _impl_.context_.Release(); +} +inline void ParamInfo::set_allocated_context(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.context_.SetAllocated(value, GetArenaForAllocation()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.context_.IsDefault()) { + _impl_.context_.Set("", GetArenaForAllocation()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:stream.ParamInfo.context) +} + +// bool isEnable = 5; +inline void ParamInfo::clear_isenable() { + _impl_.isenable_ = false; +} +inline bool ParamInfo::isenable() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.isEnable) + return _internal_isenable(); +} +inline void ParamInfo::set_isenable(bool value) { + _internal_set_isenable(value); + // @@protoc_insertion_point(field_set:stream.ParamInfo.isEnable) +} +inline bool ParamInfo::_internal_isenable() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.isenable_; +} +inline void ParamInfo::_internal_set_isenable(bool value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.isenable_ = value; +} + +// bool isAlarm = 6; +inline void ParamInfo::clear_isalarm() { + _impl_.isalarm_ = false; +} +inline bool ParamInfo::isalarm() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.isAlarm) + return _internal_isalarm(); +} +inline void ParamInfo::set_isalarm(bool value) { + _internal_set_isalarm(value); + // @@protoc_insertion_point(field_set:stream.ParamInfo.isAlarm) +} +inline bool ParamInfo::_internal_isalarm() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.isalarm_; +} +inline void ParamInfo::_internal_set_isalarm(bool value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.isalarm_ = value; +} + +// bool isShow = 7; +inline void ParamInfo::clear_isshow() { + _impl_.isshow_ = false; +} +inline bool ParamInfo::isshow() const { + // @@protoc_insertion_point(field_get:stream.ParamInfo.isShow) + return _internal_isshow(); +} +inline void ParamInfo::set_isshow(bool value) { + _internal_set_isshow(value); + // @@protoc_insertion_point(field_set:stream.ParamInfo.isShow) +} +inline bool ParamInfo::_internal_isshow() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.isshow_; +} +inline void ParamInfo::_internal_set_isshow(bool value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ; + _impl_.isshow_ = value; +} + // ------------------------------------------------------------------- // RequestInfo diff --git a/TestClient/protobuf/stream.proto b/TestClient/protobuf/stream.proto index 270abb1..6a1d0a3 100644 --- a/TestClient/protobuf/stream.proto +++ b/TestClient/protobuf/stream.proto @@ -38,8 +38,12 @@ enum DATAHANDLE { message ParamInfo{ bytes nameKey = 1; //参数key bytes strValue = 2; //value - //bool isOutput = 2; //是否只读 TYPE valueType = 3; //数据类型 + + bytes context = 4; //alarmcfg 使用 + bool isEnable = 5; + bool isAlarm = 6; + bool isShow = 7; } message RequestInfo { //读