3 Commits d4ea20c78e ... 9599cd0462

Author SHA1 Message Date
  Qiuyang 9599cd0462 Merged 2 months ago
  Qiuyang 9974483cf5 seperate test folder 2 months ago
  qiuyang 83e8e311d2 Add hepu test files 2 months ago
100 changed files with 710 additions and 1 deletions
  1. 0 0
      3rdparty/CSerialPort/SerialPort.h
  2. 0 0
      3rdparty/CSerialPort/SerialPortBase.h
  3. 0 0
      3rdparty/CSerialPort/SerialPortInfo.h
  4. 0 0
      3rdparty/CSerialPort/SerialPortInfoBase.h
  5. 0 0
      3rdparty/CSerialPort/SerialPortInfoUnixBase.h
  6. 0 0
      3rdparty/CSerialPort/SerialPortUnixBase.h
  7. 0 0
      3rdparty/CSerialPort/SerialPort_global.h
  8. 0 0
      3rdparty/CSerialPort/osplatformutil.h
  9. 0 0
      3rdparty/CSerialPort/sigslot.h
  10. 0 0
      3rdparty/rapidjson/allocators.h
  11. 0 0
      3rdparty/rapidjson/cursorstreamwrapper.h
  12. 0 0
      3rdparty/rapidjson/document.h
  13. 0 0
      3rdparty/rapidjson/encodedstream.h
  14. 0 0
      3rdparty/rapidjson/encodings.h
  15. 0 0
      3rdparty/rapidjson/error/en.h
  16. 0 0
      3rdparty/rapidjson/error/error.h
  17. 0 0
      3rdparty/rapidjson/filereadstream.h
  18. 0 0
      3rdparty/rapidjson/filewritestream.h
  19. 0 0
      3rdparty/rapidjson/fwd.h
  20. 0 0
      3rdparty/rapidjson/internal/biginteger.h
  21. 0 0
      3rdparty/rapidjson/internal/diyfp.h
  22. 0 0
      3rdparty/rapidjson/internal/dtoa.h
  23. 0 0
      3rdparty/rapidjson/internal/ieee754.h
  24. 0 0
      3rdparty/rapidjson/internal/itoa.h
  25. 0 0
      3rdparty/rapidjson/internal/meta.h
  26. 0 0
      3rdparty/rapidjson/internal/pow10.h
  27. 0 0
      3rdparty/rapidjson/internal/regex.h
  28. 0 0
      3rdparty/rapidjson/internal/stack.h
  29. 0 0
      3rdparty/rapidjson/internal/strfunc.h
  30. 0 0
      3rdparty/rapidjson/internal/strtod.h
  31. 0 0
      3rdparty/rapidjson/internal/swap.h
  32. 0 0
      3rdparty/rapidjson/istreamwrapper.h
  33. 0 0
      3rdparty/rapidjson/memorybuffer.h
  34. 0 0
      3rdparty/rapidjson/memorystream.h
  35. 0 0
      3rdparty/rapidjson/msinttypes/inttypes.h
  36. 0 0
      3rdparty/rapidjson/msinttypes/stdint.h
  37. 0 0
      3rdparty/rapidjson/ostreamwrapper.h
  38. 0 0
      3rdparty/rapidjson/pointer.h
  39. 0 0
      3rdparty/rapidjson/prettywriter.h
  40. 0 0
      3rdparty/rapidjson/rapidjson.h
  41. 0 0
      3rdparty/rapidjson/reader.h
  42. 0 0
      3rdparty/rapidjson/schema.h
  43. 0 0
      3rdparty/rapidjson/stream.h
  44. 0 0
      3rdparty/rapidjson/stringbuffer.h
  45. 0 0
      3rdparty/rapidjson/writer.h
  46. 0 0
      3rdparty/rdkafka/include/rdkafka.h
  47. 0 0
      3rdparty/rdkafka/include/rdkafkacpp.h
  48. 0 0
      3rdparty/rdkafka/lib/librdkafka++.a
  49. 0 0
      3rdparty/rdkafka/lib/librdkafka++.so
  50. 0 0
      3rdparty/rdkafka/lib/librdkafka++.so.1
  51. 0 0
      3rdparty/rdkafka/lib/librdkafka.a
  52. 0 0
      3rdparty/rdkafka/lib/librdkafka.so
  53. 0 0
      3rdparty/rdkafka/lib/librdkafka.so.1
  54. 4 0
      CMakeLists.txt
  55. 0 0
      framework/request/include/BasicConfig.h
  56. 0 0
      framework/request/include/CNStreamInferData.h
  57. 0 0
      framework/request/include/DeviceInfo.h
  58. 0 0
      framework/request/include/ExpelDevice.h
  59. 0 0
      framework/request/include/FrameInferData.h
  60. 71 0
      framework/request/include/HepuHB.h
  61. 48 0
      framework/request/include/HepuHBRe.h
  62. 91 0
      framework/request/include/HepuLogin.h
  63. 55 0
      framework/request/include/HepuLoginRe.h
  64. 150 0
      framework/request/include/HepuTarget.h
  65. 62 0
      framework/request/include/HepuTargetRe.h
  66. 0 0
      framework/request/include/HistoryVideo.h
  67. 0 0
      framework/request/include/HttpNull.hpp
  68. 0 0
      framework/request/include/HttpResultMsg.hpp
  69. 0 0
      framework/request/include/HttpToken.hpp
  70. 0 0
      framework/request/include/NettyClientCommandEnum.h
  71. 0 0
      framework/request/include/NettyClientResultMsg.h
  72. 0 0
      framework/request/include/NettyExpelDevInfo.h
  73. 0 0
      framework/request/include/NettyHttpDicCode.h
  74. 0 0
      framework/request/include/NettyHttpNull.h
  75. 0 0
      framework/request/include/NettyHttpResultMsg.h
  76. 0 0
      framework/request/include/NettyHttpToken.h
  77. 0 0
      framework/request/include/NettyServerCommandEnum.h
  78. 0 0
      framework/request/include/NettyServerResultMsg.h
  79. 0 0
      framework/request/include/Notices.h
  80. 0 0
      framework/request/include/PlayerControl.h
  81. 0 0
      framework/request/include/PlayerDeviceList.h
  82. 0 0
      framework/request/include/PlayerLogin.h
  83. 0 0
      framework/request/include/PlayerLogout.h
  84. 0 0
      framework/request/include/PlayerStatus.h
  85. 0 0
      framework/request/include/RecDeviceCommand.h
  86. 0 0
      framework/request/include/RecLoginMsg.h
  87. 0 0
      framework/request/include/RequestBase.hpp
  88. 0 0
      framework/request/include/SendBird.h
  89. 0 0
      framework/request/include/SendDevInfo.h
  90. 0 0
      framework/request/include/SendDevice.h
  91. 0 0
      framework/request/include/SendHeartBeat.h
  92. 0 0
      framework/request/include/SendLogin.h
  93. 0 0
      framework/request/include/findDevMsg.h
  94. 3 0
      framework/request/include/requests.hpp
  95. BIN
      lib/libgsd_core.so
  96. BIN
      lib/libgsd_modules.so
  97. BIN
      lib/libgsd_plugins.so
  98. 7 1
      modules/CMakeLists.txt
  99. 69 0
      modules/Hepu/include/Hepu.hpp
  100. 150 0
      modules/Hepu/src/Hepu.cpp

