From dccc1ca1304dc1fcb86c8e24edd491509269b3e7 Mon Sep 17 00:00:00 2001 From: cheliequan <liequanche@126.com> Date: 星期日, 29 一月 2023 14:44:52 +0800 Subject: [PATCH] 解决编译告警 --- main.cpp | 160 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 144 insertions(+), 16 deletions(-) diff --git a/main.cpp b/main.cpp index 58e57bc..c653594 100644 --- a/main.cpp +++ b/main.cpp @@ -1,32 +1,30 @@ #include <stdio.h> -#include <vector> +#include <map> +#include <memory> #include <string> #include <thread> -#include <memory> +#include <vector> + using namespace std; #include "3rdparty/bus_client/cbhomeclient.h" #include "3rdparty/bus_client/message.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" +#include "proto/x86_64/sysset.pb.h" - -int main(int argc, char const *argv[]) -{ +int main(int argc, char const *argv[]) { // 鍒濆鍖朾us - creg* reg = make_creg_from_cproc(make_cproc("request", "requestid")); + creg *reg = make_creg_from_cproc(make_cproc("request", "requestid")); printf("make_creg_from_cproc\n"); - void* handle = bus_client_init(NULL, 0, reg); + void *handle = bus_client_init(NULL, 0, reg); creg_free(reg); printf("bus_client_init end\n"); - // 鏈嶅姟鍣ㄩ厤缃� sysset.pb.h // protomsg::LocalConfig node; @@ -47,14 +45,144 @@ // } // 鏃堕棿瑙勫垯 - std::vector<protomsg::CameraTimerule> list; - if (dbapi_get_time_rules(handle, list)) { - printf("CameraTimerule:\n"); + // std::vector<protomsg::CameraTimerule> list; + // if (dbapi_get_time_rules(handle, list)) { + // for (unsigned int i = 0; i < list.size(); i++) { + // printf("CameraTimerule: %s\n", list[i].id().c_str()); + // } + // } + + // 绯荤粺鎺堟潈淇℃伅 + // printf("isExpired:%d\n", dbapi_get_server_get_is_sys_expired(handle)); + + // 鎽勫儚鏈� + std::vector<protomsg::Camera> list; + char *runType = (char *)"1"; // 1 瀹炴椂 0 杞 + if (dbapi_get_cameras_by_runType(handle, list, runType, false)) { + for (unsigned int i = 0; i < list.size(); i++) { + printf("Camera: %s\n", list[i].id().c_str()); + } } - //绯荤粺鎺堟潈淇℃伅 - - printf("isExpired:%d\n", dbapi_get_server_get_is_sys_expired(handle)); + string json; + dbapi_get_json_by_cameralist(list, json); + + printf("Camera list to json:%s\n", json.c_str()); + + + /* [ + { + "addr": "璐㈠姟瀹�", + "alias": "", + "brand": "", + "coordTransform": "", + "floor": -9999, + "id": "2bdee058-43d9-4e95-9ba1-2f56920f6d7c", + "ip": "", + "is_running": false, + "latitude": 0, + "linkCams": null, + "longitude": 0, + "name": "5.152锛堣储鍔″锛�", + "password": "", + "port": 0, + "reserved": "", + "resolution_height": 0, + "resolution_width": 0, + "rtsp": "rtsp://admin:a1234567@192.168.5.152:554/h264/ch1/main/av_stream", + "runServerName": "189鏈嶅姟", + "run_enable": false, + "run_server_id": "DSVAD010120190703", + "run_type": -1, + "snapshot_url": "192.168.20.189:6700/71,1c82608f5aab92?collection=DSVAD010120190703-persistent", + "status": -2, + "tasks": [ + { + "hasRule": true, + "taskname": "绂诲矖" + } + ], + "type": 0, + "username": "", + "voiceEnable": false, + "voiceId": "" + }, + { + "addr": "浜у搧鏃�2", + "alias": "", + "brand": "", + "coordTransform": "", + "floor": -9999, + "id": "d05618a4-7cdd-4b64-888c-2b1c29d3f32a", + "ip": "", + "is_running": false, + "latitude": 0, + "linkCams": null, + "longitude": 0, + "name": "5.151锛堜骇鍝佹梺锛�", + "password": "", + "port": 0, + "reserved": "", + "resolution_height": 0, + "resolution_width": 0, + "rtsp": "rtsp://admin:a1234567@192.168.5.151:554/h265/ch1/main/av_stream", + "runServerName": "189鏈嶅姟", + "run_enable": false, + "run_server_id": "DSVAD010120190703", + "run_type": -1, + "snapshot_url": "192.168.20.189:6700/72,1c9ea52ffe3560?collection=DSVAD010120190703-persistent", + "status": -2, + "tasks": [ + { + "hasRule": true, + "taskname": "鍏ヤ镜" + }, + { + "hasRule": true, + "taskname": "浜у搧鍖哄煙浜哄憳绂诲矖" + }, + { + "hasRule": true, + "taskname": "鑴卞矖" + } + ], + "type": 0, + "username": "", + "voiceEnable": false, + "voiceId": "" + }, + { + "addr": "娓f补瑁呰溅10鍙�", + "alias": "", + "brand": "", + "coordTransform": "", + "floor": -9999, + "id": "8be6055f-639c-4ea0-bcec-99b6b5b95499", + "ip": "", + "is_running": false, + "latitude": 0, + "linkCams": null, + "longitude": 0, + "name": "娓f补瑁呰溅10鍙�", + "password": "", + "port": 0, + "reserved": "", + "resolution_height": 0, + "resolution_width": 0, + "rtsp": "rtsp://admin:a1234567@192.168.5.53:554/h264/ch1/main/av_stream", + "runServerName": "189鏈嶅姟", + "run_enable": true, + "run_server_id": "DSVAD010120190703", + "run_type": -1, + "snapshot_url": "192.168.20.189:6700/72,1c8f82b46690a6?collection=DSVAD010120190703-persistent", + "status": -2, + "tasks": null, + "type": 0, + "username": "", + "voiceEnable": false, + "voiceId": "" + } +]*/ return 0; } -- Gitblit v1.8.0