@wemap/providers 12.10.8 → 12.10.9

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 (146) hide show
  1. package/dist/helpers/CustomMapProvider.d.ts +10 -0
  2. package/{index.ts → dist/index.d.ts} +0 -14
  3. package/dist/index.js +1 -3446
  4. package/dist/index.js.map +1 -1
  5. package/{src/ProvidersOptions.ts → dist/src/ProvidersOptions.d.ts} +7 -16
  6. package/dist/src/errors/AskImuOnDesktopError.d.ts +5 -0
  7. package/dist/src/errors/ContainsIgnoredProviderError.d.ts +5 -0
  8. package/dist/src/errors/GeolocationApiMissingError.d.ts +5 -0
  9. package/dist/src/errors/GeolocationPermissionDeniedError.d.ts +5 -0
  10. package/dist/src/errors/GeolocationPositionUnavailableError.d.ts +5 -0
  11. package/dist/src/errors/IpResolveServerError.d.ts +5 -0
  12. package/dist/src/errors/MissingAccelerometerError.d.ts +6 -0
  13. package/dist/src/errors/MissingArCoreError.d.ts +5 -0
  14. package/dist/src/errors/MissingGyroscopeError.d.ts +6 -0
  15. package/dist/src/errors/MissingMagnetometerError.d.ts +5 -0
  16. package/dist/src/errors/MissingNativeInterfaceError.d.ts +5 -0
  17. package/dist/src/errors/MissingPoleStarError.d.ts +5 -0
  18. package/dist/src/errors/MissingSensorError.d.ts +6 -0
  19. package/dist/src/errors/NoProviderFoundError.d.ts +5 -0
  20. package/dist/src/events/AvailabilityHelper.d.ts +5 -0
  21. package/dist/src/events/ProvidersLoggerOld.d.ts +24 -0
  22. package/dist/src/events/Types.d.ts +34 -0
  23. package/dist/src/mapmatching/MapMatchingHandler.d.ts +93 -0
  24. package/dist/src/providers/Constants.d.ts +4 -0
  25. package/{src/providers/NativeProviders.ts → dist/src/providers/NativeProviders.d.ts} +2 -23
  26. package/dist/src/providers/Provider.d.ts +64 -0
  27. package/dist/src/providers/attitude/EkfAttitude.d.ts +41 -0
  28. package/dist/src/providers/attitude/TurnProvider.d.ts +17 -0
  29. package/dist/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider.d.ts +60 -0
  30. package/dist/src/providers/attitude/absolute/AbsoluteAttitudeProvider.d.ts +44 -0
  31. package/dist/src/providers/attitude/relative/RelativeAttitudeFromBrowserProvider.d.ts +31 -0
  32. package/dist/src/providers/attitude/relative/RelativeAttitudeFromEkfProvider.d.ts +26 -0
  33. package/dist/src/providers/attitude/relative/RelativeAttitudeFromInertialProvider.d.ts +18 -0
  34. package/dist/src/providers/attitude/relative/RelativeAttitudeProvider.d.ts +25 -0
  35. package/dist/src/providers/imu/AccelerometerProvider.d.ts +11 -0
  36. package/dist/src/providers/imu/GyroscopeProvider.d.ts +11 -0
  37. package/dist/src/providers/imu/HighRotationsProvider.d.ts +15 -0
  38. package/dist/src/providers/imu/ImuProvider.d.ts +34 -0
  39. package/dist/src/providers/imu/MagnetometerCalibrationProvider.d.ts +11 -0
  40. package/dist/src/providers/inclination/InclinationFromAccProvider.d.ts +18 -0
  41. package/dist/src/providers/inclination/InclinationFromRelativeAttitudeProvider.d.ts +19 -0
  42. package/dist/src/providers/inclination/InclinationProvider.d.ts +18 -0
  43. package/dist/src/providers/legacy/helpers/HeadingUnlocker.d.ts +12 -0
  44. package/dist/src/providers/legacy/helpers/ThugDetector.d.ts +8 -0
  45. package/dist/src/providers/others/CameraNativeProvider.d.ts +11 -0
  46. package/dist/src/providers/others/CameraProjectionMatrixProvider.d.ts +11 -0
  47. package/dist/src/providers/position/absolute/AbsolutePositionProvider.d.ts +35 -0
  48. package/dist/src/providers/position/absolute/GnssWifiProvider.d.ts +28 -0
  49. package/dist/src/providers/position/absolute/IpProvider.d.ts +16 -0
  50. package/dist/src/providers/position/absolute/PoleStarProvider.d.ts +14 -0
  51. package/dist/src/providers/position/relative/GeoRelativePositionFromArCoreProvider.d.ts +17 -0
  52. package/dist/src/providers/position/relative/GeoRelativePositionProvider.d.ts +12 -0
  53. package/dist/src/providers/position/relative/PdrProvider.d.ts +15 -0
  54. package/dist/src/providers/steps/StepDetectionLadetto.d.ts +15 -0
  55. package/dist/src/providers/steps/StepDetectionMinMaxPeaks.d.ts +19 -0
  56. package/dist/src/providers/steps/StepDetectionMinMaxPeaks2.d.ts +27 -0
  57. package/dist/src/providers/steps/StepDetectionMinMaxPeaks3.d.ts +24 -0
  58. package/dist/src/providers/steps/StepProvider.d.ts +36 -0
  59. package/dist/src/providers/steps/StraightLineProvider.d.ts +21 -0
  60. package/dist/src/providers/vision/ArCoreProvider.d.ts +50 -0
  61. package/dist/src/providers/vision/BarcodeProvider.d.ts +11 -0
  62. package/dist/src/providers/vision/vps/ImageRelocalization.d.ts +11 -0
  63. package/dist/src/providers/vision/vps/RelativeRotationCalc.d.ts +10 -0
  64. package/dist/src/providers/vision/vps/VpsMetadata.d.ts +33 -0
  65. package/dist/src/providers/vision/vps/VpsProvider.d.ts +45 -0
  66. package/dist/src/providers/vision/vps/VpsRequest.d.ts +18 -0
  67. package/dist/src/providers/vision/vps/VpsResponse.d.ts +15 -0
  68. package/dist/src/smoothers/AttitudeSmoother.d.ts +23 -0
  69. package/dist/src/smoothers/PositionSmoother.d.ts +21 -0
  70. package/package.json +16 -12
  71. package/src/errors/AskImuOnDesktopError.ts +0 -10
  72. package/src/errors/ContainsIgnoredProviderError.ts +0 -10
  73. package/src/errors/GeolocationApiMissingError.ts +0 -10
  74. package/src/errors/GeolocationPermissionDeniedError.ts +0 -10
  75. package/src/errors/GeolocationPositionUnavailableError.ts +0 -10
  76. package/src/errors/IpResolveServerError.ts +0 -10
  77. package/src/errors/MissingAccelerometerError.ts +0 -11
  78. package/src/errors/MissingArCoreError.ts +0 -10
  79. package/src/errors/MissingGyroscopeError.ts +0 -11
  80. package/src/errors/MissingMagnetometerError.ts +0 -9
  81. package/src/errors/MissingNativeInterfaceError.ts +0 -11
  82. package/src/errors/MissingPoleStarError.ts +0 -10
  83. package/src/errors/MissingSensorError.ts +0 -15
  84. package/src/errors/NoProviderFoundError.ts +0 -10
  85. package/src/events/AvailabilityHelper.spec.ts +0 -30
  86. package/src/events/AvailabilityHelper.ts +0 -28
  87. package/src/events/ProvidersLoggerOld.ts +0 -87
  88. package/src/events/Types.ts +0 -18
  89. package/src/mapmatching/MapMatchingHandler.spec.ts +0 -142
  90. package/src/mapmatching/MapMatchingHandler.ts +0 -540
  91. package/src/providers/Constants.ts +0 -5
  92. package/src/providers/FakeProvider.spec.ts +0 -49
  93. package/src/providers/Provider.spec.ts +0 -113
  94. package/src/providers/Provider.ts +0 -244
  95. package/src/providers/attitude/EkfAttitude.spec.ts +0 -115
  96. package/src/providers/attitude/EkfAttitude.ts +0 -233
  97. package/src/providers/attitude/TurnProvider.ts +0 -58
  98. package/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider.ts +0 -267
  99. package/src/providers/attitude/absolute/AbsoluteAttitudeProvider.ts +0 -268
  100. package/src/providers/attitude/relative/RelativeAttitudeFromBrowserProvider.ts +0 -84
  101. package/src/providers/attitude/relative/RelativeAttitudeFromEkfProvider.ts +0 -89
  102. package/src/providers/attitude/relative/RelativeAttitudeFromInertialProvider.ts +0 -66
  103. package/src/providers/attitude/relative/RelativeAttitudeProvider.ts +0 -70
  104. package/src/providers/imu/AccelerometerProvider.ts +0 -28
  105. package/src/providers/imu/GyroscopeProvider.ts +0 -27
  106. package/src/providers/imu/HighRotationsProvider.ts +0 -49
  107. package/src/providers/imu/ImuProvider.ts +0 -110
  108. package/src/providers/imu/MagnetometerCalibrationProvider.ts +0 -21
  109. package/src/providers/inclination/InclinationFromAccProvider.ts +0 -57
  110. package/src/providers/inclination/InclinationFromRelativeAttitudeProvider.ts +0 -51
  111. package/src/providers/inclination/InclinationProvider.ts +0 -59
  112. package/src/providers/legacy/helpers/HeadingUnlocker.spec.ts +0 -53
  113. package/src/providers/legacy/helpers/HeadingUnlocker.ts +0 -44
  114. package/src/providers/legacy/helpers/ThugDetector.ts +0 -30
  115. package/src/providers/others/CameraNativeProvider.ts +0 -29
  116. package/src/providers/others/CameraProjectionMatrixProvider.ts +0 -25
  117. package/src/providers/position/absolute/AbsolutePositionProvider.spec.ts +0 -31
  118. package/src/providers/position/absolute/AbsolutePositionProvider.ts +0 -277
  119. package/src/providers/position/absolute/GnssWifiProvider.ts +0 -126
  120. package/src/providers/position/absolute/GnssWifiProviders.spec.ts +0 -90
  121. package/src/providers/position/absolute/IpProvider.ts +0 -47
  122. package/src/providers/position/absolute/PoleStarProvider.ts +0 -88
  123. package/src/providers/position/relative/GeoRelativePositionFromArCoreProvider.ts +0 -82
  124. package/src/providers/position/relative/GeoRelativePositionProvider.ts +0 -35
  125. package/src/providers/position/relative/PdrProvider.ts +0 -107
  126. package/src/providers/steps/StepDetectionLadetto.ts +0 -67
  127. package/src/providers/steps/StepDetectionMinMaxPeaks.ts +0 -70
  128. package/src/providers/steps/StepDetectionMinMaxPeaks2.ts +0 -99
  129. package/src/providers/steps/StepDetectionMinMaxPeaks3.ts +0 -192
  130. package/src/providers/steps/StepProvider.ts +0 -151
  131. package/src/providers/steps/StraightLineProvider.ts +0 -69
  132. package/src/providers/vision/ArCoreProvider.ts +0 -184
  133. package/src/providers/vision/BarcodeProvider.ts +0 -28
  134. package/src/providers/vision/vps/ImageRelocalization.ts +0 -98
  135. package/src/providers/vision/vps/RelativeRotationCalc.ts +0 -58
  136. package/src/providers/vision/vps/VpsMetadata.ts +0 -63
  137. package/src/providers/vision/vps/VpsProvider.ts +0 -251
  138. package/src/providers/vision/vps/VpsRequest.ts +0 -29
  139. package/src/providers/vision/vps/VpsResponse.ts +0 -43
  140. package/src/providers/vision/vps/VpsSchema.json +0 -90
  141. package/src/smoothers/AttitudeSmoother.ts +0 -110
  142. package/src/smoothers/PositionSmoother.spec.ts +0 -53
  143. package/src/smoothers/PositionSmoother.ts +0 -96
  144. package/tsconfig.json +0 -3
  145. package/vite.config.ts +0 -4
  146. /package/{src/providers/ProviderState.ts → dist/src/providers/ProviderState.d.ts} +0 -0