+ 0 - 0
3rdparty/CSerialPort/SerialPort.h


+ 0 - 0
3rdparty/CSerialPort/SerialPortBase.h


+ 0 - 0
3rdparty/CSerialPort/SerialPortInfo.h


+ 0 - 0
3rdparty/CSerialPort/SerialPortInfoBase.h


+ 0 - 0
3rdparty/CSerialPort/SerialPortInfoUnixBase.h


+ 0 - 0
3rdparty/CSerialPort/SerialPortUnixBase.h


+ 0 - 0
3rdparty/CSerialPort/SerialPort_global.h


+ 0 - 0
3rdparty/CSerialPort/osplatformutil.h


+ 0 - 0
3rdparty/CSerialPort/sigslot.h


+ 0 - 0
3rdparty/rapidjson/allocators.h


+ 0 - 0
3rdparty/rapidjson/cursorstreamwrapper.h


+ 0 - 0
3rdparty/rapidjson/document.h


+ 0 - 0
3rdparty/rapidjson/encodedstream.h


+ 0 - 0
3rdparty/rapidjson/encodings.h


+ 0 - 0
3rdparty/rapidjson/error/en.h


+ 0 - 0
3rdparty/rapidjson/error/error.h


+ 0 - 0
3rdparty/rapidjson/filereadstream.h


