@wemap/providers 3.0.1 → 3.1.0
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/package.json +3 -3
- package/src/Providers.js +6 -0
- package/src/ProvidersInterface.js +7 -1
- package/src/events/EventType.js +1 -1
- package/src/providers/others/BarcodeProvider.js +47 -0
- package/src/providers/others/CameraProjectionMatrixProvider.js +44 -0
- package/src/providers/position/relative/ArCoreProvider.js +1 -1
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@wemap/graph": "^3.0.0",
|
|
13
13
|
"@wemap/logger": "^3.0.0",
|
|
14
14
|
"@wemap/maths": "^3.0.0",
|
|
15
|
-
"@wemap/osm": "^3.
|
|
15
|
+
"@wemap/osm": "^3.1.0",
|
|
16
16
|
"@wemap/utils": "^3.0.0",
|
|
17
17
|
"geomagnetism": "^0.1.0",
|
|
18
18
|
"lodash.isempty": "^4.4.0",
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"lint": "eslint --ext .js,.jsx --quiet src",
|
|
64
64
|
"test": "mocha -r esm \"src/**/*.spec.js\""
|
|
65
65
|
},
|
|
66
|
-
"version": "3.0
|
|
67
|
-
"gitHead": "
|
|
66
|
+
"version": "3.1.0",
|
|
67
|
+
"gitHead": "65aa989226647982201e95ecafae68e2e48e85ae"
|
|
68
68
|
}
|
package/src/Providers.js
CHANGED
|
@@ -50,8 +50,12 @@ const GnssWifi = GnssWifiProvider.instance;
|
|
|
50
50
|
const Ip = IpProvider.instance;
|
|
51
51
|
const AbsolutePosition = AbsolutePositionProvider.instance;
|
|
52
52
|
|
|
53
|
+
import BarcodeProvider from './providers/others/BarcodeProvider';
|
|
53
54
|
import CameraNativeProvider from './providers/others/CameraNativeProvider';
|
|
55
|
+
import CameraProjectionMatrixProvider from './providers/others/CameraProjectionMatrixProvider';
|
|
56
|
+
const Barcode = BarcodeProvider.instance;
|
|
54
57
|
const CameraNative = CameraNativeProvider.instance;
|
|
58
|
+
const CameraProjectionMatrix = CameraProjectionMatrixProvider.instance;
|
|
55
59
|
|
|
56
60
|
export {
|
|
57
61
|
AbsoluteAttitude,
|
|
@@ -62,7 +66,9 @@ export {
|
|
|
62
66
|
Accelerometer,
|
|
63
67
|
ArCore,
|
|
64
68
|
Attitude,
|
|
69
|
+
Barcode,
|
|
65
70
|
CameraNative,
|
|
71
|
+
CameraProjectionMatrix,
|
|
66
72
|
GeoRelativePosition,
|
|
67
73
|
GeoRelativePositionFromArCore,
|
|
68
74
|
GnssWifi,
|
|
@@ -7,7 +7,7 @@ import { Network } from '@wemap/graph';
|
|
|
7
7
|
import EventType from './events/EventType';
|
|
8
8
|
import MetaProvider from './providers/MetaProvider';
|
|
9
9
|
import {
|
|
10
|
-
AbsoluteAttitude, AbsolutePosition, CameraNative, Inclination
|
|
10
|
+
AbsoluteAttitude, AbsolutePosition, Barcode, CameraNative, CameraProjectionMatrix, Inclination
|
|
11
11
|
} from './Providers';
|
|
12
12
|
import ProvidersLogger from './events/ProvidersLogger';
|
|
13
13
|
|
|
@@ -79,6 +79,12 @@ class ProvidersInterface {
|
|
|
79
79
|
case EventType.CameraNative:
|
|
80
80
|
return CameraNative;
|
|
81
81
|
|
|
82
|
+
case EventType.Barcode:
|
|
83
|
+
return Barcode;
|
|
84
|
+
|
|
85
|
+
case EventType.CameraProjectionMatrix:
|
|
86
|
+
return CameraProjectionMatrix;
|
|
87
|
+
|
|
82
88
|
default:
|
|
83
89
|
throw new Error(`Unable to deal with this event type: ${eventType}`);
|
|
84
90
|
}
|
package/src/events/EventType.js
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Provider from '../Provider';
|
|
2
|
+
import EventType from '../../events/EventType';
|
|
3
|
+
import { ArCore } from '../../Providers';
|
|
4
|
+
|
|
5
|
+
class BarcodeProvider extends Provider {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @override
|
|
9
|
+
*/
|
|
10
|
+
static get eventsType() {
|
|
11
|
+
return [EventType.Barcode];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @override
|
|
16
|
+
*/
|
|
17
|
+
get _availability() {
|
|
18
|
+
return ArCore.availability;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @override
|
|
23
|
+
*/
|
|
24
|
+
start() {
|
|
25
|
+
ArCore.enableBarcodeScanner();
|
|
26
|
+
|
|
27
|
+
this.providerId = ArCore.addEventListener(
|
|
28
|
+
events => {
|
|
29
|
+
const barcodeEvent = events.find(event => event.dataType === EventType.Barcode);
|
|
30
|
+
if (barcodeEvent) {
|
|
31
|
+
this.notify(barcodeEvent);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
error => this.notifyError(error)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @override
|
|
40
|
+
*/
|
|
41
|
+
stop() {
|
|
42
|
+
ArCore.disableBarcodeScanner();
|
|
43
|
+
ArCore.removeEventListener(this.providerId);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default BarcodeProvider;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import MetaProvider from '../MetaProvider';
|
|
2
|
+
import EventType from '../../events/EventType';
|
|
3
|
+
import { ArCore } from '../../Providers';
|
|
4
|
+
|
|
5
|
+
class CameraProjectionMatrixProvider extends MetaProvider {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @override
|
|
9
|
+
*/
|
|
10
|
+
static get eventsType() {
|
|
11
|
+
return [EventType.CameraProjectionMatrix];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @override
|
|
16
|
+
*/
|
|
17
|
+
get _availability() {
|
|
18
|
+
return ArCore.availability;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @override
|
|
23
|
+
*/
|
|
24
|
+
start() {
|
|
25
|
+
this.providerId = ArCore.addEventListener(
|
|
26
|
+
events => {
|
|
27
|
+
const projMatrixEvent = events.find(event => event.dataType === EventType.CameraProjectionMatrix);
|
|
28
|
+
if (projMatrixEvent) {
|
|
29
|
+
this.notify(projMatrixEvent);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
error => this.notifyError(error)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @override
|
|
38
|
+
*/
|
|
39
|
+
stop() {
|
|
40
|
+
ArCore.removeEventListener(this.providerId);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default CameraProjectionMatrixProvider;
|
|
@@ -128,7 +128,7 @@ class ArCoreProvider extends Provider {
|
|
|
128
128
|
|
|
129
129
|
if (ref & Payload.ProjMat.ref) {
|
|
130
130
|
const projMatrix = payload.slice(bufferIndex, bufferIndex + Payload.ProjMat.size);
|
|
131
|
-
events.push(this.createEvent(EventType.
|
|
131
|
+
events.push(this.createEvent(EventType.CameraProjectionMatrix, projMatrix));
|
|
132
132
|
bufferIndex += Payload.ProjMat.size;
|
|
133
133
|
}
|
|
134
134
|
|