Skip to content

Commit

Permalink
Merge pull request #8 from julianoes/pr-install-xml
Browse files Browse the repository at this point in the history
Install xml file
  • Loading branch information
julianoes authored Feb 27, 2024
2 parents 6f0c9bf + 409e017 commit cfa2da5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions camera-manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ add_executable(camera_manager
)

install(TARGETS camera_manager)
install(FILES mavlink_ftp_root/siyi_a8_mini.xml DESTINATION share/mavlink_ftp_root)

find_package(MAVSDK REQUIRED)

Expand Down
13 changes: 11 additions & 2 deletions camera-manager/camera_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <iostream>
#include <chrono>
#include <thread>
#include <filesystem>
#include <mavsdk/mavsdk.h>
#include <mavsdk/plugins/camera_server/camera_server.h>
#include <mavsdk/plugins/ftp_server/ftp_server.h>
Expand Down Expand Up @@ -55,7 +56,15 @@ int main(int argc, char* argv[])
auto ftp_server = mavsdk::FtpServer{
mavsdk.server_component_by_type(mavsdk::Mavsdk::ComponentType::Camera)};

auto ftp_result = ftp_server.set_root_dir("camera-manager/mavlink_ftp_root");
// If running locally when built first, otherwise use system-wise:
std::string path = "./camera-manager/mavlink_ftp_root";
if (!std::filesystem::exists(path)) {
path = "/usr/share/mavlink_ftp_root";
}

std::cout << "Using FTP root: " << path << " to serve camera xml file." << std::endl;

auto ftp_result = ftp_server.set_root_dir(path);
if (ftp_result != mavsdk::FtpServer::Result::Success) {
std::cerr << "Could not set FTP server root dir: " << ftp_result << std::endl;
return 2;
Expand Down Expand Up @@ -86,7 +95,7 @@ int main(int argc, char* argv[])

param_server.provide_param_int("CAM_MODE", 0);
param_server.provide_param_int("STREAM_RES", stream_res);
param_server.provide_param_int("STREAM_BITRATE", siyi_camera.bitrate());
param_server.provide_param_int("STREAM_BITRATE", static_cast<int32_t>(siyi_camera.bitrate()));
param_server.provide_param_int("STREAM_CODEC", stream_codec);

param_server.subscribe_changed_param_int([&](auto param_int) {
Expand Down
2 changes: 1 addition & 1 deletion create_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ common_args="--chdir ${working_dir}/install \

echo "common_args: ${common_args}"

if cat /etc/os-release | grep 'Ubuntu'
if cat /etc/os-release | grep -e 'Ubuntu' -e 'Mint'
then
echo "Building Ubuntu DEB package"
fpm ${common_args} \
Expand Down
2 changes: 1 addition & 1 deletion rtsp-rebroadcast/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down

0 comments on commit cfa2da5

Please sign in to comment.