|
@@ -53,9 +53,20 @@ if(gobj.SerializeToArray(str,nsize))
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
|
|
+**3. 直接发送proto消息**
|
|
|
|
+
|
|
|
|
+包含头文件
|
|
|
|
+
|
|
|
|
+#include "modulecommext.h"
|
|
|
|
+
|
|
|
|
+ mpa = new iv::modulecommext::modulecommmsg<iv::testmodulecommext>();
|
|
|
|
+
|
|
|
|
+ mpa->RegisterSend("test");
|
|
|
|
+
|
|
|
|
+
|
|
## 接收端
|
|
## 接收端
|
|
|
|
|
|
-**从共享内中读取数据**
|
|
|
|
|
|
+**1. 传统模式**
|
|
|
|
|
|
工程配置文件中添加配置信息:
|
|
工程配置文件中添加配置信息:
|
|
|
|
|
|
@@ -88,3 +99,26 @@ void listen(const char * strdata,const unsigned int nSize,const unsigned int ind
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
|
|
+
|
|
|
|
+**2. 直接接收proto消息**
|
|
|
|
+
|
|
|
|
+包含头文件
|
|
|
|
+
|
|
|
|
+#include "modulecommext.h"
|
|
|
|
+
|
|
|
|
+ mpa = new iv::modulecommext::modulecommmsg<iv::testmodulecommext>();
|
|
|
|
+ ModuleExtFun funext = std::bind(&testinteriorrecv::ListenMsg,this,std::placeholders::_1);
|
|
|
|
+ mpa->RegisterRecvPlus("test");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void testinteriorrecv::ListenMsg(google::protobuf::Message &xmsg)
|
|
|
|
+{
|
|
|
|
+ iv::testmodulecommext xdata;
|
|
|
|
+ xdata.CopyFrom(xmsg);
|
|
|
|
+ qDebug("Inter: %lld",xdata.time());
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|