@wemap/positioning 2.3.6 → 2.3.7

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 (31) hide show
  1. package/package.json +1 -1
  2. package/src/PositioningHandler.js +58 -43
  3. package/src/PositioningHandler.spec.js +47 -27
  4. package/src/components/AbsoluteAttitudeComponent.jsx +2 -6
  5. package/src/components/ArCoreAbsoluteComponent.jsx +4 -11
  6. package/src/components/ArCoreComponent.jsx +4 -11
  7. package/src/components/GnssWifiComponent.jsx +2 -6
  8. package/src/components/GnssWifiPdrComponent.jsx +4 -11
  9. package/src/components/ImuComponent.jsx +4 -12
  10. package/src/components/InclinationComponent.jsx +2 -6
  11. package/src/components/PdrComponent.jsx +5 -12
  12. package/src/components/PoseComponent.jsx +4 -11
  13. package/src/components/PositioningInclinationComponent.jsx +5 -8
  14. package/src/components/PositioningPoseComponent.jsx +10 -15
  15. package/src/components/RelativeAttitudeComponent.jsx +3 -6
  16. package/src/errors/ContainsIgnoredProviderError.js +9 -0
  17. package/src/events/Availability.js +30 -0
  18. package/src/providers/Provider.js +50 -50
  19. package/src/providers/attitude/AbsoluteAttitudeProvider.js +11 -27
  20. package/src/providers/attitude/RelativeAttitudeProvider.js +2 -17
  21. package/src/providers/others/ImuProvider.js +11 -25
  22. package/src/providers/others/InclinationProvider.js +2 -17
  23. package/src/providers/pose/ArCoreAbsoluteProvider.js +4 -30
  24. package/src/providers/pose/ArCoreProvider.js +11 -8
  25. package/src/providers/pose/GnssWifiPdrProvider.js +4 -26
  26. package/src/providers/pose/PoseProvider.js +3 -29
  27. package/src/providers/pose/pdr/PdrProvider.js +8 -28
  28. package/src/providers/position/GnssWifiProvider.js +9 -16
  29. package/src/providers/position/IpProvider.js +1 -11
  30. package/src/events/ProviderError.js +0 -52
  31. package/src/providers/FakeAbsolutePositionProvider.js +0 -56
@@ -3,9 +3,10 @@ import noop from 'lodash.noop';
3
3
  import EventType from '../events/EventType';
4
4
  import ProviderEvent from '../events/ProviderEvent';
5
5
  import Logger from '@wemap/logger';
6
- import ProviderError from '../events/ProviderError';
7
6
  import ProvidersLogger from './ProvidersLogger';
8
- import MissingNativeInterfaceError from '../errors/MissingNativeInterfaceError';
7
+ import Availability from '../events/Availability';
8
+ import PositioningOptions from '../PositioningOptions';
9
+ import ContainsIgnoredProviderError from '../errors/ContainsIgnoredProviderError';
9
10
 
10
11
  let uniqueId = 1;
11
12
 