+ 0 - 0
3rdparty/rapidjson/filewritestream.h


+ 0 - 0
3rdparty/rapidjson/fwd.h


+ 0 - 0
3rdparty/rapidjson/internal/biginteger.h


+ 0 - 0
3rdparty/rapidjson/internal/diyfp.h


+ 0 - 0
3rdparty/rapidjson/internal/dtoa.h


+ 0 - 0
3rdparty/rapidjson/internal/ieee754.h


+ 0 - 0
3rdparty/rapidjson/internal/itoa.h


+ 0 - 0
3rdparty/rapidjson/internal/meta.h


+ 0 - 0
3rdparty/rapidjson/internal/pow10.h


+ 0 - 0
3rdparty/rapidjson/internal/regex.h


+ 0 - 0
3rdparty/rapidjson/internal/stack.h


+ 0 - 0
3rdparty/rapidjson/internal/strfunc.h


+ 0 - 0
3rdparty/rapidjson/internal/strtod.h


+ 0 - 0
3rdparty/rapidjson/internal/swap.h


+ 0 - 0
3rdparty/rapidjson/istreamwrapper.h


+ 0 - 0
3rdparty/rapidjson/memorybuffer.h


+ 0 - 0
3rdparty/rapidjson/memorystream.h


+ 0 - 0
3rdparty/rapidjson/msinttypes/inttypes.h


+ 0 - 0
3rdparty/rapidjson/msinttypes/stdint.h


+ 0 - 0
3rdparty/rapidjson/ostreamwrapper.h


+ 0 - 0
3rdparty/rapidjson/pointer.h


+ 0 - 0
3rdparty/rapidjson/prettywriter.h


+ 0 - 0
3rdparty/rapidjson/rapidjson.h


+ 0 - 0
3rdparty/rapidjson/reader.h


+ 0 - 0
3rdparty/rapidjson/schema.h


+ 0 - 0
3rdparty/rapidjson/stream.h


+ 0 - 0
3rdparty/rapidjson/stringbuffer.h


+ 0 - 0
3rdparty/rapidjson/writer.h


+ 0 - 0
3rdparty/rdkafka/include/rdkafka.h


+ 0 - 0
3rdparty/rdkafka/include/rdkafkacpp.h


+ 0 - 0
3rdparty/rdkafka/lib/librdkafka++.a


+ 0 - 0
3rdparty/rdkafka/lib/librdkafka++.so


+ 0 - 0
3rdparty/rdkafka/lib/librdkafka++.so.1


+ 0 - 0
3rdparty/rdkafka/lib/librdkafka.a


+ 0 - 0
3rdparty/rdkafka/lib/librdkafka.so


+ 0 - 0
3rdparty/rdkafka/lib/librdkafka.so.1


+ 4 - 0
CMakeLists.txt

@@ -14,6 +14,7 @@ add_compile_options(-DRELEASE)
 option(build_modules "build modules" ON)
 option(build_source "build source programs" ON)
 option(build_plugins "build plugins programs" ON)
+option(build_test "build test programs" OFF)
 
 add_subdirectory(framework)
 if(build_modules)
@@ -25,6 +26,9 @@ endif()
 if(build_source)
   add_subdirectory(source)
 endif()
+if(build_test)
+  add_subdirectory(test)
+endif()
 
 # ---[ install
 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")  #set runtime path

+ 0 - 0
framework/request/include/BasicConfig.h


+ 0 - 0
framework/request/include/CNStreamInferData.h


+ 0 - 0
framework/request/include/DeviceInfo.h


+ 0 - 0
framework/request/include/ExpelDevice.h


+ 0 - 0
framework/request/include/FrameInferData.h


+ 71 - 0
framework/request/include/HepuHB.h

