Skip to content

Commit

Permalink
adds documentation to new API functions
Browse files Browse the repository at this point in the history
  • Loading branch information
benptc committed May 2, 2019
1 parent d8ab539 commit 7d638c7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion libraries/hardwareInterfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function Frame() {
exports.getIP = function () {
var ip = require("ip");
return ip.address();
}
};

exports.write = function (objectName, frameName, nodeName, value, mode, unit, unitMin, unitMax) {

Expand Down Expand Up @@ -480,6 +480,12 @@ exports.removeNode = function (objectName, frameName, nodeName) {
}
};

/**
* Removes all nodes from the specified frame
* (pushUpdatesToDevices needs to be called afterwards)
* @param {string} objectName
* @param {string} frameName
*/
exports.resetNodes = function (objectName, frameName) {
var objectID = utilities.getObjectIdFromTarget(objectName, objectsPath);
var frameID = objectID + frameName;
Expand All @@ -492,11 +498,22 @@ exports.resetNodes = function (objectName, frameName) {
}
};

/**
* Changes the node's position to become relative to the ground plane origin instead of the frame
* Defaults to true if last parameter is excluded. Explicitly pass in false to de-attach from ground plane and go back to frame.
* (pushUpdatesToDevices needs to be called afterwards)
* @param {string} objectName
* @param {string} frameName
* @param {string} nodeName
* @param {bool} shouldAttachToGroundPlane
*/
exports.attachNodeToGroundPlane = function (objectName, frameName, nodeName, shouldAttachToGroundPlane) {
var objectID = utilities.getObjectIdFromTarget(objectName, objectsPath);
var frameID = objectID + frameName;
var nodeID = objectID + frameName + nodeName;

if (typeof shouldAttachToGroundPlane === 'undefined') { shouldAttachToGroundPlane = true; } // defaults to true

if (!_.isUndefined(objectID) && !_.isNull(objectID)) {
if (objects.hasOwnProperty(objectID)) {
if (objects[objectID].frames.hasOwnProperty(frameID)) {
Expand Down

0 comments on commit 7d638c7

Please sign in to comment.