@@ -0,0 +1,33 @@
1
+ import { Calibration } from '@wemap/camera';
2
+ import { Attitude, AttitudeJson, UserPosition, UserPositionJson } from '@wemap/geo';
3
+ import { Device } from '@wemap/utils';
4
+ export type CoarsePoseJson = {
5
+ attitude?: AttitudeJson;
6
+ position?: UserPositionJson;
7
+ };
8
+ export type CoarsePose = {
9
+ attitude?: Attitude;
10
+ position?: UserPosition;
11
+ };
12
+ export type VpsMetadataJson = {
13
+ size: [number, number];
14
+ calibration?: Calibration;
15
+ coarse?: CoarsePoseJson;
16
+ device?: Device;
17
+ };
18
+ declare class VpsMetadata {
19
+ size: {
20
+ width: number;
21
+ height: number;
22
+ };
23
+ calibration: Calibration | null;
24
+ coarse: CoarsePose | null;
25
+ device: Device | null;
26
+ constructor(size: {
27
+ width: number;
28
+ height: number;
29
+ }, calibration?: Calibration | null, coarse?: CoarsePose | null, device?: Device | null);
30
+ toJson(): VpsMetadataJson;
31
+ static fromJson(json: VpsMetadataJson): VpsMetadata;
32
+ }
33
+ export default VpsMetadata;
@@ -0,0 +1,45 @@
1
+ import { Camera } from '@wemap/camera';
2
+ import { default as Provider } from '../../Provider.js';
3
+ import { default as RelativeRotationCalc } from './RelativeRotationCalc.js';
4
+ import { AbsoluteAttitude, AbsolutePosition } from '../../../events/Types.js';
5
+ export type VpsEvent = {
6
+ absoluteAttitude: AbsoluteAttitude;
7
+ absolutePosition: AbsolutePosition;
8
+ };
9
+ declare class VpsProvider extends Provider<VpsEvent> {
10
+ static MIN_TIME_BETWEEN_TWO_REQUESTS: number;
11
+ static DEFAULT_MIN_INCLINATION_FOR_REQUEST: number;
12
+ static DEFAULT_WAIT_TIME_MIN_INCLINATION_FOR_REQUEST: number;
13
+ static DEFAULT_USE_COARSE_POSE: boolean;
14
+ static CAMERA_TO_SMARTPHONE_ROT: import('@wemap/maths').Quaternion_t;
15
+ _relativeRotationCalc?: RelativeRotationCalc;
16
+ _serverError: boolean;
17
+ _cameraError: boolean;
18
+ _camera: Camera | null;
19
+ _endpoint: string | null;
20
+ _inclinationProviderId?: number;
21
+ _minInclinationForRequest: number;
22
+ _waitTimeMinInclinationForRequest: number;
23
+ _useCoarsePose: boolean;
24
+ getName: () => string;
25
+ availability: () => Promise<void>;
26
+ start(): void;
27
+ stop(): void;
28
+ _onCameraDetected: ({ camera }: {
29
+ camera: Camera;
30
+ }) => void;
31
+ _onCameraRemoved: () => void;
32
+ _useCamera(camera: Camera): void;
33
+ _internalStart: () => Promise<void>;
34
+ _internalStop: () => void;
35
+ get endpoint(): string | null;
36
+ set endpoint(endpoint: string | null);
37
+ get minInclinationForRequest(): number;
38
+ set minInclinationForRequest(minInclinationForRequest: number);
39
+ get waitTimeMinInclinationForRequest(): number;
40
+ set waitTimeMinInclinationForRequest(waitTimeMinInclinationForRequest: number);
41
+ get useCoarsePose(): boolean;
42
+ set useCoarsePose(useCoarsePose: boolean);
43
+ }
44
+ declare const _default: VpsProvider;
45
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { default as VpsMetadata, VpsMetadataJson } from './VpsMetadata.js';
2
+ export type VpsRequestJson = VpsMetadataJson & {
3
+ image: string;
4
+ };
5
+ declare class VpsRequest {
6
+ metadata: VpsMetadata;
7
+ image: HTMLCanvasElement;
8
+ constructor(metadata: VpsMetadata, image: HTMLCanvasElement);
9
+ toJson(): {
10
+ size: [number, number];
11
+ calibration?: import('@wemap/camera').Calibration | undefined;
12
+ coarse?: import('./VpsMetadata.js').CoarsePoseJson | undefined;
13
+ device?: import('@wemap/utils').Device | undefined;
14
+ image: string;
15
+ };
16
+ static fromJson(json: VpsRequestJson): VpsRequest;
17
+ }
18
+ export default VpsRequest;
@@ -0,0 +1,15 @@
1
+ import { Attitude, AttitudeJson, UserPosition, UserPositionJson } from '@wemap/geo';
2
+ export type VpsResponseJson = {
3
+ success: boolean;
4
+ attitude?: AttitudeJson;
5
+ position?: UserPositionJson;
6
+ };
7
+ declare class VpsResponse {
8
+ success: boolean;
9
+ attitude: Attitude | null;
10
+ position: UserPosition | null;
11
+ constructor(success: boolean, attitude?: Attitude | null, position?: UserPosition | null);
12
+ toJson(): VpsResponseJson;
13
+ static fromJson(json: VpsResponseJson, imageRecordTime?: number | null): VpsResponse;
14
+ }
15
+ export default VpsResponse;
@@ -0,0 +1,23 @@
1
+ import { Attitude } from '@wemap/geo';
2
+ declare class AttitudeSmoother {
3
+ callback: (attitude: Attitude) => void;
4
+ static ROTATION_SPEED_JUMP_THRESHOLD: number;
5
+ static ROTATION_SPEED_CONVERGENCE: number;
6
+ static HIGH_JUMP_THRESHOLD: number;
7
+ static ROTATION_SPEED_HIGH_JUMP_CONVERGENCE: number;
8
+ static PITCH_UNCERTAINITY_HEADING_THRESHOLD: number;
9
+ _previousAttitude?: Attitude;
10
+ _smoothing: null | {
11
+ interpAttitude(attitude: Attitude): Attitude;
12
+ toTime: number;
13
+ };
14
+ constructor(callback: (attitude: Attitude) => void);
15
+ feed(newAttitude: Attitude): void;
16
+ /**
17
+ * @param {Attitude} previousAttitude
18
+ * @param {Attitude} newAttitude
19
+ * @returns {boolean}
20
+ */
21
+ static isJump(previousAttitude: Attitude, newAttitude: Attitude): boolean;
22
+ }
23
+ export default AttitudeSmoother;
@@ -0,0 +1,21 @@
1
+ import { UserPosition } from '@wemap/geo';
2
+ declare class PositionSmoother {
3
+ callback?: ((position: UserPosition) => void) | undefined;
4
+ frequency: number;
5
+ static DEFAULT_FREQUENCY: number;
6
+ static DEFAULT_FLYBY_TIME: number;
7
+ positionsQueue: UserPosition[];
8
+ previousPosition: UserPosition | null;
9
+ timeoutNotify?: any;
10
+ /**
11
+ * @param frequency in Hz
12
+ */
13
+ constructor(callback?: ((position: UserPosition) => void) | undefined, frequency?: number);
14
+ /**
15
+ * @param flybyTime in seconds
16
+ */
17
+ feed(newPosition: UserPosition, flybyTime?: number): void;
18
+ _notifyNext: () => void;
19
+ clear(): void;
20
+ }
21
+ export default PositionSmoother;
package/package.json CHANGED
@@ -6,13 +6,13 @@
6
6
  ],