@@ -0,0 +1,71 @@
+#pragma once
+
+#include <iostream>
+
+#include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/writer.h>
+using namespace std;
+
+class HepuHB
+{
+    private:
+    public:
+        const string cmd = "userOnlineHeart";
+        string token;
+
+        HepuHB(){};
+        ~HepuHB(){};
+        void objectToJson(string& str){
+            rapidjson::StringBuffer strBuf;
+            rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
+            this->objectToJson(writer);
+            str = strBuf.GetString();
+        }
+
+        void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){
+            writer.StartObject();
+
+            writer.Key("cmd");
+            writer.String(cmd.c_str());
+
+            writer.Key("param");
+            writer.StartObject();
+
+            writer.Key("token");
+            writer.String(token.c_str());
+            writer.EndObject();
+
+            writer.EndObject();
+        }
+
+        bool jsonToObject(std::string& json){
+            rapidjson::Document doc;
+            doc.Parse(json.c_str());
+            if(!doc.IsObject()){
+                return false;
+            }
+
+            const auto end = doc.MemberEnd();
+
+            if(end == doc.FindMember("cmd") || !doc["cmd"].IsString()){
+                return false;
+            }else{
+                if(cmd != doc["cmd"].GetString())
+                    return false;
+            }
+
+            if(end == doc.FindMember("param") || !doc["param"].IsObject()) {
+                return false;
+            }else{
+                if(end == doc.FindMember("token") || !doc["token"].IsInt()){
+                    return false;
+                }else{
+                    token = doc["token"].GetString();
+                }
+            }
+
+            return true;
+        }
+};

+ 48 - 0
framework/request/include/HepuHBRe.h

@@ -0,0 +1,48 @@
+#pragma once
+
+#include <iostream>
+
+#include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/writer.h>
+using namespace std;
+
+class HepuHBRe
+{
+    private:
+    public:
+        const string cmd = "userOnlineHeart";
+        int ackvalue ;
+
+        HepuHBRe(){};
+        ~HepuHBRe(){};
+
+        bool jsonToObject(string& json){
+            rapidjson::Document doc;
+            doc.Parse(json.c_str());
+            if(!doc.IsObject()){
+                return false;
+            }
+
+            const auto end = doc.MemberEnd();
+
+            if(end == doc.FindMember("cmd") || !doc["cmd"].IsString()){
+                return false;
+            }else{
+                if(cmd != doc["cmd"].GetString())
+                    return false;
+            }
+            
+            if(end == doc.FindMember("param") || !doc["param"].IsObject()) {
+                return false;
+            }else{
+                if(end == doc.FindMember("ackvalue") || !doc["ackvalue"].IsInt()) {
+                    return false;
+                }else{
+                    ackvalue = doc["ackvalue"].GetInt();
+                }
+            }
+            return true;
+        }
+};

+ 91 - 0
framework/request/include/HepuLogin.h

@@ -0,0 +1,91 @@
+#pragma once
+
+#include <iostream>
+
+#include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/writer.h>
+using namespace std;
+
+class HepuLogin
+{
+    private:
+    public:
+        const string cmd = "userLogin";
+        string token;
+        string username;
+        string password;
+        HepuLogin(){};
+        ~HepuLogin(){};
+        
+        void objectToJson(string& str){
+            rapidjson::StringBuffer strBuf;
+            rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
+            this->objectToJson(writer);
+            str = strBuf.GetString();
+        }
+
+        void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){
+            writer.StartObject();
+
+            writer.Key("cmd");
+            writer.String(cmd.c_str());
+
+            writer.Key("param");
+            writer.StartObject();
+
+            writer.Key("token");
+            writer.String(token.c_str());
+
+            writer.Key("username");
+            writer.String(username.c_str());
+
+            writer.Key("password");
+            writer.String(password.c_str());
+            writer.EndObject();    
+
+            writer.EndObject();
+        }
+
+        bool jsonToObject(std::string& json){
+            rapidjson::Document doc;
+            doc.Parse(json.c_str());
+            if(!doc.IsObject()){
+                return false;
+            }
+
+            const auto end = doc.MemberEnd();
+
+            if(end == doc.FindMember("cmd") || !doc["cmd"].IsString()){
+                return false;
+            }else{
+                if(cmd != doc["cmd"].GetString())
+                    return false;
+            }
+            
+            if(end == doc.FindMember("param") || !doc["param"].IsObject()) {
+                return false;
+            }else{
+                if(end == doc.FindMember("token") || !doc["token"].IsString()) {
+                    return false;
+                }else{
+                    token = doc["token"].GetString();
+                }
+
+                if(end == doc.FindMember("username") || !doc["username"].IsString()) {
+                    return false;
+                }else{
+                    username = doc["username"].GetString();
+                }
+
+                if(end == doc.FindMember("password") || !doc["password"].IsString()) {
+                    return false;
+                }else{
+                    password = doc["password"].GetString();
+                }
+            }
+  
+            return true;
+        }
+};

