11var b = require ( 'bonescript' ) ;
22
3- b . setDate ( Date ( ) . toString ( ) , onSetDate ) ;
3+ b . getPlatform ( onGetPlatform ) ;
4+
5+ function onGetPlatform ( x ) {
6+ if ( ! x . name || ! x . serialNumber || ! x . version )
7+ err ( 'getPlatform returned ' + JSON . stringify ( x ) ) ;
8+ console . log ( 'Name = ' + x . name ) ;
9+ console . log ( 'S/N = ' + x . serialNumber ) ;
10+ console . log ( 'Version = ' + x . version ) ;
11+ console . log ( 'BoneScript version = ' + x . bonescript ) ;
12+ if ( x . bonescript != '0.2.2' ) )
13+ err ( 'BoneScript 0.2.2 required' ) ;
14+ b . setDate ( Date ( ) . toString ( ) , onSetDate ) ;
15+ }
416
517function onSetDate ( x ) {
618 if ( x . stdout !== null ) {
@@ -11,16 +23,6 @@ function onSetDate(x) {
1123
1224function onEcho ( x ) {
1325 if ( x . data != 'test' ) err ( 'doEcho returned ' + JSON . stringify ( x ) ) ;
14- b . getPlatform ( onGetPlatform ) ;
15- }
16-
17- function onGetPlatform ( x ) {
18- if ( ! x . name || ! x . serialNumber || ! x . version || ( x . bonescript != '0.2.2' ) )
19- err ( 'getPlatform returned ' + JSON . stringify ( x ) ) ;
20- console . log ( 'Name = ' + x . name ) ;
21- console . log ( 'S/N = ' + x . serialNumber ) ;
22- console . log ( 'Version = ' + x . version ) ;
23- console . log ( 'BoneScript version = ' + x . bonescript ) ;
2426 b . getPinMode ( 'P9_20' , onGetPinMode ) ;
2527}
2628
0 commit comments