diff --git a/README.md b/README.md index 6fbf4f77a8a8b36b576b8ee3da2f6f0b7a8794c3..967335001b36bd9ab7fec0df97f54a1f1bc6922a 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,8 @@ This project serves the developement environment / api we use to write and repre ## For MW - serial link OK, attach - - routes have route, test send - - thru route, append route - - thru link, to send. - - callback key subscribe fn's - - then: route change propogation? - - test with test: callback - - then draw something, and how does UI hook up, and when route changes ? + - how do users know to hookup, how to hookup ? + - then draw something, and how does UI hook up, and when route changes ? - change /src to /modules or /units ? diff --git a/lib/atkunit.js b/lib/atkunit.js index 38fb1520c1c5b7f17ba9656f7b799855888dea60..ed784f85f6343692011c3e3b77b1778f4eaeb429 100644 --- a/lib/atkunit.js +++ b/lib/atkunit.js @@ -9,14 +9,14 @@ let Button = InOut.Button const ATKRoute = require('./atkroute.js') -function Hardware(route){ +function Hardware(){ var hardware = { description:{ name: 'hardwareUnit', alt: 'software representation of networked hardware object', isHardware: true }, - route: ATKRoute(route) + route: ATKRoute('0,0') } hardware.state = State() @@ -24,10 +24,10 @@ function Hardware(route){ state.test = Button('test network', onNetworkTest) state.message = 'click above to test network' - state.route = route + state.route = '0,0' // default state.onChange('route', function(){ - console.log("route change, need to git it thru") + hardware.route.route = state.route }) function onNetworkTest(){ diff --git a/modules/hardware/atkbbs.js b/modules/hardware/atkbbs.js index b0e3665384bb57f89953d58d124cdc3f19342d52..960a48e140ce347c88ef85129577078b916da110 100644 --- a/modules/hardware/atkbbs.js +++ b/modules/hardware/atkbbs.js @@ -15,7 +15,7 @@ function ATKBreadBoardServo() { // '0,1' is the route to our piece of hardware // 'onPacket' is the function that will be called // when data arrives from that port - var atkbbs = Hardware('0,1') + var atkbbs = Hardware() // change the name ... atkbbs.description.name = 'ATKBBB-Servo' @@ -57,7 +57,9 @@ function ATKBreadBoardServo() { } // to get replies to certain packets, we can - + // subscribe, where 141 (here) is the 'key' + // we're looking for on the network, and the + // msg is byte array we'll get back atkbbs.route.subscribe(141, function(msg){ console.log('logging return', msg) })