+ 55 - 0
framework/request/include/HepuLoginRe.h

@@ -0,0 +1,55 @@
+#pragma once
+
+#include <iostream>
+
+#include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/writer.h>
+using namespace std;
+
+class HepuLoginRe
+{
+    private:
+    public:
+        const string cmd = "userLogin";
+        int ackvalue;    
+        string token;
+        HepuLoginRe(){};
+        ~HepuLoginRe(){};
+
+        bool jsonToObject(string& json){
+            rapidjson::Document doc;
+            doc.Parse(json.c_str());
+            if(!doc.IsObject()){
+                return false;
+            }
+
+            const auto end = doc.MemberEnd();
+
+            if(end == doc.FindMember("cmd") || !doc["cmd"].IsString()){
+                return false;
+            }else{
+                if(cmd != doc["cmd"].GetString())
+                    return false;
+            }
+
+            if(end == doc.FindMember("param") || !doc["param"].IsObject()) {
+                return false;
+            }else{
+                if(end == doc.FindMember("ackvalue") || !doc["ackvalue"].IsInt()) {
+                    return false;
+                }else{
+                    ackvalue = doc["token"].GetInt();
+                }   
+
+                if(end == doc.FindMember("token") || !doc["token"].IsString()) {
+                    return false;
+                }else{
+                    token = doc["token"].GetString();
+                }
+            }
+
+            return true;
+        }
+};

+ 150 - 0
framework/request/include/HepuTarget.h

@@ -0,0 +1,150 @@
+#pragma once
+
+#include <iostream>
+
+#include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/writer.h>
+using namespace std;
+
+class HepuTarget
+{
+    private:
+    public:
+        const string cmd = "ivpTrackingCtrl";
+        string token;
+        bool bTracking;
+        int channelid;
+        int trackingTime;
+        struct TrackingRect{
+            int x;
+            int y;
+            int w;
+            int h;
+        };
+        TrackingRect trackingRect;
+        
+        HepuTarget(){};
+        ~HepuTarget(){};
+        void objectToJson(string& str){
+            rapidjson::StringBuffer strBuf;
+            rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
+            this->objectToJson(writer);
+            str = strBuf.GetString();
+        }
+
+        void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){
+            writer.StartObject();
+
+            writer.Key("cmd");
+            writer.String(cmd.c_str());
+
+            writer.Key("param");
+            writer.StartObject();
+
+            writer.Key("token");
+            writer.String(token.c_str());
+
+            writer.Key("bTracking");
+            writer.Bool(bTracking);
+
+            writer.Key("channelid");
+            writer.Int(channelid);
+
+            writer.Key("trackingTime");
+            writer.Int(trackingTime);
+
+            writer.Key("trackingRect");
+            
+            writer.StartObject();
+            writer.Key("x");
+            writer.Int(trackingRect.x);
+
+            writer.Key("y");
+            writer.Int(trackingRect.y);
+
+            writer.Key("w");
+            writer.Int(trackingRect.w);
+
+            writer.Key("h");
+            writer.Int(trackingRect.h);
+            writer.EndObject();
+
+            writer.EndObject();
+
+            writer.EndObject();
+        }
+
+        bool jsonToObject(std::string& json){
+            rapidjson::Document doc;
+            doc.Parse(json.c_str());
+            if(!doc.IsObject()){
+                return false;
+            }
+
+            const auto end = doc.MemberEnd();
+
+            if(end == doc.FindMember("cmd") || !doc["cmd"].IsString()){
+                return false;
+            }else{
+                if(cmd != doc["cmd"].GetString())
+                    return false;
+            }            
+
+            if(end == doc.FindMember("param") || !doc["param"].IsObject()) {
+                return false;
+            }else{
+                if(end == doc.FindMember("token") || !doc["token"].IsString()) {
+                    return false;
+                }else{
+                    token = doc["token"].GetString();
+                }
+
+                if(end == doc.FindMember("bTracking") || !doc["bTracking"].IsBool()) {
+                    return false;
+                }else{
+                    bTracking = doc["bTracking"].GetBool();
+                }
+
+                if(end == doc.FindMember("channelid") || !doc["channelid"].IsInt()) {
+                    return false;
+                }else{
+                    channelid = doc["channelid"].GetInt();
+                }
+
+                if(end == doc.FindMember("trackingTime") || !doc["trackingTime"].IsInt()) {
+                    return false;
+                }else{
+                    trackingTime = doc["trackingTime"].GetInt();
+                }
+
+                if(end == doc.FindMember("trackingRect") || !doc["trackingRect"].IsObject()) {
+                    return false;
+                }else{
+                    if(end == doc.FindMember("x") || !doc["x"].IsInt()) {
+                        return false;
+                    }else{
+                        trackingRect.x = doc["x"].GetInt();
+                    }
+                    if(end == doc.FindMember("y") || !doc["y"].IsInt()) {
+                        return false;
+                    }else{
+                        trackingRect.y = doc["y"].GetInt();
+                    }
+                    if(end == doc.FindMember("w") || !doc["w"].IsInt()) {
+                        return false;
+                    }else{
+                        trackingRect.w = doc["w"].GetInt();
+                    }
+                    if(end == doc.FindMember("h") || !doc["h"].IsInt()) {
+                        return false;
+                    }else{
+                        trackingRect.h = doc["h"].GetInt();
+                    }
+                }
+            }
+
+            return true;
+        }
+};

