Skip to content

Commit

Permalink
Move statuses definitions to rmw/events_statuses/*.h (#232)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
  • Loading branch information
ivanpauno authored and ahcorde committed Oct 28, 2020
1 parent 9d7f2b3 commit d8854db
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 119 deletions.
24 changes: 24 additions & 0 deletions rmw/include/rmw/events_statuses/events_statuses.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2020 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__EVENTS_STATUSES__EVENTS_STATUSES_H_
#define RMW__EVENTS_STATUSES__EVENTS_STATUSES_H_

#include "rmw/events_statuses/incompatible_qos.h"
#include "rmw/events_statuses/liveliness_changed.h"
#include "rmw/events_statuses/liveliness_lost.h"
#include "rmw/events_statuses/offered_deadline_missed.h"
#include "rmw/events_statuses/requested_deadline_missed.h"

#endif // RMW__EVENTS_STATUSES__EVENTS_STATUSES_H_
68 changes: 68 additions & 0 deletions rmw/include/rmw/events_statuses/incompatible_qos.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// 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__EVENTS_STATUSES__INCOMPATIBLE_QOS_H_
#define RMW__EVENTS_STATUSES__INCOMPATIBLE_QOS_H_

#include <stdint.h>

#include "rmw/visibility_control.h"

#ifdef __cplusplus
extern "C"
{
#endif

/// QoS Policy Kinds
typedef enum RMW_PUBLIC_TYPE rmw_qos_policy_kind_t
{
RMW_QOS_POLICY_INVALID = 1 << 0,
RMW_QOS_POLICY_DURABILITY = 1 << 1,
RMW_QOS_POLICY_DEADLINE = 1 << 2,
RMW_QOS_POLICY_LIVELINESS = 1 << 3,
RMW_QOS_POLICY_RELIABILITY = 1 << 4,
RMW_QOS_POLICY_HISTORY = 1 << 5,
RMW_QOS_POLICY_LIFESPAN = 1 << 6
} rmw_qos_policy_kind_t;

struct RMW_PUBLIC_TYPE rmw_qos_incompatible_event_status_t
{
/**
* Total cumulative number of times the concerned subscription discovered a
* publisher for the same topic with an offered QoS that was incompatible
* with that requested by the subscription.
*/
int32_t total_count;
/**
* The change in total_count since the last time the status was read.
*/
int32_t total_count_change;
/**
* The Qos Policy Kind of one of the policies that was found to be
* incompatible the last time an incompatibility was detected.
*/
rmw_qos_policy_kind_t last_policy_kind;
};

/// Event state for a subscription's 'RMW_EVENT_REQUESTED_QOS_INCOMPATIBLE' events.
typedef struct rmw_qos_incompatible_event_status_t rmw_requested_qos_incompatible_event_status_t;

/// Event state for a publisher's 'RMW_EVENT_OFFERED_QOS_INCOMPATIBLE' events.
typedef struct rmw_qos_incompatible_event_status_t rmw_offered_qos_incompatible_event_status_t;

#ifdef __cplusplus
}
#endif

#endif // RMW__EVENTS_STATUSES__INCOMPATIBLE_QOS_H_
58 changes: 58 additions & 0 deletions rmw/include/rmw/events_statuses/liveliness_changed.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2020 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__EVENTS_STATUSES__LIVELINESS_CHANGED_H_
#define RMW__EVENTS_STATUSES__LIVELINESS_CHANGED_H_

#include <stdint.h>

#include "rmw/visibility_control.h"

#ifdef __cplusplus
extern "C"
{
#endif

/// QoS Liveliness Changed information provided by a subscription.
typedef struct RMW_PUBLIC_TYPE rmw_liveliness_changed_status_t
{
/**
* The total number of currently active Publishers which publish to the topic associated with
* the Subscription.
* This count increases when a newly matched Publisher asserts its liveliness for the first time
* or when a Publisher previously considered to be not alive reasserts its liveliness.
* The count decreases when a Publisher considered alive fails to assert its liveliness and
* becomes not alive, whether because it was deleted normally or for some other reason.
*/
int32_t alive_count;
/**
* The total count of current Publishers which publish to the topic associated with the
* Subscription that are no longer asserting their liveliness.
* This count increases when a Publisher considered alive fails to assert its liveliness and
* becomes not alive for some reason other than the normal deletion of that Publisher.
* It decreases when a previously not alive Publisher either reasserts its liveliness or is
* deleted normally.
*/
int32_t not_alive_count;
/// The change in the alive_count since the status was last read.
int32_t alive_count_change;
/// The change in the not_alive_count since the status was last read.
int32_t not_alive_count_change;
} rmw_liveliness_changed_status_t;

#ifdef __cplusplus
}
#endif

#endif // RMW__EVENTS_STATUSES__LIVELINESS_CHANGED_H_
45 changes: 45 additions & 0 deletions rmw/include/rmw/events_statuses/liveliness_lost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2020 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__EVENTS_STATUSES__LIVELINESS_LOST_H_
#define RMW__EVENTS_STATUSES__LIVELINESS_LOST_H_

#include <stdint.h>

#include "rmw/visibility_control.h"

