添加配置相关功能

This commit is contained in:
wangxx1809 2024-06-04 17:49:56 +08:00
parent 4ab95d49db
commit 89ec22ec58
21 changed files with 1052 additions and 67 deletions

View File

@ -446,6 +446,20 @@ vector<IOVersion*>* ConfigManager::GetIOVersions(int machineid)
return m_IOVersions[machineid];
}
string ConfigManager::GetIOVersionStrs(int machineid) {
if (m_IOVersions.find(machineid) == m_IOVersions.end()) {
return "";
}
string result;
auto start = m_IOVersions[machineid]->begin();
while (start != m_IOVersions[machineid]->end()) {
result += (*start)->m_VersionCode;
++start;
}
return result;
}
void ConfigManager::DeleteMachineIO()
{
char buffer[256];
@ -491,7 +505,8 @@ void ConfigManager::SendCfgToClients() {
m_EleCfg->SendToClients(ELECFGPARAM);
}
void ConfigManager::CallFuncs(const ReadData& rd) {
void ConfigManager::CallFuncs(const ReadData& rd, const list<Item>& lst, ::stream::ResponseAny** response) {
stream::ComResponce result;
ConfigFunc cfunc = (ConfigFunc)ConverType::TryToI(rd.nameKey);
switch (cfunc)
{
@ -503,6 +518,17 @@ void ConfigManager::CallFuncs(const ReadData& rd) {
DeleteMachineIO(); break;
case CONTROLRUN:
ControlRun(rd.its); break;
case IOVERSIONSTR:
if (lst.front().nameKey == "index") {
result.set_data(GetIOVersionStrs(ConverType::TryToI(lst.front().strValue)));
(*response)->mutable_data()->PackFrom(result);
}
printf("IOVERSIONSTR responded...\n");
break;
case REDTESTCFGSTART:
RedTestCfgStart(); break;
case REDTESTCFGSTOP:
RedTestCfgStop(); break;
default:
break;
}
@ -537,8 +563,8 @@ void ConfigManager::UpdateCfg(const ReadData& rd) {
case POWDERESTIMATECFG:
m_PowderEstimateCfg.Update(rd,POWDERESTIMATECFGPARAM); break;
case COMMUNICATIONCFG:
UpdateCommunicationCfg(rd);
break;
UpdateCommunicationCfg(rd); break;
default:
break;
}
@ -586,3 +612,29 @@ void ConfigManager::ControlRun(const list<Item>& its) {
}
}
void ConfigManager::RedTestCfgStart() {
vector<ScannerControlCfg*>* laserCfg = ConfigManager::GetInstance()->GetMatchScannerControlCfg();
for (size_t cIndex = 0; cIndex < laserCfg->size(); cIndex++) {
ScannerControlCfg* lcfg = (*laserCfg)[cIndex];
if (lcfg->m_LaserEnable && lcfg->m_LaserEnable->IsActive()) {
lcfg->m_LaserEnable->SetActive(false);
}
if (lcfg->m_LaserRed && !lcfg->m_LaserRed->IsActive()) {
lcfg->m_LaserRed->SetActive(true);
}
}
}
void ConfigManager::RedTestCfgStop() {
vector<ScannerControlCfg*>* laserCfg = ConfigManager::GetInstance()->GetMatchScannerControlCfg();
for (size_t lrIndex = 0; lrIndex < laserCfg->size(); lrIndex++) {
ScannerControlCfg* lcfg = (*laserCfg)[lrIndex];
if (lcfg->m_LaserRed && lcfg->m_LaserRed->IsActive()) {
lcfg->m_LaserRed->SetActive(false);
}
}
}

View File

@ -43,6 +43,10 @@ enum ConfigFunc{
SAVEMACHINECONFIG,
DELETEMACHINEIO,
CONTROLRUN,
IOVERSIONSTR,
REDTESTCFGSTART, //红光测试配置开始
REDTESTCFGSTOP, //红光测试配置结束
};
@ -77,7 +81,7 @@ public:
UIShowCfg* GetUIShowCfg() { return &m_UIShowCfg; } //已传
IOCfgWrapper* GetIoCfgWrapper() { return m_IOCfgWrapper; } //已传
void DeleteMachineIO(); //已传
vector<IOVersion*>* GetIOVersions(int machineid); //返回一个string, req-rsp模式
vector<IOVersion*>* GetIOVersions(int machineid); //已传 改为函数 GetIOVersionStrs
PowderEstimateCfg* GetPowderEstimateCfg() { return &m_PowderEstimateCfg; } //已传
map<string, CommunicationCfg*>* GetCommunicationCfg() { return m_pCommunicationCfgDao->GetCommunicationCfg(); } //已传
@ -101,7 +105,7 @@ public:
//vector<LaserCfg*>* GetLaserCfgs() { return &m_pLaserCfgDao->m_LaserCfgs; }
map<int,ScannerControlCfg*>* GetScannerControlCfg() { return &m_ScannerControlCfgDao->m_ScannerControlCfgMap; } //传
vector<ScannerControlCfg*>* GetScannerControlCfgs() { return &m_ScannerControlCfgDao->m_ScannerControlCfgs; } //不传
vector<ScannerControlCfg*>* GetMatchScannerControlCfg() { return &m_ScannerControlCfgDao->m_MatchCfg; } //添加一个函数,不用
vector<ScannerControlCfg*>* GetMatchScannerControlCfg() { return &m_ScannerControlCfgDao->m_MatchCfg; } //添加2个函数 已
ScannerControlCfgDao* GetScannerControlCfgDao() { return m_ScannerControlCfgDao; } //不用
//vector<LaserCfg*> *GetMatchLaser() { return &m_pLaserCfgDao->m_MatchLaser; }
@ -116,7 +120,7 @@ public:
}
void AddComRefCfg(CommunicationCfg* cfg, IConnect* ic) { m_ComRefCfg[cfg] = ic; } //不传
map<CommunicationCfg*, IConnect*>* GetComRefCfg() { return &m_ComRefCfg; } //传一个参数的函数功能
map<CommunicationCfg*, IConnect*>* GetComRefCfg() { return &m_ComRefCfg; } //已传 ControlRun
// map<unsigned char, ServoCfg*>* GetMitsubishiCfg() { return &m_MitsubishiCfgMap; }
// map<unsigned char, ServoCfg*>* GetSanyoCfg() { return &m_SanyoCfgMap; }
@ -129,7 +133,7 @@ public:
void SendCfgToClients();
void UpdateCfg(const ReadData& rd);
void CallFuncs(const ReadData& rd);
void CallFuncs(const ReadData& rd, const list<Item>& lst = list<Item>(), ::stream::ResponseAny** response = nullptr);
private:
ConfigManager(const ConfigManager&) {};
ConfigManager& operator=(const ConfigManager&) {};
@ -142,6 +146,9 @@ private:
void ControlRun(const list<Item>& its); //控制模块启停
void UpdateCommunicationCfg(const ReadData& rd); //更新参数
string GetIOVersionStrs(int machineid); //io版本 字符串返回
void RedTestCfgStart();
void RedTestCfgStop();
private:
SQLite::Database* m_pDB;
HbdLanguageDao* m_pHbdLanguageDao;

View File

@ -1,4 +1,5 @@
#include "CommunicationCfg.h"
#include "../utils/StringHelper.h"
CommunicationCfg::CommunicationCfg()
: m_MachineId(new IntData("MachineId", u8"", 0))
@ -24,7 +25,7 @@ CommunicationCfg::CommunicationCfg()
CommunicationCfg::CommunicationCfg(int mid, string cc, string name, const string& sContent, int type)
: m_MachineId(new IntData("MachineId",u8"",mid))
, m_ClientCode(new StrData("ClientCode",u8"",cc))
, m_ClientCode(new StrData("ClientCode",u8"编码",cc))
, m_Name(new StrData("Name",u8"",name))
, m_Type(new IntData("Type",u8"",type))
, m_IP(new StrData("IP", u8"IP", "0.0.0.0"))

View File

@ -39,7 +39,7 @@ void CommunicationCfgDao::InitBeforeFind(int mid)
{
CommunicationCfg* remote = new CommunicationCfg(mid, "REMOTE", u8"远控", _(u8"远控"), CommunicationCfg::TCP);
remote->m_IP->SetValue("192.168.3.88");
remote->m_Port ->SetValue( 12019);
remote->m_Port->SetValue(12019);
remote->m_Interval->SetValue(500);
remote->m_AlarmTimeoutTimes->SetValue(3);
m_CommunicationCfgMap[remote->m_ClientCode->GetValueStr()] = remote;

View File

@ -8,7 +8,7 @@ void DataHandle::DataCallBackProc(void* pthis, const ReadData& msg, const std::l
p->DataCallBackHandle(msg,its);
}
void DataHandle::LayersDataCallBackProc(void* pthis,const ReadData& msg, ::stream::ResponseAny** response) {
void DataHandle::LayersDataCallBackProc(void* pthis,const ReadData& msg, const list<Item>& lst, ::stream::ResponseAny** response) {
DataHandle* p = (DataHandle*)pthis;
int index = atoi(msg.strValue.data());
@ -23,6 +23,9 @@ void DataHandle::LayersDataCallBackProc(void* pthis,const ReadData& msg, ::strea
else if ((READTYPE)msg.dataType == CAMERAFUNC) {
p->m_controller->m_Camera->CallFunc(msg, response);
}
else if ((READTYPE)msg.dataType == CONFIGFUNC) {
p->m_config->CallFuncs(msg, lst, response);
}
}
@ -36,9 +39,6 @@ DataHandle::DataHandle()
DataHandle::~DataHandle() {
Stop();
//m_testFlag = true;
//if (m_testTd.joinable()) m_testTd.join();
DELP(m_streamServer);
DELP(m_controller);
}
@ -47,16 +47,6 @@ void DataHandle::Init() {
m_config = ConfigManager::GetInstance();
m_config->Init();
////测试线程
//m_testTd = std::thread ([this] {
// static float i = 10.12540f;
// while (!m_testFlag) {
// ClientWrapper::Instance()->PushAllClient(WriteData(TEST, { {string("hello"),std::to_string(i),iFLOAT}}));
// std::this_thread::sleep_for(std::chrono::seconds(1));
// }
//});
//m_testTd.detach();
m_streamServer = new StreamServer(m_config->GetMachine());
m_streamServer->SetCallBackFunc(this, &DataHandle::DataCallBackProc, &DataHandle::LayersDataCallBackProc);
m_streamServer->Init();

View File

@ -7,7 +7,7 @@
class DataHandle{
typedef void (*DataCallBack)(void* pthis, const ReadData& msg);
typedef void (*LayersDataCallBack)(void* pthis, const ReadData& msg, ::stream::ResponseAny** response);
typedef void (*LayersDataCallBack)(void* pthis, const ReadData& msg, const list<Item>& lst, ::stream::ResponseAny** response);
public:
DataHandle();
~DataHandle();
@ -17,7 +17,7 @@ public:
void Stop();
static void DataCallBackProc(void* pthis, const ReadData& msg,const std::list<Item>& its);
static void LayersDataCallBackProc(void* pthis, const ReadData& msg,::stream::ResponseAny** response);
static void LayersDataCallBackProc(void* pthis, const ReadData& msg, const list<Item>& lst, ::stream::ResponseAny** response);
private:
//DataCallBack m_dataCallBack;
//std::thread m_testTd;

View File

@ -25,8 +25,15 @@ StreamServer::~StreamServer() {
readData.nameKey = request->namekey();
readData.strValue = request->strvalue();
readData.valueType = (DATATYPE)request->valuetype();
std::list<Item> paramLst; //函数参数
for (const ::stream::ParamInfo it : request->item()) {
paramLst.emplace_back(Item{ it.namekey(),it.strvalue() ,(DATATYPE)it.valuetype() }); //直接加到readData.its上面后续的请求无法收到不知道为啥
}
if (m_layerDataCallBack)
m_layerDataCallBack(m_handlePtr, readData, &response);
m_layerDataCallBack(m_handlePtr, readData, paramLst, &response);
return Status::OK;
}

View File

@ -19,7 +19,7 @@ using stream::ResponseInfo;
class StreamServer final : public Stream::Service {
typedef void (*DataCallBack)(void* pthis,const ReadData& msg, const std::list<Item>& its);
typedef void (*LayerDataCallBack)(void* pthis, const ReadData& msg, ::stream::ResponseAny** response);
typedef void (*LayerDataCallBack)(void* pthis, const ReadData& msg,const list<Item>& lst, ::stream::ResponseAny** response);
public:

Binary file not shown.

Binary file not shown.

View File

@ -235,8 +235,27 @@ struct ImgInfoResponceDefaultTypeInternal {
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ImgInfoResponceDefaultTypeInternal _ImgInfoResponce_default_instance_;
template <typename>
PROTOBUF_CONSTEXPR ComResponce::ComResponce(::_pbi::ConstantInitialized)
: _impl_{
/*decltype(_impl_.data_)*/ {
&::_pbi::fixed_address_empty_string,
::_pbi::ConstantInitialized{},
},
/*decltype(_impl_._cached_size_)*/ {},
} {}
struct ComResponceDefaultTypeInternal {
PROTOBUF_CONSTEXPR ComResponceDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
~ComResponceDefaultTypeInternal() {}
union {
ComResponce _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComResponceDefaultTypeInternal _ComResponce_default_instance_;
} // namespace stream
static ::_pb::Metadata file_level_metadata_stream_2eproto[11];
static ::_pb::Metadata file_level_metadata_stream_2eproto[12];
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_stream_2eproto[2];
static constexpr const ::_pb::ServiceDescriptor**
file_level_service_descriptors_stream_2eproto = nullptr;
@ -367,6 +386,15 @@ const ::uint32_t TableStruct_stream_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE
PROTOBUF_FIELD_OFFSET(::stream::ImgInfoResponce, _impl_.levelimage_),
PROTOBUF_FIELD_OFFSET(::stream::ImgInfoResponce, _impl_.width_),
PROTOBUF_FIELD_OFFSET(::stream::ImgInfoResponce, _impl_.height_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::stream::ComResponce, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::stream::ComResponce, _impl_.data_),
};
static const ::_pbi::MigrationSchema
@ -382,6 +410,7 @@ static const ::_pbi::MigrationSchema
{95, -1, -1, sizeof(::stream::Point)},
{105, -1, -1, sizeof(::stream::RegResponce)},
{114, -1, -1, sizeof(::stream::ImgInfoResponce)},
{125, -1, -1, sizeof(::stream::ComResponce)},
};
static const ::_pb::Message* const file_default_instances[] = {
@ -396,6 +425,7 @@ static const ::_pb::Message* const file_default_instances[] = {
&::stream::_Point_default_instance_._instance,
&::stream::_RegResponce_default_instance_._instance,
&::stream::_ImgInfoResponce_default_instance_._instance,
&::stream::_ComResponce_default_instance_._instance,
};
const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
"\n\014stream.proto\022\006stream\032\031google/protobuf/"
@ -424,19 +454,20 @@ const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(
"\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*\223\001\n\004TYPE\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\006iFLOA"
"T\020\005\022\013\n\007iSTRING\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\nD"
"ATAHANDLE\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.RequestInf"
"o\032\023.stream.ResponseAny\"\000\022=\n\014ServerStream"
"\022\023.stream.RequestInfo\032\024.stream.ResponseI"
"nfo\"\0000\001\022=\n\014ClientStream\022\023.stream.Request"
"Info\032\024.stream.ResponseInfo\"\000(\001\022<\n\tAllStr"
"eam\022\023.stream.RequestInfo\032\024.stream.Respon"
"seInfo\"\000(\0010\001B-\n\027io.grpc.examples.streamB"
"\013StreamProtoP\001\242\002\002STb\006proto3"
"\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"
};
static const ::_pbi::DescriptorTable* const descriptor_table_stream_2eproto_deps[1] =
{
@ -446,13 +477,13 @@ static ::absl::once_flag descriptor_table_stream_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_stream_2eproto = {
false,
false,
1547,
1576,
descriptor_table_protodef_stream_2eproto,
"stream.proto",
&descriptor_table_stream_2eproto_once,
descriptor_table_stream_2eproto_deps,
1,
11,
12,
schemas,
file_default_instances,
TableStruct_stream_2eproto::offsets,
@ -3278,6 +3309,192 @@ void ImgInfoResponce::InternalSwap(ImgInfoResponce* other) {
&descriptor_table_stream_2eproto_getter, &descriptor_table_stream_2eproto_once,
file_level_metadata_stream_2eproto[10]);
}
// ===================================================================
class ComResponce::_Internal {
public:
};
ComResponce::ComResponce(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(arena) {
SharedCtor(arena);
// @@protoc_insertion_point(arena_constructor:stream.ComResponce)
}
ComResponce::ComResponce(const ComResponce& from) : ::google::protobuf::Message() {
ComResponce* const _this = this;
(void)_this;
new (&_impl_) Impl_{
decltype(_impl_.data_){},
/*decltype(_impl_._cached_size_)*/ {},
};
_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
from._internal_metadata_);
_impl_.data_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.data_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_data().empty()) {
_this->_impl_.data_.Set(from._internal_data(), _this->GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:stream.ComResponce)
}
inline void ComResponce::SharedCtor(::_pb::Arena* arena) {
(void)arena;
new (&_impl_) Impl_{
decltype(_impl_.data_){},
/*decltype(_impl_._cached_size_)*/ {},
};
_impl_.data_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.data_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
ComResponce::~ComResponce() {
// @@protoc_insertion_point(destructor:stream.ComResponce)
_internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>();
SharedDtor();
}
inline void ComResponce::SharedDtor() {
ABSL_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.data_.Destroy();
}
void ComResponce::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
PROTOBUF_NOINLINE void ComResponce::Clear() {
// @@protoc_insertion_point(message_clear_start:stream.ComResponce)
::uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.data_.ClearToEmpty();
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
}
const char* ComResponce::_InternalParse(
const char* ptr, ::_pbi::ParseContext* ctx) {
ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header);
return ptr;
}
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::_pbi::TcParseTable<0, 1, 0, 0, 2> ComResponce::_table_ = {
{
0, // no _has_bits_
0, // no _extensions_
1, 0, // max_field_number, fast_idx_mask
offsetof(decltype(_table_), field_lookup_table),
4294967294, // skipmap
offsetof(decltype(_table_), field_entries),
1, // num_field_entries
0, // num_aux_entries
offsetof(decltype(_table_), field_names), // no aux_entries
&_ComResponce_default_instance_._instance,
::_pbi::TcParser::GenericFallback, // fallback
}, {{
// bytes data = 1;
{::_pbi::TcParser::FastBS1,
{10, 63, 0, PROTOBUF_FIELD_OFFSET(ComResponce, _impl_.data_)}},
}}, {{
65535, 65535
}}, {{
// bytes data = 1;
{PROTOBUF_FIELD_OFFSET(ComResponce, _impl_.data_), 0, 0,
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
}},
// no aux_entries
{{
}},
};
::uint8_t* ComResponce::_InternalSerialize(
::uint8_t* target,
::google::protobuf::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:stream.ComResponce)
::uint32_t cached_has_bits = 0;
(void)cached_has_bits;
// bytes data = 1;
if (!this->_internal_data().empty()) {
const std::string& _s = this->_internal_data();
target = stream->WriteBytesMaybeAliased(1, _s, target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target =
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:stream.ComResponce)
return target;
}
::size_t ComResponce::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:stream.ComResponce)
::size_t total_size = 0;
::uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// bytes data = 1;
if (!this->_internal_data().empty()) {
total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize(
this->_internal_data());
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::google::protobuf::Message::ClassData ComResponce::_class_data_ = {
::google::protobuf::Message::CopyWithSourceCheck,
ComResponce::MergeImpl
};
const ::google::protobuf::Message::ClassData*ComResponce::GetClassData() const { return &_class_data_; }
void ComResponce::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<ComResponce*>(&to_msg);
auto& from = static_cast<const ComResponce&>(from_msg);
// @@protoc_insertion_point(class_specific_merge_from_start:stream.ComResponce)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_data().empty()) {
_this->_internal_set_data(from._internal_data());
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
}
void ComResponce::CopyFrom(const ComResponce& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:stream.ComResponce)
if (&from == this) return;
Clear();
MergeFrom(from);
}
PROTOBUF_NOINLINE bool ComResponce::IsInitialized() const {
return true;
}
void ComResponce::InternalSwap(ComResponce* other) {
using std::swap;
auto* lhs_arena = GetArenaForAllocation();
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.data_, lhs_arena,
&other->_impl_.data_, rhs_arena);
}
::google::protobuf::Metadata ComResponce::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_stream_2eproto_getter, &descriptor_table_stream_2eproto_once,
file_level_metadata_stream_2eproto[11]);
}
// @@protoc_insertion_point(namespace_scope)
} // namespace stream
namespace google {

View File

@ -59,6 +59,9 @@ namespace stream {
class ChainDataBlock;
struct ChainDataBlockDefaultTypeInternal;
extern ChainDataBlockDefaultTypeInternal _ChainDataBlock_default_instance_;
class ComResponce;
struct ComResponceDefaultTypeInternal;
extern ComResponceDefaultTypeInternal _ComResponce_default_instance_;
class ImgInfoResponce;
struct ImgInfoResponceDefaultTypeInternal;
extern ImgInfoResponceDefaultTypeInternal _ImgInfoResponce_default_instance_;
@ -2291,6 +2294,170 @@ class ImgInfoResponce final :
};
union { Impl_ _impl_; };
friend struct ::TableStruct_stream_2eproto;
};// -------------------------------------------------------------------
class ComResponce final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:stream.ComResponce) */ {
public:
inline ComResponce() : ComResponce(nullptr) {}
~ComResponce() override;
template<typename = void>
explicit PROTOBUF_CONSTEXPR ComResponce(::google::protobuf::internal::ConstantInitialized);
ComResponce(const ComResponce& from);
ComResponce(ComResponce&& from) noexcept
: ComResponce() {
*this = ::std::move(from);
}
inline ComResponce& operator=(const ComResponce& from) {
CopyFrom(from);
return *this;
}
inline ComResponce& operator=(ComResponce&& from) noexcept {
if (this == &from) return *this;
if (GetOwningArena() == from.GetOwningArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
&& GetOwningArena() != nullptr
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
) {
InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
}
static const ::google::protobuf::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::google::protobuf::Descriptor* GetDescriptor() {
return default_instance().GetMetadata().descriptor;
}
static const ::google::protobuf::Reflection* GetReflection() {
return default_instance().GetMetadata().reflection;
}
static const ComResponce& default_instance() {
return *internal_default_instance();
}
static inline const ComResponce* internal_default_instance() {
return reinterpret_cast<const ComResponce*>(
&_ComResponce_default_instance_);
}
static constexpr int kIndexInFileMessages =
11;
friend void swap(ComResponce& a, ComResponce& b) {
a.Swap(&b);
}
inline void Swap(ComResponce* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::google::protobuf::internal::GenericSwap(this, other);
}
}
void UnsafeArenaSwap(ComResponce* other) {
if (other == this) return;
ABSL_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
ComResponce* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<ComResponce>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const ComResponce& from);
using ::google::protobuf::Message::MergeFrom;
void MergeFrom( const ComResponce& from) {
ComResponce::MergeImpl(*this, from);
}
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final;
::uint8_t* _InternalSerialize(
::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor(::google::protobuf::Arena* arena);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ComResponce* other);
private:
friend class ::google::protobuf::internal::AnyMetadata;
static ::absl::string_view FullMessageName() {
return "stream.ComResponce";
}
protected:
explicit ComResponce(::google::protobuf::Arena* arena);
public:
static const ClassData _class_data_;
const ::google::protobuf::Message::ClassData*GetClassData() const final;
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kDataFieldNumber = 1,
};
// bytes data = 1;
void clear_data() ;
const std::string& data() const;
template <typename Arg_ = const std::string&, typename... Args_>
void set_data(Arg_&& arg, Args_... args);
std::string* mutable_data();
PROTOBUF_NODISCARD std::string* release_data();
void set_allocated_data(std::string* ptr);
private:
const std::string& _internal_data() const;
inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(
const std::string& value);
std::string* _internal_mutable_data();
public:
// @@protoc_insertion_point(class_scope:stream.ComResponce)
private:
class _Internal;
friend class ::google::protobuf::internal::TcParser;
static const ::google::protobuf::internal::TcParseTable<0, 1, 0, 0, 2> _table_;
template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
struct Impl_ {
::google::protobuf::internal::ArenaStringPtr data_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
PROTOBUF_TSAN_DECLARE_MEMBER
};
union { Impl_ _impl_; };
friend struct ::TableStruct_stream_2eproto;
};
// ===================================================================
@ -3471,6 +3638,61 @@ inline void ImgInfoResponce::_internal_set_height(::int32_t value) {
_impl_.height_ = value;
}
// -------------------------------------------------------------------
// ComResponce
// bytes data = 1;
inline void ComResponce::clear_data() {
_impl_.data_.ClearToEmpty();
}
inline const std::string& ComResponce::data() const {
// @@protoc_insertion_point(field_get:stream.ComResponce.data)
return _internal_data();
}
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void ComResponce::set_data(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
;
_impl_.data_.SetBytes(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:stream.ComResponce.data)
}
inline std::string* ComResponce::mutable_data() {
std::string* _s = _internal_mutable_data();
// @@protoc_insertion_point(field_mutable:stream.ComResponce.data)
return _s;
}
inline const std::string& ComResponce::_internal_data() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
return _impl_.data_.Get();
}
inline void ComResponce::_internal_set_data(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
;
_impl_.data_.Set(value, GetArenaForAllocation());
}
inline std::string* ComResponce::_internal_mutable_data() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
;
return _impl_.data_.Mutable( GetArenaForAllocation());
}
inline std::string* ComResponce::release_data() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:stream.ComResponce.data)
return _impl_.data_.Release();
}
inline void ComResponce::set_allocated_data(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.data_.SetAllocated(value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (_impl_.data_.IsDefault()) {
_impl_.data_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:stream.ComResponce.data)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__

View File

@ -122,6 +122,11 @@ message ImgInfoResponce{
int32 height = 3;
}
// IOVersionStr接口返回值
message ComResponce{
bytes data = 1;
}
service Stream {
rpc Simple(RequestInfo) returns (ResponseAny) {} //
rpc ServerStream (RequestInfo) returns (stream ResponseInfo) {} //

View File

@ -83,7 +83,7 @@ void DataHandle::PrintValue(const ReadData& msg){
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, StringHelper::AsciiToUtf8(it->strValue).data(), valueType.data());
msg.dataType, 33, it->nameKey.data(), 13, it->strValue.data(), valueType.data());
++it;
}
printf("共有参数%zd个...\n", msg.its.size());
@ -450,5 +450,21 @@ void DataHandle::ConfigTest() {
wd.items.emplace_back(Item{ "code", "usp" ,iSTRING });
PushMsg(wd);
printf("controlrun is called...\n");
::stream::ResponseAny resp;
stream::ComResponce result;
WriteData wdata{ CONFIGFUNC ,to_string(IOVERSIONSTR) };
wdata.items.emplace_back(Item{"index","1",iINT});
m_streamClient->Request(wdata, &resp);
if (resp.data().Is<stream::ComResponce>()) {
resp.data().UnpackTo(&result);
printf("IOVERSIONSTR resp:%s\n", result.data().data());
}
PushMsg(CONFIGFUNC, to_string(REDTESTCFGSTART));
printf("redtestcfgstart is called...\n");
PushMsg(CONFIGFUNC, to_string(REDTESTCFGSTOP));
printf("redtestcfgstop is called...\n");
}

View File

@ -88,4 +88,8 @@ enum ConfigFunc {
SAVEMACHINECONFIG,
DELETEMACHINEIO,
CONTROLRUN,
IOVERSIONSTR,
REDTESTCFGSTART, //红光测试配置开始
REDTESTCFGSTOP, //红光测试配置结束
};

View File

@ -149,6 +149,14 @@ int StreamClient::Request(const WriteData& writeData , ::stream::ResponseAny* re
request.set_namekey(writeData.nameKey);
request.set_strvalue(writeData.strValue);
request.set_valuetype((stream::TYPE)writeData.valueType);
for (auto wd = writeData.items.begin(); wd != writeData.items.end(); ++wd) {
::stream::ParamInfo* paramInfo = request.add_item();
paramInfo->set_namekey((*wd).nameKey);
paramInfo->set_strvalue((*wd).strValue);
paramInfo->set_valuetype((stream::TYPE)(*wd).valueType);
}
Status status = _stub->Simple(&context, request, response);
return status.ok();

View File

@ -512,15 +512,15 @@
<ClInclude Include="UI\UIBean.h">
<Filter>UI</Filter>
</ClInclude>
<ClInclude Include="utils\ConverType.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="protobuf\stream.grpc.pb.h">
<Filter>protobuf</Filter>
</ClInclude>
<ClInclude Include="protobuf\stream.pb.h">
<Filter>protobuf</Filter>
</ClInclude>
<ClInclude Include="utils\ConverType.h">
<Filter>utils</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="protobuf\stream.proto">

View File

@ -235,8 +235,27 @@ struct ImgInfoResponceDefaultTypeInternal {
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ImgInfoResponceDefaultTypeInternal _ImgInfoResponce_default_instance_;
template <typename>
PROTOBUF_CONSTEXPR ComResponce::ComResponce(::_pbi::ConstantInitialized)
: _impl_{
/*decltype(_impl_.data_)*/ {
&::_pbi::fixed_address_empty_string,
::_pbi::ConstantInitialized{},
},
/*decltype(_impl_._cached_size_)*/ {},
} {}
struct ComResponceDefaultTypeInternal {
PROTOBUF_CONSTEXPR ComResponceDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
~ComResponceDefaultTypeInternal() {}
union {
ComResponce _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComResponceDefaultTypeInternal _ComResponce_default_instance_;
} // namespace stream
static ::_pb::Metadata file_level_metadata_stream_2eproto[11];
static ::_pb::Metadata file_level_metadata_stream_2eproto[12];
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_stream_2eproto[2];
static constexpr const ::_pb::ServiceDescriptor**
file_level_service_descriptors_stream_2eproto = nullptr;
@ -367,6 +386,15 @@ const ::uint32_t TableStruct_stream_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE
PROTOBUF_FIELD_OFFSET(::stream::ImgInfoResponce, _impl_.levelimage_),
PROTOBUF_FIELD_OFFSET(::stream::ImgInfoResponce, _impl_.width_),
PROTOBUF_FIELD_OFFSET(::stream::ImgInfoResponce, _impl_.height_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::stream::ComResponce, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::stream::ComResponce, _impl_.data_),
};
static const ::_pbi::MigrationSchema
@ -382,6 +410,7 @@ static const ::_pbi::MigrationSchema
{95, -1, -1, sizeof(::stream::Point)},
{105, -1, -1, sizeof(::stream::RegResponce)},
{114, -1, -1, sizeof(::stream::ImgInfoResponce)},
{125, -1, -1, sizeof(::stream::ComResponce)},
};
static const ::_pb::Message* const file_default_instances[] = {
@ -396,6 +425,7 @@ static const ::_pb::Message* const file_default_instances[] = {
&::stream::_Point_default_instance_._instance,
&::stream::_RegResponce_default_instance_._instance,
&::stream::_ImgInfoResponce_default_instance_._instance,
&::stream::_ComResponce_default_instance_._instance,
};
const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
"\n\014stream.proto\022\006stream\032\031google/protobuf/"
@ -424,19 +454,20 @@ const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(
"\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*\223\001\n\004TYPE\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\006iFLOA"
"T\020\005\022\013\n\007iSTRING\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\nD"
"ATAHANDLE\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.RequestInf"
"o\032\023.stream.ResponseAny\"\000\022=\n\014ServerStream"
"\022\023.stream.RequestInfo\032\024.stream.ResponseI"
"nfo\"\0000\001\022=\n\014ClientStream\022\023.stream.Request"
"Info\032\024.stream.ResponseInfo\"\000(\001\022<\n\tAllStr"
"eam\022\023.stream.RequestInfo\032\024.stream.Respon"
"seInfo\"\000(\0010\001B-\n\027io.grpc.examples.streamB"
"\013StreamProtoP\001\242\002\002STb\006proto3"
"\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"
};
static const ::_pbi::DescriptorTable* const descriptor_table_stream_2eproto_deps[1] =
{
@ -446,13 +477,13 @@ static ::absl::once_flag descriptor_table_stream_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_stream_2eproto = {
false,
false,
1547,
1576,
descriptor_table_protodef_stream_2eproto,
"stream.proto",
&descriptor_table_stream_2eproto_once,
descriptor_table_stream_2eproto_deps,
1,
11,
12,
schemas,
file_default_instances,
TableStruct_stream_2eproto::offsets,
@ -3278,6 +3309,192 @@ void ImgInfoResponce::InternalSwap(ImgInfoResponce* other) {
&descriptor_table_stream_2eproto_getter, &descriptor_table_stream_2eproto_once,
file_level_metadata_stream_2eproto[10]);
}
// ===================================================================
class ComResponce::_Internal {
public:
};
ComResponce::ComResponce(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(arena) {
SharedCtor(arena);
// @@protoc_insertion_point(arena_constructor:stream.ComResponce)
}
ComResponce::ComResponce(const ComResponce& from) : ::google::protobuf::Message() {
ComResponce* const _this = this;
(void)_this;
new (&_impl_) Impl_{
decltype(_impl_.data_){},
/*decltype(_impl_._cached_size_)*/ {},
};
_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
from._internal_metadata_);
_impl_.data_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.data_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_data().empty()) {
_this->_impl_.data_.Set(from._internal_data(), _this->GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:stream.ComResponce)
}
inline void ComResponce::SharedCtor(::_pb::Arena* arena) {
(void)arena;
new (&_impl_) Impl_{
decltype(_impl_.data_){},
/*decltype(_impl_._cached_size_)*/ {},
};
_impl_.data_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.data_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
ComResponce::~ComResponce() {
// @@protoc_insertion_point(destructor:stream.ComResponce)
_internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>();
SharedDtor();
}
inline void ComResponce::SharedDtor() {
ABSL_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.data_.Destroy();
}
void ComResponce::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
PROTOBUF_NOINLINE void ComResponce::Clear() {
// @@protoc_insertion_point(message_clear_start:stream.ComResponce)
::uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.data_.ClearToEmpty();
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
}
const char* ComResponce::_InternalParse(
const char* ptr, ::_pbi::ParseContext* ctx) {
ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header);
return ptr;
}
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
const ::_pbi::TcParseTable<0, 1, 0, 0, 2> ComResponce::_table_ = {
{
0, // no _has_bits_
0, // no _extensions_
1, 0, // max_field_number, fast_idx_mask
offsetof(decltype(_table_), field_lookup_table),
4294967294, // skipmap
offsetof(decltype(_table_), field_entries),
1, // num_field_entries
0, // num_aux_entries
offsetof(decltype(_table_), field_names), // no aux_entries
&_ComResponce_default_instance_._instance,
::_pbi::TcParser::GenericFallback, // fallback
}, {{
// bytes data = 1;
{::_pbi::TcParser::FastBS1,
{10, 63, 0, PROTOBUF_FIELD_OFFSET(ComResponce, _impl_.data_)}},
}}, {{
65535, 65535
}}, {{
// bytes data = 1;
{PROTOBUF_FIELD_OFFSET(ComResponce, _impl_.data_), 0, 0,
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
}},
// no aux_entries
{{
}},
};
::uint8_t* ComResponce::_InternalSerialize(
::uint8_t* target,
::google::protobuf::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:stream.ComResponce)
::uint32_t cached_has_bits = 0;
(void)cached_has_bits;
// bytes data = 1;
if (!this->_internal_data().empty()) {
const std::string& _s = this->_internal_data();
target = stream->WriteBytesMaybeAliased(1, _s, target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target =
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:stream.ComResponce)
return target;
}
::size_t ComResponce::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:stream.ComResponce)
::size_t total_size = 0;
::uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// bytes data = 1;
if (!this->_internal_data().empty()) {
total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize(
this->_internal_data());
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::google::protobuf::Message::ClassData ComResponce::_class_data_ = {
::google::protobuf::Message::CopyWithSourceCheck,
ComResponce::MergeImpl
};
const ::google::protobuf::Message::ClassData*ComResponce::GetClassData() const { return &_class_data_; }
void ComResponce::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
auto* const _this = static_cast<ComResponce*>(&to_msg);
auto& from = static_cast<const ComResponce&>(from_msg);
// @@protoc_insertion_point(class_specific_merge_from_start:stream.ComResponce)
ABSL_DCHECK_NE(&from, _this);
::uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_data().empty()) {
_this->_internal_set_data(from._internal_data());
}
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
}
void ComResponce::CopyFrom(const ComResponce& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:stream.ComResponce)
if (&from == this) return;
Clear();
MergeFrom(from);
}
PROTOBUF_NOINLINE bool ComResponce::IsInitialized() const {
return true;
}
void ComResponce::InternalSwap(ComResponce* other) {
using std::swap;
auto* lhs_arena = GetArenaForAllocation();
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.data_, lhs_arena,
&other->_impl_.data_, rhs_arena);
}
::google::protobuf::Metadata ComResponce::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_stream_2eproto_getter, &descriptor_table_stream_2eproto_once,
file_level_metadata_stream_2eproto[11]);
}
// @@protoc_insertion_point(namespace_scope)
} // namespace stream
namespace google {

View File

@ -59,6 +59,9 @@ namespace stream {
class ChainDataBlock;
struct ChainDataBlockDefaultTypeInternal;
extern ChainDataBlockDefaultTypeInternal _ChainDataBlock_default_instance_;
class ComResponce;
struct ComResponceDefaultTypeInternal;
extern ComResponceDefaultTypeInternal _ComResponce_default_instance_;
class ImgInfoResponce;
struct ImgInfoResponceDefaultTypeInternal;
extern ImgInfoResponceDefaultTypeInternal _ImgInfoResponce_default_instance_;
@ -2291,6 +2294,170 @@ class ImgInfoResponce final :
};
union { Impl_ _impl_; };
friend struct ::TableStruct_stream_2eproto;
};// -------------------------------------------------------------------
class ComResponce final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:stream.ComResponce) */ {
public:
inline ComResponce() : ComResponce(nullptr) {}
~ComResponce() override;
template<typename = void>
explicit PROTOBUF_CONSTEXPR ComResponce(::google::protobuf::internal::ConstantInitialized);
ComResponce(const ComResponce& from);
ComResponce(ComResponce&& from) noexcept
: ComResponce() {
*this = ::std::move(from);
}
inline ComResponce& operator=(const ComResponce& from) {
CopyFrom(from);
return *this;
}
inline ComResponce& operator=(ComResponce&& from) noexcept {
if (this == &from) return *this;
if (GetOwningArena() == from.GetOwningArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
&& GetOwningArena() != nullptr
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
) {
InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
}
static const ::google::protobuf::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::google::protobuf::Descriptor* GetDescriptor() {
return default_instance().GetMetadata().descriptor;
}
static const ::google::protobuf::Reflection* GetReflection() {
return default_instance().GetMetadata().reflection;
}
static const ComResponce& default_instance() {
return *internal_default_instance();
}
static inline const ComResponce* internal_default_instance() {
return reinterpret_cast<const ComResponce*>(
&_ComResponce_default_instance_);
}
static constexpr int kIndexInFileMessages =
11;
friend void swap(ComResponce& a, ComResponce& b) {
a.Swap(&b);
}
inline void Swap(ComResponce* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::google::protobuf::internal::GenericSwap(this, other);
}
}
void UnsafeArenaSwap(ComResponce* other) {
if (other == this) return;
ABSL_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
ComResponce* New(::google::protobuf::Arena* arena = nullptr) const final {
return CreateMaybeMessage<ComResponce>(arena);
}
using ::google::protobuf::Message::CopyFrom;
void CopyFrom(const ComResponce& from);
using ::google::protobuf::Message::MergeFrom;
void MergeFrom( const ComResponce& from) {
ComResponce::MergeImpl(*this, from);
}
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final;
::uint8_t* _InternalSerialize(
::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor(::google::protobuf::Arena* arena);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ComResponce* other);
private:
friend class ::google::protobuf::internal::AnyMetadata;
static ::absl::string_view FullMessageName() {
return "stream.ComResponce";
}
protected:
explicit ComResponce(::google::protobuf::Arena* arena);
public:
static const ClassData _class_data_;
const ::google::protobuf::Message::ClassData*GetClassData() const final;
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kDataFieldNumber = 1,
};
// bytes data = 1;
void clear_data() ;
const std::string& data() const;
template <typename Arg_ = const std::string&, typename... Args_>
void set_data(Arg_&& arg, Args_... args);
std::string* mutable_data();
PROTOBUF_NODISCARD std::string* release_data();
void set_allocated_data(std::string* ptr);
private:
const std::string& _internal_data() const;
inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(
const std::string& value);
std::string* _internal_mutable_data();
public:
// @@protoc_insertion_point(class_scope:stream.ComResponce)
private:
class _Internal;
friend class ::google::protobuf::internal::TcParser;
static const ::google::protobuf::internal::TcParseTable<0, 1, 0, 0, 2> _table_;
template <typename T> friend class ::google::protobuf::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
struct Impl_ {
::google::protobuf::internal::ArenaStringPtr data_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
PROTOBUF_TSAN_DECLARE_MEMBER
};
union { Impl_ _impl_; };
friend struct ::TableStruct_stream_2eproto;
};
// ===================================================================
@ -3471,6 +3638,61 @@ inline void ImgInfoResponce::_internal_set_height(::int32_t value) {
_impl_.height_ = value;
}
// -------------------------------------------------------------------
// ComResponce
// bytes data = 1;
inline void ComResponce::clear_data() {
_impl_.data_.ClearToEmpty();
}
inline const std::string& ComResponce::data() const {
// @@protoc_insertion_point(field_get:stream.ComResponce.data)
return _internal_data();
}
template <typename Arg_, typename... Args_>
inline PROTOBUF_ALWAYS_INLINE void ComResponce::set_data(Arg_&& arg,
Args_... args) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
;
_impl_.data_.SetBytes(static_cast<Arg_&&>(arg), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:stream.ComResponce.data)
}
inline std::string* ComResponce::mutable_data() {
std::string* _s = _internal_mutable_data();
// @@protoc_insertion_point(field_mutable:stream.ComResponce.data)
return _s;
}
inline const std::string& ComResponce::_internal_data() const {
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
return _impl_.data_.Get();
}
inline void ComResponce::_internal_set_data(const std::string& value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
;
_impl_.data_.Set(value, GetArenaForAllocation());
}
inline std::string* ComResponce::_internal_mutable_data() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
;
return _impl_.data_.Mutable( GetArenaForAllocation());
}
inline std::string* ComResponce::release_data() {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
// @@protoc_insertion_point(field_release:stream.ComResponce.data)
return _impl_.data_.Release();
}
inline void ComResponce::set_allocated_data(std::string* value) {
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
_impl_.data_.SetAllocated(value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (_impl_.data_.IsDefault()) {
_impl_.data_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:stream.ComResponce.data)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__

View File

@ -42,7 +42,7 @@ message ParamInfo{
TYPE valueType = 3; //
}
message RequestInfo {
message RequestInfo { //
uint32 dataType = 1; //
bytes nameKey = 2; //key
bytes strValue = 3; //value值
@ -51,7 +51,7 @@ message RequestInfo {
repeated ParamInfo item = 6; //(使)
}
message ResponseInfo {
message ResponseInfo { //
uint32 dataType = 1; //
bool result = 2; //
repeated ParamInfo item = 3; //
@ -122,6 +122,11 @@ message ImgInfoResponce{
int32 height = 3;
}
// IOVersionStr接口返回值
message ComResponce{
bytes data = 1;
}
service Stream {
rpc Simple(RequestInfo) returns (ResponseAny) {} //
rpc ServerStream (RequestInfo) returns (stream ResponseInfo) {} //

View File

@ -5,3 +5,15 @@ m_alarmCfgMp
SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); 注释掉了
客户端参数要用带后缀的
//点击时只执行一次代码
static bool isenter = false;
if(点击tab){
if(!isenter){
func();
isenter = true;
}
}
else {
isenter = false;
}