Skip to content

Commit

Permalink
examples: new component API
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Oes <[email protected]>
  • Loading branch information
julianoes committed Oct 30, 2023
1 parent 7e4ac1f commit 3de652f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
8 changes: 3 additions & 5 deletions examples/autopilot_server/autopilot_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ int main(int argc, char** argv)
// thread as a ground station.
std::thread autopilotThread([]() {
mavsdk::Mavsdk mavsdkTester;
mavsdk::Mavsdk::Configuration configuration(
mavsdk::Mavsdk::Configuration::UsageType::Autopilot);
mavsdk::Mavsdk::Configuration configuration(mavsdk::Mavsdk::ComponentType::Autopilot);
mavsdkTester.set_configuration(configuration);

auto result = mavsdkTester.add_any_connection("udp://127.0.0.1:14551");
Expand All @@ -69,7 +68,7 @@ int main(int argc, char** argv)
}

auto server_component =
mavsdkTester.server_component_by_type(Mavsdk::ServerComponentType::Autopilot);
mavsdkTester.server_component_by_type(Mavsdk::ComponentType::Autopilot);

// Create server plugins
auto paramServer = mavsdk::ParamServer{server_component};
Expand Down Expand Up @@ -148,8 +147,7 @@ int main(int argc, char** argv)
// Now this is the main thread, we run client plugins to act as the GCS
// to communicate with the autopilot server plugins.
mavsdk::Mavsdk mavsdk;
mavsdk::Mavsdk::Configuration configuration(
mavsdk::Mavsdk::Configuration::UsageType::GroundStation);
mavsdk::Mavsdk::Configuration configuration(mavsdk::Mavsdk::ComponentType::GroundStation);
mavsdk.set_configuration(configuration);

auto result = mavsdk.add_any_connection("udp://:14551");
Expand Down
3 changes: 1 addition & 2 deletions examples/camera_server/camera_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ int main(int argc, const char* argv[])
// we run client plugins to act as the GCS
// to communicate with the camera server plugins.
mavsdk::Mavsdk mavsdk;
mavsdk::Mavsdk::Configuration configuration(
mavsdk::Mavsdk::Configuration::UsageType::GroundStation);
mavsdk::Mavsdk::Configuration configuration(mavsdk::Mavsdk::ComponentType::GroundStation);
mavsdk.set_configuration(configuration);

auto result = mavsdk.add_any_connection("udp://:14030");
Expand Down
4 changes: 2 additions & 2 deletions examples/camera_server/camera_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
int main(int argc, char** argv)
{
mavsdk::Mavsdk mavsdk;
mavsdk::Mavsdk::Configuration configuration(mavsdk::Mavsdk::Configuration::UsageType::Camera);
mavsdk::Mavsdk::Configuration configuration(mavsdk::Mavsdk::ComponentType::Camera);
mavsdk.set_configuration(configuration);

// 14030 is the default camera port for PX4 SITL
Expand All @@ -18,7 +18,7 @@ int main(int argc, char** argv)
std::cout << "Created camera server connection" << std::endl;

auto camera_server = mavsdk::CameraServer{
mavsdk.server_component_by_type(mavsdk::Mavsdk::ServerComponentType::Camera)};
mavsdk.server_component_by_type(mavsdk::Mavsdk::ComponentType::Camera)};

// First add all subscriptions. This defines the camera capabilities.

Expand Down
4 changes: 2 additions & 2 deletions examples/ftp_server/ftp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main(int argc, char** argv)
}

Mavsdk mavsdk;
Mavsdk::Configuration configuration(Mavsdk::Configuration::UsageType::CompanionComputer);
Mavsdk::Configuration configuration(Mavsdk::ComponentType::CompanionComputer);
mavsdk.set_configuration(configuration);
ConnectionResult connection_result = mavsdk.setup_udp_remote(argv[1], std::stoi(argv[2]));
if (connection_result != ConnectionResult::Success) {
Expand All @@ -38,7 +38,7 @@ int main(int argc, char** argv)
}

auto component =
mavsdk.server_component_by_type(mavsdk::Mavsdk::ServerComponentType::CompanionComputer);
mavsdk.server_component_by_type(mavsdk::Mavsdk::ComponentType::CompanionComputer);
auto ftp_server = FtpServer{component};
ftp_server.set_root_dir(argv[3]);

Expand Down
2 changes: 1 addition & 1 deletion examples/gimbal_device_tester/gimbal_device_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ int main(int argc, char** argv)
return 1;
}

Mavsdk::Configuration config(Mavsdk::Configuration::UsageType::Autopilot);
Mavsdk::Configuration config(Mavsdk::ComponentType::Autopilot);
config.set_system_id(own_sysid);
mavsdk.set_configuration(config);

Expand Down

0 comments on commit 3de652f

Please sign in to comment.