Browse Source

changing modulecomm.

yuchuli 2 years ago
parent
commit
dc991b652f
3 changed files with 144 additions and 0 deletions
  1. 73 0
      src/test/testmodule2/.gitignore
  2. 49 0
      src/test/testmodule2/main.cpp
  3. 22 0
      src/test/testmodule2/testmodule2.pro

+ 73 - 0
src/test/testmodule2/.gitignore

@@ -0,0 +1,73 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+.directory
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+

+ 49 - 0
src/test/testmodule2/main.cpp

@@ -0,0 +1,49 @@
+#include <QCoreApplication>
+
+
+#include "modulecomm.h"
+
+#include <thread>
+
+void threadsend(void * pa)
+{
+    while(1)
+    {
+        char str[1000];
+        iv::modulecomm::ModuleSendMsg(pa,str,30);
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+    }
+}
+
+void ListenPointCloud(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+      qDebug("%lld recv %s ",QDateTime::currentMSecsSinceEpoch(),strmemname);
+}
+
+int main(int argc, char *argv[])
+{
+    QCoreApplication a(argc, argv);
+
+    void * pa1,*pa2,*pa3,*pa4,*pa5;
+    void * pb1,*pb2,*pb3,*pb4,*pb5;
+
+    pa1 = iv::modulecomm::RegisterSend("a1",100,1);
+    pa2 = iv::modulecomm::RegisterSend("a2",1000,1);
+    pa3 = iv::modulecomm::RegisterSend("a3",10000,1);
+    pa4 = iv::modulecomm::RegisterSend("a4",100000,1);
+    pa5 = iv::modulecomm::RegisterSend("a6",1000000,1);
+
+    pb1 = iv::modulecomm::RegisterRecv("b1",ListenPointCloud);
+    pb2 = iv::modulecomm::RegisterRecv("b2",ListenPointCloud);
+    pb3 = iv::modulecomm::RegisterRecv("b3",ListenPointCloud);
+    pb4 = iv::modulecomm::RegisterRecv("b4",ListenPointCloud);
+    pb5 = iv::modulecomm::RegisterRecv("b6",ListenPointCloud);
+
+    std::thread * pthread1 = new std::thread(threadsend,pa1);
+    std::thread * pthread2 = new std::thread(threadsend,pa2);
+    std::thread * pthread3 = new std::thread(threadsend,pa3);
+    std::thread * pthread4 = new std::thread(threadsend,pa4);
+    std::thread * pthread5 = new std::thread(threadsend,pa5);
+
+    return a.exec();
+}

+ 22 - 0
src/test/testmodule2/testmodule2.pro

@@ -0,0 +1,22 @@
+QT -= gui
+
+CONFIG += c++11 console
+CONFIG -= app_bundle
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += main.cpp
+
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}