Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Apr 30, 2025

This PR adds missing timer functionalities and their corresponding unit tests. The key changes include:

  • New unit tests for timer operations in test/test-timer.js.
  • New timer binding functions in src/rcl_timer_bindings.cpp to support period retrieval, timer period change, and timer call information.
  • New Timer class methods and getter in lib/timer.js to expose the newly added timer functionalities.

Fix: #1109

@minggangw minggangw requested a review from Copilot April 30, 2025 05:04
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 missing timer functions and corresponding tests to supplement the timer API.

  • Added tests in test-timer.js for timerPeriod, changeTimerPeriod, and callTimerWithInfo.
  • Extended native bindings in src/rcl_timer_bindings.cpp to support new timer functions.
  • Updated the Timer class in lib/timer.js to expose changeTimerPeriod, timerPeriod getter, and callTimerWithInfo methods.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/test-timer.js Introduces tests for the new timer functions to verify their behavior.
src/rcl_timer_bindings.cpp Implements the native bindings for changing and retrieving timer period and call info.
lib/timer.js Exposes newly added timer functions through the Timer class API.
Comments suppressed due to low confidence (1)

src/rcl_timer_bindings.cpp:209

  • The property name 'expectetCallTime' is misspelled; consider renaming it to 'expectedCallTime' for clarity and consistency.
timer_info.Set("expectetCallTime", Napi::BigInt::New(env, call_info.expected_call_time));

it('timer.callTimerWithInfo', function (done) {
const timer = node.createTimer(BigInt('100000000'), () => {});
const info = timer.callTimerWithInfo();
assert.deepStrictEqual(typeof info.expectetCallTime, 'bigint');
Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

There is a spelling mistake in the property name 'expectetCallTime'; it should be 'expectedCallTime'.

Suggested change
assert.deepStrictEqual(typeof info.expectetCallTime, 'bigint');
assert.deepStrictEqual(typeof info.expectedCallTime, 'bigint');

Copilot uses AI. Check for mistakes.
@coveralls
Copy link

coveralls commented Apr 30, 2025

Coverage Status

coverage: 85.061% (+0.02%) from 85.045%
when pulling cb91a2a on minggangw:add-missing-timer
into 4a85210 on RobotWebTools:develop.

@minggangw minggangw requested a review from Copilot April 30, 2025 05:27
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 missing timer functionalities and their corresponding unit tests. The key changes include:

  • New unit tests for timer operations in test/test-timer.js.
  • New timer binding functions in src/rcl_timer_bindings.cpp to support period retrieval, timer period change, and timer call information.
  • New Timer class methods and getter in lib/timer.js to expose the newly added timer functionalities.

Reviewed Changes

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

File Description
test/test-timer.js Added tests for timerPeriod, changeTimerPeriod, and callTimerWithInfo
src/rcl_timer_bindings.cpp Added native bindings for timer period manipulation and info retrieval
lib/timer.js Introduced Timer methods for period change, retrieval, and call with info

@minggangw minggangw merged commit 98d2b08 into RobotWebTools:develop Apr 30, 2025
11 checks passed
minggangw added a commit that referenced this pull request Apr 30, 2025
This PR adds missing timer functionalities and their corresponding unit tests. The key changes include:
- New unit tests for timer operations in test/test-timer.js.
- New timer binding functions in src/rcl_timer_bindings.cpp to support period retrieval, timer period change, and timer call information.
- New Timer class methods and getter in lib/timer.js to expose the newly added timer functionalities.

Fix: #1109
minggangw added a commit that referenced this pull request Apr 30, 2025
This patch adds typescript interface for the newly added functions, see #1106 #1108

Fix: #1113
minggangw added a commit that referenced this pull request Apr 30, 2025
This patch adds typescript interface for the newly added functions, see #1106 #1108

Fix: #1113
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 missing functions for timer

2 participants