From 22a2a75146214b245fa2bfeacfd998539a8779fa Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 12 一月 2023 19:36:22 +0800
Subject: [PATCH] 添加pollcontrol所需接口定义.调整结构

---
 rule.cpp       |   11 ++++-
 /dev/null      |   10 -----
 stack.cpp      |   11 +++++
 dbapi.h        |   27 +++++++++++++
 main.cpp       |    3 -
 sdk.cpp        |   16 ++++++++
 sysset.cpp     |    2 
 camera.cpp     |   19 +++++++++
 polygon.cpp    |   17 ++++++++
 CMakeLists.txt |    4 ++
 10 files changed, 105 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 331d453..5194eb2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,11 @@
     )
 
 set(src
+    ${CMAKE_SOURCE_DIR}/camera.cpp
+    ${CMAKE_SOURCE_DIR}/polygon.cpp
     ${CMAKE_SOURCE_DIR}/rule.cpp
+    ${CMAKE_SOURCE_DIR}/sdk.cpp
+    ${CMAKE_SOURCE_DIR}/stack.cpp
     ${CMAKE_SOURCE_DIR}/sysset.cpp
     ${CMAKE_SOURCE_DIR}/util.cpp
     ${CMAKE_SOURCE_DIR}/3rdparty/yyjson/yyjson.c
diff --git a/camera.cpp b/camera.cpp
new file mode 100644
index 0000000..127ed6e
--- /dev/null
+++ b/camera.cpp
@@ -0,0 +1,19 @@
+#include "dbapi.h"
+#include "util.h"
+
+using namespace protomsg;
+
+// 鍔爂et鍙傛暟 runType 1: 瀹炴椂 0 杞
+bool dbapi_get_cameras_by_runtype(void *handle, std::vector<protomsg::Camera> & list) {
+    const char *topic = DATA_URL_PREFIX("/camera/getCamerasByRunType");
+
+    return true;
+}
+
+// 鍔爂et鍙傛暟 runType 1: 瀹炴椂 0 杞
+bool dbapi_get_gb28181_cameras_by_runtype(void *handle, std::vector<protomsg::Camera> & list) {
+    const char *topic = DATA_URL_PREFIX("/gb28181/camera/getCamerasByRunType");
+
+    return true;
+}
+
diff --git a/dbapi.h b/dbapi.h
new file mode 100644
index 0000000..00378d7
--- /dev/null
+++ b/dbapi.h
@@ -0,0 +1,27 @@
+#ifndef C_BHOME_BUS_DBAPIS_H
+#define C_BHOME_BUS_DBAPIS_H
+
+#include <vector>
+
+#include "proto/x86_64/sysset.pb.h"
+#include "proto/x86_64/protomsg.pb.h"
+#include "proto/x86_64/fileanalysis.pb.h"
+
+using namespace std;
+
+bool dbapi_get_server_info(void *handle, protomsg::LocalConfig & message);
+bool dbapi_get_poll_config(void *handle, protomsg::PollConfig & message);
+bool dbapi_get_stack_config(void *handle, protomsg::FileAnalysisSetting & message);
+bool dbapi_get_time_rules(void *handle, std::vector<protomsg::CameraTimerule> & list);
+bool dbapi_get_camera_rules(void *handle, std::vector<protomsg::CameraAndRules> & list);
+
+bool dbapi_get_cameras_by_runtype(void *handle, std::vector<protomsg::Camera> & list);
+bool dbapi_get_gb28181_cameras_by_runtype(void *handle, std::vector<protomsg::Camera> & list);
+bool dbapi_get_sdk_channel_set(void *handle, std::vector<protomsg::SdkChanSet> & list);
+bool dbapi_get_sdks(void *handle, std::vector<protomsg::Sdk> & list);
+
+bool dbapi_get_doing_stacks(void *handle, std::vector<protomsg::FileStack> & list);
+bool dbapi_get_polygons(void *handle, std::vector<protomsg::CameraPolygon> & list);
+bool dbapi_get_polygon_relations(void *handle, std::vector<protomsg::CameraPolygonRelation> & list);
+
+#endif
\ No newline at end of file
diff --git a/main.cpp b/main.cpp
index 8029bd9..e63170f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -9,8 +9,7 @@
 #include "3rdparty/bus_client/cbhomeclient.h"
 #include "3rdparty/bus_client/message.h"
 
-#include "sysset.h"
-#include "rule.h"
+#include "dbapi.h"
 #include "proto/x86_64/sysset.pb.h"
 #include "proto/x86_64/fileanalysis.pb.h"
 #include "proto/x86_64/protomsg.pb.h"
diff --git a/polygon.cpp b/polygon.cpp
new file mode 100644
index 0000000..22b9918
--- /dev/null
+++ b/polygon.cpp
@@ -0,0 +1,17 @@
+#include "dbapi.h"
+#include "util.h"
+
+using namespace protomsg;
+
+bool dbapi_get_polygons(void *handle, std::vector<protomsg::CameraPolygon> & list) {
+    const char *topic = DATA_URL_PREFIX("/polygon/findAll");
+
+    return true;
+}
+
+bool dbapi_get_polygon_relations(void *handle, std::vector<protomsg::CameraPolygonRelation> & list) {
+    const char *topic = DATA_URL_PREFIX("/polygon/relation/findAll");
+
+     return true;;
+}
+
diff --git a/rule.cpp b/rule.cpp
index df571c1..5335884 100644
--- a/rule.cpp
+++ b/rule.cpp
@@ -1,10 +1,17 @@
-#include "rule.h"
+#include "dbapi.h"
 #include "util.h"
 
 using namespace protomsg;
 
-bool dbapi_get_time_rules(void *handle, vector<protomsg::CameraTimerule> & list) {
+bool dbapi_get_time_rules(void *handle, std::vector<protomsg::CameraTimerule> & list) {
     const char *topic = DATA_URL_PREFIX("/cameraTimerule/findAll");
 
     return true;
 }
+
+bool dbapi_get_camera_rules(void *handle, std::vector<protomsg::CameraAndRules> & list) {
+    const char *topic = DATA_URL_PREFIX("/camera/rule/findAll");
+
+     return true;;
+}
+
diff --git a/rule.h b/rule.h
deleted file mode 100644
index f7471ed..0000000
--- a/rule.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef C_BHOME_BUS_DBAPI_RULE_H
-#define C_BHOME_BUS_DBAPI_RULE_H
-
-#include <vector>
-#include "proto/x86_64/protomsg.pb.h"
-using namespace std;
-
-bool dbapi_get_time_rules(void *handle, std::vector<protomsg::CameraTimerule> & list);
-
-#endif
\ No newline at end of file
diff --git a/sdk.cpp b/sdk.cpp
new file mode 100644
index 0000000..312c207
--- /dev/null
+++ b/sdk.cpp
@@ -0,0 +1,16 @@
+#include "dbapi.h"
+#include "util.h"
+
+using namespace protomsg;
+
+bool dbapi_get_sdk_channel_set(void *handle, std::vector<protomsg::SdkChanSet> & list) {
+    const char *topic = DATA_URL_PREFIX("/sdk/getAllSdkChanSet");
+
+    return true;
+}
+
+bool dbapi_get_sdks(void *handle, std::vector<protomsg::Sdk> & list) {
+    const char *topic = DATA_URL_PREFIX("/sdk/findAllSdk");
+
+    return true;
+}
diff --git a/stack.cpp b/stack.cpp
new file mode 100644
index 0000000..cde8f98
--- /dev/null
+++ b/stack.cpp
@@ -0,0 +1,11 @@
+#include "dbapi.h"
+#include "util.h"
+
+using namespace protomsg;
+
+bool dbapi_get_doing_stacks(void *handle, std::vector<protomsg::FileStack> & list) {
+    const char *topic = DATA_URL_PREFIX("/fileStack/findAllDoingStacks");
+
+    return true;
+}
+
diff --git a/sysset.cpp b/sysset.cpp
index a308f21..701827e 100644
--- a/sysset.cpp
+++ b/sysset.cpp
@@ -1,4 +1,4 @@
-#include "sysset.h"
+#include "dbapi.h"
 #include "util.h"
 
 using namespace protomsg;
diff --git a/sysset.h b/sysset.h
deleted file mode 100644
index 22bfe39..0000000
--- a/sysset.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef C_BHOMEBUS_DBAPI_SYSSET_H
-#define C_BHOMEBUS_DBAPI_SYSSET_H
-
-#include "proto/x86_64/sysset.pb.h"
-#include "proto/x86_64/fileanalysis.pb.h"
-
-bool dbapi_get_server_info(void *handle, protomsg::LocalConfig & message);
-bool dbapi_get_poll_config(void *handle, protomsg::PollConfig & message);
-bool dbapi_get_stack_config(void *handle, protomsg::FileAnalysisSetting & message);
-#endif
\ No newline at end of file

--
Gitblit v1.8.0