bugfix in tags, added another stream

This commit is contained in:
Lucas 2013-01-22 13:59:56 +01:00
parent ffc5030688
commit fd8f36768c
1 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,7 @@ var assert = require('assert'),
var hubAddress = '192.168.23.43', hubPort = 7110; var hubAddress = '192.168.23.43', hubPort = 7110;
var oscClient = new osc.Client(hubAddress, hubPort); var oscClient = new osc.Client(hubAddress, hubPort);
var streams = [ 91755, 70632, 53146, 45582 ]; var streams = [ 91755, 70632, 53146, 45582, 64590 ];
var client = restify.createJsonClient({ var client = restify.createJsonClient({
url: 'http://api.cosm.com', headers: {'X-ApiKey':'orKBBdLAKuKJU-RxqmZpZB6q0baSAKxBTVhKdjhUNkdyVT0g'},version:'*' url: 'http://api.cosm.com', headers: {'X-ApiKey':'orKBBdLAKuKJU-RxqmZpZB6q0baSAKxBTVhKdjhUNkdyVT0g'},version:'*'
@ -21,7 +21,7 @@ var getstream = function(streamId) {
var dataStream = obj.datastreams[i]; var dataStream = obj.datastreams[i];
if(dataStream.id != null) { if(dataStream.id != null) {
var streamName = dataStream.id; var streamName = dataStream.id;
if(streamName.length < 2 && dataStream.tags.length > 0) streamName = dataStream.tags[0] + streamName; if(streamName.length < 2 && dataStream.tags != null) streamName = dataStream.tags[0] + streamName;
var address = '/cosm/' + obj.id + "/" + streamName; var address = '/cosm/' + obj.id + "/" + streamName;
var currentValue = dataStream.current_value; var currentValue = dataStream.current_value;
@ -31,6 +31,7 @@ var getstream = function(streamId) {
if(recentvalues[address] != currentValue) { if(recentvalues[address] != currentValue) {
oscClient.send(address, currentValue); oscClient.send(address, currentValue);
console.log(address + ": " + currentValue);
} }
recentvalues[address] = currentValue; recentvalues[address] = currentValue;