@wemap/providers 6.1.0 → 6.1.1
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/dist/wemap-providers.es.js +21 -12
- package/dist/wemap-providers.es.js.map +1 -1
- package/package.json +2 -2
- package/src/Providers.js +1 -1
- package/src/ProvidersOptions.js +2 -2
- package/src/providers/position/absolute/AbsolutePosition.js +13 -4
- package/src/providers/vision/{VisionRelocalization.js → Vps.js} +6 -6
|
@@ -196,7 +196,7 @@ const ProvidersOptions = {
|
|
|
196
196
|
* battery. They can be added to this list to be used
|
|
197
197
|
* List of {@link Provider#pname}
|
|
198
198
|
*/
|
|
199
|
-
optionalProviders: [
|
|
199
|
+
optionalProviders: [],
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* Define the list of EventType that are optionals
|
|
@@ -213,7 +213,7 @@ const ProvidersOptions = {
|
|
|
213
213
|
smoother: true,
|
|
214
214
|
|
|
215
215
|
get hasVps() {
|
|
216
|
-
return this.optionalProviders.includes('
|
|
216
|
+
return this.optionalProviders.includes('Vps');
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
219
|
|
|
@@ -3681,7 +3681,7 @@ function preciseTime() {
|
|
|
3681
3681
|
|
|
3682
3682
|
/* eslint-disable max-statements */
|
|
3683
3683
|
|
|
3684
|
-
class
|
|
3684
|
+
class Vps extends Provider {
|
|
3685
3685
|
|
|
3686
3686
|
// static SERVICE_URL = 'http://localhost:45678/';
|
|
3687
3687
|
static SERVICE_URL = 'https://vps.maaap.it/';
|
|
@@ -3701,7 +3701,7 @@ class VisionRelocalization extends Provider {
|
|
|
3701
3701
|
* @override
|
|
3702
3702
|
*/
|
|
3703
3703
|
static get pname() {
|
|
3704
|
-
return '
|
|
3704
|
+
return 'Vps';
|
|
3705
3705
|
}
|
|
3706
3706
|
|
|
3707
3707
|
/**
|
|
@@ -3790,14 +3790,14 @@ class VisionRelocalization extends Provider {
|
|
|
3790
3790
|
while (this.state !== ProviderState.STOPPPED) {
|
|
3791
3791
|
|
|
3792
3792
|
const diffTime = preciseTime() - lastTimestamp;
|
|
3793
|
-
const timeToWait = Math.max(0,
|
|
3793
|
+
const timeToWait = Math.max(0, Vps.MIN_TIME_BETWEEN_TWO_REQUESTS - diffTime);
|
|
3794
3794
|
await new Promise(resolve => setTimeout(resolve, timeToWait));
|
|
3795
3795
|
|
|
3796
3796
|
if (this.state === ProviderState.STOPPPED) {
|
|
3797
3797
|
break;
|
|
3798
3798
|
}
|
|
3799
3799
|
|
|
3800
|
-
const url =
|
|
3800
|
+
const url = Vps.SERVICE_URL + Vps.MAP_ID;
|
|
3801
3801
|
|
|
3802
3802
|
// 1. Prepare the request
|
|
3803
3803
|
if (!this._camera || this._camera.state !== Camera.State.STARTED) {
|
|
@@ -3893,7 +3893,7 @@ class VisionRelocalization extends Provider {
|
|
|
3893
3893
|
return [];
|
|
3894
3894
|
}
|
|
3895
3895
|
|
|
3896
|
-
const { attitude, userPosition } =
|
|
3896
|
+
const { attitude, userPosition } = Vps._parseJsonResponse(json, requestTime);
|
|
3897
3897
|
|
|
3898
3898
|
const events = [
|
|
3899
3899
|
this.createEvent(EventType.AbsoluteAttitude, attitude),
|
|
@@ -3940,7 +3940,7 @@ class VisionRelocalization extends Provider {
|
|
|
3940
3940
|
}
|
|
3941
3941
|
}
|
|
3942
3942
|
|
|
3943
|
-
var
|
|
3943
|
+
var Vps$1 = new Vps();
|
|
3944
3944
|
|
|
3945
3945
|
class AbsolutePosition extends Provider {
|
|
3946
3946
|
|
|
@@ -4001,11 +4001,12 @@ class AbsolutePosition extends Provider {
|
|
|
4001
4001
|
|
|
4002
4002
|
if (ProvidersOptions.hasVps) {
|
|
4003
4003
|
|
|
4004
|
-
|
|
4004
|
+
this._vpsProviderId = Vps$1.addEventListener(events => {
|
|
4005
4005
|
for (const providerEvent of events) {
|
|
4006
4006
|
if (providerEvent.dataType === EventType.AbsolutePosition) {
|
|
4007
4007
|
this._onAbsolutePosition(providerEvent);
|
|
4008
|
-
|
|
4008
|
+
Vps$1.removeEventListener(this._vpsProviderId);
|
|
4009
|
+
this._vpsProviderId = null;
|
|
4009
4010
|
return;
|
|
4010
4011
|
}
|
|
4011
4012
|
}
|
|
@@ -4033,8 +4034,16 @@ class AbsolutePosition extends Provider {
|
|
|
4033
4034
|
stop() {
|
|
4034
4035
|
if (this._relativePositionProviderId) {
|
|
4035
4036
|
GeoRelativePositionProvider.removeEventListener(this._relativePositionProviderId);
|
|
4037
|
+
this._relativePositionProviderId = null;
|
|
4038
|
+
}
|
|
4039
|
+
if (this._gnssWifiProviderId) {
|
|
4040
|
+
GnssWifi$1.removeEventListener(this._gnssWifiProviderId);
|
|
4041
|
+
this._gnssWifiProviderId = null;
|
|
4042
|
+
}
|
|
4043
|
+
if (this._vpsProviderId) {
|
|
4044
|
+
Vps$1.removeEventListener(this._vpsProviderId);
|
|
4045
|
+
this._vpsProviderId = null;
|
|
4036
4046
|
}
|
|
4037
|
-
GnssWifi$1.removeEventListener(this._gnssWifiProviderId);
|
|
4038
4047
|
|
|
4039
4048
|
MapMatchingHandler$1.removeEventListener(this._mapMatchingHandlerId);
|
|
4040
4049
|
}
|
|
@@ -5292,7 +5301,7 @@ var Providers = /*#__PURE__*/Object.freeze({
|
|
|
5292
5301
|
GnssWifi: GnssWifi$1,
|
|
5293
5302
|
Ip: Ip$1,
|
|
5294
5303
|
AbsolutePosition: AbsolutePosition$1,
|
|
5295
|
-
|
|
5304
|
+
Vps: Vps$1,
|
|
5296
5305
|
Barcode: Barcode$1,
|
|
5297
5306
|
CameraNative: CameraNative$1,
|
|
5298
5307
|
CameraProjectionMatrix: CameraProjectionMatrix$1
|