+ 62 - 0
framework/request/include/HepuTargetRe.h

@@ -0,0 +1,62 @@
+#pragma once
+
+#include <iostream>
+
+#include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/writer.h>
+using namespace std;
+
+class HepuTargetRe
+{
+    private:
+    public:
+        const string cmd = "ivpTrackingCtrl";
+        int ackvalue;
+        int channelid;
+        bool bTracking;
+        
+        HepuTargetRe(){};
+        ~HepuTargetRe(){};
+
+        bool jsonToObject(string& json){
+            rapidjson::Document doc;
+            doc.Parse(json.c_str());
+            if(!doc.IsObject()){
+                return false;
+            }
+
+            const auto end = doc.MemberEnd();
+
+            if(end == doc.FindMember("cmd") || !doc["cmd"].IsString()){
+                return false;
+            }else{
+                if(cmd != doc["cmd"].GetString())
+                    return false;
+            }
+
+            if(end == doc.FindMember("param") || !doc["param"].IsObject()) {
+                return false;
+            }else{
+                if(end == doc.FindMember("ackvalue") || !doc["ackvalue"].IsInt()) {
+                    return false;
+                }else{
+                    ackvalue = doc["ackvalue"].GetInt();
+                }
+
+                if(end == doc.FindMember("channelid") || !doc["channelid"].IsInt()) {
+                    return false;
+                }else{
+                    channelid = doc["channelid"].GetInt();
+                }
+
+                if(end == doc.FindMember("bTracking") || !doc["bTracking"].IsBool()) {
+                    return false;
+                }else{
+                    bTracking = doc["bTracking"].GetBool();
+                }
+            }
+            return true;
+        }
+};

+ 0 - 0
framework/request/include/HistoryVideo.h


+ 0 - 0
framework/request/include/HttpNull.hpp


+ 0 - 0
framework/request/include/HttpResultMsg.hpp


+ 0 - 0
framework/request/include/HttpToken.hpp


+ 0 - 0
framework/request/include/NettyClientCommandEnum.h


+ 0 - 0
framework/request/include/NettyClientResultMsg.h


+ 0 - 0
framework/request/include/NettyExpelDevInfo.h


+ 0 - 0
framework/request/include/NettyHttpDicCode.h


+ 0 - 0
framework/request/include/NettyHttpNull.h


+ 0 - 0
framework/request/include/NettyHttpResultMsg.h


+ 0 - 0
framework/request/include/NettyHttpToken.h


+ 0 - 0
framework/request/include/NettyServerCommandEnum.h


+ 0 - 0
framework/request/include/NettyServerResultMsg.h


+ 0 - 0
framework/request/include/Notices.h


+ 0 - 0
framework/request/include/PlayerControl.h


+ 0 - 0
framework/request/include/PlayerDeviceList.h


+ 0 - 0
framework/request/include/PlayerLogin.h


+ 0 - 0
framework/request/include/PlayerLogout.h


+ 0 - 0
framework/request/include/PlayerStatus.h


+ 0 - 0
framework/request/include/RecDeviceCommand.h


