@@ -23,6 +23,11 @@ const namespaceUtils = require('../utils/namespace_utils.js');
2323const ActionClientInterface = require ( './ActionClientInterface.js' ) ;
2424const ActionServerInterface = require ( './ActionServerInterface.js' ) ;
2525
26+ /**
27+ * Handle class for nodes created with rosnodejs
28+ * @param node {RosNode} node that handle is attached to.
29+ * @param namespace {string} namespace of node. @default null
30+ */
2631class NodeHandle {
2732 constructor ( node , namespace = null ) {
2833 this . _node = node ;
@@ -301,6 +306,56 @@ class NodeHandle {
301306 return this . _node . getMasterUri ( ) ;
302307 }
303308
309+ /**
310+ * @typedef {Object } TopicList
311+ * @property {{name: string, type: string}[] } topics Array of topics
312+ */
313+
314+
315+ /**
316+ * Get list of topics that can be subscribed to. This does not return
317+ * topics that have no publishers.
318+ *
319+ * @param {string } subgraph Restrict topic names to match within the
320+ * specified subgraph. Subgraph namespace is
321+ * resolved relative to this node's namespace.
322+ * Will return all names if no subgraph is given.
323+ * @return {Promise.<TopicList> }
324+ */
325+ getPublishedTopics ( subgraph = "" ) {
326+ return this . _node . getPublishedTopics ( subgraph ) ;
327+ }
328+
329+ /**
330+ * Retrieve list topic names and their types.
331+ *
332+ * @return {Promise.<TopicList> }
333+ */
334+ getTopicTypes ( ) {
335+ return this . _node . getTopicTypes ( ) ;
336+ }
337+
338+
339+ /**
340+ * @typedef {Object } SystemState
341+ * @property {{...string:Array.<string>} } publishers An object with topic names as keys and
342+ * an array of publishers as values
343+ * @property {{...string:Array.<string>} } subscribers An object with topic names as keys and
344+ * an array of subscribers as values
345+ * @property {{...string:Array.<string>} } services An object with service names as keys and
346+ * an array of providers as values
347+ */
348+
349+ /**
350+ * Retrieve list representation of system state (i.e. publishers,
351+ * subscribers, and services).
352+ *
353+ * @return {Promise.<SystemState> }
354+ */
355+ getSystemState ( ) {
356+ return this . _node . getSystemState ( ) ;
357+ }
358+
304359//------------------------------------------------------------------
305360// Param Interface
306361//------------------------------------------------------------------
0 commit comments