Skip to content

Commit

Permalink
refactor #116 remove callback_type (#154) (#163)
Browse files Browse the repository at this point in the history
* refactor #116 remove callback_type

Signed-off-by: BrettRD <[email protected]>

* rename subscription callback

Signed-off-by: BrettRD <[email protected]>

* deduplicate remove functions

Signed-off-by: BrettRD <[email protected]>
(cherry picked from commit 700ea24)

Co-authored-by: Brett Downing <[email protected]>
  • Loading branch information
mergify[bot] and BrettRD authored Jul 28, 2021
1 parent 0f654b8 commit f8a630c
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 166 deletions.
2 changes: 1 addition & 1 deletion rclc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ With `rclc_executor_trigger_any` being the default trigger condition, the curren
With the `rclc_executor_trigger_one` trigger, the handle to trigger is specified with `trigger_object`.
In the other cases of the trigger conditions this parameter shall be `NULL`.

**rclc_executor_add_subscription(rclc_executor_t * executor, rcl_subscription_t * subscription, void * msg, rclc_callback_t callback, rclc_executor_handle_invocation_t invocation)**
**rclc_executor_add_subscription(rclc_executor_t * executor, rcl_subscription_t * subscription, void * msg, rclc_subscription_callback_t callback, rclc_executor_handle_invocation_t invocation)**

**rclc_executor_add_timer( rclc_executor_t * executor, rcl_timer_t * timer)**

Expand Down
2 changes: 1 addition & 1 deletion rclc/include/rclc/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ rclc_executor_add_subscription(
rclc_executor_t * executor,
rcl_subscription_t * subscription,
void * msg,
rclc_callback_t callback,
rclc_subscription_callback_t callback,
rclc_executor_handle_invocation_t invocation);

/**
Expand Down
29 changes: 13 additions & 16 deletions rclc/include/rclc/executor_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ extern "C"
typedef enum
{
SUBSCRIPTION,
SUBSCRIPTION_WITH_CONTEXT,
TIMER,
// TIMER_WITH_CONTEXT, // TODO
CLIENT,
CLIENT_WITH_REQUEST_ID,
// CLIENT_WITH_CONTEXT, // TODO
SERVICE,
SERVICE_WITH_REQUEST_ID,
SERVICE_WITH_CONTEXT,
GUARD_CONDITION,
// GUARD_CONDITION_WITH_CONTEXT, //TODO
NONE
} rclc_executor_handle_type_t;

Expand All @@ -46,21 +53,13 @@ typedef enum
ALWAYS
} rclc_executor_handle_invocation_t;

typedef enum
{
CB_UNDEFINED,
CB_WITHOUT_REQUEST_ID,
CB_WITH_REQUEST_ID,
CB_WITH_CONTEXT,
} rclc_executor_handle_callback_type_t;


/// Type definition for callback function.
typedef void (* rclc_callback_t)(const void *);

/// Type definition for subscription callback function
/// - incoming message
// typedef void (* rclc_subscription_callback_t)(const void *);
typedef void (* rclc_subscription_callback_t)(const void *);

/// Type definition (duplicate) for subscription callback function (alias for foxy and galactic).
/// - incoming message
typedef rclc_subscription_callback_t rclc_callback_t;

/// Type definition for subscription callback function
/// - incoming message
Expand Down Expand Up @@ -137,7 +136,7 @@ typedef struct

/// Storage for callbacks
union {
rclc_callback_t callback;
rclc_subscription_callback_t subscription_callback;
rclc_subscription_callback_with_context_t subscription_callback_with_context;
rclc_service_callback_t service_callback;
rclc_service_callback_with_request_id_t service_callback_with_reqid;
Expand All @@ -159,8 +158,6 @@ typedef struct
/// Interval variable. Flag, which is true, if new data is available from DDS queue
/// (is set after calling rcl_take)
bool data_available;
/// callback type for service/client
rclc_executor_handle_callback_type_t callback_type;
} rclc_executor_handle_t;

/// Information about total number of subscriptions, guard_conditions, timers, subscription etc.
Expand Down
Loading

0 comments on commit f8a630c

Please sign in to comment.