vita

0.9.3 • Public • Published

Vita

Version 0.9


JaveScript bindings for libvita.


Requirements

  • libvita - Libvita is a library for controlling ansync devices. You can download this at Ansync.com.

Installation

npm install vita

Execution

sudo node appName.js

Device Organization

All Libvita devices will have the following organization:

Board  
   |-Property 1  
   |-Property ...  
   |-Property N  
   |  
   |-Group 1  
   |   |-Property 1  
   |   |-Property ...  
   |   |-Property N  
   |   |  
   |   |-Channel 1  
   |   |   |-Property 1  
   |   |   |-Property ...  
   |   |   |-Property N  
   |   |-Channel ...  
   |   |-Channel N  
   |-Group ...  
   |-Group N  
  • Boards represent individual daughter cards that may be attached to a mainboard such as Mersin, Megaboard, or Pizza Slices.
  • Groups represent collections of channels, and map directly to hardware ports on the daughter card.
  • Channels represent the I/O channels on a daughter card. These are semantic channels, and may represent a pin or collection of pins which compose an I/O port. For example, channels on the AN2006 map to pin pairs on the daughter card’s 32-pin header. On AN2053, a channel represents an instance of the motor controller, which maps to two pins and encapsulates several properties and an FPGA.
  • Properties represent the configuration and attributes of their parent. They may be provided by the end user or may be read from hardware. They may be cached in the library or read back live.

API

   var vita = require('vita');
   var board = vita.open('boardName')
   // or
   vita.open('boardname', callback); // callback(err, board)
    // 'boardname' is in the form 'usb:board_class/serial' (e.g. 'usb:CLASS_AN2006/123456')
   
   board.setOutputs(group, channel, data, callback); // callback(err)
   board.getInputs(group, channel, callback); // callback(err, data)
   
   board.setProperty(group, channel, property, data, callback); // callback(err)
   board.requestProperty(group, channel, property, callback); // callback(err, data)
   
   board.startAgent(group, channel, interval, callback); // callback(err, data, agentId)
   board.stopAgent(agentId);
   
   board.close();

Behavior:

Because the Top Level functions are thin wrappers around Library Level functions, the Top Level has no defined behavior of its own. All work is handled at the Library Level

setOutputs: This function will set the outputs on a given group or channel in a device-specific manner. This function is asynchronous.

requestInputs: This function will make an asynchronous request to read back the value for a given group or channel. If given a callback, the callback function must be called when the requested inputs become ready.

setProperty: This function will set a property for the given board/group/channel.

requestProperty: This function will make an asynchronous request to read properties from hardware. The behavior of requestProperty should be effectively identical to that of requestInputs.

Readme

Keywords

none

Package Sidebar

Install

npm i vita

Weekly Downloads

23

Version

0.9.3

License

none

Last publish

Collaborators

  • ansync