7
7
  "description": "A package using different geoloc systems",
8
8
  "main": "dist/index.js",
9
- "types": "index.ts",
9
+ "types": "./dist/index.d.ts",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/wemap/wemap-modules-js.git"
13
13
  },
14
14
  "name": "@wemap/providers",
15
- "version": "12.10.8",
15
+ "version": "12.10.9",
16
16
  "bugs": {
17
17
  "url": "https://github.com/wemap/wemap-modules-js/issues"
18
18
  },
@@ -22,14 +22,14 @@
22
22
  "build": "vite build"
23
23
  },
24
24
  "dependencies": {
25
- "@wemap/camera": "^12.10.6",
26
- "@wemap/geo": "^12.10.4",
27
- "@wemap/logger": "^12.10.0",
28
- "@wemap/map": "^12.10.4",
29
- "@wemap/maths": "^12.10.0",
30
- "@wemap/osm": "^12.10.4",
31
- "@wemap/routers": "^12.10.8",
32
- "@wemap/utils": "^12.10.0",
25
+ "@wemap/camera": "^12.10.9",
26
+ "@wemap/geo": "^12.10.9",
27
+ "@wemap/logger": "^12.10.9",
28
+ "@wemap/map": "^12.10.9",
29
+ "@wemap/maths": "^12.10.9",
30
+ "@wemap/osm": "^12.10.9",
31
+ "@wemap/routers": "^12.10.9",
32
+ "@wemap/utils": "^12.10.9",
33
33
  "geomag": "^1.0.0"
34
34
  },
