@wemap/positioning 2.7.13 → 14.0.0-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.
Files changed (104) hide show
  1. package/README.md +51 -0
  2. package/dist/index.d.ts +19 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +16582 -0
  5. package/dist/qr-scanner-worker.min-CdBZO1_x.js +2 -0
  6. package/dist/src/ILocationSource.d.ts +104 -0
  7. package/dist/src/ILocationSource.d.ts.map +1 -0
  8. package/dist/src/MapMatching.d.ts +83 -0
  9. package/dist/src/MapMatching.d.ts.map +1 -0
  10. package/dist/src/location-sources/GnssWifiLocationSource.d.ts +79 -0
  11. package/dist/src/location-sources/GnssWifiLocationSource.d.ts.map +1 -0
  12. package/dist/src/location-sources/LocationSource.d.ts +102 -0
  13. package/dist/src/location-sources/LocationSource.d.ts.map +1 -0
  14. package/dist/src/location-sources/VPSLocationSource.d.ts +107 -0
  15. package/dist/src/location-sources/VPSLocationSource.d.ts.map +1 -0
  16. package/dist/src/types.d.ts +65 -0
  17. package/dist/src/types.d.ts.map +1 -0
  18. package/dist/src/utils/permissions.d.ts +29 -0
  19. package/dist/src/utils/permissions.d.ts.map +1 -0
  20. package/dist/vitest.config.d.ts +3 -0
  21. package/dist/vitest.config.d.ts.map +1 -0
  22. package/package.json +23 -59
  23. package/babel.config.js +0 -11
  24. package/config.json +0 -4
  25. package/debug/absolute-attitude.html +0 -16
  26. package/debug/arcore-absolute.html +0 -16
  27. package/debug/arcore.html +0 -16
  28. package/debug/components/AbsoluteAttitudeComponent.jsx +0 -100
  29. package/debug/components/ArCoreAbsoluteComponent.jsx +0 -104
  30. package/debug/components/ArCoreComponent.jsx +0 -69
  31. package/debug/components/GnssWifiComponent.jsx +0 -56
  32. package/debug/components/GnssWifiPdrComponent.jsx +0 -76
  33. package/debug/components/ImuComponent.jsx +0 -95
  34. package/debug/components/InclinationComponent.jsx +0 -52
  35. package/debug/components/MapComponent.jsx +0 -228
  36. package/debug/components/NavigationConfig.js +0 -92
  37. package/debug/components/PdrComponent.jsx +0 -75
  38. package/debug/components/PoseComponent.jsx +0 -77
  39. package/debug/components/PositioningComponent.jsx +0 -29
  40. package/debug/components/PositioningInclinationComponent.jsx +0 -82
  41. package/debug/components/PositioningPoseComponent.jsx +0 -117
  42. package/debug/components/RelativeAttitudeComponent.jsx +0 -82
  43. package/debug/components/StartStopComponent.jsx +0 -50
  44. package/debug/components/Utils.js +0 -128
  45. package/debug/components/index.js +0 -34
  46. package/debug/gnss-wifi-pdr.html +0 -16
  47. package/debug/gnss-wifi.html +0 -16
  48. package/debug/imu.html +0 -16
  49. package/debug/inclination.html +0 -16
  50. package/debug/pdr.html +0 -16
  51. package/debug/pose.html +0 -16
  52. package/debug/positioning.html +0 -16
  53. package/debug/relative-attitude.html +0 -16
  54. package/dist/wemap-positioning.min.js +0 -1
  55. package/index.js +0 -8
  56. package/src/PositioningHandler.js +0 -237
  57. package/src/PositioningHandler.spec.js +0 -294
  58. package/src/PositioningOptions.js +0 -34
  59. package/src/errors/AskImuOnDesktopError.js +0 -9
  60. package/src/errors/ContainsIgnoredProviderError.js +0 -9
  61. package/src/errors/GeolocationApiMissingError.js +0 -9
  62. package/src/errors/GeolocationPermissionDeniedError.js +0 -9
  63. package/src/errors/GeolocationPositionUnavailableError.js +0 -9
  64. package/src/errors/IpResolveServerError.js +0 -9
  65. package/src/errors/MissingAccelerometerError.js +0 -11
  66. package/src/errors/MissingArCoreError.js +0 -9
  67. package/src/errors/MissingGyroscopeError.js +0 -11
  68. package/src/errors/MissingMagnetometerError.js +0 -9
  69. package/src/errors/MissingNativeInterfaceError.js +0 -9
  70. package/src/errors/MissingSensorError.js +0 -14
  71. package/src/errors/NoProviderFoundError.js +0 -9
  72. package/src/events/Availability.js +0 -30
  73. package/src/events/EventType.js +0 -22
  74. package/src/events/ProviderEvent.js +0 -35
  75. package/src/providers/Constants.js +0 -5
  76. package/src/providers/Provider.js +0 -247
  77. package/src/providers/ProvidersList.js +0 -44
  78. package/src/providers/ProvidersLogger.js +0 -75
  79. package/src/providers/attitude/AbsoluteAttitudeProvider.js +0 -199
  80. package/src/providers/attitude/EkfAttitude.js +0 -238
  81. package/src/providers/attitude/EkfAttitude.spec.js +0 -116
  82. package/src/providers/attitude/RelativeAttitudeProvider.js +0 -121
  83. package/src/providers/others/ImuProvider.js +0 -179
  84. package/src/providers/others/InclinationProvider.js +0 -99
  85. package/src/providers/others/MapMatchingProvider.js +0 -65
  86. package/src/providers/pose/ArCoreAbsoluteProvider.js +0 -235
  87. package/src/providers/pose/ArCoreProvider.js +0 -191
  88. package/src/providers/pose/GnssWifiPdrProvider.js +0 -219
  89. package/src/providers/pose/PoseProvider.js +0 -71
  90. package/src/providers/pose/pdr/PdrProvider.js +0 -364
  91. package/src/providers/pose/pdr/helpers/HeadingUnlocker.js +0 -41
  92. package/src/providers/pose/pdr/helpers/HeadingUnlocker.spec.js +0 -26
  93. package/src/providers/pose/pdr/helpers/Smoother.js +0 -92
  94. package/src/providers/pose/pdr/helpers/Smoother.spec.js +0 -426
  95. package/src/providers/pose/pdr/helpers/ThugDetector.js +0 -37
  96. package/src/providers/pose/pdr/steps/StepDetection.js +0 -7
  97. package/src/providers/pose/pdr/steps/StepDetectionLadetto.js +0 -67
  98. package/src/providers/pose/pdr/steps/StepDetectionMinMaxPeaks.js +0 -80
  99. package/src/providers/pose/pdr/steps/StepDetectionMinMaxPeaks2.js +0 -108
  100. package/src/providers/position/GnssWifiProvider.js +0 -130
  101. package/src/providers/position/IpProvider.js +0 -74
  102. package/webpack/webpack.common.js +0 -20
  103. package/webpack/webpack.dev.js +0 -24
  104. package/webpack/webpack.prod.js +0 -15
