From 0e15de4069de6ee9ca073c1bdd0b8498209df3f8 Mon Sep 17 00:00:00 2001 From: vaishnav98 Date: Fri, 22 Jun 2018 14:19:31 +0530 Subject: [PATCH] change port from fixed port: 80 on rpc client also changed console messages and function names on test-rpc.js from ..._previous to ..._oldstyle --- src/bonescript.js | 2 +- test/test-rpc.js | 42 +++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/bonescript.js b/src/bonescript.js index 65b915db..bc2e06a0 100644 --- a/src/bonescript.js +++ b/src/bonescript.js @@ -42,7 +42,7 @@ function _onSocketIOLoaded(host, port, socketio) { socket = socketio('http://' + host + ':' + port); else socket = socketio('___INSERT_HOST___', { - port: 80 + port: port }); socket.on('require', getRequireData); socket.on('bonescript', _seqcall); diff --git a/test/test-rpc.js b/test/test-rpc.js index 1613bc9b..6b8fd905 100644 --- a/test/test-rpc.js +++ b/test/test-rpc.js @@ -13,12 +13,12 @@ exports.setUp = function (callback) { exports.testRPC_callbacks = function (test) { test.expect(16); - bonescript.startClient('127.0.0.1', 8000, getPlatformTest_previous); + bonescript.startClient('127.0.0.1', 8000, getPlatformTest_oldstyle); - function getPlatformTest_previous() { + function getPlatformTest_oldstyle() { var b = bonescript.require('bonescript'); b.getPlatform(function (platform) { - console.log("***getPlatformTest_previous***"); + console.log("***getPlatformTest_oldstyle***"); console.log(platform); console.log('Name: ' + platform.name); console.log('Version: ' + platform.bonescript); @@ -36,16 +36,16 @@ exports.testRPC_callbacks = function (test) { console.log('Version: ' + platform.bonescript); test.equals(platform.name, platform_.name); test.equals(platform.bonescript, platform_.bonescript); - pinModeTest_previous(); + pinModeTest_oldstyle(); }); } - function pinModeTest_previous() { + function pinModeTest_oldstyle() { var b = bonescript.require('bonescript'); b.pinMode("P8_13", b.OUTPUT, 7, 'pullup', 'fast', printStatus); function printStatus(x) { - console.log("***pinModeTest_previous***"); + console.log("***pinModeTest_oldstyle***"); console.log('value = ' + x.value); console.log('err = ' + x.err); pinModeTest_nodestyle(x); @@ -62,16 +62,16 @@ exports.testRPC_callbacks = function (test) { console.log('err = ' + err); test.equals(x.err, err); test.equals(x.value, value); - getPinModeTest_previous(); + getPinModeTest_oldstyle(); } } - function getPinModeTest_previous() { + function getPinModeTest_oldstyle() { var b = bonescript.require('bonescript'); b.getPinMode("P8_13", printPinMux); function printPinMux(x) { - console.log("***getPinModeTest_previous***"); + console.log("***getPinModeTest_oldstyle***"); console.log('mux = ' + x.mux); console.log('pullup = ' + x.pullup); console.log('slew = ' + x.slew); @@ -108,16 +108,16 @@ exports.testRPC_callbacks = function (test) { console.log("***digitalWriteTest***"); console.log('err = ' + x.err); test.ok(true); - digitalReadTest_previous(); + digitalReadTest_oldstyle(); } } - function digitalReadTest_previous() { + function digitalReadTest_oldstyle() { var b = bonescript.require('bonescript'); b.digitalRead('P8_19', printStatus); function printStatus(x) { - console.log("***digitalReadTest_previous***"); + console.log("***digitalReadTest_oldstyle***"); console.log('x.value = ' + x.value); console.log('x.err = ' + x.err); digitalReadTest_nodestyle(x) @@ -146,17 +146,17 @@ exports.testRPC_callbacks = function (test) { console.log("***analogWriteTest***"); console.log(JSON.stringify(x)); test.ok(true); - analogReadTest_previous(); + analogReadTest_oldstyle(); } } - function analogReadTest_previous() { + function analogReadTest_oldstyle() { var b = bonescript.require('bonescript'); b.analogRead('P9_36', printStatus); function printStatus(x) { - console.log("***analogReadTest_previous***"); + console.log("***analogReadTest_oldstyle***"); console.log('x.value = ' + x.value); console.log('x.err = ' + x.err); analogReadTest_nodestyle(x); @@ -172,16 +172,16 @@ exports.testRPC_callbacks = function (test) { console.log('x.value = ' + value); console.log('x.err = ' + err); test.equals(x.value, value); - attachInterruptTest_previous() + attachInterruptTest_oldstyle() } } - function attachInterruptTest_previous() { + function attachInterruptTest_oldstyle() { var b = bonescript.require('bonescript'); b.attachInterrupt('P8_19', true, b.CHANGE, interruptCallback); function interruptCallback(x) { - console.log("***attachInterruptTest_previous***"); + console.log("***attachInterruptTest_oldstyle***"); console.log(JSON.stringify(x)); attachInterruptTest_nodestyle(x) } @@ -196,16 +196,16 @@ exports.testRPC_callbacks = function (test) { console.log(JSON.stringify(resp)); test.equals(x.err, err); test.equals(x.pin.name, resp.pin.name); - readTextFileTest_previous(); + readTextFileTest_oldstyle(); } } - function readTextFileTest_previous() { + function readTextFileTest_oldstyle() { var b = bonescript.require('bonescript'); b.readTextFile('/etc/fstab', printStatus); function printStatus(x) { - console.log("***readTextFileTest_previous***"); + console.log("***readTextFileTest_oldstyle***"); console.log('x.data = ' + x.data); console.log('x.err = ' + x.err); readTextFileTest_nodestyle(x);