35
35
  "devDependencies": {
@@ -48,13 +48,17 @@
48
48
  ],
49
49
  "license": "ISC",
50
50
  "type": "module",
51
+ "files": [
52
+ "dist",
53
+ "helpers"
54
+ ],
51
55
  "exports": {
52
56
  ".": {
53
- "types": "./index.ts",
57
+ "types": "./dist/index.d.ts",
54
58
  "import": "./dist/index.mjs",
55
59
  "require": "./dist/index.js"
56
60
  },
57
61
  "./helpers/*": "./helpers/*"
58
62
  },
59
- "gitHead": "f9403da66a9608b96175565a9090fbf9dbb234a1"
63
+ "gitHead": "80eb531e0d704bc01cc93469b62cf0d6a83dcfd1"
60
64
  }
@@ -1,10 +0,0 @@
1
- class AskImuOnDesktopError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'It seems that you ask for IMU events on a desktop browser';
4
-
5
- constructor(message?: string) {
6
- super(message || AskImuOnDesktopError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default AskImuOnDesktopError;
@@ -1,10 +0,0 @@
1
- class ContainsIgnoredProviderError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'Contains ignored provider';
4
-
5
- constructor(message?: string) {
6
- super(message || ContainsIgnoredProviderError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default ContainsIgnoredProviderError;
@@ -1,10 +0,0 @@
1
- class GeolocationApiMissingError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'Geolocation api is missing';
4
-
5
- constructor(message?: string) {
6
- super(message || GeolocationApiMissingError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default GeolocationApiMissingError;
@@ -1,10 +0,0 @@
1
- class GeolocationPermissionDeniedError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'Geolocation permission denied';
4
-
5
- constructor(message?: string) {
6
- super(message || GeolocationPermissionDeniedError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default GeolocationPermissionDeniedError;
@@ -1,10 +0,0 @@
1
- class GeolocationPositionUnavailableError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'Geolocation position unavailable';
4
-
5
- constructor(message?: string) {
6
- super(message || GeolocationPositionUnavailableError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default GeolocationPositionUnavailableError;
@@ -1,10 +0,0 @@
1
- class IpResolveServerError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'IP Resolver failed';
4
-
5
- constructor(message?: string) {
6
- super(message || IpResolveServerError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default IpResolveServerError;
@@ -1,11 +0,0 @@
1
- import MissingSensorError from './MissingSensorError.js';
2
- class MissingAccelerometerError extends MissingSensorError {
3
-
4
- static DEFAULT_MESSAGE = 'Impossible to retrieve Acceleration data';
5
-
6
- constructor(message?: string) {
7
- super(message || MissingAccelerometerError.DEFAULT_MESSAGE);
8
- }
9
- }
10
-
11
- export default MissingAccelerometerError;
@@ -1,10 +0,0 @@
1
- class MissingArCoreError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'ARCore is missing';
4
-
5
- constructor(message?: string) {
6
- super(message || MissingArCoreError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default MissingArCoreError;
@@ -1,11 +0,0 @@
1
- import MissingSensorError from './MissingSensorError.js';
2
- class MissingGyroscopeError extends MissingSensorError {
3
-
4
- static DEFAULT_MESSAGE = 'Impossible to retrieve Angular Rate data';
5
-
6
- constructor(message?: string) {
7
- super(message || MissingSensorError.DEFAULT_MESSAGE);
8
- }
9
- }
10
-
11
- export default MissingGyroscopeError;
@@ -1,9 +0,0 @@
1
- import MissingSensorError from './MissingSensorError.js';
2
-
3
- class MissingMagnetometerError extends MissingSensorError {
4
- constructor(message?: string) {
5
- super(message);
6
- }
7
- }
8
-
9
- export default MissingMagnetometerError;
@@ -1,11 +0,0 @@
1
- class MissingNativeInterfaceError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'Native interface is missing. You are maybe trying to '
4
- + 'execute a code which is not available in a web browser';
5
-
6
- constructor(message?: string) {
7
- super(message || MissingNativeInterfaceError.DEFAULT_MESSAGE);
8
- }
9
- }
10
-
11
- export default MissingNativeInterfaceError;
@@ -1,10 +0,0 @@
1
- class MissingPoleStarError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'PoleStar is missing';
4
-
5
- constructor(message?: string) {
6
- super(message || MissingPoleStarError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default MissingPoleStarError;
@@ -1,15 +0,0 @@
1
- class MissingSensorError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'Impossible to retrieve events, a sensor is missing';
4
-
5
- constructor(message?: string) {
6
- super(message || MissingSensorError.DEFAULT_MESSAGE);
7
- }
8
-
9
- from(fromMessage: string) {
10
- this.message += ' from ' + fromMessage;
11
- return this;
12
- }
13
- }
14
-
15
- export default MissingSensorError;
@@ -1,10 +0,0 @@
1
- class NoProviderFoundError extends Error {
2
-
3
- static DEFAULT_MESSAGE = 'Unable to find a provider with your given parameters';
4
-
5
- constructor(message?: string) {
6
- super(message || NoProviderFoundError.DEFAULT_MESSAGE);
7
- }
8
- }
9
-
10
- export default NoProviderFoundError;
@@ -1,30 +0,0 @@
1
- import chai from 'chai';
2
- import chaiAsPromised from 'chai-as-promised';
3
-
4
- import AvailabilityHelper from './AvailabilityHelper.js';
5
-
6
- chai.use(chaiAsPromised);
7
- const { expect } = chai;
8
-
9
- const availabilityOk = Promise.resolve();
10
- const availabilityFail1 = Promise.resolve(new Error('Reason 1.'));
11
- const availabilityFail2 = Promise.resolve(new Error('Reason 2.'));
12
-
13
- describe('AvailabilityHelper', () => {
14
-
15
- it('every', async () => {
16
- expect(await AvailabilityHelper.every([availabilityOk, availabilityOk])).is.equal(null);
17
- expect((await AvailabilityHelper.every([availabilityOk, availabilityFail1]))!.message).is.equal('Reason 1.');
18
- expect((await AvailabilityHelper.every([availabilityFail1, availabilityOk]))!.message).is.equal('Reason 1.');
19
- expect((await AvailabilityHelper.every([availabilityFail1, availabilityFail2]))!.message).is.equal('Reason 1.');
20
- expect((await AvailabilityHelper.every([availabilityFail2, availabilityFail1]))!.message).is.equal('Reason 2.');
21
- });
22
-
23
- it('some', async () => {
24
- expect(await AvailabilityHelper.some([availabilityOk, availabilityOk])).is.equal(null);
25
- expect(await AvailabilityHelper.some([availabilityOk, availabilityFail1])).is.equal(null);
26
- expect(await AvailabilityHelper.some([availabilityFail1, availabilityOk])).is.equal(null);
27
- expect((await AvailabilityHelper.some([availabilityFail1, availabilityFail2]))!.message).is.equal('Reason 1.');
28
- expect((await AvailabilityHelper.some([availabilityFail2, availabilityFail1]))!.message).is.equal('Reason 2.');
29
- });
30
- });
@@ -1,28 +0,0 @@
1
- export type AvailabilityPromise = Promise<Error | null | void>;
2
-
3
- export default class AvailabilityHelper {
4
-
5
- static async every(availabilityPromises: AvailabilityPromise[]): AvailabilityPromise {
6
- for (const aPr of availabilityPromises) {
7
- const error = await aPr;
8
- if (error) {
9
- return error;
10
- }
11
- }
12
- return null;
13
- }
14
-
15
- static async some(availabilityPromises: AvailabilityPromise[]): AvailabilityPromise {
16
- let firstError;
17
- for (const aPr of availabilityPromises) {
18
- const error = await aPr;
19
- if (!error) {
20
- return null;
21
- } else if (!firstError) {
22
- firstError = error;
23
- }
24
- }
25
- return firstError || null;
26
- }
27
-
28
- }
@@ -1,87 +0,0 @@
1
- import Logger from '@wemap/logger';
2
-
3
- interface MyObject { getName(): string }
4
-
5
- class ProvidersLoggerOld {
6
-
7
- _enabled = false;
8
-
9
- currentId = 0;
10
- objectsIdMap = new WeakMap<MyObject, number>();
11
-
12
- pushEvents: { [key: number]: number } = {};
13
- pushEventsRef: { [key: number]: MyObject } = {};
14
-
15
- interval?: number;
16
- initDate?: number;
17
-
18
-
19
- get enabled() {
20
- return this._enabled;
21
- }
22
-
23
- set enabled(_newVal) {
24
- this._enabled = _newVal;
25
- }
26
-
27
- initializeInterval() {
28
-
29
- if (this.interval) {
30
- return;
31
- }
32
-
33
- this.interval = window.setInterval(() => {
34
-
35
- for (const [key, value] of Object.entries(this.pushEvents)) {
36
- Logger.debug('Received ' + value + ' notifications from '
37
- + this.pushEventsRef[Number(key)].getName() + ' last second');
38
- }
39
-
40
- this.pushEvents = {};
41
- this.pushEventsRef = {};
42
- }, 1000);
43
- }
44
-
45
- getObjectId(object: MyObject) {
46
- if (!this.objectsIdMap.has(object)) {
47
- this.objectsIdMap.set(object, ++this.currentId);
48
- }
49
- return this.objectsIdMap.get(object) as number;
50
- }
51
-
52
- addEvent(object: MyObject, method: string) {
53
-
54
- if (!this.enabled) {
55
- return;
56
- }
57
-
58
- if (!this.initDate) {
59
- this.initDate = Date.now();
60
- }
61
-
62
- this.initializeInterval();
63
-
64
- const objectId = this.getObjectId(object);
65
- const objectClassName = object.getName();
66
-
67
- Logger.debug(objectClassName + '[' + objectId + '].' + method);
68
- }
69
-
70
- incrementNotifications(object: MyObject) {
71
-
72
- if (!this.enabled) {
73
- return;
74
- }
75
-
76
- const objectId = this.getObjectId(object);
77
-
78
- let counter = this.pushEvents[objectId];
79
- if (!counter) {
80
- counter = 0;
81
- this.pushEventsRef[objectId] = object;
82
- }
83
- this.pushEvents[objectId] = counter + 1;
84
- }
85
-
86
- }
87
- export default new ProvidersLoggerOld();
@@ -1,18 +0,0 @@
1
- import { Attitude, UserPosition } from "@wemap/geo";
2
- import { Vector16_t, Vector3_t } from "@wemap/maths";
3
-
4
- export type Acceleration = Readonly<{ readonly timestamp: number; readonly values: Vector3_t; }>
5
- export type AngularRate = Readonly<{ readonly timestamp: number; readonly values: Vector3_t; }>
6
- export type HighRotation = Readonly<{ readonly timestamp: number; }>
7
- export type MagnetometerNeedCalibration = Readonly<{ readonly angle: number; }>
8
- export class RelativeAttitude extends Attitude { }
9
- export class AbsoluteAttitude extends Attitude { }
10
- export class AbsolutePosition extends UserPosition { }
11
- export type Inclination = number;
12
- export type Barcode = string;
13
- export type Step = { readonly size: number; readonly number: number; }
14
- export type Turn = { readonly timestamp: number; }
15
- export type StraightLine = boolean;
16
- export type CameraProjectionMatrix = Vector16_t;
17
- export type CameraNativeState = 'started' | 'stopped';
18
-