Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROUTING-1234: having the Service as Lib example in Recorder show the … #697

Merged
merged 6 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.0
latest
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ target_compile_features(Requester PRIVATE cxx_std_11)
target_link_libraries(
Requester
RTIConnextDDS::messaging_cpp2_api
RTIConnextDDS::service_admin_cpp2
RTIConnextDDS::recording_service
${CONNEXTDDS_EXTERNAL_LIBS}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ target_include_directories(
target_link_libraries(
ServiceAsLibExample
RTIConnextDDS::cpp2_api
RTIConnextDDS::service_admin_cpp2
RTIConnextDDS::recording_service
${CONNEXTDDS_EXTERNAL_LIBS}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <rti/recording/Service.hpp>
#include <rti/recording/ServiceProperty.hpp>

#include <rti/idlgen/ServiceAdmin.hpp>

void print_usage(const char *executable)
{
Expand Down Expand Up @@ -109,7 +109,24 @@ int main(int argc, char *argv[])
embedded_service.start();
// Wait for 'running_seconds' seconds
std::this_thread::sleep_for(std::chrono::seconds(running_seconds));
embedded_service.stop();
RTI::Service::Admin::CommandRequest request;
request.action(RTI::Service::Admin::CommandActionKind::UPDATE_ACTION);
request.resource_identifier(
service_property.application_role()
== rti::recording::ApplicationRoleKind::
RECORD_APPLICATION
? "/recording_services/service_as_lib/state"
: "/replay_services/service_as_lib/state");
request.string_body("STOPPED");
RTI::Service::Admin::CommandReply reply =
embedded_service.execute_command(request);
if (reply.retcode()
!= RTI::Service::Admin::CommandReplyRetcode::OK_RETCODE) {
std::cerr << "Error stopping the service: " << reply.string_body()
<< ", native error code = " << reply.native_retcode()
<< std::endl;
return EXIT_FAILURE;
}
} catch (const std::exception &ex) {
std::cerr << "Exception: " << ex.what() << std::endl;
return EXIT_FAILURE;
Expand Down
Loading