Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76365e3a07 | |||
| e6a38af241 | |||
| a4ad49c1a7 |
+8
-8
@@ -20,8 +20,8 @@ set (PROJECT_NAME cameradar)
|
|||||||
project (${PROJECT_NAME})
|
project (${PROJECT_NAME})
|
||||||
|
|
||||||
set (${PROJECT_NAME}_VERSION_MAJOR 0)
|
set (${PROJECT_NAME}_VERSION_MAJOR 0)
|
||||||
set (${PROJECT_NAME}_VERSION_MINOR 1)
|
set (${PROJECT_NAME}_VERSION_MINOR 2)
|
||||||
set (${PROJECT_NAME}_VERSION_PATCH 1)
|
set (${PROJECT_NAME}_VERSION_PATCH 2)
|
||||||
set (${PROJECT_NAME}_SUFFIX "-beta")
|
set (${PROJECT_NAME}_SUFFIX "-beta")
|
||||||
set (${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}${${PROJECT_NAME}_SUFFIX}")
|
set (${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}${${PROJECT_NAME}_SUFFIX}")
|
||||||
|
|
||||||
@@ -92,10 +92,10 @@ link_directories (
|
|||||||
)
|
)
|
||||||
|
|
||||||
include_directories (
|
include_directories (
|
||||||
"cameradar_standalone/include"
|
"cameradar_standalone/include"
|
||||||
"deps/jsoncpp/src/deps.jsoncpp/include"
|
"deps/jsoncpp/src/deps.jsoncpp/include"
|
||||||
"deps/boost/src/deps.boost/include"
|
"deps/boost/src/deps.boost/include"
|
||||||
"deps/mysql-connector/include"
|
"deps/mysql-connector/include"
|
||||||
)
|
)
|
||||||
|
|
||||||
set (${CAMERADAR_BINARIES} "")
|
set (${CAMERADAR_BINARIES} "")
|
||||||
@@ -122,8 +122,8 @@ set (CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${${PROJECT_NAME}_VERSION}_${CMAKE
|
|||||||
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||||
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||||
set (CPACK_PACKAGE_VERSION_MAJOR "0")
|
set (CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||||
set (CPACK_PACKAGE_VERSION_MINOR "1")
|
set (CPACK_PACKAGE_VERSION_MINOR "2")
|
||||||
set (CPACK_PACKAGE_VERSION_PATCH "0")
|
set (CPACK_PACKAGE_VERSION_PATCH "2")
|
||||||
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}_${${PROJECT_NAME}_VERSION}")
|
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}_${${PROJECT_NAME}_VERSION}")
|
||||||
set (CPACK_GENERATOR "TGZ")
|
set (CPACK_GENERATOR "TGZ")
|
||||||
set (CPACK_SOURCE_GENERATOR "TGZ")
|
set (CPACK_SOURCE_GENERATOR "TGZ")
|
||||||
|
|||||||
@@ -100,6 +100,13 @@ The only dependencies are `docker` and `docker-compose`.
|
|||||||
Here is the basic content of the configuration file with simple placeholders :
|
Here is the basic content of the configuration file with simple placeholders :
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"mysql_db" : {
|
||||||
|
"host" : "MYSQL_SERVER_IP_ADDRESS",
|
||||||
|
"port" : MYSQL_SERVER_PORT,
|
||||||
|
"user": "root",
|
||||||
|
"password": "root",
|
||||||
|
"db_name": "cmrdr"
|
||||||
|
},
|
||||||
"subnets" : "SUBNET1,SUBNET2,SUBNET3,[...]",
|
"subnets" : "SUBNET1,SUBNET2,SUBNET3,[...]",
|
||||||
"ports" : "PORT1,PORT2,[...]",
|
"ports" : "PORT1,PORT2,[...]",
|
||||||
"rtsp_url_file" : "conf/url.json",
|
"rtsp_url_file" : "conf/url.json",
|
||||||
|
|||||||
@@ -21,5 +21,4 @@ set (LIBRARY_OUTPUT_PATH ${CAMERADAR_CACHE_MANAGER_OUTPUT_PATH})
|
|||||||
add_subdirectory(dumb_cache_manager)
|
add_subdirectory(dumb_cache_manager)
|
||||||
add_subdirectory(mysql_cache_manager)
|
add_subdirectory(mysql_cache_manager)
|
||||||
|
|
||||||
message (${CAMERADAR_CACHE_MANAGERS})
|
|
||||||
set (CAMERADAR_CACHE_MANAGERS ${CAMERADAR_CACHE_MANAGERS} PARENT_SCOPE)
|
set (CAMERADAR_CACHE_MANAGERS ${CAMERADAR_CACHE_MANAGERS} PARENT_SCOPE)
|
||||||
|
|||||||
@@ -53,8 +53,10 @@ dumb_cache_manager::set_streams(std::vector<etix::cameradar::stream_model> model
|
|||||||
//! Inserts a single stream to the cache
|
//! Inserts a single stream to the cache
|
||||||
void
|
void
|
||||||
dumb_cache_manager::update_stream(const etix::cameradar::stream_model& newmodel) {
|
dumb_cache_manager::update_stream(const etix::cameradar::stream_model& newmodel) {
|
||||||
for (auto& it : this->streams) {
|
for (auto& stream : this->streams) {
|
||||||
if (it.address == newmodel.address && it.port == newmodel.port) { it = newmodel; }
|
if (stream.address == newmodel.address && stream.port == newmodel.port) {
|
||||||
|
stream = newmodel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +64,9 @@ dumb_cache_manager::update_stream(const etix::cameradar::stream_model& newmodel)
|
|||||||
std::vector<etix::cameradar::stream_model>
|
std::vector<etix::cameradar::stream_model>
|
||||||
dumb_cache_manager::get_streams() {
|
dumb_cache_manager::get_streams() {
|
||||||
std::vector<stream_model> ret;
|
std::vector<stream_model> ret;
|
||||||
for (const auto& it : this->streams) {
|
for (const auto& stream : this->streams) {
|
||||||
if (not it.service_name.compare("rtsp") && not it.state.compare("open")) ret.push_back(it);
|
if (not stream.service_name.compare("rtsp") && not stream.state.compare("open"))
|
||||||
|
ret.push_back(stream);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -72,10 +75,10 @@ dumb_cache_manager::get_streams() {
|
|||||||
std::vector<etix::cameradar::stream_model>
|
std::vector<etix::cameradar::stream_model>
|
||||||
dumb_cache_manager::get_valid_streams() {
|
dumb_cache_manager::get_valid_streams() {
|
||||||
std::vector<stream_model> ret;
|
std::vector<stream_model> ret;
|
||||||
for (const auto& it : this->streams) {
|
for (const auto& stream : this->streams) {
|
||||||
if ((not it.service_name.compare("rtsp") && not it.state.compare("open")) && it.ids_found &&
|
if ((not stream.service_name.compare("rtsp") && not stream.state.compare("open")) &&
|
||||||
it.path_found)
|
stream.ids_found && stream.path_found)
|
||||||
ret.push_back(it);
|
ret.push_back(stream);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,12 +71,15 @@ curl_describe(const std::string& path, bool logs) {
|
|||||||
curl_easy_cleanup(csession);
|
curl_easy_cleanup(csession);
|
||||||
fclose(protofile);
|
fclose(protofile);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
LOG_DEBUG_("Response code : " + std::to_string(rc), "describe");
|
||||||
if (logs) {
|
if (logs) {
|
||||||
if (rc != 401 && pos == std::string::npos)
|
// Some cameras return 400 instead of 401, don't know why.
|
||||||
|
// Some cameras timeout and then curl considers the status as 0
|
||||||
|
if (rc != 401 && rc != 400 && rc && pos == std::string::npos)
|
||||||
LOG_INFO_("Unprotected camera discovered.", "brutelogs");
|
LOG_INFO_("Unprotected camera discovered.", "brutelogs");
|
||||||
return ((res == CURLE_OK) && rc != 401);
|
return ((res == CURLE_OK) && rc != 401 && rc != 400 && rc);
|
||||||
}
|
}
|
||||||
return ((res == CURLE_OK) && rc != 404);
|
return ((res == CURLE_OK) && rc != 404 && rc != 400 && rc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user