注册功能提交
This commit is contained in:
parent
3e8d350e96
commit
686636097d
@ -14,7 +14,8 @@ Controller::Controller()
|
||||
, m_SysParamWrapper(nullptr)
|
||||
, m_AxisRecordWrapper(nullptr)
|
||||
, m_SignalStateWrapper(nullptr)
|
||||
, m_sendTdExitFlag(false){
|
||||
, m_sendTdExitFlag(false)
|
||||
, m_reg(nullptr){
|
||||
|
||||
|
||||
}
|
||||
@ -38,6 +39,7 @@ Controller::~Controller() {
|
||||
DELP(m_ScannerCtrl);
|
||||
|
||||
DELP(m_Purifier);
|
||||
DELP(m_reg);
|
||||
|
||||
BaseCtrl::SUninit();
|
||||
}
|
||||
@ -49,8 +51,6 @@ void Controller::Init(){
|
||||
BaseCtrl::SInit();
|
||||
m_jobController.SInit();
|
||||
|
||||
|
||||
|
||||
m_CoreCommunication = new CoreCommunication();
|
||||
m_CoreCommunication->SetIOCfgWrapper(ConfigManager::GetInstance()->GetIoCfgWrapper());
|
||||
m_CoreCommunication->SetSysParamWrapper(m_SysParamWrapper);
|
||||
@ -119,6 +119,8 @@ void Controller::Init(){
|
||||
}
|
||||
m_Purifier->Init();
|
||||
|
||||
m_reg = new Registration();
|
||||
|
||||
m_jobController.StartLoadPrepareJob();
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include "../remote/RemoteClient.h"
|
||||
#include "../Purifier/BasePurifier.h"
|
||||
#include <thread>
|
||||
#include "../Registration/Registration.h"
|
||||
|
||||
class Controller {
|
||||
public:
|
||||
@ -39,7 +40,7 @@ public:
|
||||
|
||||
MachineCfg* m_MachineCfg;
|
||||
|
||||
|
||||
Registration* m_reg;
|
||||
private:
|
||||
bool m_sendTdExitFlag;
|
||||
thread m_sendParamThread;
|
||||
|
||||
@ -17,9 +17,9 @@ void DataHandle::LayersDataCallBackProc(void* pthis,const ReadData& msg, ::strea
|
||||
if (!p || index<1 || index>(int)size) return;
|
||||
p->m_controller->m_jobController.m_PrepareJob->GetMetaData()->GetLayerByIndex(index - 1, response);
|
||||
}
|
||||
//else if ((READTYPE)msg.dataType == XYSCANSTATE) {
|
||||
//
|
||||
//}
|
||||
else if ((READTYPE)msg.dataType == REGISTFUNC) {
|
||||
p->m_controller->m_reg->CallFunc(msg,response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -99,33 +99,6 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
|
||||
printf("没有准备好哦,无法操作\n"); return;
|
||||
}
|
||||
m_controller->m_Machine->CallAxisFunc(msg); break;
|
||||
//case SCANERSTART: //开始扫描
|
||||
// scanners = m_controller->m_ScannerCtrl->GetScanners();
|
||||
// index = atoi(msg.strValue.c_str());
|
||||
// if (index >= (*scanners).size()) return;
|
||||
// if ((*scanners)[index]) (*scanners)[index]->StartDebugTest();
|
||||
// break;
|
||||
//case SCANERSTOP: //停止扫描
|
||||
// scanners = m_controller->m_ScannerCtrl->GetScanners();
|
||||
// index = atoi(msg.strValue.c_str());
|
||||
// if (index >= (*scanners).size()) return;
|
||||
// if ((*scanners)[index]) (*scanners)[index]->StopDebugTest();
|
||||
// break;
|
||||
//case STARTHEATINGSCANNERTEST: //开始振镜预热测试
|
||||
// scanners = m_controller->m_ScannerCtrl->GetScanners();
|
||||
// index = atoi(msg.strValue.c_str());
|
||||
// if (index >= (*scanners).size()) return;
|
||||
// if((*scanners)[index]) (*scanners)[index]->StartHeatingScannerTest();
|
||||
// break;
|
||||
//case STOPHEATINGSCANNERTEST: //停止振镜预热
|
||||
// scanners = m_controller->m_ScannerCtrl->GetScanners();
|
||||
// index = atoi(msg.strValue.c_str());
|
||||
// if (index >= (*scanners).size()) return;
|
||||
// if ((*scanners)[index]) (*scanners)[index]->StopHeatingScannerTest();
|
||||
// break;
|
||||
//case INITERRORINFOSREQ: //初始化错误信息
|
||||
// msg.clientPtr->PushMsg(new WriteData(INITERRORINFOSRSP, { {string(""), m_controller->m_ScannerCtrl->GetInitErrorInfos(), iSTRING} }));
|
||||
// break;
|
||||
case VERSIONREQ: //获取版本信息
|
||||
msg.clientPtr->PushMsg(new WriteData(VERSIONRSP, { { string(""), g_SystemInfo->m_ProductVersion, iSTRING } }));
|
||||
break;
|
||||
|
||||
@ -14,6 +14,7 @@ enum READTYPE {
|
||||
RESETELEC, //PowerMeterClient
|
||||
PURIFIERPARAMW, //净化器参数写入
|
||||
LAYERDATAREQ, //layer数据请求
|
||||
REGISTFUNC, //注册函数集
|
||||
|
||||
SETZEROPOS, //AxisState使用
|
||||
AXISSTOPALL, //axis 运动急停
|
||||
|
||||
@ -25,14 +25,6 @@ StreamServer::~StreamServer() {
|
||||
readData.nameKey = request->namekey();
|
||||
readData.strValue = request->strvalue();
|
||||
readData.valueType = (DATATYPE)request->valuetype();
|
||||
//if ((READTYPE)(request->datatype()) == LAYERDATAREQ) {
|
||||
// if (m_layerDataCallBack)
|
||||
// m_layerDataCallBack(m_handlePtr, readData, &response);
|
||||
//}
|
||||
//else if((READTYPE)(request->datatype()) == XYSCANSTATE){
|
||||
// if (m_layerDataCallBack)
|
||||
// m_layerDataCallBack(m_handlePtr, readData, &response);
|
||||
//}
|
||||
if (m_layerDataCallBack)
|
||||
m_layerDataCallBack(m_handlePtr, readData, &response);
|
||||
return Status::OK;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "Registration.h"
|
||||
#include "Registration.h"
|
||||
#include <fstream>
|
||||
#include "../config/ConfigManager.h"
|
||||
#include "../utils/TimeHelper.h"
|
||||
@ -169,3 +169,27 @@ Registration::RegType Registration::CheckRegKey(std::string reg_file)
|
||||
else
|
||||
return REG_FAIL;
|
||||
}
|
||||
|
||||
|
||||
void Registration::CallFunc(const ReadData& rd, ::stream::ResponseAny** response) {
|
||||
char code[120]{ 0 };
|
||||
stream::RegResponce result;
|
||||
REGFUNC regF = (REGFUNC)stoi(rd.nameKey);
|
||||
switch (regF) {
|
||||
case CHECKREG:
|
||||
result.set_data(CheckReg(stoll(rd.strValue)));
|
||||
(*response)->mutable_data()->PackFrom(result);
|
||||
break;
|
||||
case GETSN:
|
||||
sprintf_s(code, 120, "%s", rd.strValue.c_str());
|
||||
result.set_data((int)GetSN(code));
|
||||
(*response)->mutable_data()->PackFrom(result);
|
||||
break;
|
||||
case CHECKREGKEY:
|
||||
result.set_data(CheckRegKey(rd.strValue));
|
||||
(*response)->mutable_data()->PackFrom(result);
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,9 +1,18 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "key.h"
|
||||
#include <string>
|
||||
#include <GL/mesa_gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/khronos_glext.h>
|
||||
#include "../DataManage/RWData.h"
|
||||
#include "../protobuf/stream.pb.h"
|
||||
|
||||
enum REGFUNC {
|
||||
CHECKREG = 0,
|
||||
GETSN,
|
||||
CHECKREGKEY,
|
||||
|
||||
};
|
||||
|
||||
class Registration
|
||||
{
|
||||
@ -22,6 +31,7 @@ public:
|
||||
GLuint GetSN(char* strcode);
|
||||
RegType CheckRegKey(std::string reg_file);
|
||||
|
||||
void CallFunc(const ReadData& rd, ::stream::ResponseAny** response);
|
||||
private:
|
||||
unsigned int m_TrailYear;
|
||||
unsigned int m_TrailMonth;
|
||||
|
||||
@ -203,9 +203,9 @@ void BaseCtrl::SendToClients() {
|
||||
its.emplace_back(Item{"IsPrePrint",to_string(IsPrePrint()), iBOOL});
|
||||
its.emplace_back(Item{"IsPauseStanBy",to_string(IsPauseStanBy()), iBOOL});
|
||||
its.emplace_back(Item{"IsHeatingScanner",to_string(IsHeatingScanner()), iBOOL});
|
||||
its.emplace_back(Item{"State",to_string(GetState()), iBOOL});
|
||||
its.emplace_back(Item{"PreState",to_string(GetPreState()), iBOOL});
|
||||
its.emplace_back(Item{"PauseState",to_string(GetPauseState()), iBOOL});
|
||||
its.emplace_back(Item{"State",to_string(GetState()), iINT });
|
||||
its.emplace_back(Item{"PreState",to_string(GetPreState()), iINT });
|
||||
its.emplace_back(Item{"PauseState",to_string(GetPauseState()), iINT});
|
||||
|
||||
ClientWrapper::Instance()->PushAllClient(WriteData(SCANCTRLSTATE, its));
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
void StartGetScanInfo();
|
||||
void StopGetScanInfo();
|
||||
void SetAutoUpdateScanInfo(bool isauto);
|
||||
void GetXYScanState(ScanStateXYSCT* scanstate, time_t &t); //咋办
|
||||
void GetXYScanState(ScanStateXYSCT* scanstate, time_t &t);
|
||||
virtual void UpdateScannerInfo() {}
|
||||
|
||||
//bool IsUpScanner();
|
||||
|
||||
@ -780,7 +780,7 @@ void ScannerCtrl::DispatchDataBlock()
|
||||
|
||||
size_t layerindex = job->GetStartIndex();
|
||||
|
||||
//m_Camera->SetDemandCatpure(true); //wxxtest
|
||||
m_Camera->SetDemandCatpure(true); //wxxtest
|
||||
bool nodebug = !g_isDebug;
|
||||
|
||||
//job->UpdateJobBeanWhenStart();
|
||||
@ -1814,12 +1814,10 @@ void ScannerCtrl::CallFunc(const ReadData& rd) {
|
||||
}
|
||||
|
||||
void ScannerCtrl::SendToClients() {
|
||||
std::shared_lock<std::shared_mutex> lck(m_mtx);
|
||||
|
||||
list<Item> lst;
|
||||
lst.emplace_back(Item{ "IsTestLayerEnable", to_string(IsTestLayerEnable()), iBOOL});
|
||||
lst.emplace_back(Item{ "IsHeatingScannerEnable", to_string(IsHeatingScannerEnable()), iBOOL});
|
||||
lst.emplace_back(Item{ "InitErrorInfos", GetInitErrorInfos(), iSTRING});
|
||||
lst.emplace_back(Item{ "IsTestLayerEnable", to_string(IsTestLayerEnable()), iBOOL });
|
||||
lst.emplace_back(Item{ "IsHeatingScannerEnable", to_string(IsHeatingScannerEnable()), iBOOL });
|
||||
lst.emplace_back(Item{ "InitErrorInfos", GetInitErrorInfos(), iSTRING });
|
||||
int count = m_scan.size();
|
||||
lst.emplace_back(Item{ "ScanCount", to_string(count), iINT});
|
||||
for (int i = 0; i < count; ++i) {
|
||||
@ -1833,6 +1831,5 @@ void ScannerCtrl::SendToClients() {
|
||||
++iter;
|
||||
}
|
||||
|
||||
|
||||
ClientWrapper::Instance()->PushAllClient(WriteData(SCANCTRLPARAM,lst));
|
||||
}
|
||||
@ -74,6 +74,7 @@ public:
|
||||
void SetServoManager(ServoManager* servoManager) { m_ServoManager = servoManager; }
|
||||
|
||||
void StartHeatingMotion();
|
||||
|
||||
void StopHeatingMotion(bool iswait);
|
||||
|
||||
void SetRemoteClient(RemoteClient* rc) { m_RemoteClient = rc; }
|
||||
|
||||
Binary file not shown.
@ -199,8 +199,24 @@ struct PointDefaultTypeInternal {
|
||||
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PointDefaultTypeInternal _Point_default_instance_;
|
||||
template <typename>
|
||||
PROTOBUF_CONSTEXPR RegResponce::RegResponce(::_pbi::ConstantInitialized)
|
||||
: _impl_{
|
||||
/*decltype(_impl_.data_)*/ 0,
|
||||
/*decltype(_impl_._cached_size_)*/ {},
|
||||
} {}
|
||||
struct RegResponceDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR RegResponceDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
|
||||
~RegResponceDefaultTypeInternal() {}
|
||||
union {
|
||||
RegResponce _instance;
|
||||
};
|
||||
};
|
||||
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RegResponceDefaultTypeInternal _RegResponce_default_instance_;
|
||||
} // namespace stream
|
||||
static ::_pb::Metadata file_level_metadata_stream_2eproto[9];
|
||||
static ::_pb::Metadata file_level_metadata_stream_2eproto[10];
|
||||
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_stream_2eproto[1];
|
||||
static constexpr const ::_pb::ServiceDescriptor**
|
||||
file_level_service_descriptors_stream_2eproto = nullptr;
|
||||
@ -309,6 +325,15 @@ const ::uint32_t TableStruct_stream_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE
|
||||
~0u, // no sizeof(Split)
|
||||
PROTOBUF_FIELD_OFFSET(::stream::Point, _impl_.xpos_),
|
||||
PROTOBUF_FIELD_OFFSET(::stream::Point, _impl_.ypos_),
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::stream::RegResponce, _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::RegResponce, _impl_.data_),
|
||||
};
|
||||
|
||||
static const ::_pbi::MigrationSchema
|
||||
@ -322,6 +347,7 @@ static const ::_pbi::MigrationSchema
|
||||
{71, -1, -1, sizeof(::stream::VectorDataBlock)},
|
||||
{83, -1, -1, sizeof(::stream::ChainDataBlock)},
|
||||
{93, -1, -1, sizeof(::stream::Point)},
|
||||
{103, -1, -1, sizeof(::stream::RegResponce)},
|
||||
};
|
||||
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
@ -334,6 +360,7 @@ static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::stream::_VectorDataBlock_default_instance_._instance,
|
||||
&::stream::_ChainDataBlock_default_instance_._instance,
|
||||
&::stream::_Point_default_instance_._instance,
|
||||
&::stream::_RegResponce_default_instance_._instance,
|
||||
};
|
||||
const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
"\n\014stream.proto\022\006stream\032\031google/protobuf/"
|
||||
@ -357,17 +384,18 @@ const char descriptor_table_protodef_stream_2eproto[] PROTOBUF_SECTION_VARIABLE(
|
||||
" \001(\002\022\016\n\006startY\030\002 \001(\002\022\014\n\004endX\030\003 \001(\002\022\014\n\004en"
|
||||
"dY\030\004 \001(\002\"A\n\016ChainDataBlock\022\016\n\006dotNum\030\001 \001"
|
||||
"(\r\022\037\n\010pointVec\030\002 \003(\0132\r.stream.Point\"#\n\005P"
|
||||
"oint\022\014\n\004xPos\030\001 \001(\002\022\014\n\004yPos\030\002 \001(\002*X\n\004TYPE"
|
||||
"\022\t\n\005iBOOL\020\000\022\n\n\006iSHORT\020\001\022\013\n\007iUSHORT\020\002\022\010\n\004"
|
||||
"iINT\020\003\022\t\n\005iUINT\020\004\022\n\n\006iFLOAT\020\005\022\013\n\007iSTRING"
|
||||
"\020\0062\372\001\n\006Stream\0224\n\006Simple\022\023.stream.Request"
|
||||
"Info\032\023.stream.ResponseAny\"\000\022=\n\014ServerStr"
|
||||
"eam\022\023.stream.RequestInfo\032\024.stream.Respon"
|
||||
"seInfo\"\0000\001\022=\n\014ClientStream\022\023.stream.Requ"
|
||||
"estInfo\032\024.stream.ResponseInfo\"\000(\001\022<\n\tAll"
|
||||
"Stream\022\023.stream.RequestInfo\032\024.stream.Res"
|
||||
"ponseInfo\"\000(\0010\001B-\n\027io.grpc.examples.stre"
|
||||
"amB\013StreamProtoP\001\242\002\002STb\006proto3"
|
||||
"oint\022\014\n\004xPos\030\001 \001(\002\022\014\n\004yPos\030\002 \001(\002\"\033\n\013RegR"
|
||||
"esponce\022\014\n\004data\030\001 \001(\005*X\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\005i"
|
||||
"UINT\020\004\022\n\n\006iFLOAT\020\005\022\013\n\007iSTRING\020\0062\372\001\n\006Stre"
|
||||
"am\0224\n\006Simple\022\023.stream.RequestInfo\032\023.stre"
|
||||
"am.ResponseAny\"\000\022=\n\014ServerStream\022\023.strea"
|
||||
"m.RequestInfo\032\024.stream.ResponseInfo\"\0000\001\022"
|
||||
"=\n\014ClientStream\022\023.stream.RequestInfo\032\024.s"
|
||||
"tream.ResponseInfo\"\000(\001\022<\n\tAllStream\022\023.st"
|
||||
"ream.RequestInfo\032\024.stream.ResponseInfo\"\000"
|
||||
"(\0010\001B-\n\027io.grpc.examples.streamB\013StreamP"
|
||||
"rotoP\001\242\002\002STb\006proto3"
|
||||
};
|
||||
static const ::_pbi::DescriptorTable* const descriptor_table_stream_2eproto_deps[1] =
|
||||
{
|
||||
@ -377,13 +405,13 @@ static ::absl::once_flag descriptor_table_stream_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_stream_2eproto = {
|
||||
false,
|
||||
false,
|
||||
1270,
|
||||
1299,
|
||||
descriptor_table_protodef_stream_2eproto,
|
||||
"stream.proto",
|
||||
&descriptor_table_stream_2eproto_once,
|
||||
descriptor_table_stream_2eproto_deps,
|
||||
1,
|
||||
9,
|
||||
10,
|
||||
schemas,
|
||||
file_default_instances,
|
||||
TableStruct_stream_2eproto::offsets,
|
||||
@ -2752,6 +2780,172 @@ void Point::InternalSwap(Point* other) {
|
||||
&descriptor_table_stream_2eproto_getter, &descriptor_table_stream_2eproto_once,
|
||||
file_level_metadata_stream_2eproto[8]);
|
||||
}
|
||||
// ===================================================================
|
||||
|
||||
class RegResponce::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
RegResponce::RegResponce(::google::protobuf::Arena* arena)
|
||||
: ::google::protobuf::Message(arena) {
|
||||
SharedCtor(arena);
|
||||
// @@protoc_insertion_point(arena_constructor:stream.RegResponce)
|
||||
}
|
||||
RegResponce::RegResponce(const RegResponce& from)
|
||||
: ::google::protobuf::Message(), _impl_(from._impl_) {
|
||||
_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
|
||||
from._internal_metadata_);
|
||||
// @@protoc_insertion_point(copy_constructor:stream.RegResponce)
|
||||
}
|
||||
inline void RegResponce::SharedCtor(::_pb::Arena* arena) {
|
||||
(void)arena;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.data_){0},
|
||||
/*decltype(_impl_._cached_size_)*/ {},
|
||||
};
|
||||
}
|
||||
RegResponce::~RegResponce() {
|
||||
// @@protoc_insertion_point(destructor:stream.RegResponce)
|
||||
_internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>();
|
||||
SharedDtor();
|
||||
}
|
||||
inline void RegResponce::SharedDtor() {
|
||||
ABSL_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
}
|
||||
void RegResponce::SetCachedSize(int size) const {
|
||||
_impl_._cached_size_.Set(size);
|
||||
}
|
||||
|
||||
PROTOBUF_NOINLINE void RegResponce::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:stream.RegResponce)
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.data_ = 0;
|
||||
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* RegResponce::_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> RegResponce::_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
|
||||
&_RegResponce_default_instance_._instance,
|
||||
::_pbi::TcParser::GenericFallback, // fallback
|
||||
}, {{
|
||||
// int32 data = 1;
|
||||
{::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(RegResponce, _impl_.data_), 63>(),
|
||||
{8, 63, 0, PROTOBUF_FIELD_OFFSET(RegResponce, _impl_.data_)}},
|
||||
}}, {{
|
||||
65535, 65535
|
||||
}}, {{
|
||||
// int32 data = 1;
|
||||
{PROTOBUF_FIELD_OFFSET(RegResponce, _impl_.data_), 0, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kInt32)},
|
||||
}},
|
||||
// no aux_entries
|
||||
{{
|
||||
}},
|
||||
};
|
||||
|
||||
::uint8_t* RegResponce::_InternalSerialize(
|
||||
::uint8_t* target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:stream.RegResponce)
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void)cached_has_bits;
|
||||
|
||||
// int32 data = 1;
|
||||
if (this->_internal_data() != 0) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::
|
||||
WriteInt32ToArrayWithField<1>(
|
||||
stream, this->_internal_data(), 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.RegResponce)
|
||||
return target;
|
||||
}
|
||||
|
||||
::size_t RegResponce::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:stream.RegResponce)
|
||||
::size_t total_size = 0;
|
||||
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// int32 data = 1;
|
||||
if (this->_internal_data() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(
|
||||
this->_internal_data());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
const ::google::protobuf::Message::ClassData RegResponce::_class_data_ = {
|
||||
::google::protobuf::Message::CopyWithSourceCheck,
|
||||
RegResponce::MergeImpl
|
||||
};
|
||||
const ::google::protobuf::Message::ClassData*RegResponce::GetClassData() const { return &_class_data_; }
|
||||
|
||||
|
||||
void RegResponce::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
|
||||
auto* const _this = static_cast<RegResponce*>(&to_msg);
|
||||
auto& from = static_cast<const RegResponce&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:stream.RegResponce)
|
||||
ABSL_DCHECK_NE(&from, _this);
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_data() != 0) {
|
||||
_this->_internal_set_data(from._internal_data());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void RegResponce::CopyFrom(const RegResponce& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:stream.RegResponce)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
PROTOBUF_NOINLINE bool RegResponce::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void RegResponce::InternalSwap(RegResponce* other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
swap(_impl_.data_, other->_impl_.data_);
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata RegResponce::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_stream_2eproto_getter, &descriptor_table_stream_2eproto_once,
|
||||
file_level_metadata_stream_2eproto[9]);
|
||||
}
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace stream
|
||||
namespace google {
|
||||
|
||||
@ -71,6 +71,9 @@ extern ParamInfoDefaultTypeInternal _ParamInfo_default_instance_;
|
||||
class Point;
|
||||
struct PointDefaultTypeInternal;
|
||||
extern PointDefaultTypeInternal _Point_default_instance_;
|
||||
class RegResponce;
|
||||
struct RegResponceDefaultTypeInternal;
|
||||
extern RegResponceDefaultTypeInternal _RegResponce_default_instance_;
|
||||
class RequestInfo;
|
||||
struct RequestInfoDefaultTypeInternal;
|
||||
extern RequestInfoDefaultTypeInternal _RequestInfo_default_instance_;
|
||||
@ -1875,6 +1878,164 @@ class Point final :
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_stream_2eproto;
|
||||
};// -------------------------------------------------------------------
|
||||
|
||||
class RegResponce final :
|
||||
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:stream.RegResponce) */ {
|
||||
public:
|
||||
inline RegResponce() : RegResponce(nullptr) {}
|
||||
~RegResponce() override;
|
||||
template<typename = void>
|
||||
explicit PROTOBUF_CONSTEXPR RegResponce(::google::protobuf::internal::ConstantInitialized);
|
||||
|
||||
RegResponce(const RegResponce& from);
|
||||
RegResponce(RegResponce&& from) noexcept
|
||||
: RegResponce() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline RegResponce& operator=(const RegResponce& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline RegResponce& operator=(RegResponce&& 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 RegResponce& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const RegResponce* internal_default_instance() {
|
||||
return reinterpret_cast<const RegResponce*>(
|
||||
&_RegResponce_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
9;
|
||||
|
||||
friend void swap(RegResponce& a, RegResponce& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(RegResponce* 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(RegResponce* other) {
|
||||
if (other == this) return;
|
||||
ABSL_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
RegResponce* New(::google::protobuf::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<RegResponce>(arena);
|
||||
}
|
||||
using ::google::protobuf::Message::CopyFrom;
|
||||
void CopyFrom(const RegResponce& from);
|
||||
using ::google::protobuf::Message::MergeFrom;
|
||||
void MergeFrom( const RegResponce& from) {
|
||||
RegResponce::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(RegResponce* other);
|
||||
|
||||
private:
|
||||
friend class ::google::protobuf::internal::AnyMetadata;
|
||||
static ::absl::string_view FullMessageName() {
|
||||
return "stream.RegResponce";
|
||||
}
|
||||
protected:
|
||||
explicit RegResponce(::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,
|
||||
};
|
||||
// int32 data = 1;
|
||||
void clear_data() ;
|
||||
::int32_t data() const;
|
||||
void set_data(::int32_t value);
|
||||
|
||||
private:
|
||||
::int32_t _internal_data() const;
|
||||
void _internal_set_data(::int32_t value);
|
||||
|
||||
public:
|
||||
// @@protoc_insertion_point(class_scope:stream.RegResponce)
|
||||
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_ {
|
||||
::int32_t data_;
|
||||
mutable ::google::protobuf::internal::CachedSize _cached_size_;
|
||||
PROTOBUF_TSAN_DECLARE_MEMBER
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_stream_2eproto;
|
||||
};
|
||||
|
||||
// ===================================================================
|
||||
@ -2891,6 +3052,32 @@ inline void Point::_internal_set_ypos(float value) {
|
||||
_impl_.ypos_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// RegResponce
|
||||
|
||||
// int32 data = 1;
|
||||
inline void RegResponce::clear_data() {
|
||||
_impl_.data_ = 0;
|
||||
}
|
||||
inline ::int32_t RegResponce::data() const {
|
||||
// @@protoc_insertion_point(field_get:stream.RegResponce.data)
|
||||
return _internal_data();
|
||||
}
|
||||
inline void RegResponce::set_data(::int32_t value) {
|
||||
_internal_set_data(value);
|
||||
// @@protoc_insertion_point(field_set:stream.RegResponce.data)
|
||||
}
|
||||
inline ::int32_t RegResponce::_internal_data() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return _impl_.data_;
|
||||
}
|
||||
inline void RegResponce::_internal_set_data(::int32_t value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
;
|
||||
_impl_.data_ = value;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
@ -98,6 +98,10 @@ message Point{
|
||||
float yPos = 2; // Y 位置 : Float //单位 mm
|
||||
}
|
||||
|
||||
//注册功能返回信息
|
||||
message RegResponce{
|
||||
int32 data = 1;
|
||||
}
|
||||
|
||||
|
||||
service Stream {
|
||||
|
||||
@ -37,13 +37,15 @@ DataHandle::~DataHandle() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DataHandle::Init() {
|
||||
m_streamClient = new StreamClient();
|
||||
m_streamClient->SetCallBackFunc(this,&DataHandle::DataCallBackProc);
|
||||
m_streamClient->Init();
|
||||
|
||||
stream::ResponseInfo* response = new stream::ResponseInfo(); //获取一层图层的数据
|
||||
m_streamClient->GetLayerByIndex(1, response);
|
||||
//stream::ResponseInfo* response = new stream::ResponseInfo(); //获取一层图层的数据
|
||||
//m_streamClient->GetLayerByIndex(1, response);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -103,9 +105,10 @@ void DataHandle::Usage() {
|
||||
printf(COLOR_GREEN "print TestClient usage:\n" COLOR_RESET);
|
||||
printf(" 0: " COLOR_YELLOW "print help information...\n" COLOR_RESET);
|
||||
printf(" 1: " COLOR_YELLOW "exit program...\n" COLOR_RESET);
|
||||
printf(" 2: " COLOR_YELLOW "start test all...\n" COLOR_RESET);
|
||||
printf(" 3: " COLOR_YELLOW "start test axis move interface...\n" COLOR_RESET);
|
||||
printf(" 4: " COLOR_YELLOW "start test scan control interface...\n" COLOR_RESET);
|
||||
printf(" 2: " COLOR_YELLOW "test all...\n" COLOR_RESET);
|
||||
printf(" 3: " COLOR_YELLOW "test axis move interface...\n" COLOR_RESET);
|
||||
printf(" 4: " COLOR_YELLOW "test scan control interface...\n" COLOR_RESET);
|
||||
printf(" 5: " COLOR_YELLOW "test registration interface...\n" COLOR_RESET);
|
||||
printf(" 100: " COLOR_YELLOW "start test recv param interface...\n" COLOR_RESET);
|
||||
}
|
||||
|
||||
@ -150,19 +153,56 @@ void DataHandle::ParamReadUsage() {
|
||||
printf(" 34: " COLOR_YELLOW "print scan ctrl state data...\n" COLOR_RESET);
|
||||
printf(" 35: " COLOR_YELLOW "print scan ctrl Param data...\n" COLOR_RESET);
|
||||
printf(" 36: " COLOR_YELLOW "print xy scan state data...\n" COLOR_RESET);
|
||||
|
||||
|
||||
}
|
||||
|
||||
int DataHandle::Request(int index) {
|
||||
int result = 0;
|
||||
|
||||
string userInput;
|
||||
switch (index) {
|
||||
case 0:
|
||||
Usage(); break;
|
||||
case 1:
|
||||
Stop(); break;
|
||||
case 2:
|
||||
AllTest(); break;
|
||||
case 3:
|
||||
AxisMoveTest(); break;
|
||||
case 4:
|
||||
ScanCtrlTest(); break;
|
||||
case 5:
|
||||
RegistrationTest(); break;
|
||||
case 100:
|
||||
ParamReadUsage();
|
||||
while (printf("*请输入命令:") && std::getline(std::cin, userInput)) {
|
||||
if (userInput == "q") {
|
||||
printf("返回上一级...\n"); break;
|
||||
}
|
||||
else if (userInput.empty()) {
|
||||
continue;
|
||||
}
|
||||
else if (userInput == "h") {
|
||||
ParamReadUsage(); continue;
|
||||
}
|
||||
ParamRequest(stoi(userInput));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void DataHandle::AllTest() {
|
||||
AxisMoveTest();
|
||||
ScanCtrlTest();
|
||||
|
||||
RegistrationTest();
|
||||
}
|
||||
|
||||
|
||||
void DataHandle::Request(int index) {
|
||||
void DataHandle::ParamRequest(int index) {
|
||||
if (index == 2) {
|
||||
SetPushMsg(VERSIONREQ); //获取版本信息
|
||||
}
|
||||
@ -221,4 +261,43 @@ void DataHandle::ScanCtrlTest() {
|
||||
Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DataHandle::RegistrationTest(){
|
||||
|
||||
::stream::ResponseAny resp;
|
||||
WriteData wdata;
|
||||
stream::RegResponce result;
|
||||
|
||||
wdata.valueType = iSTRING;
|
||||
wdata.strValue = to_string(time(nullptr));
|
||||
wdata.nameKey = to_string(CHECKREG);
|
||||
wdata.dataType = REGISTFUNC;
|
||||
m_streamClient->Request(wdata,&resp);
|
||||
|
||||
if (resp.data().Is<stream::RegResponce>()) {
|
||||
resp.data().UnpackTo(&result);
|
||||
printf("CHECKREG resp:%d\n", result.data());
|
||||
}
|
||||
Sleep(100);
|
||||
|
||||
wdata.valueType = iSTRING;
|
||||
wdata.strValue = "123456789";
|
||||
wdata.nameKey = to_string(GETSN);
|
||||
m_streamClient->Request(wdata, &resp);
|
||||
if (resp.data().Is<stream::RegResponce>()) {
|
||||
resp.data().UnpackTo(&result);
|
||||
printf("GETSN resp:%u\n", (unsigned int)result.data());
|
||||
}
|
||||
Sleep(100);
|
||||
|
||||
wdata.valueType = iSTRING;
|
||||
wdata.strValue = "regconfig";
|
||||
wdata.nameKey = to_string(CHECKREGKEY);
|
||||
m_streamClient->Request(wdata, &resp);
|
||||
if (resp.data().Is<stream::RegResponce>()) {
|
||||
resp.data().UnpackTo(&result);
|
||||
printf("CHECKREGKEY resp:%d\n", result.data());
|
||||
}
|
||||
}
|
||||
@ -23,10 +23,12 @@ public:
|
||||
|
||||
string GetVersion()const {return m_version;}
|
||||
|
||||
void Request(int index);
|
||||
void ParamRequest(int index);
|
||||
int Request(int index);
|
||||
void AllTest();
|
||||
void AxisMoveTest(); //轴运动测试
|
||||
void ScanCtrlTest(); //扫描控制测试
|
||||
void RegistrationTest(); //注册功能测试
|
||||
|
||||
void Usage();
|
||||
void ParamReadUsage();
|
||||
|
||||
@ -48,4 +48,18 @@ enum SCANCTRLFUNC {
|
||||
STOPHEATINGMOTION,
|
||||
|
||||
END1 //结束标记
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
enum REGFUNC {
|
||||
CHECKREG = 0,
|
||||
GETSN,
|
||||
CHECKREGKEY,
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
REG_SUCCESS = 0,
|
||||
REG_TRIAL,
|
||||
REG_FAIL,
|
||||
} RegType;
|
||||
@ -97,6 +97,7 @@ enum WRITETYPE {
|
||||
RESETELEC, //PowerMeterClient
|
||||
PURIFIERPARAMW, //净化器参数写入
|
||||
LAYERDATAREQ, //layer数据请求
|
||||
REGISTFUNC, //注册函数集
|
||||
|
||||
SETZEROPOS, //AxisState使用
|
||||
AXISSTOPALL, //axis 运动急停
|
||||
|
||||
@ -113,7 +113,7 @@ void StreamClient::AllStream() {
|
||||
}
|
||||
|
||||
|
||||
bool StreamClient::GetLayerByIndex(int index, ::stream::ResponseInfo* response){
|
||||
bool StreamClient::GetLayerByIndex(int index, ::stream::ResponseAny* response){
|
||||
// 初始化 gRPC
|
||||
std::string targetStr = m_localIp + ":" + std::to_string(m_port);
|
||||
std::unique_ptr<Stream::Stub> _stub = Stream::NewStub(grpc::CreateChannel(targetStr, grpc::InsecureChannelCredentials()));
|
||||
@ -125,4 +125,21 @@ bool StreamClient::GetLayerByIndex(int index, ::stream::ResponseInfo* response){
|
||||
request.set_valuetype((stream::TYPE)iINT);
|
||||
Status status = _stub->Simple(&context, request, response);
|
||||
return status.ok();
|
||||
}
|
||||
|
||||
|
||||
int StreamClient::Request(const WriteData& writeData , ::stream::ResponseAny* response) {
|
||||
// 初始化 gRPC
|
||||
std::string targetStr = m_localIp + ":" + std::to_string(m_port);
|
||||
std::unique_ptr<Stream::Stub> _stub = Stream::NewStub(grpc::CreateChannel(targetStr, grpc::InsecureChannelCredentials()));
|
||||
|
||||
ClientContext context;
|
||||
::stream::RequestInfo request;
|
||||
request.set_datatype(REGISTFUNC);
|
||||
request.set_namekey(writeData.nameKey);
|
||||
request.set_strvalue(writeData.strValue);
|
||||
request.set_valuetype((stream::TYPE)iSTRING);
|
||||
Status status = _stub->Simple(&context, request, response);
|
||||
return status.ok();
|
||||
|
||||
}
|
||||
@ -32,7 +32,9 @@ public:
|
||||
}
|
||||
|
||||
void SetPushMsg(const WriteData& msg);
|
||||
bool GetLayerByIndex(int index, ::stream::ResponseInfo* response);
|
||||
bool GetLayerByIndex(int index, ::stream::ResponseAny* response);
|
||||
int RegistRequest(const WriteData& writeData, ::stream::ResponseAny* response);
|
||||
int Request(const WriteData& writeData, ::stream::ResponseAny* response);
|
||||
private:
|
||||
bool GetPushMsg(WriteData& msg);
|
||||
|
||||
|
||||
@ -74,9 +74,6 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="protobuf\stream.grpc.pb.cc">
|
||||
<Filter>protobuf</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="protobuf\stream.pb.cc">
|
||||
<Filter>protobuf</Filter>
|
||||
</ClCompile>
|
||||
@ -260,6 +257,9 @@
|
||||
<ClCompile Include="config\bean\HbdLanguage.cpp">
|
||||
<Filter>config\bean</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="protobuf\stream.grpc.pb.cc">
|
||||
<Filter>protobuf</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="protobuf\stream.grpc.pb.h">
|
||||
|
||||
@ -73,39 +73,9 @@ int main(int argc, char** argv) {
|
||||
if (!unknowCmd)printf("*请输入命令:");
|
||||
std::getline(std::cin, userInput); // 读取用户输入
|
||||
unknowCmd = false;
|
||||
if (userInput == "0") {
|
||||
dataHandle->Usage();
|
||||
}
|
||||
else if (userInput == "1") {
|
||||
printf("service is exiting...\n");
|
||||
dataHandle->Stop();
|
||||
break;
|
||||
}
|
||||
else if (userInput == "2") {
|
||||
dataHandle->AllTest();
|
||||
}
|
||||
else if (userInput == "3") {
|
||||
dataHandle->AxisMoveTest();
|
||||
}
|
||||
else if (userInput == "4") {
|
||||
dataHandle->ScanCtrlTest();
|
||||
}
|
||||
else if (userInput == "100") {
|
||||
dataHandle->ParamReadUsage();
|
||||
while (printf("*请输入命令:") && std::getline(std::cin, userInput)) {
|
||||
if (userInput == "q") {
|
||||
printf("返回上一级...\n"); break;
|
||||
}
|
||||
else if (userInput.empty()) {
|
||||
continue;
|
||||
}
|
||||
else if (userInput == "h") {
|
||||
dataHandle->ParamReadUsage(); continue;
|
||||
}
|
||||
dataHandle->Request(stoi(userInput));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (userInput.empty()) continue;
|
||||
|
||||
if(dataHandle->Request(stoi(userInput)) < 0){
|
||||
printf("未识别的命令,请重新输入命令:");
|
||||
unknowCmd = true;
|
||||
}
|
||||
|
||||
@ -41,23 +41,23 @@ Stream::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, co
|
||||
, rpcmethod_AllStream_(Stream_method_names[3], options.suffix_for_stats(),::grpc::internal::RpcMethod::BIDI_STREAMING, channel)
|
||||
{}
|
||||
|
||||
::grpc::Status Stream::Stub::Simple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::stream::ResponseInfo* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::stream::RequestInfo, ::stream::ResponseInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Simple_, context, request, response);
|
||||
::grpc::Status Stream::Stub::Simple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::stream::ResponseAny* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::stream::RequestInfo, ::stream::ResponseAny, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Simple_, context, request, response);
|
||||
}
|
||||
|
||||
void Stream::Stub::async::Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::stream::RequestInfo, ::stream::ResponseInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Simple_, context, request, response, std::move(f));
|
||||
void Stream::Stub::async::Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::stream::RequestInfo, ::stream::ResponseAny, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Simple_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void Stream::Stub::async::Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
void Stream::Stub::async::Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Simple_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>* Stream::Stub::PrepareAsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::stream::ResponseInfo, ::stream::RequestInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Simple_, context, request);
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>* Stream::Stub::PrepareAsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::stream::ResponseAny, ::stream::RequestInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Simple_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>* Stream::Stub::AsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>* Stream::Stub::AsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncSimpleRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
@ -116,11 +116,11 @@ Stream::Service::Service() {
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
Stream_method_names[0],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< Stream::Service, ::stream::RequestInfo, ::stream::ResponseInfo, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
new ::grpc::internal::RpcMethodHandler< Stream::Service, ::stream::RequestInfo, ::stream::ResponseAny, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](Stream::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::stream::RequestInfo* req,
|
||||
::stream::ResponseInfo* resp) {
|
||||
::stream::ResponseAny* resp) {
|
||||
return service->Simple(ctx, req, resp);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
@ -158,7 +158,7 @@ Stream::Service::Service() {
|
||||
Stream::Service::~Service() {
|
||||
}
|
||||
|
||||
::grpc::Status Stream::Service::Simple(::grpc::ServerContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response) {
|
||||
::grpc::Status Stream::Service::Simple(::grpc::ServerContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
|
||||
@ -37,12 +37,12 @@ class Stream final {
|
||||
class StubInterface {
|
||||
public:
|
||||
virtual ~StubInterface() {}
|
||||
virtual ::grpc::Status Simple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::stream::ResponseInfo* response) = 0;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseInfo>> AsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseInfo>>(AsyncSimpleRaw(context, request, cq));
|
||||
virtual ::grpc::Status Simple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::stream::ResponseAny* response) = 0;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseAny>> AsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseAny>>(AsyncSimpleRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseInfo>> PrepareAsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseInfo>>(PrepareAsyncSimpleRaw(context, request, cq));
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseAny>> PrepareAsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseAny>>(PrepareAsyncSimpleRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientReaderInterface< ::stream::ResponseInfo>> ServerStream(::grpc::ClientContext* context, const ::stream::RequestInfo& request) {
|
||||
return std::unique_ptr< ::grpc::ClientReaderInterface< ::stream::ResponseInfo>>(ServerStreamRaw(context, request));
|
||||
@ -74,8 +74,8 @@ class Stream final {
|
||||
class async_interface {
|
||||
public:
|
||||
virtual ~async_interface() {}
|
||||
virtual void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response, std::function<void(::grpc::Status)>) = 0;
|
||||
virtual void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response, ::grpc::ClientUnaryReactor* reactor) = 0;
|
||||
virtual void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response, std::function<void(::grpc::Status)>) = 0;
|
||||
virtual void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response, ::grpc::ClientUnaryReactor* reactor) = 0;
|
||||
virtual void ServerStream(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::grpc::ClientReadReactor< ::stream::ResponseInfo>* reactor) = 0;
|
||||
virtual void ClientStream(::grpc::ClientContext* context, ::stream::ResponseInfo* response, ::grpc::ClientWriteReactor< ::stream::RequestInfo>* reactor) = 0;
|
||||
virtual void AllStream(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::stream::RequestInfo,::stream::ResponseInfo>* reactor) = 0;
|
||||
@ -84,8 +84,8 @@ class Stream final {
|
||||
virtual class async_interface* async() { return nullptr; }
|
||||
class async_interface* experimental_async() { return async(); }
|
||||
private:
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseInfo>* AsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseInfo>* PrepareAsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseAny>* AsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stream::ResponseAny>* PrepareAsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientReaderInterface< ::stream::ResponseInfo>* ServerStreamRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< ::stream::ResponseInfo>* AsyncServerStreamRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< ::stream::ResponseInfo>* PrepareAsyncServerStreamRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
@ -99,12 +99,12 @@ class Stream final {
|
||||
class Stub final : public StubInterface {
|
||||
public:
|
||||
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
|
||||
::grpc::Status Simple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::stream::ResponseInfo* response) override;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>> AsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>>(AsyncSimpleRaw(context, request, cq));
|
||||
::grpc::Status Simple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::stream::ResponseAny* response) override;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>> AsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>>(AsyncSimpleRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>> PrepareAsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>>(PrepareAsyncSimpleRaw(context, request, cq));
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>> PrepareAsyncSimple(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>>(PrepareAsyncSimpleRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientReader< ::stream::ResponseInfo>> ServerStream(::grpc::ClientContext* context, const ::stream::RequestInfo& request) {
|
||||
return std::unique_ptr< ::grpc::ClientReader< ::stream::ResponseInfo>>(ServerStreamRaw(context, request));
|
||||
@ -136,8 +136,8 @@ class Stream final {
|
||||
class async final :
|
||||
public StubInterface::async_interface {
|
||||
public:
|
||||
void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response, std::function<void(::grpc::Status)>) override;
|
||||
void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response, ::grpc::ClientUnaryReactor* reactor) override;
|
||||
void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response, std::function<void(::grpc::Status)>) override;
|
||||
void Simple(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response, ::grpc::ClientUnaryReactor* reactor) override;
|
||||
void ServerStream(::grpc::ClientContext* context, const ::stream::RequestInfo* request, ::grpc::ClientReadReactor< ::stream::ResponseInfo>* reactor) override;
|
||||
void ClientStream(::grpc::ClientContext* context, ::stream::ResponseInfo* response, ::grpc::ClientWriteReactor< ::stream::RequestInfo>* reactor) override;
|
||||
void AllStream(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::stream::RequestInfo,::stream::ResponseInfo>* reactor) override;
|
||||
@ -152,8 +152,8 @@ class Stream final {
|
||||
private:
|
||||
std::shared_ptr< ::grpc::ChannelInterface> channel_;
|
||||
class async async_stub_{this};
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>* AsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseInfo>* PrepareAsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>* AsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::stream::ResponseAny>* PrepareAsyncSimpleRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientReader< ::stream::ResponseInfo>* ServerStreamRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request) override;
|
||||
::grpc::ClientAsyncReader< ::stream::ResponseInfo>* AsyncServerStreamRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq, void* tag) override;
|
||||
::grpc::ClientAsyncReader< ::stream::ResponseInfo>* PrepareAsyncServerStreamRaw(::grpc::ClientContext* context, const ::stream::RequestInfo& request, ::grpc::CompletionQueue* cq) override;
|
||||
@ -174,7 +174,7 @@ class Stream final {
|
||||
public:
|
||||
Service();
|
||||
virtual ~Service();
|
||||
virtual ::grpc::Status Simple(::grpc::ServerContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response);
|
||||
virtual ::grpc::Status Simple(::grpc::ServerContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response);
|
||||
virtual ::grpc::Status ServerStream(::grpc::ServerContext* context, const ::stream::RequestInfo* request, ::grpc::ServerWriter< ::stream::ResponseInfo>* writer);
|
||||
virtual ::grpc::Status ClientStream(::grpc::ServerContext* context, ::grpc::ServerReader< ::stream::RequestInfo>* reader, ::stream::ResponseInfo* response);
|
||||
virtual ::grpc::Status AllStream(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::stream::ResponseInfo, ::stream::RequestInfo>* stream);
|
||||
@ -191,11 +191,11 @@ class Stream final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseInfo* /*response*/) override {
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseAny* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
void RequestSimple(::grpc::ServerContext* context, ::stream::RequestInfo* request, ::grpc::ServerAsyncResponseWriter< ::stream::ResponseInfo>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
void RequestSimple(::grpc::ServerContext* context, ::stream::RequestInfo* request, ::grpc::ServerAsyncResponseWriter< ::stream::ResponseAny>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
|
||||
}
|
||||
};
|
||||
@ -267,25 +267,25 @@ class Stream final {
|
||||
public:
|
||||
WithCallbackMethod_Simple() {
|
||||
::grpc::Service::MarkMethodCallback(0,
|
||||
new ::grpc::internal::CallbackUnaryHandler< ::stream::RequestInfo, ::stream::ResponseInfo>(
|
||||
new ::grpc::internal::CallbackUnaryHandler< ::stream::RequestInfo, ::stream::ResponseAny>(
|
||||
[this](
|
||||
::grpc::CallbackServerContext* context, const ::stream::RequestInfo* request, ::stream::ResponseInfo* response) { return this->Simple(context, request, response); }));}
|
||||
::grpc::CallbackServerContext* context, const ::stream::RequestInfo* request, ::stream::ResponseAny* response) { return this->Simple(context, request, response); }));}
|
||||
void SetMessageAllocatorFor_Simple(
|
||||
::grpc::MessageAllocator< ::stream::RequestInfo, ::stream::ResponseInfo>* allocator) {
|
||||
::grpc::MessageAllocator< ::stream::RequestInfo, ::stream::ResponseAny>* allocator) {
|
||||
::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0);
|
||||
static_cast<::grpc::internal::CallbackUnaryHandler< ::stream::RequestInfo, ::stream::ResponseInfo>*>(handler)
|
||||
static_cast<::grpc::internal::CallbackUnaryHandler< ::stream::RequestInfo, ::stream::ResponseAny>*>(handler)
|
||||
->SetMessageAllocator(allocator);
|
||||
}
|
||||
~WithCallbackMethod_Simple() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseInfo* /*response*/) override {
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseAny* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
virtual ::grpc::ServerUnaryReactor* Simple(
|
||||
::grpc::CallbackServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseInfo* /*response*/) { return nullptr; }
|
||||
::grpc::CallbackServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseAny* /*response*/) { return nullptr; }
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithCallbackMethod_ServerStream : public BaseClass {
|
||||
@ -368,7 +368,7 @@ class Stream final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseInfo* /*response*/) override {
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseAny* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
@ -436,7 +436,7 @@ class Stream final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseInfo* /*response*/) override {
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseAny* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
@ -519,7 +519,7 @@ class Stream final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseInfo* /*response*/) override {
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseAny* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
@ -601,10 +601,10 @@ class Stream final {
|
||||
WithStreamedUnaryMethod_Simple() {
|
||||
::grpc::Service::MarkMethodStreamed(0,
|
||||
new ::grpc::internal::StreamedUnaryHandler<
|
||||
::stream::RequestInfo, ::stream::ResponseInfo>(
|
||||
::stream::RequestInfo, ::stream::ResponseAny>(
|
||||
[this](::grpc::ServerContext* context,
|
||||
::grpc::ServerUnaryStreamer<
|
||||
::stream::RequestInfo, ::stream::ResponseInfo>* streamer) {
|
||||
::stream::RequestInfo, ::stream::ResponseAny>* streamer) {
|
||||
return this->StreamedSimple(context,
|
||||
streamer);
|
||||
}));
|
||||
@ -613,12 +613,12 @@ class Stream final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable regular version of this method
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseInfo* /*response*/) override {
|
||||
::grpc::Status Simple(::grpc::ServerContext* /*context*/, const ::stream::RequestInfo* /*request*/, ::stream::ResponseAny* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
// replace default version of method with streamed unary
|
||||
virtual ::grpc::Status StreamedSimple(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::stream::RequestInfo,::stream::ResponseInfo>* server_unary_streamer) = 0;
|
||||
virtual ::grpc::Status StreamedSimple(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::stream::RequestInfo,::stream::ResponseAny>* server_unary_streamer) = 0;
|
||||
};
|
||||
typedef WithStreamedUnaryMethod_Simple<Service > StreamedUnaryService;
|
||||
template <class BaseClass>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,11 @@
|
||||
//bytes替代string 防止乱码
|
||||
syntax = "proto3";
|
||||
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
package stream;
|
||||
|
||||
|
||||
//ption cc_generic_services = true;
|
||||
option java_multiple_files = true;
|
||||
option java_package = "io.grpc.examples.stream";
|
||||
@ -19,9 +22,12 @@ enum TYPE{
|
||||
iSTRING = 6;
|
||||
}
|
||||
|
||||
/*==================begin 通用通信结构体====================*/
|
||||
|
||||
message ParamInfo{
|
||||
bytes nameKey = 1; //参数key
|
||||
bytes strValue = 2; //value
|
||||
//bool isOutput = 2; //是否只读
|
||||
TYPE valueType = 3; //数据类型
|
||||
}
|
||||
|
||||
@ -39,9 +45,67 @@ message ResponseInfo {
|
||||
repeated ParamInfo item = 3; //参数值
|
||||
}
|
||||
|
||||
/*==================end 通用通信结构体====================*/
|
||||
|
||||
message ResponseAny{
|
||||
google.protobuf.Any data = 1;
|
||||
}
|
||||
|
||||
/*==================begin h3d图层结构体===================*/
|
||||
message LayerData{
|
||||
|
||||
float zCooldinate = 1; // Z 坐标 : Float 单位 mm
|
||||
float powder = 2; // 供粉量: Float 单位 mm
|
||||
float layerThickness = 3; //层厚
|
||||
//LayerSummary layerSummary = 3; // 层统计区() : Struct
|
||||
//uint32 layerBlock = 5; //层块数 决定多少个层块数据库
|
||||
repeated LayerDataBlock layerDataBlock = 4; //层块数据区
|
||||
|
||||
bool result = 5; //是否ok
|
||||
}
|
||||
|
||||
|
||||
message LayerDataBlock
|
||||
{
|
||||
int32 elementId = 1; // 零件 ID : Int32
|
||||
int32 elementParamId = 2; // 零件参数 ID : Int32
|
||||
//DataBlockSummary dbSummary = 3; //块统计区 : Struct
|
||||
//uint32 blockNum = 4; // 块数据数: Uint32 //决定有多少个块数据区
|
||||
|
||||
uint32 blockType = 3; // 块类型: Char //1 代表向量型数据块,3 代表链型数据块
|
||||
repeated VectorDataBlock vecBlocks= 4; //块数据区 向量型
|
||||
repeated ChainDataBlock chainBlocks = 5; //块数据区 链型
|
||||
uint32 order = 6;
|
||||
}
|
||||
|
||||
|
||||
message VectorDataBlock{
|
||||
float startX = 1; // 始点 X 位置 : Float //单位 mm
|
||||
float startY=2; // 始点 Y 位置 : Float //单位 mm
|
||||
float endX = 3; // 终点 X 位置 : Float //单位 mm
|
||||
float endY = 4; // 终点 Y 位置 : Float //单位 mm
|
||||
}
|
||||
|
||||
|
||||
message ChainDataBlock
|
||||
{
|
||||
uint32 dotNum = 1; // 点数:Uint32 //决定有多少个点区
|
||||
repeated Point pointVec = 2; // 点区
|
||||
}
|
||||
|
||||
message Point{
|
||||
float xPos = 1; // X 位置 : Float //单位 mm
|
||||
float yPos = 2; // Y 位置 : Float //单位 mm
|
||||
}
|
||||
|
||||
//注册功能返回信息
|
||||
message RegResponce{
|
||||
int32 data = 1;
|
||||
}
|
||||
|
||||
|
||||
service Stream {
|
||||
rpc Simple(RequestInfo) returns (ResponseInfo) {} // 简单模式
|
||||
rpc Simple(RequestInfo) returns (ResponseAny) {} // 简单模式
|
||||
rpc ServerStream (RequestInfo) returns (stream ResponseInfo) {} // 服务端数据流模式
|
||||
rpc ClientStream (stream RequestInfo) returns (ResponseInfo) {} // 客户端数据流模式
|
||||
rpc AllStream (stream RequestInfo) returns (stream ResponseInfo) {} // 双向数据流模式
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user