-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathapplication.js
More file actions
30 lines (28 loc) · 918 Bytes
/
application.js
File metadata and controls
30 lines (28 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
Application에서 data에 접근하기 위해서는 uKey만을 사용합니다.
실행에 앞서 thingplug 사이트에서 사용자와 계정에 디바이스 등록을 진행해야합니다.
*/
'use strict';
var colors = require('colors');
var async = require('async');
var config = require('./config');
var api = require('./lib/api');
async.waterfall([
function (cb) {
api.createNode(config.nodeID, cb);
},
function (nodeRI, cb){
config.nodeRI = nodeRI;
api.getLatestContainer(config.nodeID, config.containerName, cb);
},
function(data, cb){
console.log('content : ' + data.con);
console.log('resouceId : ' + data.ri);
console.log('createdAt : '+ data.ct);
var cmd = JSON.stringify({'cmd':'on'});
api.reqMgmtCmd(config.nodeRI, config.command, cmd, cb);
}
], function(err,resourceID){
if(err) return console.log(err);
console.log('resourceID: '+resourceID);
});