Skip to content

Commit

Permalink
v0.2.2 : Cameradar now supports badly configured cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullaakut committed May 27, 2016
1 parent e6a38af commit 76365e3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ project (${PROJECT_NAME})

set (${PROJECT_NAME}_VERSION_MAJOR 0)
set (${PROJECT_NAME}_VERSION_MINOR 2)
set (${PROJECT_NAME}_VERSION_PATCH 0)
set (${PROJECT_NAME}_VERSION_PATCH 2)
set (${PROJECT_NAME}_SUFFIX "-beta")
set (${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}${${PROJECT_NAME}_SUFFIX}")

Expand Down Expand Up @@ -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_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR "0")
set (CPACK_PACKAGE_VERSION_MINOR "1")
set (CPACK_PACKAGE_VERSION_PATCH "0")
set (CPACK_PACKAGE_VERSION_MINOR "2")
set (CPACK_PACKAGE_VERSION_PATCH "2")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}_${${PROJECT_NAME}_VERSION}")
set (CPACK_GENERATOR "TGZ")
set (CPACK_SOURCE_GENERATOR "TGZ")
Expand Down
19 changes: 11 additions & 8 deletions cache_managers/dumb_cache_manager/src/dumb_cache_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,20 @@ dumb_cache_manager::set_streams(std::vector<etix::cameradar::stream_model> model
//! Inserts a single stream to the cache
void
dumb_cache_manager::update_stream(const etix::cameradar::stream_model& newmodel) {
for (auto& it : this->streams) {
if (it.address == newmodel.address && it.port == newmodel.port) { it = newmodel; }
for (auto& stream : this->streams) {
if (stream.address == newmodel.address && stream.port == newmodel.port) {
stream = newmodel;
}
}
}

//! Gets all cached streams
std::vector<etix::cameradar::stream_model>
dumb_cache_manager::get_streams() {
std::vector<stream_model> ret;
for (const auto& it : this->streams) {
if (not it.service_name.compare("rtsp") && not it.state.compare("open")) ret.push_back(it);
for (const auto& stream : this->streams) {
if (not stream.service_name.compare("rtsp") && not stream.state.compare("open"))
ret.push_back(stream);
}
return ret;
}
Expand All @@ -72,10 +75,10 @@ dumb_cache_manager::get_streams() {
std::vector<etix::cameradar::stream_model>
dumb_cache_manager::get_valid_streams() {
std::vector<stream_model> ret;
for (const auto& it : this->streams) {
if ((not it.service_name.compare("rtsp") && not it.state.compare("open")) && it.ids_found &&
it.path_found)
ret.push_back(it);
for (const auto& stream : this->streams) {
if ((not stream.service_name.compare("rtsp") && not stream.state.compare("open")) &&
stream.ids_found && stream.path_found)
ret.push_back(stream);
}
return ret;
}
Expand Down
9 changes: 6 additions & 3 deletions cameradar_standalone/src/describe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ curl_describe(const std::string& path, bool logs) {
curl_easy_cleanup(csession);
fclose(protofile);
curl_global_cleanup();
LOG_DEBUG_("Response code : " + std::to_string(rc), "describe");
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");
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.

0 comments on commit 76365e3

Please sign in to comment.