Note: For using this sample, you need a valid oAuth credential for the translation / extraction portion. Visit this page for instructions to get on-board.
Note: It also relies on the https://github.com/cyrillef/PlougonvelinNode Project which is the real brain running on a BeagleBone Black device which controls the shutters, lights, and sensors.
This sample uses the Autodesk Forge Viewer to display my house, and has a Forge Viewer IoT Extension to connect to my house BeagleBone Black IoT implementation via a secured socket.io connection. However, the security layers is implemented on the BeagleBone Black device.
This sample is dependent of Node.js and few Node.js extensions which would update/install automatically via 'npm':
-
Node.js
Node.js - built on Chrome's JavaScript runtime for easily building fast, scalable network applications. You can get Node.js from here
Node.js modules:"express": "4.x", "morgan": "1.x", "request": "*", "socket.io": "0.9.x", "view-and-data": "^1.0.6", "bower": "^1.6.5"
-
Require.js - RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node. Using a modular script loader like RequireJS will improve the speed and quality of your code., available here.
-
jquery.js - jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript., available here.
-
smoothie - A JavaScript Charting Library for Streaming Data, available here
All these libraries can be install via bower
"async": "1.4.2", "jquery": "2.1.4", "requirejs": "2.1.17", "domReady": "2.0.1", "view-and-data-toolkit": "*", "smoothie": "~1.27.0", "requirejs-plugins": "~1.0.3"
The sample was created using Node.js and javascript.
Once the Heroku server is setup, go on your Heroku Dashboard, select this new server, next Settings, and press the 'Reveal Config Vars.' button.
Create 3 variables like this:
a. PORT = 80
b. CONSUMERKEY = <your consumer key>
c. CONSUMERSECRET = <your consumer secret>
Next restart the server.
-
Download and install Node.js (that will install npm as well)
-
Download this repo anywhere you want
-
Execute 'npm install', this command will download and install the required node & bower modules automatically for you.
npm install
-
Set your credential keys to run the sample: use system environment variables
- Define a CONSUMERKEY and CONSUMERSECRET system variables from the console or script which will launch the server.
- Windows
set CONSUMERKEY=xxx set CONSUMERSECRET=xxx
- OSX/Linux
or passing on the command line to the Node.js processexport CONSUMERKEY xxx export CONSUMERSECRET xxx
sudo [PORT=<port>] CONSUMERKEY=xxx CONSUMERSECRET=xxx node server.js
Replace keys placeholder xxx with your own keys. - Windows
- Define a CONSUMERKEY and CONSUMERSECRET system variables from the console or script which will launch the server.
-
Edit file ./html/js/app-init.js line #39-41, and set your model URN
Edit files in ./html/data to describe your model / sensors settings. -
You are done for the setup, launch the node server using the command '[sudo] node server.js'. sudo is required only on OSX and Linux.
- Windows
[set PORT=<port>] node start.js
- OSX/Linux
sudo [PORT=<port>] node server.js
Note: the port argument can be omitted and default to port 80. If port 80 is already in use by another application (like Skype, or IIS, or Apache, ...), you can use any other free port such as 8000, 3000, etc... But in the next section you would need to specify the port to use, i.e. http://localhost[:port]/ - Windows
-
If you choose option b. for setup, launch http://localhost[:port]/setup.html, otherwise you are good to go with http://localhost[:port]/
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.
Hans Kellner, Autodesk, Inc.
OCTO
Alex Chein, Autodesk, Inc.
PDG
Cyrille Fauvel (Autodesk Developer Network)
http://www.autodesk.com/adn
http://around-the-corner.typepad.com/