Source: lib/action/graph.js

  1. // Copyright (c) 2020 Matt Richard. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. 'use strict';
  15. const rclnodejs = require('bindings')('rclnodejs');
  16. /**
  17. * Get a list of action names and types for action clients associated with a node.
  18. * @param {Node} node - The node used for discovery.
  19. * @param {string} nodeName - The name of a remote node to get action clients for.
  20. * @param {string} namespace - Namespace of the remote node.
  21. * @return {array} - An array of the names and types.
  22. */
  23. function getActionClientNamesAndTypesByNode(node, nodeName, namespace) {
  24. return rclnodejs.actionGetClientNamesAndTypesByNode(
  25. node.handle,
  26. nodeName,
  27. namespace
  28. );
  29. }
  30. /**
  31. * Get a list of action names and types for action servers associated with a node.
  32. * @param {Node} node - The node used for discovery.
  33. * @param {string} nodeName - The name of a remote node to get action servers for.
  34. * @param {string} namespace - Namespace of the remote node.
  35. * @return {array} - An array of the names and types.
  36. */
  37. function getActionServerNamesAndTypesByNode(node, nodeName, namespace) {
  38. return rclnodejs.actionGetServerNamesAndTypesByNode(
  39. node.handle,
  40. nodeName,
  41. namespace
  42. );
  43. }
  44. /**
  45. * Get a list of action names and types.
  46. * @param {Node} node - The node used for discovery.
  47. * @return {array} - An array of the names and types.
  48. */
  49. function getActionNamesAndTypes(node) {
  50. return rclnodejs.actionGetNamesAndTypes(node.handle);
  51. }
  52. module.exports = {
  53. getActionClientNamesAndTypesByNode,
  54. getActionServerNamesAndTypesByNode,
  55. getActionNamesAndTypes,
  56. };