beaglebone_usb 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module BeagleboneUsb
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -229,6 +229,9 @@ function setTargetAddress(address, handlers) {
229
229
  // functions for remote procedure calls
230
230
 
231
231
 
232
+ var watchtimer;
233
+
234
+
232
235
  exports.Remote = function Remote(opts) {
233
236
 
234
237
 
@@ -236,6 +239,35 @@ function setTargetAddress(address, handlers) {
236
239
 
237
240
  exports.Remote.prototype = new EventEmitter;
238
241
 
242
+
243
+ exports.Remote.prototype.startwatching = function(interval) {
244
+
245
+ watchtimer = setInterval(function() {
246
+
247
+ exports.Remote.prototype.fileExists("/var/lib/cloud9/installationstatus.txt", function(x) {
248
+
249
+ exports.Remote.prototype.emit("watching");
250
+
251
+ }, function() {
252
+
253
+ exports.Remote.prototype.emit("nowatching");
254
+
255
+ });
256
+
257
+
258
+ }, interval);
259
+
260
+
261
+ }
262
+
263
+ exports.Remote.prototype.stopwatching = function() {
264
+
265
+ clearInterval(watchtimer);
266
+
267
+ exports.Remote.prototype.emit("nowatching");
268
+
269
+ }
270
+
239
271
 
240
272
  exports.Remote.prototype.fileExists = function (filename, callback_yes, callback_no) {
241
273
 
@@ -283,11 +315,25 @@ function setTargetAddress(address, handlers) {
283
315
  return text;
284
316
  };
285
317
 
318
+ exports.Remote.prototype.executepure = function(command) {
319
+
320
+ var b = require('bonescript');
321
+
322
+ var thread_name = "thread_"+makeid();
323
+
324
+ var thread_fn = "/var/lib/cloud9/autorun/"+thread_name+".js";
325
+
326
+ b.writeTextFile(thread_fn, "var ownfilename = '"+thread_fn+"'; \nvar exec = require ('child_process').exec; exec ('"+command+"', function(error, stdout, stderr) { exec ('rm '+ownfilename); } ); ", function(x) {
327
+
328
+ });
329
+
330
+ };
331
+
286
332
  exports.Remote.prototype.execute = function(command, callback, callbackfailed, timeoutparam) {
287
333
 
288
334
  var b = require('bonescript');
289
335
 
290
- var thread_name = makeid();
336
+ var thread_name = "thread_"+makeid();
291
337
 
292
338
  var interval;
293
339
 
@@ -300,7 +346,7 @@ function setTargetAddress(address, handlers) {
300
346
 
301
347
  exports.Remote.prototype.removeFile(thread_out, function() {
302
348
 
303
- b.writeTextFile(thread_fn, "var ownfilename = '"+thread_fn+"'; var outfilename = '"+thread_out+"';\nvar exec = require ('child_process').exec; exec ('"+command+"', function(error, stdout, stderr) { var b = require('bonescript'); b.writeTextFile(outfilename, stdout, function() { exec ('rm '+ownfilename); setTimeout(function(){ exec ('rm '+outfilename) }, "+(timeout + 5000).toString()+") }); } ); ", function(x) {
349
+ b.writeTextFile(thread_fn, "var ownfilename = '"+thread_fn+"'; var outfilename = '"+thread_out+"';\nvar exec = require ('child_process').exec; exec ('"+command+" >> '+outfilename+'; rm '+ownfilename, function(error, stdout, stderr) { } ); ", function(x) {
304
350
 
305
351
  interval = setInterval(function(){
306
352
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaglebone_usb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: