@wemap/providers 3.2.2 → 3.2.4
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.
- package/debug/dist/absolute-attitude.html +19 -0
- package/{dist → debug/dist}/absolute-position.html +5 -2
- package/{dist → debug/dist}/gnss-wifi.html +5 -2
- package/{dist → debug/dist}/imu.html +5 -2
- package/debug/dist/inclination.html +19 -0
- package/debug/dist/index.html +20 -0
- package/debug/dist/positioning-legacy.html +19 -0
- package/debug/dist/relative-attitude.html +19 -0
- package/debug/dist/step-detection.html +19 -0
- package/debug/index.js +7 -9
- package/debug/{components → src}/AbsolutePositionComponent.jsx +4 -4
- package/debug/{components → src}/GnssWifiComponent.jsx +5 -5
- package/debug/{components → src}/Utils.js +2 -4
- package/debug/src/map/SimpleMap.jsx +47 -0
- package/index.js +1 -3
- package/package.json +12 -36
- package/src/ProvidersInterface.js +4 -1
- package/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider.js +1 -1
- package/src/providers/attitude/relative/RelativeAttitudeFromBrowserProvider.js +1 -1
- package/src/providers/imu/ImuProvider.js +1 -1
- package/src/providers/position/absolute/AbsolutePositionProvider.js +4 -2
- package/src/providers/position/absolute/GnssWifiProvider.js +1 -1
- package/babel.config.json +0 -16
- package/config.json +0 -4
- package/debug/MainComponent.jsx +0 -51
- package/debug/css/App.css +0 -128
- package/debug/css/UserOnMapHandler.css +0 -43
- package/debug/details/DetailsAttitudeComponent.jsx +0 -128
- package/debug/details/DetailsComponent.jsx +0 -31
- package/debug/details/DetailsPositionComponent.jsx +0 -134
- package/debug/details/ItineraryComponent.jsx +0 -264
- package/debug/map/MapComponent.jsx +0 -85
- package/debug/map/MapHandler.js +0 -44
- package/debug/map/helpers/ItineraryMapHandler.js +0 -283
- package/debug/map/helpers/MapClickHandler.js +0 -121
- package/debug/map/helpers/UserOnMapHandler.js +0 -91
- package/debug/stores/ItineraryStore.js +0 -198
- package/dist/absolute-attitude.html +0 -16
- package/dist/assets/indoor-maps/bureaux-wemap-montpellier.geojson +0 -7270
- package/dist/inclination.html +0 -16
- package/dist/index.html +0 -19
- package/dist/js/providers-components.js +0 -2361
- package/dist/logger.html +0 -58
- package/dist/positioning-legacy.html +0 -16
- package/dist/relative-attitude.html +0 -16
- package/dist/step-detection.html +0 -16
- package/src/logger/NavigationLogger.js +0 -138
- package/src/logger/NavigationLoggerConverter.js +0 -263
- package/webpack/webpack.common.cjs +0 -26
- package/webpack/webpack.dev.cjs +0 -25
- package/webpack/webpack.prod.cjs +0 -15
- /package/debug/{components → src}/AbsoluteAttitudeComponent.jsx +0 -0
- /package/debug/{components → src}/ImuComponent.jsx +0 -0
- /package/debug/{components → src}/InclinationComponent.jsx +0 -0
- /package/debug/{components → src}/NavigationConfig.js +0 -0
- /package/debug/{components → src}/RelativeAttitudeComponent.jsx +0 -0
- /package/debug/{components → src}/StartStopComponent.jsx +0 -0
- /package/debug/{components → src}/StepDetectionComponent.jsx +0 -0
package/dist/logger.html
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, user-scalable=no">
|
|
7
|
-
<title>Debug Pose</title>
|
|
8
|
-
<script src="js/providers-components.js"></script>
|
|
9
|
-
|
|
10
|
-
<style>
|
|
11
|
-
#logger {
|
|
12
|
-
background: #ffffffaa;
|
|
13
|
-
position: absolute;
|
|
14
|
-
bottom: 0;
|
|
15
|
-
left: 0;
|
|
16
|
-
z-index: 2;
|
|
17
|
-
margin: 5px;
|
|
18
|
-
padding-left: 10px;
|
|
19
|
-
padding-right: 10px;
|
|
20
|
-
min-width: 100px;
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
|
-
</head>
|
|
24
|
-
|
|
25
|
-
<body>
|
|
26
|
-
<div id="app"></div>
|
|
27
|
-
<div id="logger">
|
|
28
|
-
<div class="title">Logger</div>
|
|
29
|
-
<button id="start">Start</button>
|
|
30
|
-
<button id="stop" disabled>Stop</button>
|
|
31
|
-
</div>
|
|
32
|
-
<script>
|
|
33
|
-
const app = createReactElement(MainComponent, document.getElementById('app'));
|
|
34
|
-
|
|
35
|
-
const SERVER_URL = 'https://localhost:9002'
|
|
36
|
-
|
|
37
|
-
const startButton = document.getElementById('start');
|
|
38
|
-
const stopButton = document.getElementById('stop');
|
|
39
|
-
|
|
40
|
-
startButton.addEventListener('click', () => {
|
|
41
|
-
document.dispatchEvent(new CustomEvent('providers.logger.start', { detail : {
|
|
42
|
-
serverUrl: SERVER_URL,
|
|
43
|
-
logsSize: 300
|
|
44
|
-
}}));
|
|
45
|
-
startButton.disabled = true;
|
|
46
|
-
stopButton.disabled = false;
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
stopButton.addEventListener('click', () => {
|
|
50
|
-
document.dispatchEvent(new Event('providers.logger.stop'));
|
|
51
|
-
startButton.disabled = false;
|
|
52
|
-
stopButton.disabled = true;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
</script>
|
|
56
|
-
</body>
|
|
57
|
-
|
|
58
|
-
</html>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, user-scalable=no">
|
|
7
|
-
<title>Debug Positioning</title>
|
|
8
|
-
<script src="js/providers-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(PositioningComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, user-scalable=no">
|
|
7
|
-
<title>Debug Relative Attitude</title>
|
|
8
|
-
<script src="js/providers-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(RelativeAttitudeComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/dist/step-detection.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, user-scalable=no">
|
|
7
|
-
<title>Debug Step Detection</title>
|
|
8
|
-
<script src="js/providers-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(StepDetectionComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import cookies from 'browser-cookies';
|
|
3
|
-
|
|
4
|
-
import { TimeUtils } from '@wemap/utils';
|
|
5
|
-
|
|
6
|
-
import ProvidersOptions from '../ProvidersOptions.js';
|
|
7
|
-
import NavigationLoggerConverter from './NavigationLoggerConverter.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class NavigationLogger {
|
|
11
|
-
|
|
12
|
-
static serverUrl;
|
|
13
|
-
static logsSize;
|
|
14
|
-
|
|
15
|
-
static logs;
|
|
16
|
-
static sessionsId;
|
|
17
|
-
|
|
18
|
-
static isRecording = false;
|
|
19
|
-
|
|
20
|
-
static start(serverUrl, logsSize = 200) {
|
|
21
|
-
if (this.isRecording) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
this.isRecording = true;
|
|
25
|
-
|
|
26
|
-
this.serverUrl = serverUrl;
|
|
27
|
-
this.logsSize = logsSize;
|
|
28
|
-
|
|
29
|
-
// Initialize
|
|
30
|
-
this.logs = new Array(this.logsSize);
|
|
31
|
-
this.currentLogIndex = 0;
|
|
32
|
-
|
|
33
|
-
// Fill and send the config object
|
|
34
|
-
const config = {};
|
|
35
|
-
config.startTime = TimeUtils.preciseTime;
|
|
36
|
-
config.options = ProvidersOptions;
|
|
37
|
-
config.sessionId = this.sessionId = uuidv4();
|
|
38
|
-
config.userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : '';
|
|
39
|
-
if (typeof document !== 'undefined') {
|
|
40
|
-
config.cookieId = cookies.get('providers.logger.uuid');
|
|
41
|
-
if (!config.cookieId) {
|
|
42
|
-
config.cookieId = uuidv4();
|
|
43
|
-
cookies.set('providers.logger.uuid', config.cookieId);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
this._sendConfig(config);
|
|
47
|
-
this._feed(NavigationLoggerConverter.configToLog(config));
|
|
48
|
-
|
|
49
|
-
// Dispatch started event
|
|
50
|
-
if (typeof document !== 'undefined') {
|
|
51
|
-
document.dispatchEvent(new CustomEvent('providers.logger.started', { detail: { config: this.config } }));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
static stop() {
|
|
56
|
-
if (!this.isRecording) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this._sendLogs(this.logs.filter(el => el !== null));
|
|
61
|
-
// this.config.endTime = TimeUtils.preciseTime;
|
|
62
|
-
|
|
63
|
-
if (typeof document !== 'undefined') {
|
|
64
|
-
document.dispatchEvent(new CustomEvent('providers.logger.stopped', { detail: { logs: this.logs } }));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
this.isRecording = false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static feedImuData(event) {
|
|
71
|
-
if (!this.isRecording) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
this._feed(NavigationLoggerConverter.imuDataToLog(TimeUtils.preciseTime, event));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
static feedGeolocation(geolocationEvent) {
|
|
78
|
-
if (!this.isRecording) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
this._feed(NavigationLoggerConverter.geolocationToLog(TimeUtils.preciseTime, geolocationEvent));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
static feedExternalData(eventType, data) {
|
|
85
|
-
if (!this.isRecording) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
this._feed(NavigationLoggerConverter.externalDataToLog(TimeUtils.preciseTime, eventType, data));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
static _feed(line) {
|
|
93
|
-
this.logs[this.currentLogIndex++] = line;
|
|
94
|
-
if (this.logsSize && this.logs[this.logsSize - 1]) {
|
|
95
|
-
this._flush();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
static _flush() {
|
|
100
|
-
this._sendLogs(this.logs);
|
|
101
|
-
if (typeof document !== 'undefined') {
|
|
102
|
-
document.dispatchEvent(new CustomEvent('providers.logger.flush', { detail: { logs: this.logs } }));
|
|
103
|
-
}
|
|
104
|
-
this.currentLogIndex = 0;
|
|
105
|
-
this.logs = new Array(this.logsSize);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
static _sendConfig(config) {
|
|
110
|
-
const xmlhttp = new XMLHttpRequest();
|
|
111
|
-
xmlhttp.open('POST', this.serverUrl + '/config');
|
|
112
|
-
xmlhttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
|
113
|
-
xmlhttp.send(JSON.stringify(config));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
static _sendLogs(logs) {
|
|
117
|
-
const xmlhttp = new XMLHttpRequest();
|
|
118
|
-
xmlhttp.open('POST', this.serverUrl + '/logs/' + this.sessionId, true);
|
|
119
|
-
xmlhttp.setRequestHeader('Content-Type', 'text/plain');
|
|
120
|
-
xmlhttp.send(logs.join('\n'));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (typeof document !== 'undefined') {
|
|
125
|
-
document.addEventListener('providers.logger.start', event => {
|
|
126
|
-
if (!('detail' in event)) {
|
|
127
|
-
throw new Error('[providers.logger.start] did not find event detail');
|
|
128
|
-
}
|
|
129
|
-
if (!('serverUrl' in event.detail)) {
|
|
130
|
-
throw new Error('[providers.logger.start] did not find serverUrl');
|
|
131
|
-
}
|
|
132
|
-
NavigationLogger.start(event.detail.serverUrl, event.detail.logsSize);
|
|
133
|
-
});
|
|
134
|
-
document.addEventListener('providers.logger.stop', () => NavigationLogger.stop());
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
export default NavigationLogger;
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/* eslint-disable complexity */
|
|
2
|
-
import {
|
|
3
|
-
UserPosition, AbsoluteHeading, Attitude
|
|
4
|
-
} from '@wemap/geo';
|
|
5
|
-
import { Network } from '@wemap/graph';
|
|
6
|
-
|
|
7
|
-
import EventType from '../events/EventType.js';
|
|
8
|
-
|
|
9
|
-
const SEPARATOR = ',';
|
|
10
|
-
|
|
11
|
-
const PRECISION = 1e-6;
|
|
12
|
-
const PRECISION_INV = 1 / PRECISION;
|
|
13
|
-
const round = num => typeof num === 'number' ? Math.round(num * PRECISION_INV) / PRECISION_INV : num;
|
|
14
|
-
|
|
15
|
-
class NavigationLoggerConverter {
|
|
16
|
-
|
|
17
|
-
static configToLog(config) {
|
|
18
|
-
return [1, JSON.stringify(config)].join(SEPARATOR);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static geolocationToLog(time, event) {
|
|
22
|
-
return [
|
|
23
|
-
2,
|
|
24
|
-
round(time),
|
|
25
|
-
round(event.timestamp),
|
|
26
|
-
event.coords.latitude,
|
|
27
|
-
event.coords.longitude,
|
|
28
|
-
typeof event.coords.altitude === 'number' ? round(event.coords.altitude) : null,
|
|
29
|
-
round(event.coords.accuracy),
|
|
30
|
-
typeof event.coords.altitudeAccuracy === 'number' ? round(event.coords.altitudeAccuracy) : null,
|
|
31
|
-
typeof event.coords.heading === 'number' ? round(event.coords.heading) : null,
|
|
32
|
-
typeof event.coords.speed === 'number' ? round(event.coords.speed) : null
|
|
33
|
-
].join(SEPARATOR);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static imuDataToLog(time, event) {
|
|
37
|
-
switch (event.type) {
|
|
38
|
-
|
|
39
|
-
case 'devicemotion':
|
|
40
|
-
const acc = event.accelerationIncludingGravity;
|
|
41
|
-
const gyr = event.rotationRate;
|
|
42
|
-
const linearAcc = event.acceleration;
|
|
43
|
-
return [
|
|
44
|
-
3,
|
|
45
|
-
event.type,
|
|
46
|
-
round(time),
|
|
47
|
-
round(event.timeStamp),
|
|
48
|
-
acc && typeof acc.x === 'number' ? round(acc.x) : null,
|
|
49
|
-
acc && typeof acc.y === 'number' ? round(acc.y) : null,
|
|
50
|
-
acc && typeof acc.z === 'number' ? round(acc.z) : null,
|
|
51
|
-
gyr && typeof gyr.alpha === 'number' ? round(gyr.alpha) : null,
|
|
52
|
-
gyr && typeof gyr.beta === 'number' ? round(gyr.beta) : null,
|
|
53
|
-
gyr && typeof gyr.gamma === 'number' ? round(gyr.gamma) : null,
|
|
54
|
-
linearAcc && typeof linearAcc.x === 'number' ? round(linearAcc.x) : null,
|
|
55
|
-
linearAcc && typeof linearAcc.y === 'number' ? round(linearAcc.y) : null,
|
|
56
|
-
linearAcc && typeof linearAcc.z === 'number' ? round(linearAcc.z) : null,
|
|
57
|
-
round(event.interval)
|
|
58
|
-
].join(SEPARATOR);
|
|
59
|
-
|
|
60
|
-
case 'deviceorientation':
|
|
61
|
-
return [
|
|
62
|
-
3,
|
|
63
|
-
event.type,
|
|
64
|
-
round(time),
|
|
65
|
-
round(event.timeStamp),
|
|
66
|
-
round(event.alpha),
|
|
67
|
-
round(event.beta),
|
|
68
|
-
round(event.gamma),
|
|
69
|
-
round(event.webkitCompassHeading),
|
|
70
|
-
event.absolute ? 1 : 0
|
|
71
|
-
].join(SEPARATOR);
|
|
72
|
-
|
|
73
|
-
case 'deviceorientationabsolute':
|
|
74
|
-
return [
|
|
75
|
-
3,
|
|
76
|
-
event.type,
|
|
77
|
-
round(time),
|
|
78
|
-
round(event.timeStamp),
|
|
79
|
-
round(event.alpha),
|
|
80
|
-
round(event.beta),
|
|
81
|
-
round(event.gamma),
|
|
82
|
-
event.absolute ? 1 : 0
|
|
83
|
-
].join(SEPARATOR);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
throw new Error(`Cannot parse event: ${event.type}`, event);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
static externalDataToLog(time, eventType, data) {
|
|
90
|
-
switch (eventType) {
|
|
91
|
-
case EventType.Network:
|
|
92
|
-
return [4, 'network', round(time), data === null ? null : JSON.stringify(data.toCompressedJson())].join(SEPARATOR);
|
|
93
|
-
case EventType.AbsolutePosition:
|
|
94
|
-
return [4, 'absolute-position', round(time), JSON.stringify(data.toJson())].join(SEPARATOR);
|
|
95
|
-
case EventType.AbsoluteHeading:
|
|
96
|
-
return [4, 'absolute-heading', round(time), JSON.stringify(data.toJson())].join(SEPARATOR);
|
|
97
|
-
case EventType.AbsoluteAttitude:
|
|
98
|
-
return [4, 'absolute-attitude', round(time), JSON.stringify(data.toJson())].join(SEPARATOR);
|
|
99
|
-
}
|
|
100
|
-
return [4, 'unknown', eventType].join(SEPARATOR);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
static logToObj(str) {
|
|
105
|
-
const logType = parseInt(str[0], 10);
|
|
106
|
-
switch (logType) {
|
|
107
|
-
case 1:
|
|
108
|
-
return this.logToConfig(str);
|
|
109
|
-
case 2:
|
|
110
|
-
return this.logToGeolocation(str);
|
|
111
|
-
case 3:
|
|
112
|
-
return this.logToImu(str);
|
|
113
|
-
case 4:
|
|
114
|
-
return this.logToExternalData(str);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
throw new Error(`Cannot parse log: ${str}`);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
static logToConfig(str) {
|
|
121
|
-
const config = JSON.parse(str.substring(2));
|
|
122
|
-
return {
|
|
123
|
-
type: 'config',
|
|
124
|
-
time: config.startTime,
|
|
125
|
-
data: config
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
static logToGeolocation(str) {
|
|
130
|
-
const array = str.split(SEPARATOR).map(parseFloat);
|
|
131
|
-
return {
|
|
132
|
-
type: 'geolocation',
|
|
133
|
-
time: array[1],
|
|
134
|
-
data: {
|
|
135
|
-
timestamp: array[2],
|
|
136
|
-
coords: {
|
|
137
|
-
latitude: array[3],
|
|
138
|
-
longitude: array[4],
|
|
139
|
-
altitude: array[5],
|
|
140
|
-
accuracy: array[6],
|
|
141
|
-
altitudeAccuracy: array[7],
|
|
142
|
-
heading: array[8],
|
|
143
|
-
speed: array[9]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
static logToImu(str) {
|
|
150
|
-
|
|
151
|
-
const indexOfSecondComma = str.indexOf(SEPARATOR, 2);
|
|
152
|
-
const eventName = str.substring(2, indexOfSecondComma);
|
|
153
|
-
const data = str.substring(indexOfSecondComma + 1).split(SEPARATOR).map(parseFloat);
|
|
154
|
-
|
|
155
|
-
const event = new CustomEvent(eventName);
|
|
156
|
-
Object.defineProperties(event, { timeStamp: { writable: true } });
|
|
157
|
-
|
|
158
|
-
switch (eventName) {
|
|
159
|
-
case 'devicemotion':
|
|
160
|
-
Object.assign(event, {
|
|
161
|
-
timeStamp: data[1],
|
|
162
|
-
accelerationIncludingGravity: {
|
|
163
|
-
x: data[2],
|
|
164
|
-
y: data[3],
|
|
165
|
-
z: data[4]
|
|
166
|
-
},
|
|
167
|
-
rotationRate: {
|
|
168
|
-
alpha: data[5],
|
|
169
|
-
beta: data[6],
|
|
170
|
-
gamma: data[7]
|
|
171
|
-
},
|
|
172
|
-
acceleration: {
|
|
173
|
-
x: data[8],
|
|
174
|
-
y: data[9],
|
|
175
|
-
z: data[10]
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
break;
|
|
179
|
-
|
|
180
|
-
case 'deviceorientation':
|
|
181
|
-
Object.assign(event, {
|
|
182
|
-
timeStamp: data[1],
|
|
183
|
-
alpha: data[2],
|
|
184
|
-
beta: data[3],
|
|
185
|
-
gamma: data[4],
|
|
186
|
-
webkitCompassHeading: data[5],
|
|
187
|
-
absolute: data[6] === 1
|
|
188
|
-
});
|
|
189
|
-
break;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
case 'deviceorientationabsolute':
|
|
193
|
-
Object.assign(event, {
|
|
194
|
-
timeStamp: data[1],
|
|
195
|
-
alpha: data[2],
|
|
196
|
-
beta: data[3],
|
|
197
|
-
gamma: data[4],
|
|
198
|
-
absolute: data[5] === 1
|
|
199
|
-
});
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
type: 'imu',
|
|
205
|
-
time: data[0],
|
|
206
|
-
data: event
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
static logToExternalData(str) {
|
|
211
|
-
|
|
212
|
-
const indexOfSecondComma = str.indexOf(SEPARATOR, 2);
|
|
213
|
-
const eventTypeStr = str.substring(2, indexOfSecondComma);
|
|
214
|
-
|
|
215
|
-
const indexOfThirdComma = str.indexOf(SEPARATOR, indexOfSecondComma + 1);
|
|
216
|
-
const time = parseFloat(str.substring(indexOfSecondComma + 1, indexOfThirdComma));
|
|
217
|
-
|
|
218
|
-
const dataStr = str.substring(indexOfThirdComma + 1);
|
|
219
|
-
|
|
220
|
-
let data;
|
|
221
|
-
switch (eventTypeStr) {
|
|
222
|
-
|
|
223
|
-
case 'network':
|
|
224
|
-
data = {
|
|
225
|
-
eventType: EventType.Network,
|
|
226
|
-
data: dataStr === null ? null : Network.fromCompressedJson(JSON.parse(dataStr))
|
|
227
|
-
};
|
|
228
|
-
break;
|
|
229
|
-
|
|
230
|
-
case 'absolute-position':
|
|
231
|
-
data = {
|
|
232
|
-
eventType: EventType.AbsolutePosition,
|
|
233
|
-
data: dataStr === null ? null : UserPosition.fromJson(JSON.parse(dataStr))
|
|
234
|
-
};
|
|
235
|
-
break;
|
|
236
|
-
|
|
237
|
-
case 'absolute-attitude':
|
|
238
|
-
data = {
|
|
239
|
-
eventType: EventType.AbsoluteAttitude,
|
|
240
|
-
data: dataStr === null ? null : Attitude.fromJson(JSON.parse(dataStr))
|
|
241
|
-
};
|
|
242
|
-
break;
|
|
243
|
-
|
|
244
|
-
case 'absolute-heading':
|
|
245
|
-
data = {
|
|
246
|
-
eventType: EventType.AbsoluteHeading,
|
|
247
|
-
data: dataStr === null ? null : AbsoluteHeading.fromJson(JSON.parse(dataStr))
|
|
248
|
-
};
|
|
249
|
-
break;
|
|
250
|
-
|
|
251
|
-
default:
|
|
252
|
-
throw new Error(`Cannot parse eventType: ${eventTypeStr}`);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return {
|
|
256
|
-
type: 'external',
|
|
257
|
-
time,
|
|
258
|
-
data
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
export default NavigationLoggerConverter;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
module: {
|
|
5
|
-
rules: [
|
|
6
|
-
{
|
|
7
|
-
test: /\.jsx?$/,
|
|
8
|
-
exclude: /(node_modules|.test.js|.spec.js|.mock.js)/,
|
|
9
|
-
use: { loader: 'babel-loader' }
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
test: /\.css$/,
|
|
13
|
-
use: ['style-loader', 'css-loader']
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
test: /\.(png|jpe?g|gif|svg)$/i,
|
|
17
|
-
use: ['file-loader']
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
resolve: {
|
|
22
|
-
extensions: ['.js', '.jsx'],
|
|
23
|
-
alias: { 'mapbox-gl': path.resolve('node_modules', 'mapbox-gl') }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
};
|
package/webpack/webpack.dev.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const merge = require('webpack-merge');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const common = require('./webpack.common.cjs');
|
|
5
|
-
const config = require('../config.json');
|
|
6
|
-
|
|
7
|
-
const distFolder = path.join(__dirname, '../', config.distFolder);
|
|
8
|
-
|
|
9
|
-
module.exports = merge(common, {
|
|
10
|
-
mode: 'development',
|
|
11
|
-
entry: { 'providers-components': './debug/index.js' },
|
|
12
|
-
output: {
|
|
13
|
-
publicPath: '/js/',
|
|
14
|
-
filename: '[name].js',
|
|
15
|
-
path: path.join(distFolder, 'js'),
|
|
16
|
-
libraryTarget: 'global'
|
|
17
|
-
},
|
|
18
|
-
devServer: {
|
|
19
|
-
contentBase: distFolder,
|
|
20
|
-
inline: true,
|
|
21
|
-
hot: true,
|
|
22
|
-
host: '0.0.0.0',
|
|
23
|
-
port: 9000
|
|
24
|
-
}
|
|
25
|
-
});
|
package/webpack/webpack.prod.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const merge = require('webpack-merge');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const common = require('./webpack.common.cjs');
|
|
5
|
-
const config = require('../config.json');
|
|
6
|
-
|
|
7
|
-
module.exports = merge(common, {
|
|
8
|
-
mode: 'production',
|
|
9
|
-
entry: './index.js',
|
|
10
|
-
output: {
|
|
11
|
-
filename: config.distFileName,
|
|
12
|
-
path: path.join(__dirname, '../', config.distFolder),
|
|
13
|
-
libraryTarget: 'commonjs2'
|
|
14
|
-
}
|
|
15
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|