Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional timeout argument to callService #835

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/core/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ export default class Service extends EventEmitter {
* @param {TRequest} request - The service request to send.
* @param {callServiceCallback} [callback] - Function with the following params:
* @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params:
*/
callService(request, callback, failedCallback) {
* @param {number} [timeout] - Optional timeout, in seconds, for the service call. A non-positive value means no timeout.
* If not provided, the rosbridge server will use its default value.
*/
callService(request, callback, failedCallback, timeout) {
if (this.isAdvertised) {
return;
}
Expand All @@ -71,8 +73,10 @@ export default class Service extends EventEmitter {
id: serviceCallId,
service: this.name,
type: this.serviceType,
args: request
args: request,
timeout: timeout
};

this.ros.callOnConnection(call);
}
/**
Expand Down
Loading