UNPKG

thing-it-device-hibox

Version:

[thing-it-node] Device Plugin for HiBox Systems, TV Experts and Engineers.

128 lines (111 loc) 2.56 kB
/** * This test file allows to run the basic initiation of the * HellowWorld class. It does not, however, simulate full * interaction with the node. */ var q = require('q'); var HiBoxTV = require('../HiBoxTV'); var hiBoxTV = HiBoxTV.create({}); hiBoxTV.isSimulated = function () { return false; }; hiBoxTV.configuration = { user: "basdemo", password: "basdemo123", baseURL: "https://demo.hibox.fi/hbx/api", targetURL: "https://demo.hibox.fi/hbx/api/bas/device/tv-NTIyMTAz", }; hiBoxTV.publishEvent = function (event, data) { console.log("Event", event); }; hiBoxTV.publishStateChange = function () { console.log("State published."); //console.log(this.getState()); }; hiBoxTV.logInfo = function () { if (arguments.length == 1) { console.log(arguments[0]); } else { console.log(arguments); } } hiBoxTV.logDebug = function () { hiBoxTV.logInfo(arguments); } hiBoxTV.logError = function () { hiBoxTV.logInfo(arguments); } console.log("About to start"); hiBoxTV.start() .then(function () { hiBoxTV.on(); }) .delay(4000) /* .then(function () { hiBoxTV.setVolume(100); }) */ .delay(4000) .then(function () { hiBoxTV.changeChannel({channel: hiBoxTV.configuration.baseURL + "/bas/media/ch-Mjg1NTU"}); }) /* .delay(6000) .then(function () { hiBoxTV.setChannel2(); }) .delay(6000) .then(function () { hiBoxTV.setChannel3(); }) .delay(6000) .then(function () { hiBoxTV.setChannel4(); }) .delay(6000) .then(function () { hiBoxTV.setChannel5(); }) .delay(6000) .then(function () { hiBoxTV.setVolume(0); }) */ .delay(6000) .then(function () { hiBoxTV.setChannel1(); }) .delay(6000) .done(function () { return hiBoxTV.toggleStandby() /* }) .catch(function (reason) { console.log("Error during test.", reason); */ }); /* setTimeout(function () { hiBoxTV.setStandby(false); }, 1000); setTimeout(function () { hiBoxTV.setVolume(25); }, 5000); setTimeout(function () { hiBoxTV.setChannel("https://demo.hibox.fi/hbx/api/bas/media/ch-Mjg1NTU="); }, 7500); setTimeout(function () { hiBoxTV.setVolume(100); }, 10000); setTimeout(function () { hiBoxTV.setVolume(0); }, 15000); setTimeout(function () { hiBoxTV.setChannel("https://demo.hibox.fi/hbx/api/bas/media/ch-Mjg1NDk="); }, 20000); setTimeout(function () { hiBoxTV.setStandby(true); }, 25000); */