Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Jun 5, 2025

This PR adds support for subscription and publisher event handlers across native bindings and the JavaScript API, and updates tests and type definitions accordingly.

  • Introduce C++ bindings and event handle management in HandleManager and Executor
  • Extend Node, Subscription, and Publisher classes to accept and clean up event callbacks
  • Add and adjust tests and type declarations for event handler functionality

Fix: #1142, #492

@minggangw minggangw requested a review from Copilot June 5, 2025 01:51

This comment was marked as outdated.

@coveralls
Copy link

coveralls commented Jun 5, 2025

Coverage Status

coverage: 84.625% (-0.2%) from 84.823%
when pulling 7956426 on minggangw:fix-1142
into 0dbe3da on RobotWebTools:develop.

@minggangw minggangw requested a review from Copilot June 5, 2025 03:09

This comment was marked as outdated.

@minggangw minggangw requested a review from Copilot June 5, 2025 05:29

This comment was marked as outdated.

@minggangw minggangw requested a review from Copilot June 5, 2025 05:40

This comment was marked as outdated.

@minggangw minggangw requested a review from Copilot June 5, 2025 08:36

This comment was marked as outdated.

@minggangw minggangw requested a review from Copilot June 5, 2025 08:52

This comment was marked as outdated.

@minggangw minggangw requested a review from Copilot June 6, 2025 03:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for event handler functionality for subscriptions and publishers by extending native bindings, updating the executor and handle manager, and augmenting test coverage.

  • Adds C++ bindings for event handle management.
  • Updates Node, Subscription, and Publisher classes to integrate event callbacks.
  • Enhances tests and type definitions to cover new event functionality.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/types/index.test-d.ts Adds test cases for event callbacks on subscriptions and publishers.
test/test-type-description-service.js Minor update to delay tests based on distro conditions.
test/test-event-handle.js Introduces comprehensive tests for subscription and publisher events.
src/rcl_event_handle_bindings.{h,cpp} Implements new bindings for event handle functionality.
src/handle_manager.{h,cpp} Integrates event handles into wait set management and entity tracking.
src/executor.cpp Updates wait set resizing and ready handle collection to include events.
src/addon.cpp Registers the new event handle bindings.
lib/{subscription.js, publisher.js, node.js} Extends API methods to support event callbacks on subscriptions/publishers.
lib/lifecycle_publisher.js Updates publisher creation to work with node handles.
binding.gyp Adds the event handle bindings source file.
Comments suppressed due to low confidence (2)

lib/node.js:620

  • Consider using a more descriptive error message in createPublisher when eventCallbacks is provided but is not an instance of PublisherEventCallbacks, for example: 'Invalid argument: eventCallbacks must be an instance of PublisherEventCallbacks.'
if (typeof typeClass !== 'function' || typeof topic !== 'string' || (eventCallbacks && !(eventCallbacks instanceof PublisherEventCallbacks))) {

lib/node.js:688

  • Use a more detailed error message in createSubscription when eventCallbacks is provided but not an instance of SubscriptionEventCallbacks (e.g., 'Invalid argument: eventCallbacks must be an instance of SubscriptionEventCallbacks.') to improve debugging clarity.
if (typeof typeClass !== 'function' || typeof topic !== 'string' || (eventCallbacks && !(eventCallbacks instanceof SubscriptionEventCallbacks))) {

@minggangw minggangw merged commit 1502f32 into RobotWebTools:develop Jun 6, 2025
19 checks passed
minggangw added a commit that referenced this pull request Jun 6, 2025
This PR adds support for subscription and publisher event handlers across native bindings and the JavaScript API, and updates tests and type definitions accordingly.

- Introduce C++ bindings and event handle management in `HandleManager` and `Executor`
- Extend `Node`, `Subscription`, and `Publisher` classes to accept and clean up event callbacks
- Add and adjust tests and type declarations for event handler functionality

Fix: #1142, #492
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for EventHandle

2 participants