@@ -1,237 +0,0 @@
1
- /* eslint-disable max-statements */
2
- import EventType from './events/EventType';
3
- import PdrProvider from './providers/pose/pdr/PdrProvider';
4
- import GnssWifiPdrProvider from './providers/pose/GnssWifiPdrProvider';
5
- import PoseProvider from './providers/pose/PoseProvider';
6
- import PositioningOptions from './PositioningOptions';
7
- import InclinationProvider from './providers/others/InclinationProvider';
8
- import Logger from '@wemap/logger';
9
- import ArCoreAbsoluteProvider from './providers/pose/ArCoreAbsoluteProvider';
10
- import GnssWifiProvider from './providers/position/GnssWifiProvider';
11
- import NoProviderFoundError from './errors/NoProviderFoundError';
12
- import Availability from './events/Availability';
13
- import RelativeAttitudeProvider from './providers/attitude/RelativeAttitudeProvider';
14
- import AbsoluteAttitudeProvider from './providers/attitude/AbsoluteAttitudeProvider';
15
-
16
- /**
17
- * @private
18
- */
19
- class PositioningHandler {
20
-
21
- providerInstances = [];
22
-
23
- /**
24
- * Constructor of PositioningHandler
25
- * @public
26
- */
27
- constructor() {
28
-
29
- }
30
-
31
- /**
32
- * Start to listen events
33
- * @param {EventType[]} eventsType array of events to subscribe
34
- * @param {Function} onEvent Callback on events, first and only parameter is a: {@link ProviderEvent[]}.
35
- * @param {Function} onError Callback on errors, first and only parameter is a: {@link ProviderError[]}.
36
- * @param {PositioningOptions} options
37
- * @returns {Number} an id to stop or interact with
38
- */
39
- start(eventsType, onEvent, onError, options) {
40
-
41
- this.options = Object.assign({}, PositioningOptions, options);
42
-
43
- try {
44
- const providerClass = PositioningHandler.findProvider(eventsType, this.options);
45
- const provider = Reflect.construct(providerClass, [onEvent, onError, this.options]);
46
- this.providerInstances[provider.id] = provider;
47
- provider.start();
48
-
49
- return {
50
- id: provider.id,
51
- name: provider.name,
52
- useCameraNatively: provider.useCameraNatively
53
- };
54
- } catch (e) {
55
- onError(e);
56
- return null;
57
- }
58
- }
59
-
60
- /**
61
- * @private
62
- */
63
- static findProvider(eventsType, _options) {
64
-
65
- const options = Object.assign({}, PositioningOptions, _options);
66
-
67
- let availability = Availability.yes();
68
- const canUse = (provider) => {
69
- availability = provider.checkAvailability(options);
70
- return availability.isSupported;
71
- };
72
-
73
- const wantInclination = eventsType.length === 1
74
- && eventsType.includes(EventType.Inclination);
75
-
76
- if (wantInclination) {
77
- if (canUse(InclinationProvider)) {
78
- return InclinationProvider;
79
- }
80
- throw availability.reason;
81
- }
82
-
83
- const wantPoseProvider = [EventType.AbsolutePosition, EventType.AbsoluteAttitude]
84
- .every(elem => eventsType.includes(elem)) && eventsType.length === 2;
85
-
86
- if (wantPoseProvider) {
87
-
88
- if (options.waitInputPosition) {
89
- if (canUse(ArCoreAbsoluteProvider)) {
90
- return ArCoreAbsoluteProvider;
91
- }
92
- if (canUse(PdrProvider)) {
93
- return PdrProvider;
94
- }
95
-
96
- throw availability.reason;
97
- }
98
-
99
- if (canUse(GnssWifiPdrProvider)) {
100
- return GnssWifiPdrProvider;
101
- }
102
-
103
- if (canUse(PoseProvider)) {
104
- return PoseProvider;
105
- }
106
-
107
- if (!options.optionalEvents.includes(EventType.AbsoluteAttitude)) {
108
- throw availability.reason;
109
- }
110
-
111
- if (canUse(GnssWifiProvider)) {
112
- return GnssWifiProvider;
113
- }
114
-
115
- throw availability.reason;
116
- }
117
-
118
- const wantAbsoluteAttitude = eventsType.length === 1
119
- && eventsType.includes(EventType.AbsoluteAttitude);
120
-
121
- if (wantAbsoluteAttitude) {
122
- if (canUse(AbsoluteAttitudeProvider)) {
123
- return AbsoluteAttitudeProvider;
124
- }
125
- throw availability.reason;
126
- }
127
-
128
-
129
- const wantRelativeAttitude = eventsType.length === 1
130
- && eventsType.includes(EventType.RelativeAttitude);
131
-
132
- if (wantRelativeAttitude) {
133
- if (!options.waitInputHeading) {
134
- throw new NoProviderFoundError();
135
- }
136
- if (canUse(RelativeAttitudeProvider)) {
137
- return RelativeAttitudeProvider;
138
- }
139
- throw availability.reason;
140
- }
141
-
142
- throw new NoProviderFoundError();
143
- }
144
-
145
- /**
146
- * @public
147
- */
148
- stop(providerId) {
149
- this.providerInstances[providerId].stop();
150
- delete this.providerInstances[providerId];
151
- }
152
-
153
- /**
154
- * @public
155
- */
156
- setPosition(id, position) {
157
- const provider = this.providerInstances[id];
158
- if (!provider) {
159
- throw new Error('Unknown provider');
160
- }
161
- if (!provider.setPosition) {
162
- Logger.warn('Cannot set position to ' + provider.constructor.name);
163
- return;
164
- }
165
- provider.setPosition(position);
166
- }
167
-
168
- /**
169
- * @public
170
- */
171
- setHeading(id, heading) {
172
- const provider = this.providerInstances[id];
173
- if (!provider) {
174
- throw new Error('Unknown provider');
175
- }
176
- if (!provider.setHeading) {
177
- Logger.warn('Cannot set heading to ' + provider.constructor.name);
178
- return;
179
- }
180
- provider.setHeading(heading);
181
- }
182
-
183
- /**
184
- * @public
185
- */
186
- setItinerary(id, itinerary) {
187
- const provider = this.providerInstances[id];
188
- if (!provider) {
189
- throw new Error('Unknown provider');
190
- }
191
- if (!provider.setItinerary) {
192
- Logger.warn('Cannot set itinerary to ' + provider.constructor.name);
193
- return;
194
- }
195
- provider.setItinerary(itinerary);
196
- }
197
-
198
- /**
199
- * @public
200
- */
201
- setNetwork(id, network) {
202
- const provider = this.providerInstances[id];
203
- if (!provider) {
204
- throw new Error('Unknown provider');
205
- }
206
- if (!provider.setNetwork) {
207
- Logger.warn('Cannot set network to ' + provider.constructor.name);
208
- return;
209
- }
210
- provider.setNetwork(network);
211
- }
212
-
213
- /**
214
- * @public
215
- */
216
- enableBarcodeScanner(id) {
217
- const provider = this.providerInstances[id];
218
- if (!(provider instanceof ArCoreAbsoluteProvider)) {
219
- throw new Error('Not available. ArCore not started');
220
- }
221
- provider.enableBarcodeScanner();
222
- }
223
-
224
- /**
225
- * @public
226
- */
227
- disableBarcodeScanner(id) {
228
- const provider = this.providerInstances[id];
229
- if (!(provider instanceof ArCoreAbsoluteProvider)) {
230
- throw new Error('Not available. ArCore not started');
231
- }
232
- provider.disableBarcodeScanner();
233
- }
234
-
235
- }
236
-
237
- export default PositioningHandler;
@@ -1,294 +0,0 @@
1
- import chai from 'chai';
2
-
3
- import PositioningHandler from './PositioningHandler';
4
- import EventType from './events/EventType';
5
- import InclinationProvider from './providers/others/InclinationProvider';
6
- import GnssWifiPdrProvider from './providers/pose/GnssWifiPdrProvider';
7
- import PoseProvider from './providers/pose/PoseProvider';
8
- import PdrProvider from './providers/pose/pdr/PdrProvider';
9
- import ArCoreAbsoluteProvider from './providers/pose/ArCoreAbsoluteProvider';
10
- import GnssWifiProvider from './providers/position/GnssWifiProvider';
11
- import ArCoreProvider from './providers/pose/ArCoreProvider';
12
- import { ProvidersName } from './providers/ProvidersList';
13
- import AskImuOnDesktopError from './errors/AskImuOnDesktopError';
14
- import ContainsIgnoredProviderError from './errors/ContainsIgnoredProviderError';
15
- import AbsoluteAttitudeProvider from './providers/attitude/AbsoluteAttitudeProvider';
16
- import NoProviderFoundError from './errors/NoProviderFoundError';
17
- import RelativeAttitudeProvider from './providers/attitude/RelativeAttitudeProvider';
18
-
19
- const expect = chai.expect;
20
-
21
- function fakeUserAgent(userAgent) {
22
- global.navigator = { userAgent };
23
- }
24
-
25
- function fakeNativeInterface(arcore = true) {
26
- // We have to clear the cache here
27
- ArCoreProvider._nativeProvider = null;
28
-
29
- global.WemapProvidersAndroid = {
30
- getArCoreProvider: () => {
31
- return { checkAvailability: () => arcore };
32
- }
33
- };
34
- }
35
-
36
- function fakeGeolocation() {
37
- navigator.__defineGetter__('geolocation', () => {
38
- return { watchPosition: () => { } };
39
- });
40
- }
41
-
42
- function config(userAgent, nativeInterface = false, arcore = false) {
43
- if (userAgent) {
44
- fakeUserAgent(userAgent);
45
- }
46
- if (nativeInterface) {
47
- fakeNativeInterface(arcore);
48
- } else {
49
- delete global.WemapProvidersAndroid;
50
- }
51
- fakeGeolocation();
52
- }
53
-
54
- const CHROME_ANDROID_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-G960F Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.157 Mobile Safari/537.36';
55
-
56
- const CHROME_DESKTOP_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36';
57
-
58
- describe('PositioningHandler#findProvider', () => {
59
-
60
- it('Inclination Desktop', () => {
61
- config(CHROME_DESKTOP_USER_AGENT);
62
-
63
- expect(
64
- () => PositioningHandler.findProvider([EventType.Inclination])
65
- ).to.throw(AskImuOnDesktopError);
66
- });
67
-
68
- it('Inclination Mobile', () => {
69
- config(CHROME_ANDROID_USER_AGENT);
70
- const provider = PositioningHandler.findProvider([EventType.Inclination]);
71
- expect(provider).to.be.equals(InclinationProvider);
72
- });
73
-
74
- it('Pose Desktop', () => {
75
- config(CHROME_DESKTOP_USER_AGENT);
76
- expect(
77
- () => PositioningHandler.findProvider([EventType.AbsolutePosition, EventType.AbsoluteAttitude])
78
- ).to.throw(AskImuOnDesktopError);
79
- });
80
-
81
- it('Pose without PDR Desktop', () => {
82
- config(CHROME_DESKTOP_USER_AGENT);
83
- expect(
84
- () => PositioningHandler.findProvider(
85
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
86
- { ignoreProviders: [PdrProvider] }
87
- )
88
- ).to.throw(AskImuOnDesktopError);
89
- });
90
-
91
- it('Pose without ArCore Desktop', () => {
92
- config(CHROME_DESKTOP_USER_AGENT);
93
- expect(
94
- () => PositioningHandler.findProvider(
95
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
96
- { ignoreProviders: [ArCoreProvider] }
97
- )
98
- ).to.throw(AskImuOnDesktopError);
99
- });
100
-
101
- it('Pose with optional attitude Desktop', () => {
102
- config(CHROME_DESKTOP_USER_AGENT);
103
- expect(
104
- () => PositioningHandler.findProvider([EventType.AbsolutePosition, EventType.AbsoluteAttitude])
105
- ).to.throw(AskImuOnDesktopError);
106
- });
107
-
108
- it('Pose with optional attitude without PDR Desktop', () => {
109
- config(CHROME_DESKTOP_USER_AGENT);
110
- const provider = PositioningHandler.findProvider(
111
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
112
- {
113
- ignoreProviders: [ProvidersName.Pdr],
114
- optionalEvents: [EventType.AbsoluteAttitude]
115
- }
116
- );
117
- expect(provider).to.be.equals(GnssWifiProvider);
118
- });
119
-
120
- it('Pose with optional attitude without ArCore Desktop', () => {
121
- config(CHROME_DESKTOP_USER_AGENT);
122
- const provider = PositioningHandler.findProvider(
123
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
124
- {
125
- ignoreProviders: [ProvidersName.ArCore],
126
- optionalEvents: [EventType.AbsoluteAttitude]
127
- }
128
- );
129
- expect(provider).to.be.equals(GnssWifiProvider);
130
- });
131
-
132
- it('Pose with optional attitude without PDR and ArCore Desktop', () => {
133
- config(CHROME_DESKTOP_USER_AGENT);
134
- const provider = PositioningHandler.findProvider(
135
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
136
- {
137
- ignoreProviders: [ProvidersName.Pdr, ProvidersName.ArCore],
138
- optionalEvents: [EventType.AbsoluteAttitude]
139
- }
140
- );
141
- expect(provider).to.be.equals(GnssWifiProvider);
142
- });
143
-
144
- it('Pose Mobile Web', () => {
145
- config(CHROME_ANDROID_USER_AGENT);
146
- const provider = PositioningHandler.findProvider([EventType.AbsolutePosition, EventType.AbsoluteAttitude]);
147
- expect(provider).to.be.equals(GnssWifiPdrProvider);
148
- });
149
-
150
- it('Pose without PDR Mobile Web', () => {
151
- config(CHROME_ANDROID_USER_AGENT);
152
- const provider = PositioningHandler.findProvider(
153
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
154
- { ignoreProviders: [ProvidersName.Pdr] }
155
- );
156
- expect(provider).to.be.equals(PoseProvider);
157
- });
158
-
159
- it('Pose without ArCore Mobile Web', () => {
160
- config(CHROME_ANDROID_USER_AGENT);
161
- const provider = PositioningHandler.findProvider(
162
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
163
- { ignoreProviders: [ProvidersName.ArCore] }
164
- );
165
- expect(provider).to.be.equals(GnssWifiPdrProvider);
166
- });
167
-
168
- it('Pose without PDR and ArCore Mobile Web', () => {
169
- config(CHROME_ANDROID_USER_AGENT);
170
- const provider = PositioningHandler.findProvider(
171
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
172
- { ignoreProviders: [ProvidersName.Pdr, ProvidersName.ArCore] }
173
- );
174
- expect(provider).to.be.equals(PoseProvider);
175
- });
176
-
177
- it('Pose with waitInputPosition Mobile Web', () => {
178
- config(CHROME_ANDROID_USER_AGENT);
179
- const provider = PositioningHandler.findProvider(
180
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
181
- { waitInputPosition: true }
182
- );
183
- expect(provider).to.be.equals(PdrProvider);
184
- });
185
-
186
- it('Pose with waitInputPosition Mobile Native with ArCore', () => {
187
- config(CHROME_ANDROID_USER_AGENT, true, true);
188
- const provider = PositioningHandler.findProvider(
189
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
190
- { waitInputPosition: true }
191
- );
192
- expect(provider).to.be.equals(ArCoreAbsoluteProvider);
193
- });
194
-
195
- it('Pose with waitInputPosition Mobile Native without ArCore', () => {
196
- config(CHROME_ANDROID_USER_AGENT, true, false);
197
- const provider = PositioningHandler.findProvider(
198
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
199
- {
200
- waitInputPosition: true,
201
- ignoreProviders: [ProvidersName.ArCore]
202
- }
203
- );
204
- expect(provider).to.be.equals(PdrProvider);
205
- });
206
-
207
- it('Pose with waitInputPosition without PDR Mobile Web', () => {
208
- config(CHROME_ANDROID_USER_AGENT, false);
209
- expect(
210
- () => PositioningHandler.findProvider(
211
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
212
- {
213
- waitInputPosition: true,
214
- ignoreProviders: [ProvidersName.Pdr]
215
- }
216
- )
217
- ).to.throw(ContainsIgnoredProviderError);
218
- });
219
-
220
- it('Pose with waitInputPosition without ArCore Mobile Native', () => {
221
- config(CHROME_ANDROID_USER_AGENT, true, true);
222
- const provider = PositioningHandler.findProvider(
223
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
224
- {
225
- waitInputPosition: true,
226
- ignoreProviders: [ProvidersName.ArCore]
227
- }
228
- );
229
- expect(provider).to.be.equals(PdrProvider);
230
- });
231
-
232
- it('Pose without GnssWifi Desktop', () => {
233
- config(CHROME_DESKTOP_USER_AGENT, false);
234
- expect(
235
- () => PositioningHandler.findProvider(
236
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
237
- {
238
- ignoreProviders: [ProvidersName.GnssWifi],
239
- optionalEvents: [EventType.AbsoluteAttitude]
240
- }
241
- )
242
- ).to.throw(ContainsIgnoredProviderError);
243
- });
244
-
245
- it('Absolute Attitude Desktop', () => {
246
- config(CHROME_DESKTOP_USER_AGENT);
247
- expect(
248
- () => PositioningHandler.findProvider([EventType.AbsoluteAttitude])
249
- ).to.throw(AskImuOnDesktopError);
250
- });
251
-
252
-
253
- it('Absolute Attitude Web', () => {
254
- config(CHROME_ANDROID_USER_AGENT);
255
- const provider = PositioningHandler.findProvider([EventType.AbsoluteAttitude]);
256
- expect(provider).to.be.equals(AbsoluteAttitudeProvider);
257
- });
258
-
259
-
260
- it('Relative Attitude Desktop without waitInputHeading', () => {
261
- config(CHROME_DESKTOP_USER_AGENT);
262
- expect(
263
- () => PositioningHandler.findProvider([EventType.RelativeAttitude])
264
- ).to.throw(NoProviderFoundError);
265
- });
266
-
267
- it('Relative Attitude Desktop', () => {
268
- config(CHROME_DESKTOP_USER_AGENT);
269
- expect(() => PositioningHandler.findProvider(
270
- [EventType.RelativeAttitude],
271
- { waitInputHeading: true })
272
- ).to.throw(AskImuOnDesktopError);
273
- });
274
-
275
- it('Relative Attitude Web without waitInputHeading', () => {
276
- config(CHROME_ANDROID_USER_AGENT);
277
- expect(
278
- () => PositioningHandler.findProvider([EventType.RelativeAttitude])
279
- ).to.throw(NoProviderFoundError);
280
- });
281
-
282
-
283
- it('Relative Attitude Web', () => {
284
- config(CHROME_ANDROID_USER_AGENT);
285
- const provider = PositioningHandler.findProvider(
286
- [EventType.RelativeAttitude],
287
- { waitInputHeading: true }
288
- );
289
- expect(provider).to.be.equals(RelativeAttitudeProvider);
290
- });
291
-
292
- });
293
-
294
- delete global.navigator;
@@ -1,34 +0,0 @@
1
- const PositioningOptions = {
2
-
3
- /**
4
- * Does provider have to wait an input position to start
5
- * @see PositioningHandler#setPosition()
6
- */
7
- waitInputPosition: false,
8
-
9
- /**
10
- * Does provider have to wait an input heading to start
11
- * @see PositioningHandler#setHeading()
12
- */
13
- waitInputHeading: false,
14
-
15
- /**
16
- * Does provider will use map to
17
- * @see PositioningHandler#setItinerary()
18
- */
19
- useMapMatching: false,
20
-
21
- /**
22
- * Providers listed here will not be used by PositioningHandler
23
- * List of {@link Provider#name}
24
- */
25
- ignoreProviders: [],
26
-
27
- /**
28
- * Define the list of EventType that are optionals
29
- * List of {@link EventType}
30
- */
31
- optionalEvents: []
32
- };
33
-
34
- export default PositioningOptions;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'It seems that you ask for IMU events on a desktop browser';
2
-
3
- class AskImuOnDesktopError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default AskImuOnDesktopError;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'Contains ignored provider';
2
-
3
- class ContainsIgnoredProviderError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default ContainsIgnoredProviderError;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'Geolocation api is missing';
2
-
3
- class GeolocationApiMissingError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default GeolocationApiMissingError;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'Geolocation permission denied';
2
-
3
- class GeolocationPermissionDeniedError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default GeolocationPermissionDeniedError;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'Geolocation position unavailable';
2
-
3
- class GeolocationPositionUnavailableError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default GeolocationPositionUnavailableError;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'IP Resolver failed';
2
-
3
- class IpResolveServerError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default IpResolveServerError;
@@ -1,11 +0,0 @@
1
- const DEFAULT_MESSAGE = 'Impossible to retrieve Acceleration data';
2
-
3
- import MissingSensorError from './MissingSensorError';
4
-
5
- class MissingAccelerometerError extends MissingSensorError {
6
- constructor(message) {
7
- super(message || DEFAULT_MESSAGE);
8
- }
9
- }
10
-
11
- export default MissingAccelerometerError;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'ARCore is missing';
2
-
3
- class MissingArCoreError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default MissingArCoreError;
@@ -1,11 +0,0 @@
1
- const DEFAULT_MESSAGE = 'Impossible to retrieve Angular Rate data';
2
-
3
- import MissingSensorError from './MissingSensorError';
4
-
5
- class MissingGyroscopeError extends MissingSensorError {
6
- constructor(message) {
7
- super(message || DEFAULT_MESSAGE);
8
- }
9
- }
10
-
11
- export default MissingGyroscopeError;
@@ -1,9 +0,0 @@
1
- import MissingSensorError from './MissingSensorError';
2
-
3
- class MissingMagnetometerError extends MissingSensorError {
4
- constructor(message) {
5
- super(message);
6
- }
7
- }
8
-
9
- export default MissingMagnetometerError;
@@ -1,9 +0,0 @@
1
- const DEFAULT_MESSAGE = 'Native interface is missing';
2
-
3
- class MissingNativeInterfaceError extends Error {
4
- constructor(message) {
5
- super(message || DEFAULT_MESSAGE);
6
- }
7
- }
8
-
9
- export default MissingNativeInterfaceError;