Browse Source

Add hepu test files

qiuyang 2 months ago
parent
commit
83e8e311d2
100 changed files with 722 additions and 9 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. 0 0
      framework/request/include/BasicConfig.h
  55. 0 0
      framework/request/include/CNStreamInferData.h
  56. 0 0
      framework/request/include/DeviceInfo.h
  57. 0 0
      framework/request/include/ExpelDevice.h
  58. 0 0
      framework/request/include/FrameInferData.h
  59. 71 0
      framework/request/include/HepuHB.h
  60. 48 0
      framework/request/include/HepuHBRe.h
  61. 91 0
      framework/request/include/HepuLogin.h
  62. 55 0
      framework/request/include/HepuLoginRe.h
  63. 150 0
      framework/request/include/HepuTarget.h
  64. 62 0
      framework/request/include/HepuTargetRe.h
  65. 0 0
      framework/request/include/HistoryVideo.h
  66. 0 0
      framework/request/include/HttpNull.hpp
  67. 0 0
      framework/request/include/HttpResultMsg.hpp
  68. 0 0
      framework/request/include/HttpToken.hpp
  69. 0 0
      framework/request/include/NettyClientCommandEnum.h
  70. 0 0
      framework/request/include/NettyClientResultMsg.h
  71. 0 0
      framework/request/include/NettyExpelDevInfo.h
  72. 0 0
      framework/request/include/NettyHttpDicCode.h
  73. 0 0
      framework/request/include/NettyHttpNull.h
  74. 0 0
      framework/request/include/NettyHttpResultMsg.h
  75. 0 0
      framework/request/include/NettyHttpToken.h
  76. 0 0
      framework/request/include/NettyServerCommandEnum.h
  77. 0 0
      framework/request/include/NettyServerResultMsg.h
  78. 0 0
      framework/request/include/Notices.h
  79. 0 0
      framework/request/include/PlayerControl.h
  80. 0 0
      framework/request/include/PlayerDeviceList.h
  81. 0 0
      framework/request/include/PlayerLogin.h
  82. 0 0
      framework/request/include/PlayerLogout.h
  83. 0 0
      framework/request/include/PlayerStatus.h
  84. 0 0
      framework/request/include/RecDeviceCommand.h
  85. 0 0
      framework/request/include/RecLoginMsg.h
  86. 0 0
      framework/request/include/RequestBase.hpp
  87. 0 0
      framework/request/include/SendBird.h
  88. 0 0
      framework/request/include/SendDevInfo.h
  89. 0 0
      framework/request/include/SendDevice.h
  90. 0 0
      framework/request/include/SendHeartBeat.h
  91. 0 0
      framework/request/include/SendLogin.h
  92. 0 0
      framework/request/include/findDevMsg.h
  93. 3 0
      framework/request/include/requests.hpp
  94. BIN
      lib/libgsd_modules.so
  95. BIN
      lib/libgsd_plugins.so
  96. 7 1
      modules/CMakeLists.txt
  97. 3 3
      modules/Expel/src/DevicePlayerV4.cpp
  98. 69 0
      modules/Hepu/include/Hepu.hpp
  99. 150 0
      modules/Hepu/src/Hepu.cpp
  100. 13 5
      plugins/CMakeLists.txt

+ 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


+ 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_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)

+ 3 - 3
modules/Expel/src/DevicePlayerV4.cpp

