|
@@ -9,14 +9,20 @@ DialogViewMessage::DialogViewMessage(std::string strmsgname,QWidget *parent) :
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
+ InitMsgType();
|
|
|
mstrmsgname = strmsgname;
|
|
|
|
|
|
- mpa = new iv::modulecommext::modulecommmsg<iv::testmodulecommext>();
|
|
|
+// mpa = new iv::modulecommext::modulecommmsg<iv::testmodulecommext>();
|
|
|
|
|
|
- ModuleExtFun funext = std::bind(&DialogViewMessage::UpdateMsg,this,std::placeholders::_1);
|
|
|
- mpa->RegisterRecvPlus(strmsgname.data(),funext);
|
|
|
+// ModuleExtFun funext = std::bind(&DialogViewMessage::UpdateMsg,this,std::placeholders::_1);
|
|
|
+// mpa->RegisterRecvPlus(strmsgname.data(),funext);
|
|
|
iv::testmodulecommext x;
|
|
|
|
|
|
+ ModuleFun funraw = std::bind(&DialogViewMessage::UpdateRawMsg,this,std::placeholders::_1,
|
|
|
+ std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,
|
|
|
+ std::placeholders::_5);
|
|
|
+ mparaw = iv::modulecomm::RegisterRecvPlus(strmsgname.data(),funraw);
|
|
|
+
|
|
|
::google::protobuf::Message * px = &x;
|
|
|
px->GetTypeName();
|
|
|
|
|
@@ -53,3 +59,25 @@ void DialogViewMessage::UpdateMsg(google::protobuf::Message &xmsg)
|
|
|
qDebug("update");
|
|
|
emit msgupdate();
|
|
|
}
|
|
|
+
|
|
|
+void DialogViewMessage::UpdateRawMsg(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
+{
|
|
|
+ char * strxdata = new char[nSize];
|
|
|
+ memcpy(strxdata,strdata,nSize);
|
|
|
+ if(mvectorprob.size() == 0)
|
|
|
+ {
|
|
|
+ mvectorprob = GetProbProtoIndex(strxdata,nSize,mvectorprobname);
|
|
|
+ }
|
|
|
+
|
|
|
+ qDebug("prob size is %d ",mvectorprob.size());
|
|
|
+ if(mvectorprob.size() > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ std::shared_ptr<google::protobuf::Message> msg_ptr = GetProtoMessage(strxdata,nSize,mvectorprob[0]);
|
|
|
+ if(msg_ptr != NULL)
|
|
|
+ {
|
|
|
+ qDebug("parse ok.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ delete strxdata;
|
|
|
+}
|