@@ -16,10 +17,14 @@ let uniqueId = 1;
16
17
  class Provider {
17
18
 
18
19
  static DEFAULT_NAME = 'Unknown';
19
- static DEFAULT_OPTIONS = {
20
- stopOnError: true,
21
- checkAvailabilityOnStart: true
22
- };
20
+ static DEFAULT_OPTIONS = Object.assign(
21
+ {},
22
+ PositioningOptions,
23
+ {
24
+ stopOnError: true,
25
+ checkAvailabilityOnStart: true
26
+ }
27
+ );
23
28
 
24
29
  static State = {
25
30
  STARTING: 0,
@@ -43,7 +48,7 @@ class Provider {
43
48
  constructor(onEvent, onError, options) {
44
49
  this.onEvent = onEvent || noop;
45
50
  this.onError = onError || noop;
46
- this.options = Object.assign(this.constructor.DEFAULT_OPTIONS, options);
51
+ this.options = Object.assign({}, Provider.DEFAULT_OPTIONS, PositioningOptions, options);
47
52
  this.id = uniqueId++;
48
53
  ProvidersLogger.addEvent(this, 'constructor');
49
54
  }
@@ -68,21 +73,47 @@ class Provider {
68
73
  }
69
74
 
70
75
  /**
71
- * @override
76
+ * //TODO
72
77
  */
73
- static checkAvailabilityErrors() {
74
- return this.requiredProviders.reduce(
75
- (acc, val) => acc.concat(val.checkAvailabilityErrors()), []
76
- );
78
+ static checkAvailability(options) {
79
+
80
+ if (this.containsIgnoredProviders(options)) {
81
+ return Availability.no(new ContainsIgnoredProviderError());
82
+ }
83
+
84
+ return this
85
+ .getRequiredProviders(options)
86
+ .reduce((acc, val) =>
87
+ Availability.merge(acc, val.checkAvailability(options)), Availability.yes()
88
+ );
77
89
  }
78
90
 
79
91
  /**
80
92
  * Return the list of required providers
81
93
  */
82
- static get requiredProviders() {
94
+ static getRequiredProviders() {
83
95
  return [];
84
96
  }
85
97
 
98
+ static containsIgnoredProviders(options) {
99
+ return this
100
+ .getRequiredProvidersRecursively(options)
101
+ .some(elem => options.ignoreProviders.includes(elem.name));
102
+ }
103
+
104
+
105
+ /**
106
+ * Return the list of required providers
107
+ */
108
+ static getRequiredProvidersRecursively(options) {
109
+ if (this.getRequiredProviders(options).length === 0) {
110
+ return [this];
111
+ }
112
+ return this.getRequiredProviders().reduce(
113
+ (acc, val) => acc.concat(val.getRequiredProvidersRecursively(options)), [this]
114
+ );
115
+ }
116
+
86
117
  /**
87
118
  * Start the Provider
88
119
  * @public
@@ -96,9 +127,9 @@ class Provider {
96
127
  this.state = Provider.State.STARTING;
97
128
 
98
129
  if (this.options.checkAvailabilityOnStart) {
99
- const availabilityErrors = this.constructor.checkAvailabilityErrors();
100
- if (availabilityErrors.length !== 0) {
101
- this.notifyError(...availabilityErrors);
130
+ const availibility = this.constructor.checkAvailability(this.options);
131
+ if (!availibility.isSupported) {
132
+ this.notifyError(availibility.reason);
102
133
  return;
103
134
  }
104
135
  }
@@ -152,10 +183,10 @@ class Provider {
152
183
 
153
184
  /**
154
185
  * Notify the subscriber defined in {@link constructor}
155
- * @param {ProviderError[]} errors The error raised
186
+ * @param {Error[]} errors The error raised
156
187
  */
157
- notifyError(...errors) {
158
- this.onError(errors);
188
+ notifyError(error) {
189
+ this.onError(error);
159
190
  if (this.options.stopOnError && this.state === Provider.State.STARTED) {
160
191
  this.stop();
161
192
  }
@@ -187,33 +218,6 @@ class Provider {
187
218
  return this.constructor.createEvent(dataType, data, timestamp);
188
219
  }
189
220
 
190
- /**
191
- * Create an event error from current provider
192
- * @param {EventType} dataType type of ProviderError
193
- * @param {ProviderError} error error raised by the problem exported to ProviderError
194
- * @param {Number} timestamp event timestamp
195
- * @protected
196
- */
197
- static createError(dataType, error, timestamp) {
198
- const event = new ProviderError(this.name, dataType, error);
199
- if (timestamp) {
200
- event.timestamp = timestamp;
201
- }
202
- return event;
203
- }
204
-
205
- /**
206
- * Create an event error from current provider
207
- * @param {EventType} dataType type of ProviderError
208
- * @param {ProviderError} error error raised by the problem exported to ProviderError
209
- * @param {Number} timestamp event timestamp
210
- * @protected
211
- */
212
- createError(dataType, error, timestamp) {
213
- return this.constructor.createError(dataType, error, timestamp);
214
- }
215
-
216
-
217
221
  static hasNativeInterface() {
218
222
  return Boolean(Provider.nativeInterface);
219
223
  }
@@ -221,10 +225,6 @@ class Provider {
221
225
  static get nativeInterface() {
222
226
  return global.WemapProvidersAndroid;
223
227
  }
224
-
225
- static createMissingNativeInterfaceError(dataType) {
226
- return this.createError(dataType, new MissingNativeInterfaceError());
227
- }
228
228
  }
229
229
 
230
230
  export default Provider;
@@ -16,6 +16,7 @@ import AskImuOnDesktopError from '../../errors/AskImuOnDesktopError';
16
16
  import MissingMagnetometerError from '../../errors/MissingMagnetometerError';
17
17
  import MissingSensorError from '../../errors/MissingSensorError';
18
18
  import Logger from '@wemap/logger';
19
+ import Availability from '../../events/Availability';
19
20
 
20
21
 
21
22
  /**
@@ -54,18 +55,13 @@ class AbsoluteAttitudeProvider extends Provider {
54
55
  /**
55
56
  * @override
56
57
  */
57
- static checkAvailabilityErrors() {
58
-
59
- if (BrowserUtils.isMobile) {
60
- return [];
61
- }
62
-
63
- return [
64
- AbsoluteAttitudeProvider.createError(
65
- EventType.AbsoluteAttitude,
66
- new AskImuOnDesktopError()
67
- )
68
- ];
58
+ static checkAvailability(options) {
59
+ return Availability.merge(
60
+ super.checkAvailability(options),
61
+ BrowserUtils.isMobile
62
+ ? Availability.yes()
63
+ : Availability.no(new AskImuOnDesktopError())
64
+ );
69
65
  }
70
66
 
71
67
  /**
@@ -108,11 +104,7 @@ class AbsoluteAttitudeProvider extends Provider {
108
104
  const timestamp = e.timeStamp / 1e3;
109
105
 
110
106
  if (!e.alpha || !e.beta || !e.gamma) {
111
- super.notifyError(this.createError(
112
- EventType.AbsoluteAttitude,
113
- new MissingSensorError().from('deviceorientationabsolute'),
114
- timestamp
115
- ));
107
+ this.notifyError(new MissingSensorError().from('deviceorientationabsolute'));
116
108
  return;
117
109
  }
118
110
  this.onDeviceOrientationCommonEvent(timestamp,
@@ -125,20 +117,12 @@ class AbsoluteAttitudeProvider extends Provider {
125
117
  const timestamp = e.timeStamp / 1e3;
126
118
 
127
119
  if (!e.beta || !e.gamma) {
128
- super.notifyError(this.createError(
129
- EventType.AbsoluteAttitude,
130
- new MissingSensorError().from('deviceorientation'),
131
- timestamp
132
- ));
120
+ this.notifyError(new MissingSensorError().from('deviceorientation'));
133
121
  return;
134
122
  }
135
123
 
136
124
  if (!e.webkitCompassHeading) {
137
- super.notifyError(this.createError(
138
- EventType.AbsoluteAttitude,
139
- new MissingMagnetometerError().from('deviceorientation'),
140
- timestamp
141
- ));
125
+ super.notifyError(new MissingMagnetometerError().from('deviceorientation'));
142
126
  return;
143
127
  }
144
128
 
@@ -4,7 +4,6 @@ import EkfAttitude from './EkfAttitude';
4
4
  import ImuProvider from '../others/ImuProvider';
5
5
  import { Attitude } from '@wemap/geo';
6
6
  import { deg2rad } from '@wemap/maths';
7
- import ProviderError from '../../events/ProviderError';
8
7
 
9
8
 
10
9
  /**
@@ -26,7 +25,7 @@ class RelativeAttitudeProvider extends Provider {
26
25
  this.relativeOffsetQuaternion = [1, 0, 0, 0];
27
26
 
28
27
  this.imuProvider = new ImuProvider(this.onImuEvent,
29
- this.onImuError, { require: [EventType.Acceleration, EventType.AngularRate] });
28
+ onError, { require: [EventType.Acceleration, EventType.AngularRate] });
30
29
 
31
30
  }
32
31
 
@@ -47,7 +46,7 @@ class RelativeAttitudeProvider extends Provider {
47
46
  /**
48
47
  * @override
49
48
  */
50
- static get requiredProviders() {
49
+ static getRequiredProviders() {
51
50
  return [ImuProvider];
52
51
  }
53
52
 
@@ -110,20 +109,6 @@ class RelativeAttitudeProvider extends Provider {
110
109
 
111
110
  this.ekfAttitude.setOrientationYaw(heading);
112
111
  }
113
-
114
- onImuError = imuErrors => {
115
- this.notifyError(...ProviderError.modifyArrayDataType(imuErrors, EventType.RelativeAttitude));
116
- }
117
-
118
- /**
119
- * @override
120
- */
121
- static checkAvailabilityErrors() {
122
- return ProviderError.modifyArrayDataType(
123
- super.checkAvailabilityErrors(),
124
- EventType.RelativeAttitude
125
- );
126
- }
127
112
  }
128
113
 
129
114
  export default RelativeAttitudeProvider;
@@ -9,6 +9,7 @@ import EventType from '../../events/EventType';
9
9
  import MissingAccelerometerError from '../../errors/MissingAccelerometerError';
10
10
  import MissingGyroscopeError from '../../errors/MissingGyroscopeError';
11
11
  import AskImuOnDesktopError from '../../errors/AskImuOnDesktopError';
12
+ import Availability from '../../events/Availability';
12
13
 
13
14
  /**
14
15
  * Imu (Inertial Measurement Unit) provider retrieve acceleration data
@@ -78,22 +79,13 @@ class ImuProvider extends Provider {
78
79
  /**
79
80
  * @override
80
81
  */
81
- static checkAvailabilityErrors() {
82
-
83
- if (BrowserUtils.isMobile) {
84
- return [];
85
- }
86
-
87
- return [
88
- ImuProvider.createError(
89
- EventType.AngularRate,
90
- new AskImuOnDesktopError()
91
- ),
92
- ImuProvider.createError(
93
- EventType.Acceleration,
94
- new AskImuOnDesktopError()
95
- )
96
- ];
82
+ static checkAvailability(options) {
83
+ return Availability.merge(
84
+ super.checkAvailability(options),
85
+ BrowserUtils.isMobile
86
+ ? Availability.yes()
87
+ : Availability.no(new AskImuOnDesktopError())
88
+ );
97
89
  }
98
90
 
99
91
  /**
@@ -142,11 +134,7 @@ class ImuProvider extends Provider {
142
134
  }
143
135
 
144
136
  if (!acc) {
145
- super.notifyError(this.createError(
146
- EventType.AngularRate,
147
- new MissingAccelerometerError().from('devicemotion'),
148
- timestamp
149
- ));
137
+ this.notifyError(new MissingAccelerometerError().from('devicemotion'));
150
138
  return;
151
139
  }
152
140
 
@@ -168,9 +156,7 @@ class ImuProvider extends Provider {
168
156
  }
169
157
 
170
158
  if (!gyr) {
171
- super.notifyError(this.createError(EventType.AngularRate,
172
- new MissingGyroscopeError().from('devicemotion'),
173
- timestamp));
159
+ this.notifyError(new MissingGyroscopeError().from('devicemotion'));
174
160
  return;
175
161
  }
176
162
 
@@ -178,7 +164,7 @@ class ImuProvider extends Provider {
178
164
  }
179
165
 
180
166
  if (events.length !== 0) {
181
- super.notify(...events);
167
+ this.notify(...events);
182
168
  }
183
169
  }
184
170
 
@@ -1,7 +1,6 @@
1
1
  import Provider from '../Provider';
2
2
  import EventType from '../../events/EventType';
3
3
  import ImuProvider from './ImuProvider';
4
- import ProviderError from '../../events/ProviderError';
5
4
 
6
5
  /**
7
6
  * Inclination provider gives the inclination of the device using Imu Sensor
@@ -19,7 +18,7 @@ class InclinationProvider extends Provider {
19
18
 
20
19
  this.imuProvider = new ImuProvider(
21
20
  this.onImuEvent,
22
- this.onImuError,
21
+ onError,
23
22
  { require: [EventType.Acceleration] }
24
23
  );
25
24
  }
@@ -41,7 +40,7 @@ class InclinationProvider extends Provider {
41
40
  /**
42
41
  * @override
43
42
  */
44
- static get requiredProviders() {
43
+ static getRequiredProviders() {
45
44
  return [ImuProvider];
46
45
  }
47
46
 
@@ -88,20 +87,6 @@ class InclinationProvider extends Provider {
88
87
 
89
88
  this.notify(this.createEvent(EventType.Inclination, inclination));
90
89
  };
91
-
92
- onImuError = imuErrors => {
93
- this.notifyError(...ProviderError.modifyArrayDataType(imuErrors, EventType.Inclination));
94
- }
95
-
96
- /**
97
- * @override
98
- */
99
- static checkAvailabilityErrors() {
100
- return ProviderError.modifyArrayDataType(
101
- super.checkAvailabilityErrors(),
102
- EventType.Inclination
103
- );
104
- }
105
90
  }
106
91
 
107
92
  export default InclinationProvider;
@@ -8,7 +8,6 @@ import {
8
8
  Quaternion, Vector3
9
9
  } from '@wemap/maths';
10
10
  import ImuProvider from '../others/ImuProvider';
11
- import ProviderError from '../../events/ProviderError';
12
11
 
13
12
  /**
14
13
  * Pose provider is the provider used by the PositioningHandler. It uses the best fusion
@@ -24,13 +23,13 @@ class ArCoreAbsoluteProvider extends Provider {
24
23
 
25
24
  this.arCoreProvider = new ArCoreProvider(
26
25
  e => this.onArCoreEvent(e),
27
- e => this.onArCoreError(e),
26
+ onError,
28
27
  options);
29
28
 
30
29
  this.imuProvider = new ImuProvider(
31
30
  this.onImuEvent,
32
- this.onImuError,
33
- Object.assign(options || {}, { require: [EventType.AngularRate] })
31
+ onError,
32
+ Object.assign({}, options || {}, { require: [EventType.AngularRate] })
34
33
  );
35
34
  }
36
35
 
@@ -51,7 +50,7 @@ class ArCoreAbsoluteProvider extends Provider {
51
50
  /**
52
51
  * Return the list of required providers
53
52
  */
54
- static get requiredProviders() {
53
+ static getRequiredProviders() {
55
54
  return [ArCoreProvider, ImuProvider];
56
55
  }
57
56
 
@@ -71,15 +70,6 @@ class ArCoreAbsoluteProvider extends Provider {
71
70
  this.imuProvider.stop();
72
71
  }
73
72
 
74
- /**
75
- * @override
76
- */
77
- static checkAvailabilityErrors() {
78
- return ArCoreProvider.checkAvailabilityErrors().concat(
79
- ImuProvider.checkAvailabilityErrors()
80
- );
81
- }
82
-
83
73
  onArCoreEvent = events => {
84
74
  events.forEach(event => {
85
75
  if (event.dataType === EventType.RelativeAttitude) {
@@ -145,26 +135,10 @@ class ArCoreAbsoluteProvider extends Provider {
145
135
  return pos1[0] === pos2[0] && pos1[1] === pos2[1] && pos1[2] === pos2[2];
146
136
  }
147
137
 
148
- onArCoreError = arCoreErrors => {
149
- this.notifyError(...(
150
- ProviderError.modifyArrayDataType(arCoreErrors, EventType.AbsoluteAttitude).concat(
151
- ProviderError.modifyArrayDataType(arCoreErrors, EventType.AbsolutePosition)
152
- ))
153
- );
154
- };
155
-
156
138
  onImuEvent = events => {
157
139
  this.angularRate = events[0].data;
158
140
  }
159
141
 
160
- onImuError = imuErrors => {
161
- this.notifyError(...(
162
- ProviderError.modifyArrayDataType(imuErrors, EventType.AbsoluteAttitude).concat(
163
- ProviderError.modifyArrayDataType(imuErrors, EventType.AbsolutePosition)
164
- ))
165
- );
166
- }
167
-
168
142
  setHeading(heading) {
169
143
 
170
144
  if (!this.relativeAttitude) {
@@ -4,6 +4,7 @@ import Provider from '../Provider';
4
4
  import EventType from '../../events/EventType';
5
5
  import MissingArCoreError from '../../errors/MissingArCoreError';
6
6
  import MissingNativeInterfaceError from '../../errors/MissingNativeInterfaceError';
7
+ import Availability from '../../events/Availability';
7
8
 
8
9
  /**
9
10
  * Pose provider is the provider used by the PositioningHandler. It uses the best fusion
@@ -28,7 +29,7 @@ class ArCoreProvider extends Provider {
28
29
  /**
29
30
  * Return the list of required providers
30
31
  */
31
- static get requiredProviders() {
32
+ static getRequiredProviders() {
32
33
  return [];
33
34
  }
34
35
 
@@ -92,23 +93,25 @@ class ArCoreProvider extends Provider {
92
93
  /**
93
94
  * @override
94
95
  */
95
- static checkAvailabilityErrors() {
96
+ static checkAvailability(options) {
97
+
98
+ const supAvailability = super.checkAvailability(options);
99
+ if (!supAvailability.isSupported) {
100
+ return supAvailability;
101
+ }
96
102
 
97
103
  try {
98
104
  const nativeProvider = this.nativeProvider;
99
105
 
100
106
  if (!nativeProvider.checkAvailability()) {
101
- throw new MissingArCoreError();
107
+ return Availability.no(new MissingArCoreError());
102
108
  }
103
109
 
104
110
  } catch (e) {
105
- return [
106
- this.createError(EventType.RelativeAttitude, e),
107
- this.createError(EventType.RelativePosition, e)
108
- ];
111
+ return Availability.no(e);
109
112
  }
110
113
 
111
- return [];
114
+ return Availability.yes();
112
115
  }
113
116
  }
114
117
 
@@ -8,7 +8,6 @@ import GnssWifiProvider from '../position/GnssWifiProvider';
8
8
  import EventType from '../../events/EventType';
9
9
  import AbsoluteAttitudeProvider from '../attitude/AbsoluteAttitudeProvider';
10
10
  import Constants from '../Constants';
11
- import ProviderError from '../../events/ProviderError';
12
11
 
13
12
  const GPF_ACCURACY = 25;
14
13
  const GPF_DISTANCE = 25;
@@ -24,11 +23,11 @@ class GnssWifiPdrProvider extends MapMatchingProvider {
24
23
  constructor(onEvent, onError, options) {
25
24
  super(onEvent, onError, options);
26
25
 
27
- this.pdrProvider = new PdrProvider(e => this.onPdrEvent(e), e => this.onProviderError(e), options);
28
- this.gnssWifiProvider = new GnssWifiProvider(e => this.onGnssWifiEvent(e), e => this.onProviderError(e), options);
26
+ this.pdrProvider = new PdrProvider(e => this.onPdrEvent(e), onError, options);
27
+ this.gnssWifiProvider = new GnssWifiProvider(e => this.onGnssWifiEvent(e), onError, options);
29
28
  this.absoluteAttitudeProvider = new AbsoluteAttitudeProvider(
30
29
  e => this.onAbsoluteAttitudeEvent(e),
31
- e => this.onProviderError(e),
30
+ onError,
32
31
  options
33
32
  );
34
33
 
@@ -55,7 +54,7 @@ class GnssWifiPdrProvider extends MapMatchingProvider {
55
54
  /**
56
55
  * @override
57
56
  */
58
- static get requiredProviders() {
57
+ static getRequiredProviders() {
59
58
  return [PdrProvider, GnssWifiProvider, AbsoluteAttitudeProvider];
60
59
  }
61
60
 
@@ -158,27 +157,6 @@ class GnssWifiPdrProvider extends MapMatchingProvider {
158
157
  this.lastAttitude = attitude;
159
158
  }
160
159
 
161
- onProviderError(errors) {
162
- this.notifyError(...ProviderError.modifyArrayDataType(errors, EventType.AbsoluteAttitude));
163
- this.notifyError(...ProviderError.modifyArrayDataType(errors, EventType.AbsolutePosition));
164
- }
165
-
166
- /**
167
- * @override
168
- */
169
- static checkAvailabilityErrors() {
170
- const errors = super.checkAvailabilityErrors();
171
- return ProviderError.modifyArrayDataType(
172
- errors,
173
- EventType.AbsolutePosition
174
- ).concat(
175
- ProviderError.modifyArrayDataType(
176
- errors,
177
- EventType.AbsoluteAttitude
178
- )
179
- );
180
- }
181
-
182
160
  /**
183
161
  * MapMatching
184
162
  */
@@ -3,7 +3,6 @@ import EventType from '../../events/EventType';
3
3
 
4
4
  import GnssWifiProvider from '../position/GnssWifiProvider';
5
5
  import AbsoluteAttitudeProvider from '../attitude/AbsoluteAttitudeProvider';
6
- import ProviderError from '../../events/ProviderError';
7
6
 
8
7
  /**
9
8
  * Pose provider is the provider used by the PositioningHandler. It uses the best fusion
@@ -17,11 +16,11 @@ class PoseProvider extends Provider {
17
16
  constructor(onEvent, onError, options) {
18
17
  super(onEvent, onError, options);
19
18
 
20
- this.absoluteAttitudeProvider = new AbsoluteAttitudeProvider(onEvent, e => this.onAbsoluteAttitudeError(e));
19
+ this.absoluteAttitudeProvider = new AbsoluteAttitudeProvider(onEvent, onError);
21
20
  this.gnssWifiProvider = new GnssWifiProvider((events) => {
22
21
  this.absoluteAttitudeProvider.setPosition(events[0].data);
23
22
  onEvent(events);
24
- }, e => this.onGnssWifiError(e));
23
+ }, onError);
25
24
  }
26
25
 
27
26
  /**
@@ -41,7 +40,7 @@ class PoseProvider extends Provider {
41
40
  /**
42
41
  * Return the list of required providers
43
42
  */
44
- static get requiredProviders() {
43
+ static getRequiredProviders() {
45
44
  return [AbsoluteAttitudeProvider, GnssWifiProvider];
46
45
  }
47
46
 
@@ -60,31 +59,6 @@ class PoseProvider extends Provider {
60
59
  this.absoluteAttitudeProvider.stop();
61
60
  this.gnssWifiProvider.stop();
62
61
  }
63
-
64
- onAbsoluteAttitudeError(errors) {
65
- this.notifyError(...ProviderError.modifyArrayDataType(errors, EventType.AbsoluteAttitude));
66
- }
67
-
68
- onGnssWifiError(errors) {
69
- this.notifyError(...ProviderError.modifyArrayDataType(errors, EventType.AbsolutePosition));
70
- }
71
-
72
- /**
73
- * @override
74
- */
75
- static checkAvailabilityErrors() {
76
- const errorsAttitude = AbsoluteAttitudeProvider.checkAvailabilityErrors();
77
- const errorsGnssWifi = GnssWifiProvider.checkAvailabilityErrors();
78
- return ProviderError.modifyArrayDataType(
79
- errorsGnssWifi,
80
- EventType.AbsolutePosition
81
- ).concat(
82
- ProviderError.modifyArrayDataType(
83
- errorsAttitude,
84
- EventType.AbsoluteAttitude
85
- )
86
- );
87
- }
88
62
  }
89
63
 
90
64
  export default PoseProvider;