@@ -140,7 +140,7 @@ namespace gsd
     int8_t DevicePlayerV4::Open(std::string DeviceId, uint8_t* data, int& length){
         ControlerMsg gasControl;
         gasControl.deviceId = atoi(DeviceId.c_str());
-        if(gasControl.deviceId == 3) gasControl.deviceId = 0;
+        //if(gasControl.deviceId == 3) gasControl.deviceId = 0;
         gasControl.msgId = DEVICEGASV3_COMMAND_PLAY_NOW;
         gasControl.data = 0x00;
         length = 10;
@@ -157,7 +157,7 @@ namespace gsd
     int8_t DevicePlayerV4::Close(std::string DeviceId, uint8_t* data, int& length){
         ControlerMsg gasControl;
         gasControl.deviceId = atoi(DeviceId.c_str());
-        if(gasControl.deviceId == 3) gasControl.deviceId = 0;
+        //if(gasControl.deviceId == 3) gasControl.deviceId = 0;
         gasControl.msgId = DEVICEGASV3_COMMAND_STOP;
         gasControl.data = 0x00;
         length = 10;
@@ -173,7 +173,7 @@ namespace gsd
     int8_t DevicePlayerV4::Fire(std::string DeviceId, uint8_t* data, int& length){
         ControlerMsg gasControl;
         gasControl.deviceId = atoi(DeviceId.c_str());
-        if(gasControl.deviceId == 3) gasControl.deviceId = 0;
+        //if(gasControl.deviceId == 3) gasControl.deviceId = 0;
         gasControl.msgId = DEVICEGASV3_COMMAND_PLAY_NOW;
         gasControl.data = 0x00;
         length = 10;

+ 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;
+    }
+}

+ 13 - 5
plugins/CMakeLists.txt

@@ -22,6 +22,8 @@ option(build_MonitorPlugin "build module MonitorPlugin" ON)
 option(build_TcpPlugin "build module TcpPlugin" ON)
 option(build_AuditPlugin "build module AuditPlugin" ON)
 option(build_kafka           "build module kafka" ON)
+option(build_HepuPlugin "build module HepuPlugin" ON)
+
 
 
 # ---[ 3rdparty
@@ -49,6 +51,7 @@ include_directories(${GSD_ROOT_DIR}/modules/Monitor/include)
 include_directories(${GSD_ROOT_DIR}/modules/TCPClient/include)
 include_directories(${GSD_ROOT_DIR}/modules/HttpServer/include)
 include_directories(${GSD_ROOT_DIR}/modules/config/include)
+include_directories(${GSD_ROOT_DIR}/modules/Hepu/include)
 include_directories(${GSD_ROOT_DIR}/modules/Audit/include)
 
 set(module_list "")
@@ -56,27 +59,32 @@ set(srcs "")
 
 if(build_ExpelPlugin)
   list(APPEND module_list ExpelPlugin)
-  include_directories(${PROJECT_SOURCE_DIR}/modules/ExpelPlugin/src)
+  include_directories(${PROJECT_SOURCE_DIR}/plugins/ExpelPlugin/src)
   install(DIRECTORY ExpelPlugin/include/ DESTINATION include)
 endif()
 if(build_HttpPlugin)
   list(APPEND module_list HttpPlugin)
-  include_directories(${PROJECT_SOURCE_DIR}/modules/HttpPlugin/src)
+  include_directories(${PROJECT_SOURCE_DIR}/plugins/HttpPlugin/src)
   install(DIRECTORY HttpPlugin/include/ DESTINATION include)
 endif()
 if(build_MonitorPlugin)
   list(APPEND module_list MonitorPlugin)
-  include_directories(${PROJECT_SOURCE_DIR}/modules/MonitorPlugin/src)
+  include_directories(${PROJECT_SOURCE_DIR}/plugins/MonitorPlugin/src)
   install(DIRECTORY MonitorPlugin/include/ DESTINATION include)
 endif()
 if(build_TcpPlugin)
   list(APPEND module_list TcpPlugin)
-  include_directories(${PROJECT_SOURCE_DIR}/modules/TcpPlugin/src)
+  include_directories(${PROJECT_SOURCE_DIR}/plugins/TcpPlugin/src)
   install(DIRECTORY TcpPlugin/include/ DESTINATION include)
 endif()
+if(build_HepuPlugin)
+  list(APPEND module_list HepuPlugin)
+  include_directories(${PROJECT_SOURCE_DIR}/plugins/HepuPlugin/src)
+  install(DIRECTORY HepuPlugin/include/ DESTINATION include)
+endif()
 if(build_AuditPlugin)
   list(APPEND module_list AuditPlugin)
-  include_directories(${PROJECT_SOURCE_DIR}/modules/AuditPlugin/src)
+  include_directories(${PROJECT_SOURCE_DIR}/plugins/AuditPlugin/src)
   install(DIRECTORY AuditPlugin/include/ DESTINATION include)
 endif()
 

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