-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from oci-labs/system_test_cleanup
System test cleanup
- Loading branch information
Showing
123 changed files
with
3,539 additions
and
5,224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2014-2017 Open Source Robotics Foundation, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMW_OPENDDS_CPP__DDSCLIENT_HPP_ | ||
#define RMW_OPENDDS_CPP__DDSCLIENT_HPP_ | ||
|
||
#include <rmw_opendds_cpp/Service.hpp> | ||
#include <rmw_opendds_cpp/OpenDDSNode.hpp> | ||
#include <rmw_opendds_cpp/RmwAllocateFree.hpp> | ||
|
||
#include <dds/DCPS/GuardCondition.h> | ||
|
||
class DDSClient | ||
{ | ||
public: | ||
typedef RmwAllocateFree<DDSClient> Raf; | ||
static DDSClient * from(const rmw_client_t * client); | ||
int64_t send(const void * ros_request) const; | ||
bool take(rmw_service_info_t * request_header, void * ros_reply) const; | ||
void add_to(OpenDDSNode * dds_node); | ||
bool remove_from(OpenDDSNode * dds_node); | ||
bool is_server_available() const; | ||
const std::string& service_name() const { return service_.name(); } | ||
void * requester() const { return requester_; } | ||
DDS::ReadCondition_var read_condition() const { return read_condition_; } | ||
|
||
private: | ||
friend Raf; | ||
DDSClient(const rosidl_service_type_support_t * ts, const char * service_name, | ||
const rmw_qos_profile_t * rmw_qos, DDS::DomainParticipant_var dp); | ||
~DDSClient() { cleanup(); } | ||
void cleanup(); | ||
bool count_matched_subscribers(size_t & count) const; | ||
bool count_matched_publishers(size_t & count) const; | ||
|
||
Service service_; | ||
void * requester_; | ||
DDS::DataReader_var reader_; | ||
DDS::ReadCondition_var read_condition_; | ||
DDS::DataWriter_var writer_; | ||
}; | ||
|
||
#endif // RMW_OPENDDS_CPP__DDSCLIENT_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright 2014-2017 Open Source Robotics Foundation, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMW_OPENDDS_CPP__DDSPUBLISHER_HPP_ | ||
#define RMW_OPENDDS_CPP__DDSPUBLISHER_HPP_ | ||
|
||
#include <rmw_opendds_cpp/DDSEntity.hpp> | ||
#include <rmw_opendds_cpp/DDSTopic.hpp> | ||
#include <rmw_opendds_cpp/RmwAllocateFree.hpp> | ||
|
||
#include <atomic> | ||
|
||
class OpenDDSPublisherListener : public DDS::PublisherListener | ||
{ | ||
public: | ||
typedef RmwAllocateFree<OpenDDSPublisherListener> Raf; | ||
|
||
virtual void on_publication_matched(DDS::DataWriter *, const DDS::PublicationMatchedStatus & status) { | ||
current_count_ = status.current_count; | ||
} | ||
std::size_t current_count() const { return current_count_; } | ||
|
||
void on_offered_deadline_missed(DDS::DataWriter_ptr, const DDS::OfferedDeadlineMissedStatus&) {} | ||
void on_offered_incompatible_qos(DDS::DataWriter_ptr, const DDS::OfferedIncompatibleQosStatus&) {} | ||
void on_liveliness_lost(DDS::DataWriter_ptr, const DDS::LivelinessLostStatus&) {} | ||
|
||
private: | ||
friend Raf; | ||
OpenDDSPublisherListener() { current_count_ = 0; } | ||
~OpenDDSPublisherListener() {} | ||
std::atomic<std::size_t> current_count_; | ||
}; | ||
|
||
class DDSPublisher : public DDSEntity | ||
{ | ||
public: | ||
typedef RmwAllocateFree<DDSPublisher> Raf; | ||
static DDSPublisher * from(const rmw_publisher_t * pub); | ||
const std::string& topic_name() const { return topic_.name(); } | ||
const std::string& topic_type() const { return topic_.type(); } | ||
rmw_ret_t get_rmw_qos(rmw_qos_profile_t & qos) const; | ||
rmw_ret_t to_cdr_stream(const void * ros_message, rcutils_uint8_array_t & cdr_stream); | ||
DDS::DataWriter_var writer() const { return writer_; } | ||
|
||
std::size_t matched_subscribers() const { return listener_->current_count(); } | ||
DDS::InstanceHandle_t instance_handle() const { return publisher_->get_instance_handle(); } | ||
rmw_gid_t gid() const { return publisher_gid_; } | ||
|
||
// Remap the OpenDDS DataWriter status to a generic RMW status | ||
rmw_ret_t get_status(const DDS::StatusMask mask, void * rmw_status) override; | ||
// Return the writer associated with this publisher | ||
DDS::Entity * get_entity() override { return writer_; } | ||
private: | ||
friend Raf; | ||
DDSPublisher(DDS::DomainParticipant_var dp, const rosidl_message_type_support_t * ros_ts, | ||
const char * topic_name, const rmw_qos_profile_t * rmw_qos); | ||
~DDSPublisher() { cleanup(); } | ||
void cleanup(); | ||
|
||
DDSTopic topic_; | ||
OpenDDSPublisherListener * listener_; | ||
DDS::Publisher_var publisher_; | ||
DDS::DataWriter_var writer_; | ||
rmw_gid_t publisher_gid_; | ||
}; | ||
|
||
#endif // RMW_OPENDDS_CPP__DDSPUBLISHER_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2014-2017 Open Source Robotics Foundation, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMW_OPENDDS_CPP__DDSSERVER_HPP_ | ||
#define RMW_OPENDDS_CPP__DDSSERVER_HPP_ | ||
|
||
#include <rmw_opendds_cpp/Service.hpp> | ||
#include <rmw_opendds_cpp/OpenDDSNode.hpp> | ||
#include <rmw_opendds_cpp/RmwAllocateFree.hpp> | ||
|
||
#include <dds/DCPS/GuardCondition.h> | ||
|
||
class DDSServer | ||
{ | ||
public: | ||
typedef RmwAllocateFree<DDSServer> Raf; | ||
static DDSServer * from(const rmw_service_t * service); | ||
bool take(rmw_service_info_t * request_header, void * ros_request) const; | ||
bool send(const rmw_request_id_t * request_header, const void * ros_reply) const; | ||
void add_to(OpenDDSNode * dds_node); | ||
bool remove_from(OpenDDSNode * dds_node); | ||
const std::string& service_name() const { return service_.name(); } | ||
void * replier() const { return replier_; } | ||
DDS::ReadCondition_var read_condition() const { return read_condition_; } | ||
|
||
private: | ||
friend Raf; | ||
DDSServer(const rosidl_service_type_support_t * ts, const char * service_name, | ||
const rmw_qos_profile_t * rmw_qos, DDS::DomainParticipant_var dp); | ||
~DDSServer() { cleanup(); } | ||
void cleanup(); | ||
|
||
Service service_; | ||
void * replier_; | ||
DDS::DataReader_var reader_; | ||
DDS::ReadCondition_var read_condition_; | ||
DDS::DataWriter_var writer_; | ||
}; | ||
|
||
#endif // RMW_OPENDDS_CPP__DDSSERVER_HPP_ |
Oops, something went wrong.