Deleted un-needed files, becuase they are integrated into the agent
Bryan Roe committed
Aug 22, 2019 at 16:58 UTC
c1fa797d9fc5c79d195c78b10734f00f6858d9f0
2 files changed
-129
agents/modules_meshcore/linux-dbus.js
deleted
-128
@@ -1,128 +0,0 @@
1
-/*
2
-Copyright 2018-2019 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-try { Object.defineProperty(Array.prototype, "peek", { value: function () { return (this.length > 0 ? this[this.length - 1] : undefined); } }); } catch (e) { }
18
-
19
-
20
-
21
-function dbus(address, uid)
22
-{
23
- this._ObjectID = 'linux-dbus';
24
- require('events').EventEmitter.call(this, true)
25
- .createEvent('signal');
26
- Object.defineProperty(this, "uid", { value: uid });
27
- this._child = require('child_process').execFile("/bin/sh", ["sh"], { type: require('child_process').SpawnTypes.TERM, uid: uid == null ? -1 : uid });
28
- this._child.stdin.write('dbus-monitor --session "type=\'signal\', interface=\'' + address + '\'" | ( while read X; do echo "$X"; done )\n');
29
- this._child.stdout.dbus = this;
30
- this._child.stdout.on('data', function (chunk)
31
- {
32
- // Parse DBUS Data
33
- if (!this.ready) { this.ready = true; return; }
34
-
35
- var lines = [];
36
- var tokens = chunk.toString().split('\r\n');
37
- for (var i in tokens)
38
- {
39
- if (tokens[i] == '')
40
- {
41
- // End of record
42
- this.dbus.preParseRecords(lines);
43
- lines = [];
44
- }
45
- else
46
- {
47
- lines.push(tokens[i]);
48
- }
49
- }
50
- });
51
- this.preParseRecords = function (lines)
52
- {
53
- var record = [];
54
- for (var i in lines)
55
- {
56
- if(lines[i].startsWith('signal '))
57
- {
58
- if(record.length>0)
59
- {
60
- this.parseRecords(record);
61
- }
62
- record = [];
63
- }
64
- record.push(lines[i]);
65
- }
66
- if (record.length > 0)
67
- {
68
- this.parseRecords(record);
69
- }
70
- }
71
- this.parseRecords = function (lines)
72
- {
73
- if (lines[0].startsWith('signal '))
74
- {
75
- var signal = {};
76
- var sigtokens = lines[0].split(' ');
77
- sigtokens.shift();
78
-
79
- for (var i in sigtokens) {
80
- var sigitems = sigtokens[i].split('=');
81
- if (sigitems.length == 2) {
82
- signal[sigitems[0]] = sigitems[1];
83
- }
84
- }
85
-
86
- lines.shift();
87
- signal.data = lines;
88
-
89
- this.parseSignal(signal);
90
- }
91
- }
92
- this.parseSignal = function(signal)
93
- {
94
- var data = signal.data;
95
- signal.data = [];
96
-
97
- for(var i=0; i<data.length; ++i)
98
- {
99
- if (data[i].startsWith('array '))
100
- {
101
- signal.data.push([]);
102
- for(i=i+1; i<data.length; ++i)
103
- {
104
- this.parseSignal2(data[i], signal.data.peek());
105
- }
106
- }
107
- else
108
- {
109
- this.parseSignal2(data[i], signal.data);
110
- }
111
- }
112
-
113
- this.emit('signal', signal);
114
- }
115
- this.parseSignal2 = function (inputStr, outArray)
116
- {
117
- if(inputStr.startsWith('string '))
118
- {
119
- outArray.push(JSON.parse(inputStr.slice(7)));
120
- }
121
- else if(inputStr.startsWith('boolean '))
122
- {
123
- outArray.push(JSON.parse(inputStr.slice(8)));
124
- }
125
- }
126
-}
127
-
128
-module.exports = dbus;
agents/modules_meshcore_min/linux-dbus.min.js
deleted
-1
@@ -1 +0,0 @@
1
-try{Object.defineProperty(Array.prototype,"peek",{value:function(){return(this.length>0?this[this.length-1]:undefined)}})}catch(e){}function dbus(a,b){this._ObjectID="linux-dbus";require("events").EventEmitter.call(this,true).createEvent("signal");Object.defineProperty(this,"uid",{value:b});this._child=require("child_process").execFile("/bin/sh",["sh"],{type:require("child_process").SpawnTypes.TERM,uid:b==null?-1:b});this._child.stdin.write("dbus-monitor --session \"type='signal', interface='"+a+'\'" | ( while read X; do echo "$X"; done )\n');this._child.stdout.dbus=this;this._child.stdout.on("data",function(c){if(!this.ready){this.ready=true;return}var f=[];var g=c.toString().split("\r\n");for(var d in g){if(g[d]==""){this.dbus.preParseRecords(f);f=[]}else{f.push(g[d])}}});this.preParseRecords=function(d){var f=[];for(var c in d){if(d[c].startsWith("signal ")){if(f.length>0){this.parseRecords(f)}f=[]}f.push(d[c])}if(f.length>0){this.parseRecords(f)}};this.parseRecords=function(d){if(d[0].startsWith("signal ")){var g={};var h=d[0].split(" ");h.shift();for(var c in h){var f=h[c].split("=");if(f.length==2){g[f[0]]=f[1]}}d.shift();g.data=d;this.parseSignal(g)}};this.parseSignal=function(f){var c=f.data;f.data=[];for(var d=0;d<c.length;++d){if(c[d].startsWith("array ")){f.data.push([]);for(d=d+1;d<c.length;++d){this.parseSignal2(c[d],f.data.peek())}}else{this.parseSignal2(c[d],f.data)}}this.emit("signal",f)};this.parseSignal2=function(c,d){if(c.startsWith("string ")){d.push(JSON.parse(c.slice(7)))}else{if(c.startsWith("boolean ")){d.push(JSON.parse(c.slice(8)))}}}}module.exports=dbus;
\ No newline at end of file