#ifdef __cplusplus
extern "C"
{
#endif

/// QoS Liveliness Lost information provided by a publisher.
typedef struct RMW_PUBLIC_TYPE rmw_liveliness_lost_status_t
{
/**
* Lifetime cumulative number of times that a previously-alive Publisher became not alive due to
* a failure to actively signal its liveliness within its offered liveliness period.
* This count does not change when an already not alive Publisher simply remains not alive for
* another liveliness period.
*/
int32_t total_count;
/// The change in total_count since the last time the status was last read.
int32_t total_count_change;
} rmw_liveliness_lost_status_t;

#ifdef __cplusplus
}
#endif

#endif // RMW__EVENTS_STATUSES__LIVELINESS_LOST_H_
45 changes: 45 additions & 0 deletions rmw/include/rmw/events_statuses/offered_deadline_missed.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2020 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__EVENTS_STATUSES__OFFERED_DEADLINE_MISSED_H_
#define RMW__EVENTS_STATUSES__OFFERED_DEADLINE_MISSED_H_

#include <stddef.h>

#include "rmw/visibility_control.h"

#ifdef __cplusplus
extern "C"
{
#endif

/// QoS Deadline Missed information provided by a publisher.
typedef struct RMW_PUBLIC_TYPE rmw_offered_deadline_missed_status_t
{
/**
* Lifetime cumulative number of offered deadline periods elapsed during which a Publisher failed
* to provide data.
* Missed deadlines accumulate; that is, each deadline period the total_count will be incremented
* by one.
*/
int32_t total_count;
/// The change in total_count since the last time the status was last read.
int32_t total_count_change;
} rmw_offered_deadline_missed_status_t;

#ifdef __cplusplus
}
#endif

#endif // RMW__EVENTS_STATUSES__OFFERED_DEADLINE_MISSED_H_
45 changes: 45 additions & 0 deletions rmw/include/rmw/events_statuses/requested_deadline_missed.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2020 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__EVENTS_STATUSES__REQUESTED_DEADLINE_MISSED_H_
#define RMW__EVENTS_STATUSES__REQUESTED_DEADLINE_MISSED_H_

#include <stdint.h>

#include "rmw/visibility_control.h"

#ifdef __cplusplus
extern "C"
{
#endif

/// QoS Requested Deadline Missed information provided by a subscription.
typedef struct RMW_PUBLIC_TYPE rmw_requested_deadline_missed_status_t
{
/**
* Lifetime cumulative number of missed deadlines detected for any instance read by the
* subscription.
* Missed deadlines accumulate; that is, each deadline period the total_count will be incremented
* by one for each instance for which data was not received.
*/
int32_t total_count;
/// The incremental number of deadlines detected since the status was read.
int32_t total_count_change;
} rmw_requested_deadline_missed_status_t;

#ifdef __cplusplus
}
#endif

#endif // RMW__EVENTS_STATUSES__REQUESTED_DEADLINE_MISSED_H_
52 changes: 2 additions & 50 deletions rmw/include/rmw/incompatible_qos_events_statuses.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright 2020 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.
Expand All @@ -15,54 +15,6 @@
#ifndef RMW__INCOMPATIBLE_QOS_EVENTS_STATUSES_H_
#define RMW__INCOMPATIBLE_QOS_EVENTS_STATUSES_H_

#include <stdint.h>

#include "rmw/visibility_control.h"

#ifdef __cplusplus
extern "C"
{
#endif

/// QoS Policy Kinds
typedef enum RMW_PUBLIC_TYPE rmw_qos_policy_kind_t
{
RMW_QOS_POLICY_INVALID = 1 << 0,
RMW_QOS_POLICY_DURABILITY = 1 << 1,
RMW_QOS_POLICY_DEADLINE = 1 << 2,
RMW_QOS_POLICY_LIVELINESS = 1 << 3,
RMW_QOS_POLICY_RELIABILITY = 1 << 4,
RMW_QOS_POLICY_HISTORY = 1 << 5,
RMW_QOS_POLICY_LIFESPAN = 1 << 6
} rmw_qos_policy_kind_t;

struct RMW_PUBLIC_TYPE rmw_qos_incompatible_event_status_t
{
/**
* Total cumulative number of times the concerned subscription discovered a
* publisher for the same topic with an offered QoS that was incompatible
* with that requested by the subscription.
*/
int32_t total_count;
/**
* The change in total_count since the last time the status was read.
*/
int32_t total_count_change;
/**
* The Qos Policy Kind of one of the policies that was found to be
* incompatible the last time an incompatibility was detected.
*/
rmw_qos_policy_kind_t last_policy_kind;
};

/// Event state for a subscription's 'RMW_EVENT_REQUESTED_QOS_INCOMPATIBLE' events.
typedef struct rmw_qos_incompatible_event_status_t rmw_requested_qos_incompatible_event_status_t;

/// Event state for a publisher's 'RMW_EVENT_OFFERED_QOS_INCOMPATIBLE' events.
typedef struct rmw_qos_incompatible_event_status_t rmw_offered_qos_incompatible_event_status_t;

#ifdef __cplusplus
}
#endif
#include "rmw/events_statuses/incompatible_qos.h"

#endif // RMW__INCOMPATIBLE_QOS_EVENTS_STATUSES_H_
Loading

0 comments on commit d8854db

Please sign in to comment.