|
@@ -0,0 +1,58 @@
|
|
|
+#include <QCoreApplication>
|
|
|
+
|
|
|
+#include <thread>
|
|
|
+#include <memory>
|
|
|
+
|
|
|
+#include "fusionobjectarray.pb.h"
|
|
|
+
|
|
|
+
|
|
|
+#include "modulecomm.h"
|
|
|
+
|
|
|
+void * gpa;
|
|
|
+
|
|
|
+void sharemsg()
|
|
|
+{
|
|
|
+ iv::fusion::fusionobjectarray xfusion;
|
|
|
+ iv::fusion::fusionobject * pobj = xfusion.add_obj();
|
|
|
+
|
|
|
+ int i,j;
|
|
|
+ for(i=0;i<200;i++)
|
|
|
+ {
|
|
|
+ for(j=0;j<100;j++)
|
|
|
+ {
|
|
|
+ double x,y;
|
|
|
+ x = i*0.2 ;
|
|
|
+ y = j*0.2 + 10.0;
|
|
|
+ iv::fusion::NomalXYZ * ppoint = pobj->add_nomal_centroid();
|
|
|
+ ppoint->set_nomal_x(x);
|
|
|
+ ppoint->set_nomal_y(y);
|
|
|
+ ppoint->set_nomal_z(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int nbytesize = xfusion.ByteSize();
|
|
|
+ std::shared_ptr<char> pstr_prt = std::shared_ptr<char>(new char[nbytesize]);
|
|
|
+ if(xfusion.SerializeToArray(pstr_prt.get(),nbytesize))
|
|
|
+ {
|
|
|
+ iv::modulecomm::ModuleSendMsg(gpa,pstr_prt.get(),nbytesize);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void threadshare()
|
|
|
+{
|
|
|
+ gpa = iv::modulecomm::RegisterSend("li_ra_fusion",10000000,1);
|
|
|
+ while(1)
|
|
|
+ {
|
|
|
+ sharemsg();
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int main(int argc, char *argv[])
|
|
|
+{
|
|
|
+ QCoreApplication a(argc, argv);
|
|
|
+
|
|
|
+ std::thread * pthread = new std::thread(threadshare);
|
|
|
+
|
|
|
+ return a.exec();
|
|
|
+}
|