NetworkTables bindings for node.js
C++ JavaScript Python C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ntcore @ b8ad1de
.gitignore Initial commit Apr 22, 2016
.gitmodules
NetworkTable_node.cc
NetworkTable_node.h
Readme.md
binding.gyp
leak_test.js
ntcore_node.cc
ntcore_node.h
package.json
test.js
test_client.js

Readme.md

NetworkTables bindings for node.js

API

const ntcore = require('ntcore_node');

Almost all functions may throw errors.

ntcore.setOptions(options)

Sets NetworkTables options. Must be called before init

Options:

ntcore.init(mode, addr)

Sets up NetworkTables to either run as a server or connect to a server.

mode: One of ntcore.SERVER or ntcore.CLIENT
addr: The IP address or hostname to connect to, if in client mode

ntcore.dispose()

Closes NetworkTables connections and disposes of all table objects. Any remaining table objects from ntcore.getTable() will have undefined behavior.

ntcore.getTable(name)

Gets a network table object with the specified name.

ntcore.getAllEntries()

Returns an array of all entries NetworkTables knows about, as an array of full pathnames.

NetworkTable.get(key, defaultValue)

Returns a NetworkTables value for the specified key if it exists, otherwise defaultValue.

NetworkTable.put(key, value)

Inserts or replaces the NetworkTables value for the specified key with value.

NetworkTable.remove(key)

Deletes the key and associated value from the table, if it exists.

NetworkTable.getTablePath()

Returns the NetworkTables path for this table (eg, what was passed to ntcore.getTable(name)).

NetworkTable.onChange(key, function(key, newValue){})

Adds a change listener for the specified key.

Known Issues

  • Will not exit cleanly on SIGINT because the exit handler is never called
  • No support for raw NetworkTable values

Building

For node.js:

For nw.js:

  • Install nw-gyp + dependencies
  • Getting nw-gyp to work with VS 2015 on Windows required some black magic that I can't remember how to do right now. On Linux and OSX I don't expect issues.
  • nw-gyp configure build --target=<target nw.js version> --python "path to your python 2.7". For Windows, add --msvs_version=2015.
  • Find the ntcore_node.node file