+ 0 - 0
framework/request/include/RecLoginMsg.h


+ 0 - 0
framework/request/include/RequestBase.hpp


+ 0 - 0
framework/request/include/SendBird.h


+ 0 - 0
framework/request/include/SendDevInfo.h


+ 0 - 0
framework/request/include/SendDevice.h


+ 0 - 0
framework/request/include/SendHeartBeat.h


+ 0 - 0
framework/request/include/SendLogin.h


+ 0 - 0
framework/request/include/findDevMsg.h


+ 3 - 0
framework/request/include/requests.hpp

@@ -21,6 +21,9 @@
 #include "RecDeviceCommand.h"
 #include "RecLoginMsg.h"
 
+#include "HepuHB.h"
+#include "HepuLogin.h"
+#include "HepuTarget.h"
 
 #include "SendBird.h"
 #include "SendDevice.h"

BIN
lib/libgsd_core.so


BIN
lib/libgsd_modules.so


BIN
lib/libgsd_plugins.so


+ 7 - 1
modules/CMakeLists.txt

@@ -24,7 +24,8 @@ option(build_TCPClient "build module TCPClient" ON)
 option(build_config "build module config" ON)
 option(build_HttpServer "build module HttpServer" ON)
 option(build_Audit "build module Audit" ON)
-option(build_kafka           "build module kafka" ON)
+option(build_kafka "build module kafka" ON)
+option(build_Hepu "build module Hepu" ON)
 
 # ---[ 3rdparty
 set(3RDPARTY_LIBS "")
@@ -83,6 +84,11 @@ if(build_HttpServer)
   include_directories(${PROJECT_SOURCE_DIR}/modules/HttpServer/src)
   install(DIRECTORY HttpServer/include/ DESTINATION include)
 endif()
+if(build_Hepu)
+  list(APPEND module_list Hepu)
+  include_directories($(PROJECT_SOURCE_DIR)/modules/Hepu/src)
+  install(DIRECTORY Hepu/include/ DESTINATION include)
+endif()
 if(build_Audit)
   list(APPEND module_list Audit)
   include_directories(${PROJECT_SOURCE_DIR}/modules/Audit/src)

+ 69 - 0
modules/Hepu/include/Hepu.hpp

@@ -0,0 +1,69 @@
+#ifndef __HEPU_H__
+#define __HEPU_H__
+
+#include <iostream>
+#include <time.h>
+#include <ctime>
+
+#include "Util/logger.h"
+#include "Util/NoticeCenter.h"
+#include "Poller/EventPoller.h"
+#include "Util/SqlPool.h"
+#include "Network/TcpClient.h"
+#include "Poller/Timer.h"
+#include "TCPClient.hpp"
+#include <httplib.h>
+#include "Notices.h"
+
+#include "UtilBase.hpp"
+
+#include "HepuHB.h"
+#include "HepuHBRe.h"
+#include "HepuLogin.h"
+#include "HepuLoginRe.h"
+#include "HepuTarget.h"
+#include "HepuTargetRe.h"
+
+using namespace std;
+
+namespace gsd{
+
+    class Hepu: public enable_shared_from_this<Hepu>, public ModuleBase
+    {
+        private:
+
+            string username;
+            string password;
+            string token;
+
+        public:
+            Hepu(){}
+            ~Hepu(){}
+
+            virtual bool Init(){
+                return true;
+            }
+
+            virtual void Destroy(){
+
+            }
+
+            int32_t Init(string username, string url, int port);
+
+            static std::shared_ptr<Hepu> CreateNew();
+
+            int32_t LoginHepu();
+
+            bool alive();
+
+            int32_t sendHepuHB(HepuHB& HepuHBMsg);
+
+            int32_t sendHepuHB();
+
+            int32_t sendHepuTarget(HepuTarget& HepuTargetMsg);
+
+    };
+};
+
+
+#endif

+ 150 - 0
modules/Hepu/src/Hepu.cpp

