Skip to content

Commit e517282

Browse files
author
rckey
committed
changed to coordinates for positioning
1 parent 3fde042 commit e517282

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Parameter | Function | Default
1818
host | (Remote-) node we're connecting to. | 0.0.0.0
1919
port | Iota-api port on the node. | 14265
2020
id | Identifies the streamobject. | "SensorNode"
21-
location | Nodes location, eg. "Home" or "52.26°N 13.42°E" [...]. | "Home"
21+
location | Nodes location, eg. 'lat': 52.26 'lng': 13.42. | {'lat': 40.65, 'lng': -73.91}
2222
seed | Seed for creating transactions/MAM-messages. | [generated]
2323
rec | Receiving address (tanglestream only). | "GPB9PBNCJTPGF..."
2424
tag | Tag for Transactions (tanglestream only). | "SENSORNODEROCKS"

app.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ async function readSensor () {
2828
return await json;
2929
}
3030

31+
/* coordinate generators (for testing) */
32+
33+
function lat () {
34+
return Math.round((Math.random() * 0.05 + 40.65) * 100) / 100;
35+
}
36+
37+
function lng () {
38+
return Math.round((Math.random() * 0.05 + -73.91) * 100) / 100;
39+
}
40+
3141
//#############################################
3242
//## SETUP STREAMS ##
3343
//#############################################
@@ -37,7 +47,7 @@ streams.push(new MAM_STREAM ({
3747
'host': 'http://0.0.0.0',
3848
'port': 14265,
3949
'id': 'SensorNode (MAM)',
40-
'location': 'Home',
50+
'location': {'lat': lat(), 'lng': lng()}
4151
}))
4252

4353
/* TANGLESTREAM */

utils/stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class STREAM {
1818
});
1919

2020
this.id = _stream.id || 'SensorNode';
21-
this.location = _stream.location || 'Home';
21+
this.location = _stream.location || {'lat': 40.65, 'lng': -73.91};
2222
this.sources = [];
2323

2424
this.seed = _stream.seed || this.generateSeed();

utils/stream_mam.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MAM_STREAM {
1919
});
2020

2121
this.id = _stream.id || 'SensorNode';
22-
this.location = _stream.location || 'Home';
22+
this.location = _stream.location || {'lat': 40.65, 'lng': -73.91};
2323
this.sources = [];
2424

2525
this.seed = _stream.seed || this.generateSeed();

0 commit comments

Comments
 (0)