@@ -0,0 +1,150 @@
+#include "Hepu.hpp"
+
+namespace gsd{
+    std::shared_ptr<httplib::Client> m_hepu = nullptr;
+
+    std::shared_ptr<Hepu> Hepu::CreateNew(){
+        static shared_ptr<Hepu> hepu = nullptr;
+        if(hepu == nullptr) 
+            hepu = std::make_shared<Hepu>();
+        return hepu;
+    }
+
+    int32_t Hepu::Init(std::string username, std::string url, int port){
+        this->username = username;
+        m_hepu = std::make_shared<httplib::Client>(url, port);
+        if(m_hepu == NULL){
+            ErrorL << "Hepu http client initialization failed.";
+            return ERR;
+        }
+        if(this->LoginHepu() != OK){
+            ErrorL << "Failed to login to Hepu IPC.";
+            return ERR;
+        }
+        return OK;
+    }
+
+    int32_t Hepu::LoginHepu(){
+        if(m_hepu == nullptr) return ERR;
+
+        HepuLogin hepuloginMsg;
+        std::string msg;
+        hepuloginMsg.token = "";
+        hepuloginMsg.username = this->username;
+        hepuloginMsg.password = this->password;
+        hepuloginMsg.objectToJson(msg);
+        msg += "\r\n";
+
+        if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
+            if(res->status != 100){
+                HepuLoginRe hepuloginReMsg;
+                if(!hepuloginReMsg.jsonToObject(res->body)){
+                    return ERR;
+                }
+                if(hepuloginReMsg.ackvalue != 100){
+                    return ERR;
+                }
+                if(hepuloginReMsg.token.size()){
+                    this->token = hepuloginReMsg.token;
+                    return OK;
+                }
+                return ERR;
+            }
+            return ERR;
+        }else{
+            auto err = res.error();
+            ErrorL << "The service is not available,"<<err<<endl;
+            return ERR;
+        }
+        return ERR;
+    }
+
+    bool Hepu::alive(){
+        return this->token == "" ? false : true;
+    }
+
+    int32_t Hepu::sendHepuHB(HepuHB& hepuHBMsg){
+        if(m_hepu == nullptr) return ERR;
+
+        std::string msg;
+        hepuHBMsg.token = this->token;
+        hepuHBMsg.objectToJson(msg);
+        msg+="\r\n";
+
+        if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
+            if(res->status != 100){
+                HepuHBRe hepuHBReMsg;
+                if(!hepuHBReMsg.jsonToObject(res->body)){
+                    return ERR;
+                }
+                if(hepuHBReMsg.ackvalue != 100){
+                    return ERR;
+                }
+                return OK;
+            }
+            return ERR;
+        }else{
+            auto err = res.error();
+            ErrorL << "Hepu Heartbeat failed,"<<err<<endl;
+            return ERR;
+        }
+        return ERR;
+    }
+
+    int32_t Hepu::sendHepuHB(){
+        if(m_hepu == nullptr) return ERR;
+
+        HepuHB hepuHBMsg;
+        std::string msg;
+        hepuHBMsg.token = this->token;
+        hepuHBMsg.objectToJson(msg);
+        msg+="\r\n";
+
+        if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
+            if(res->status != 100){
+                HepuHBRe hepuHBReMsg;
+                if(!hepuHBReMsg.jsonToObject(res->body)){
+                    return ERR;
+                }
+                if(hepuHBReMsg.ackvalue != 100){
+                    return ERR;
+                }
+                return OK;
+            }
+            return ERR;
+        }else{
+            auto err = res.error();
+            ErrorL << "Hepu Heartbeat failed,"<<err<<endl;
+            return ERR;
+        }
+        return ERR;
+    }
+
+    int32_t Hepu::sendHepuTarget(HepuTarget& HepuTargetMsg){
+        if(m_hepu == nullptr) return ERR;
+
+        std::string msg;
+        HepuTargetMsg.token = this->token;
+        HepuTargetMsg.objectToJson(msg);
+        msg+="\r\n";
+
+        if(auto res = m_hepu->Post("/cgi-bin/proc.cgi", msg,"application/json")){
+            if(res->status != 100){
+                HepuTargetRe hepuTargetReMsg;
+                if(!hepuTargetReMsg.jsonToObject(res->body)){
+                    return ERR;
+                }
+                if(hepuTargetReMsg.ackvalue != 100){
+                    return ERR;
+                }
+                return OK;
+            }
+            return ERR;
+        }else{
+            auto err = res.error();
+            ErrorL << "Hepu Heartbeat failed,"<<err<<endl;
+            return ERR;
+        }
+        return ERR;
+    }
+}

Some files were not shown because too many files changed in this diff