@mxtommy/kip 1.3.0 → 2.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.
- package/CHANGELOG.md +38 -3
- package/CONTRIBUTORS.md +4 -4
- package/KipGaugeSample3-1024x508.png +0 -0
- package/LICENSE +21 -0
- package/README.md +80 -42
- package/package.json +52 -46
- package/public/3rdpartylicenses.txt +61 -412
- package/public/assets/NoSleep.min.js +2 -2
- package/public/assets/icon-64x64.png +0 -0
- package/public/index.html +3 -3
- package/public/main.9dba30de44eed02b.js +1 -0
- package/public/manifest.json +9 -4
- package/public/polyfills.d1da7d2e907c253a.js +1 -0
- package/public/runtime.e75056c32c37f59d.js +1 -0
- package/public/styles.6b1c2c92be18a2cc.css +1 -0
- package/.angulardoc.json +0 -4
- package/angular.json +0 -162
- package/e2e/app.e2e-spec.ts +0 -14
- package/e2e/app.po.ts +0 -11
- package/e2e/tsconfig.e2e.json +0 -14
- package/karma.conf.js +0 -31
- package/public/main-es2018.98175eb4c61ccaf7eb17.js +0 -1
- package/public/main-es5.98175eb4c61ccaf7eb17.js +0 -1
- package/public/polyfills-es2018.3a61665863c173cd6ba3.js +0 -1
- package/public/polyfills-es5.44827ae4ff4e41de51fb.js +0 -1
- package/public/runtime-es2018.baedb88c6d2abacae2b8.js +0 -1
- package/public/runtime-es5.baedb88c6d2abacae2b8.js +0 -1
- package/public/styles.b92ae2c466c89712209d.css +0 -5
- package/src/app/alarm-menu/alarm-menu.component.html +0 -55
- package/src/app/alarm-menu/alarm-menu.component.scss +0 -52
- package/src/app/alarm-menu/alarm-menu.component.spec.ts +0 -25
- package/src/app/alarm-menu/alarm-menu.component.ts +0 -186
- package/src/app/app-help/app-help.component.css +0 -4
- package/src/app/app-help/app-help.component.html +0 -135
- package/src/app/app-help/app-help.component.ts +0 -45
- package/src/app/app-settings.service.spec.ts +0 -15
- package/src/app/app-settings.service.ts +0 -478
- package/src/app/app.component.css +0 -39
- package/src/app/app.component.html +0 -93
- package/src/app/app.component.scss +0 -79
- package/src/app/app.component.spec.ts +0 -32
- package/src/app/app.component.ts +0 -191
- package/src/app/app.module.ts +0 -200
- package/src/app/config.blank.const.ts +0 -52
- package/src/app/config.blank.notification.const.ts +0 -19
- package/src/app/config.blank.units.const.ts +0 -23
- package/src/app/config.demo.const.ts +0 -384
- package/src/app/data-browser/data-browser.component.css +0 -29
- package/src/app/data-browser/data-browser.component.html +0 -44
- package/src/app/data-browser/data-browser.component.spec.ts +0 -25
- package/src/app/data-browser/data-browser.component.ts +0 -91
- package/src/app/data-browser-row/data-browser-row-unit-modal.html +0 -17
- package/src/app/data-browser-row/data-browser-row.component.css +0 -10
- package/src/app/data-browser-row/data-browser-row.component.html +0 -5
- package/src/app/data-browser-row/data-browser-row.component.ts +0 -79
- package/src/app/data-set.service.spec.ts +0 -15
- package/src/app/data-set.service.ts +0 -273
- package/src/app/dynamic-widget.directive.spec.ts +0 -8
- package/src/app/dynamic-widget.directive.ts +0 -11
- package/src/app/filter-self.pipe.spec.ts +0 -8
- package/src/app/filter-self.pipe.ts +0 -14
- package/src/app/fit-text.directive.spec.ts +0 -8
- package/src/app/fit-text.directive.ts +0 -61
- package/src/app/gauge-steel/gauge-steel.component.css +0 -5
- package/src/app/gauge-steel/gauge-steel.component.html +0 -4
- package/src/app/gauge-steel/gauge-steel.component.spec.ts +0 -25
- package/src/app/gauge-steel/gauge-steel.component.ts +0 -282
- package/src/app/gauges-module/base-gauge.ts +0 -301
- package/src/app/gauges-module/gauges.module.ts +0 -17
- package/src/app/gauges-module/linear-gauge.ts +0 -50
- package/src/app/gauges-module/radial-gauge.ts +0 -48
- package/src/app/layout-split/layout-split.component.html +0 -30
- package/src/app/layout-split/layout-split.component.scss +0 -33
- package/src/app/layout-split/layout-split.component.spec.ts +0 -25
- package/src/app/layout-split/layout-split.component.ts +0 -59
- package/src/app/layout-splits.service.spec.ts +0 -15
- package/src/app/layout-splits.service.ts +0 -284
- package/src/app/modal-path-selector/modal-path-selector.component.html +0 -62
- package/src/app/modal-path-selector/modal-path-selector.component.scss +0 -39
- package/src/app/modal-path-selector/modal-path-selector.component.spec.ts +0 -25
- package/src/app/modal-path-selector/modal-path-selector.component.ts +0 -132
- package/src/app/modal-widget/modal-widget.component.css +0 -33
- package/src/app/modal-widget/modal-widget.component.html +0 -341
- package/src/app/modal-widget/modal-widget.component.spec.ts +0 -25
- package/src/app/modal-widget/modal-widget.component.ts +0 -84
- package/src/app/notifications.service.spec.ts +0 -12
- package/src/app/notifications.service.ts +0 -392
- package/src/app/object-keys.pipe.spec.ts +0 -8
- package/src/app/object-keys.pipe.ts +0 -13
- package/src/app/reset-config/reset-config.component.css +0 -0
- package/src/app/reset-config/reset-config.component.html +0 -3
- package/src/app/reset-config/reset-config.component.spec.ts +0 -25
- package/src/app/reset-config/reset-config.component.ts +0 -31
- package/src/app/root-display/root-display.component.css +0 -0
- package/src/app/root-display/root-display.component.html +0 -4
- package/src/app/root-display/root-display.component.spec.ts +0 -25
- package/src/app/root-display/root-display.component.ts +0 -57
- package/src/app/safe.pipe.ts +0 -16
- package/src/app/settings/settings.component.css +0 -9
- package/src/app/settings/settings.component.html +0 -25
- package/src/app/settings/settings.component.spec.ts +0 -25
- package/src/app/settings/settings.component.ts +0 -22
- package/src/app/settings-config/settings-config.component.css +0 -39
- package/src/app/settings-config/settings-config.component.html +0 -118
- package/src/app/settings-config/settings-config.component.spec.ts +0 -25
- package/src/app/settings-config/settings-config.component.ts +0 -161
- package/src/app/settings-datasets/settings-datasets.component.html +0 -43
- package/src/app/settings-datasets/settings-datasets.component.scss +0 -39
- package/src/app/settings-datasets/settings-datasets.component.spec.ts +0 -25
- package/src/app/settings-datasets/settings-datasets.component.ts +0 -98
- package/src/app/settings-datasets/settings-datasets.modal.html +0 -54
- package/src/app/settings-notifications/settings-notifications.component.css +0 -0
- package/src/app/settings-notifications/settings-notifications.component.html +0 -65
- package/src/app/settings-notifications/settings-notifications.component.spec.ts +0 -25
- package/src/app/settings-notifications/settings-notifications.component.ts +0 -29
- package/src/app/settings-signalk/settings-signalk.component.css +0 -3
- package/src/app/settings-signalk/settings-signalk.component.html +0 -89
- package/src/app/settings-signalk/settings-signalk.component.spec.ts +0 -25
- package/src/app/settings-signalk/settings-signalk.component.ts +0 -174
- package/src/app/settings-units/settings-units.component.css +0 -4
- package/src/app/settings-units/settings-units.component.html +0 -19
- package/src/app/settings-units/settings-units.component.spec.ts +0 -25
- package/src/app/settings-units/settings-units.component.ts +0 -62
- package/src/app/settings-zones/settings-zones.component.css +0 -22
- package/src/app/settings-zones/settings-zones.component.html +0 -70
- package/src/app/settings-zones/settings-zones.component.ts +0 -154
- package/src/app/settings-zones/settings-zones.modal.css +0 -14
- package/src/app/settings-zones/settings-zones.modal.html +0 -39
- package/src/app/signalk-connection.service.ts +0 -344
- package/src/app/signalk-delta.service.spec.ts +0 -15
- package/src/app/signalk-delta.service.ts +0 -97
- package/src/app/signalk-full.service.spec.ts +0 -15
- package/src/app/signalk-full.service.ts +0 -99
- package/src/app/signalk-interfaces.ts +0 -129
- package/src/app/signalk-requests.service.spec.ts +0 -12
- package/src/app/signalk-requests.service.ts +0 -180
- package/src/app/signalk.service.spec.ts +0 -15
- package/src/app/signalk.service.ts +0 -428
- package/src/app/svg-autopilot/svg-autopilot.component.html +0 -1036
- package/src/app/svg-autopilot/svg-autopilot.component.spec.ts +0 -25
- package/src/app/svg-autopilot/svg-autopilot.component.ts +0 -174
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.html +0 -119
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.scss +0 -0
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.spec.ts +0 -25
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.ts +0 -49
- package/src/app/svg-wind/svg-wind.component.css +0 -0
- package/src/app/svg-wind/svg-wind.component.html +0 -969
- package/src/app/svg-wind/svg-wind.component.scss +0 -76
- package/src/app/svg-wind/svg-wind.component.spec.ts +0 -25
- package/src/app/svg-wind/svg-wind.component.ts +0 -280
- package/src/app/unit-window/unit-window.component.css +0 -37
- package/src/app/unit-window/unit-window.component.html +0 -8
- package/src/app/unit-window/unit-window.component.spec.ts +0 -25
- package/src/app/unit-window/unit-window.component.ts +0 -134
- package/src/app/unit-window/unit-window.modal.html +0 -25
- package/src/app/units.service.ts +0 -300
- package/src/app/widget-autopilot/widget-autopilot.component.html +0 -78
- package/src/app/widget-autopilot/widget-autopilot.component.scss +0 -191
- package/src/app/widget-autopilot/widget-autopilot.component.spec.ts +0 -25
- package/src/app/widget-autopilot/widget-autopilot.component.ts +0 -774
- package/src/app/widget-blank/widget-blank.component.html +0 -5
- package/src/app/widget-blank/widget-blank.component.scss +0 -21
- package/src/app/widget-blank/widget-blank.component.spec.ts +0 -25
- package/src/app/widget-blank/widget-blank.component.ts +0 -17
- package/src/app/widget-gauge/widget-gauge.component.css +0 -26
- package/src/app/widget-gauge/widget-gauge.component.html +0 -29
- package/src/app/widget-gauge/widget-gauge.component.spec.ts +0 -25
- package/src/app/widget-gauge/widget-gauge.component.ts +0 -120
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.html +0 -126
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.scss +0 -94
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.spec.ts +0 -25
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.ts +0 -424
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.html +0 -122
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.scss +0 -69
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.spec.ts +0 -25
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.ts +0 -553
- package/src/app/widget-historical/widget-historical.component.css +0 -31
- package/src/app/widget-historical/widget-historical.component.html +0 -14
- package/src/app/widget-historical/widget-historical.component.scss +0 -0
- package/src/app/widget-historical/widget-historical.component.spec.ts +0 -25
- package/src/app/widget-historical/widget-historical.component.ts +0 -306
- package/src/app/widget-iframe/widget-iframe.component.css +0 -12
- package/src/app/widget-iframe/widget-iframe.component.html +0 -21
- package/src/app/widget-iframe/widget-iframe.component.spec.ts +0 -25
- package/src/app/widget-iframe/widget-iframe.component.ts +0 -63
- package/src/app/widget-list.service.spec.ts +0 -15
- package/src/app/widget-list.service.ts +0 -135
- package/src/app/widget-manager.service.spec.ts +0 -15
- package/src/app/widget-manager.service.ts +0 -141
- package/src/app/widget-numeric/widget-numeric.component.html +0 -13
- package/src/app/widget-numeric/widget-numeric.component.scss +0 -52
- package/src/app/widget-numeric/widget-numeric.component.spec.ts +0 -25
- package/src/app/widget-numeric/widget-numeric.component.ts +0 -457
- package/src/app/widget-simple-linear/widget-simple-linear.component.html +0 -28
- package/src/app/widget-simple-linear/widget-simple-linear.component.scss +0 -64
- package/src/app/widget-simple-linear/widget-simple-linear.component.spec.ts +0 -25
- package/src/app/widget-simple-linear/widget-simple-linear.component.ts +0 -199
- package/src/app/widget-state/widget-state.component.html +0 -27
- package/src/app/widget-state/widget-state.component.scss +0 -68
- package/src/app/widget-state/widget-state.component.spec.ts +0 -25
- package/src/app/widget-state/widget-state.component.ts +0 -178
- package/src/app/widget-switch/widget-switch.component.css +0 -70
- package/src/app/widget-switch/widget-switch.component.html +0 -17
- package/src/app/widget-switch/widget-switch.component.spec.ts +0 -25
- package/src/app/widget-switch/widget-switch.component.ts +0 -134
- package/src/app/widget-text-generic/widget-text-generic.component.css +0 -55
- package/src/app/widget-text-generic/widget-text-generic.component.html +0 -9
- package/src/app/widget-text-generic/widget-text-generic.component.spec.ts +0 -25
- package/src/app/widget-text-generic/widget-text-generic.component.ts +0 -253
- package/src/app/widget-tutorial/widget-tutorial.component.css +0 -0
- package/src/app/widget-tutorial/widget-tutorial.component.html +0 -34
- package/src/app/widget-tutorial/widget-tutorial.component.spec.ts +0 -25
- package/src/app/widget-tutorial/widget-tutorial.component.ts +0 -18
- package/src/app/widget-unknown/widget-unknown.component.css +0 -0
- package/src/app/widget-unknown/widget-unknown.component.html +0 -3
- package/src/app/widget-unknown/widget-unknown.component.spec.ts +0 -25
- package/src/app/widget-unknown/widget-unknown.component.ts +0 -15
- package/src/app/widget-wind/widget-wind.component.css +0 -24
- package/src/app/widget-wind/widget-wind.component.html +0 -20
- package/src/app/widget-wind/widget-wind.component.spec.ts +0 -25
- package/src/app/widget-wind/widget-wind.component.ts +0 -369
- package/src/assets/.gitkeep +0 -0
- package/src/assets/NoSleep.min.js +0 -2
- package/src/assets/alarm.mp3 +0 -0
- package/src/assets/alert.mp3 +0 -0
- package/src/assets/alertl.old.mp3 +0 -0
- package/src/assets/emergency.mp3 +0 -0
- package/src/assets/fontawesome6/css/all.min.css +0 -6
- package/src/assets/fontawesome6/webfonts/fa-brands-400.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-brands-400.woff2 +0 -0
- package/src/assets/fontawesome6/webfonts/fa-regular-400.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-regular-400.woff2 +0 -0
- package/src/assets/fontawesome6/webfonts/fa-solid-900.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-solid-900.woff2 +0 -0
- package/src/assets/fontawesome6/webfonts/fa-v4compatibility.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-v4compatibility.woff2 +0 -0
- package/src/assets/icon-192x192.png +0 -0
- package/src/assets/icon-256x256.png +0 -0
- package/src/assets/icon-384x384.png +0 -0
- package/src/assets/icon-512x512.png +0 -0
- package/src/assets/notification.mp3 +0 -0
- package/src/assets/steelseries-min.js +0 -25
- package/src/assets/steelseries-min.js.map +0 -8
- package/src/assets/steelseries.js +0 -15834
- package/src/assets/svg-autopilot-inkscape-plain.svg +0 -983
- package/src/assets/svg-wind-inkscape.svg +0 -1358
- package/src/assets/tween-min.js +0 -1
- package/src/assets/tween.js +0 -381
- package/src/assets/warn.mp3 +0 -0
- package/src/environments/environment.prod.ts +0 -3
- package/src/environments/environment.ts +0 -8
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -20
- package/src/main.ts +0 -11
- package/src/manifest.json +0 -33
- package/src/polyfills.ts +0 -80
- package/src/styles.css +0 -47
- package/src/styles.scss +0 -157
- package/src/test.ts +0 -32
- package/src/themes/darkBlueTheme.scss +0 -117
- package/src/themes/defaultTheme.scss +0 -50
- package/src/themes/highContrastTheme.scss +0 -47
- package/src/themes/modernTheme.scss +0 -143
- package/src/themes/nightMode.scss +0 -185
- package/src/themes/platypusTheme.scss +0 -80
- package/src/themes/signalkTheme.scss +0 -112
- package/src/tsconfig.app.json +0 -15
- package/src/tsconfig.spec.json +0 -20
- package/src/typings.d.ts +0 -5
- package/tsconfig.json +0 -24
- package/tslint.json +0 -143
- /package/{KipGaugeSample-1-1024x545.png → KipGaugeSample1-1024x545.png} +0 -0
- /package/{KipMonitor-1024x488.png → KipGaugeSample2-1024x488.png} +0 -0
|
@@ -1,774 +0,0 @@
|
|
|
1
|
-
import { ViewChild, Input, ElementRef, Component, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
-
import { Subscription } from 'rxjs';
|
|
3
|
-
import { MatButton } from '@angular/material/button';
|
|
4
|
-
import { MatDialog } from '@angular/material/dialog';
|
|
5
|
-
|
|
6
|
-
import { SignalKService } from '../signalk.service';
|
|
7
|
-
import { SignalkRequestsService, skRequest } from '../signalk-requests.service';
|
|
8
|
-
import { ModalWidgetComponent } from '../modal-widget/modal-widget.component';
|
|
9
|
-
import { WidgetManagerService, IWidget, IWidgetConfig } from '../widget-manager.service';
|
|
10
|
-
import { UnitsService } from '../units.service';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const defaultConfig: IWidgetConfig = {
|
|
14
|
-
displayName: 'N2k Autopilot',
|
|
15
|
-
filterSelfPaths: true,
|
|
16
|
-
paths: {
|
|
17
|
-
"apState": {
|
|
18
|
-
description: "Autopilot State",
|
|
19
|
-
path: 'self.steering.autopilot.state',
|
|
20
|
-
source: 'default',
|
|
21
|
-
pathType: "string",
|
|
22
|
-
isPathConfigurable: false,
|
|
23
|
-
convertUnitTo: "",
|
|
24
|
-
},
|
|
25
|
-
"apTargetHeadingMag": {
|
|
26
|
-
description: "Autopilot Target Heading Mag",
|
|
27
|
-
path: 'self.steering.autopilot.target.headingMagnetic',
|
|
28
|
-
source: 'default',
|
|
29
|
-
pathType: "number",
|
|
30
|
-
convertUnitTo: "deg",
|
|
31
|
-
isPathConfigurable: true,
|
|
32
|
-
},
|
|
33
|
-
"apTargetWindAngleApp": {
|
|
34
|
-
description: "Autopilot Target Wind Angle Apparent",
|
|
35
|
-
path: 'self.steering.autopilot.target.windAngleApparent',
|
|
36
|
-
source: 'default',
|
|
37
|
-
pathType: "number",
|
|
38
|
-
convertUnitTo: "deg",
|
|
39
|
-
isPathConfigurable: true,
|
|
40
|
-
},
|
|
41
|
-
"apNotifications": {
|
|
42
|
-
description: "Autopilot Notifications",
|
|
43
|
-
path: 'self.notifications.autopilot.*', //TODO(David): need to add support for .* type subscription paths in sk service and widget config modal
|
|
44
|
-
source: 'default',
|
|
45
|
-
pathType: "string",
|
|
46
|
-
convertUnitTo: "",
|
|
47
|
-
isPathConfigurable: false,
|
|
48
|
-
},
|
|
49
|
-
"headingMag": {
|
|
50
|
-
description: "Heading Magnetic",
|
|
51
|
-
path: 'self.navigation.headingMagnetic',
|
|
52
|
-
source: 'default',
|
|
53
|
-
pathType: "number",
|
|
54
|
-
convertUnitTo: "deg",
|
|
55
|
-
isPathConfigurable: true,
|
|
56
|
-
},
|
|
57
|
-
"headingTrue": {
|
|
58
|
-
description: "Heading True",
|
|
59
|
-
path: 'self.navigation.headingTrue',
|
|
60
|
-
source: 'default',
|
|
61
|
-
pathType: "number",
|
|
62
|
-
convertUnitTo: "deg",
|
|
63
|
-
isPathConfigurable: true,
|
|
64
|
-
},
|
|
65
|
-
"windAngleApparent": {
|
|
66
|
-
description: "Wind Angle Apparent",
|
|
67
|
-
path: 'self.environment.wind.angleApparent',
|
|
68
|
-
source: 'default',
|
|
69
|
-
pathType: "number",
|
|
70
|
-
convertUnitTo: "deg",
|
|
71
|
-
isPathConfigurable: true,
|
|
72
|
-
},
|
|
73
|
-
"windAngleTrueWater": {
|
|
74
|
-
description: "Wind Angle True Water",
|
|
75
|
-
path: 'self.environment.wind.angleTrueWater',
|
|
76
|
-
source: 'default',
|
|
77
|
-
pathType: "number",
|
|
78
|
-
convertUnitTo: "deg",
|
|
79
|
-
isPathConfigurable: true,
|
|
80
|
-
},
|
|
81
|
-
"rudderAngle": {
|
|
82
|
-
description: "Rudder Angle",
|
|
83
|
-
path: 'self.steering.rudderAngle',
|
|
84
|
-
source: 'default',
|
|
85
|
-
pathType: "number",
|
|
86
|
-
convertUnitTo: "deg",
|
|
87
|
-
isPathConfigurable: true,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
usage: {
|
|
91
|
-
"headingMag": ['wind', 'route', 'auto', 'standby'],
|
|
92
|
-
"headingTrue": ['wind', 'route', 'auto', 'standby'],
|
|
93
|
-
"windAngleApparent": ['wind'],
|
|
94
|
-
"windAngleTrueWater": ['wind'],
|
|
95
|
-
},
|
|
96
|
-
typeVal: {
|
|
97
|
-
"headingMag": 'Mag',
|
|
98
|
-
"headingTrue": 'True',
|
|
99
|
-
"windAngleApparent": 'AWA',
|
|
100
|
-
"windAngleTrueWater": 'TWA',
|
|
101
|
-
},
|
|
102
|
-
barColor: 'accent', // theme palette to select
|
|
103
|
-
autoStart: false,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const defaultPpreferedDisplayMode = {
|
|
107
|
-
wind: 'windAngleApparent',
|
|
108
|
-
route: 'headingMag',
|
|
109
|
-
auto: 'headingMag',
|
|
110
|
-
standby: 'headingMag'
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const commands = {
|
|
114
|
-
"auto": {"path":"self.steering.autopilot.state","value":"auto"},
|
|
115
|
-
"wind": {"path":"self.steering.autopilot.state","value":"wind"},
|
|
116
|
-
"route": {"path":"self.steering.autopilot.state","value":"route"},
|
|
117
|
-
"standby": {"path":"self.steering.autopilot.state","value":"standby"},
|
|
118
|
-
"+1": {"path":"self.steering.autopilot.actions.adjustHeading","value":1},
|
|
119
|
-
"+10": {"path":"self.steering.autopilot.actions.adjustHeading","value":10},
|
|
120
|
-
"-1": {"path":"self.steering.autopilot.actions.adjustHeading","value":-1},
|
|
121
|
-
"-10": {"path":"self.steering.autopilot.actions.adjustHeading","value":-10},
|
|
122
|
-
"tackToPort": {"path":"self.steering.autopilot.actions.tack","value":"port"},
|
|
123
|
-
"tackToStarboard": {"path":"self.steering.autopilot.actions.tack","value":"starboard"},
|
|
124
|
-
"advanceWaypoint": {"path":"self.steering.autopilot.actions.advanceWaypoint","value":"1"}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const noData = '-- -- -- --';
|
|
128
|
-
const noPilot = 'No pilot';
|
|
129
|
-
const noHeading = '---°';
|
|
130
|
-
const countDownDefault: number = 5;
|
|
131
|
-
const timeoutBlink = 250;
|
|
132
|
-
|
|
133
|
-
@Component({
|
|
134
|
-
selector: 'app-widget-autopilot',
|
|
135
|
-
templateUrl: './widget-autopilot.component.html',
|
|
136
|
-
styleUrls: ['./widget-autopilot.component.scss'],
|
|
137
|
-
})
|
|
138
|
-
export class WidgetAutopilotComponent implements OnInit, OnDestroy {
|
|
139
|
-
@Input('widgetUUID') widgetUUID: string;
|
|
140
|
-
@Input('unlockStatus') unlockStatus: boolean;
|
|
141
|
-
|
|
142
|
-
// AP keypad
|
|
143
|
-
@ViewChild('powerBtn') powerBtn: MatButton;
|
|
144
|
-
@ViewChild('stbTackBtn') stbTackBtn: MatButton;
|
|
145
|
-
@ViewChild('plus1Btn') plus1Btn: MatButton;
|
|
146
|
-
@ViewChild('minus1Btn') minus1Btn: MatButton;
|
|
147
|
-
@ViewChild('prtTackBtn') prtTackBtn: MatButton;
|
|
148
|
-
@ViewChild('standbyBtn') standbyBtn: MatButton;
|
|
149
|
-
@ViewChild('plus10Btn') plus10Btn: MatButton;
|
|
150
|
-
@ViewChild('minus10Btn') minus10Btn: MatButton;
|
|
151
|
-
@ViewChild('autoBtn') autoBtn: MatButton;
|
|
152
|
-
@ViewChild('windModeBtn') windModeBtn: MatButton;
|
|
153
|
-
@ViewChild('trackModeBtn') trackModeBtn: MatButton;
|
|
154
|
-
@ViewChild('muteBtn') muteBtn: MatButton;
|
|
155
|
-
@ViewChild('messageBtn') messageBtn: MatButton;
|
|
156
|
-
|
|
157
|
-
// AP Screen
|
|
158
|
-
@ViewChild('appSvgAutopilot') apScreen : any;
|
|
159
|
-
|
|
160
|
-
// hack to access material-theme palette colors
|
|
161
|
-
@ViewChild('primary') private primaryElement: ElementRef;
|
|
162
|
-
@ViewChild('accent') private accentElement: ElementRef;
|
|
163
|
-
@ViewChild('warn') private warnElement: ElementRef;
|
|
164
|
-
@ViewChild('primaryDark') private primaryDarkElement: ElementRef;
|
|
165
|
-
@ViewChild('accentDark') private accentDarkElement: ElementRef;
|
|
166
|
-
@ViewChild('warnDark') private warnDarkElement: ElementRef;
|
|
167
|
-
@ViewChild('background') private backgroundElement: ElementRef;
|
|
168
|
-
@ViewChild('text') private textElement: ElementRef;
|
|
169
|
-
|
|
170
|
-
activeWidget: IWidget;
|
|
171
|
-
config: IWidgetConfig;
|
|
172
|
-
displayName: string;
|
|
173
|
-
|
|
174
|
-
// Subscription stuff
|
|
175
|
-
currentAPState: any = null; // Current Pilot Mode - used for display, keyboard state and buildCommand function
|
|
176
|
-
apStateSub: Subscription = null;
|
|
177
|
-
|
|
178
|
-
currentAPTargetAppWind: number = 0;
|
|
179
|
-
apTargetAppWindSub: Subscription = null;
|
|
180
|
-
|
|
181
|
-
currentHeading: number = 0;
|
|
182
|
-
headingSub: Subscription = null;
|
|
183
|
-
|
|
184
|
-
currentAppWindAngle: number = null;
|
|
185
|
-
appWindAngleSub: Subscription = null;
|
|
186
|
-
|
|
187
|
-
currentRudder: number = null;
|
|
188
|
-
rudderSub: Subscription = null;
|
|
189
|
-
|
|
190
|
-
skApNotificationSub = new Subscription;
|
|
191
|
-
skRequestSub = new Subscription; // signalk-Request result observer
|
|
192
|
-
|
|
193
|
-
// Widget var
|
|
194
|
-
handleCountDownCounterTimeout = null;
|
|
195
|
-
handleConfirmActionTimeout = null;
|
|
196
|
-
handleMessageTimeout = null;
|
|
197
|
-
handleReceiveTimeout = null;
|
|
198
|
-
handleDisplayErrorTimeout = null;
|
|
199
|
-
countDownValue: number = 0;
|
|
200
|
-
actionToBeConfirmed: string = "";
|
|
201
|
-
skPathToAck: string = "";
|
|
202
|
-
preferedDisplayMode = defaultPpreferedDisplayMode;
|
|
203
|
-
isWChecked: boolean = false; // used for Wind toggle
|
|
204
|
-
isTChecked: boolean = false; // used for Track toggle
|
|
205
|
-
isApConnected: boolean = false;
|
|
206
|
-
notificationsArray = {};
|
|
207
|
-
alarmsCount: number = 0;
|
|
208
|
-
|
|
209
|
-
notificationTest = {};
|
|
210
|
-
|
|
211
|
-
constructor(
|
|
212
|
-
public dialog:MatDialog,
|
|
213
|
-
private SignalKService: SignalKService,
|
|
214
|
-
private SignalkRequestsService: SignalkRequestsService,
|
|
215
|
-
private WidgetManagerService: WidgetManagerService,
|
|
216
|
-
private UnitsService: UnitsService,
|
|
217
|
-
) { }
|
|
218
|
-
|
|
219
|
-
ngOnInit() {
|
|
220
|
-
this.activeWidget = this.WidgetManagerService.getWidget(this.widgetUUID);
|
|
221
|
-
if (this.activeWidget.config === null) {
|
|
222
|
-
// no data, let's set some!
|
|
223
|
-
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, defaultConfig);
|
|
224
|
-
this.config = defaultConfig; // load default config.
|
|
225
|
-
} else {
|
|
226
|
-
this.config = this.activeWidget.config;
|
|
227
|
-
this.displayName = this.config.displayName;
|
|
228
|
-
}
|
|
229
|
-
if (this.config.autoStart) {
|
|
230
|
-
setTimeout(() => {this.startApHead();});
|
|
231
|
-
}
|
|
232
|
-
// this.demoMode(); // demo mode for troubleshooting
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
demoMode() {
|
|
236
|
-
|
|
237
|
-
// this.setNotificationMessage('{"path":"notifications.autopilot.PilotWarningWindShift","value":{"state":"alarm","message":"Pilot Warning Wind Shift"}}');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
ngOnDestroy() {
|
|
241
|
-
this.stopAllSubscriptions();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
startAllSubscriptions() {
|
|
245
|
-
this.subscribeHeading();
|
|
246
|
-
this.subscribeAppWindAngle();
|
|
247
|
-
this.subscribeRudder();
|
|
248
|
-
this.subscribeAPState();
|
|
249
|
-
this.subscribeAPTargetAppWind();
|
|
250
|
-
this.subscribeSKRequest();
|
|
251
|
-
this.subscribeAPNotification();
|
|
252
|
-
console.log("Autopilot Sub Started");
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
stopAllSubscriptions() {
|
|
256
|
-
this.unsubscribeHeading();
|
|
257
|
-
this.unsubscribeAppWindAngle();
|
|
258
|
-
this.unsubscribeRudder();
|
|
259
|
-
this.unsubscribeAPState();
|
|
260
|
-
this.unsubscribeAPTargetAppWind();
|
|
261
|
-
this.unsubscribeSKRequest();
|
|
262
|
-
this.unsubscribeAPNotification();
|
|
263
|
-
console.log("Autopilot Subs Stopped");
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
subscribeAPNotification() {
|
|
267
|
-
if (typeof(this.config.paths['apNotifications'].path) != 'string') { return } // nothing to sub to...
|
|
268
|
-
this.skApNotificationSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['apNotifications'].path, this.config.paths['apNotifications'].source).subscribe(
|
|
269
|
-
newValue => {
|
|
270
|
-
|
|
271
|
-
if (!newValue.value == null) {
|
|
272
|
-
this.setNotificationMessage(newValue.value);
|
|
273
|
-
console.log(newValue.value);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
unsubscribeAPNotification() {
|
|
280
|
-
if (this.skApNotificationSub !== null) {
|
|
281
|
-
this.skApNotificationSub.unsubscribe();
|
|
282
|
-
this.skApNotificationSub = null;
|
|
283
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['apNotifications'].path);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
subscribeSKRequest() {
|
|
288
|
-
this.skRequestSub = this.SignalkRequestsService.subscribeRequest().subscribe(requestResult => {
|
|
289
|
-
if (requestResult.widgetUUID == this.widgetUUID) {
|
|
290
|
-
this.commandReceived(requestResult);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
unsubscribeSKRequest() {
|
|
296
|
-
if (this.skRequestSub !== null) {
|
|
297
|
-
this.skRequestSub.unsubscribe();
|
|
298
|
-
this.skRequestSub = null;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
subscribeAPTargetAppWind() {
|
|
303
|
-
this.unsubscribeAPTargetAppWind();
|
|
304
|
-
if (typeof(this.config.paths['apTargetWindAngleApp'].path) != 'string') { return } // nothing to sub to...
|
|
305
|
-
this.apTargetAppWindSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['apTargetWindAngleApp'].path, this.config.paths['apTargetWindAngleApp'].source).subscribe(
|
|
306
|
-
newValue => {
|
|
307
|
-
if (newValue.value === null) {
|
|
308
|
-
this.currentAPTargetAppWind = 0;
|
|
309
|
-
} else {
|
|
310
|
-
this.currentAPTargetAppWind = this.UnitsService.convertUnit('deg', newValue.value);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
unsubscribeAPTargetAppWind() {
|
|
317
|
-
if (this.apTargetAppWindSub !== null) {
|
|
318
|
-
this.apTargetAppWindSub.unsubscribe();
|
|
319
|
-
this.apTargetAppWindSub = null;
|
|
320
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['apTargetWindAngleApp'].path);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
subscribeAPState() {
|
|
325
|
-
if (typeof(this.config.paths['apState'].path) != 'string') { return } // nothing to sub to...
|
|
326
|
-
this.apStateSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['apState'].path, this.config.paths['apState'].source).subscribe(
|
|
327
|
-
newValue => {
|
|
328
|
-
this.currentAPState = newValue.value;
|
|
329
|
-
this.SetKeyboardMode(this.currentAPState);
|
|
330
|
-
}
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
unsubscribeAPState() {
|
|
335
|
-
if (this.apStateSub !== null) {
|
|
336
|
-
this.apStateSub.unsubscribe();
|
|
337
|
-
this.apStateSub = null;
|
|
338
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['apState'].path);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
subscribeHeading() {
|
|
343
|
-
this.unsubscribeHeading();
|
|
344
|
-
if (typeof(this.config.paths['headingMag'].path) != 'string') { return } // nothing to sub to...
|
|
345
|
-
this.headingSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['headingMag'].path, this.config.paths['headingMag'].source).subscribe(
|
|
346
|
-
newValue => {
|
|
347
|
-
if (newValue.value === null) {
|
|
348
|
-
this.currentHeading = 0;
|
|
349
|
-
} else {
|
|
350
|
-
|
|
351
|
-
this.currentHeading = this.UnitsService.convertUnit('deg', newValue.value);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
unsubscribeHeading() {
|
|
359
|
-
if (this.headingSub !== null) {
|
|
360
|
-
this.headingSub.unsubscribe();
|
|
361
|
-
this.headingSub = null;
|
|
362
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['headingMag'].path);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
subscribeAppWindAngle() {
|
|
367
|
-
this.unsubscribeAppWindAngle();
|
|
368
|
-
if (typeof(this.config.paths['windAngleApparent'].path) != 'string') { return } // nothing to sub to...
|
|
369
|
-
|
|
370
|
-
this.appWindAngleSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['windAngleApparent'].path, this.config.paths['windAngleApparent'].source).subscribe(
|
|
371
|
-
newValue => {
|
|
372
|
-
if (newValue.value === null) {
|
|
373
|
-
this.currentAppWindAngle = null;
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
let converted = this.UnitsService.convertUnit('deg', newValue.value);
|
|
378
|
-
// 0-180+ for stb
|
|
379
|
-
// -0 to -180 for port
|
|
380
|
-
// need in 0-360
|
|
381
|
-
|
|
382
|
-
if (converted < 0) {// stb
|
|
383
|
-
this.currentAppWindAngle = 360 + converted; // adding a negative number subtracts it...
|
|
384
|
-
} else {
|
|
385
|
-
this.currentAppWindAngle = converted;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
unsubscribeAppWindAngle() {
|
|
392
|
-
if (this.appWindAngleSub !== null) {
|
|
393
|
-
this.appWindAngleSub.unsubscribe();
|
|
394
|
-
this.appWindAngleSub = null;
|
|
395
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['windAngleApparent'].path);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
subscribeRudder() {
|
|
400
|
-
this.unsubscribeRudder();
|
|
401
|
-
if (typeof(this.config.paths['rudderAngle'].path) != 'string') { return } // nothing to sub to...
|
|
402
|
-
this.rudderSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['rudderAngle'].path, this.config.paths['rudderAngle'].source).subscribe(
|
|
403
|
-
newValue => {
|
|
404
|
-
if (newValue.value === null) {
|
|
405
|
-
this.currentRudder = 0;
|
|
406
|
-
} else {
|
|
407
|
-
|
|
408
|
-
this.currentRudder = this.UnitsService.convertUnit('deg', newValue.value);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
unsubscribeRudder() {
|
|
416
|
-
if (this.rudderSub !== null) {
|
|
417
|
-
this.rudderSub.unsubscribe();
|
|
418
|
-
this.rudderSub = null;
|
|
419
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['rudderAngle'].path);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
openWidgetSettings() {
|
|
424
|
-
let dialogRef = this.dialog.open(ModalWidgetComponent, {
|
|
425
|
-
width: '80%',
|
|
426
|
-
data: this.config
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
dialogRef.afterClosed().subscribe(result => {
|
|
430
|
-
// save new settings
|
|
431
|
-
if (result) {
|
|
432
|
-
this.config = result;
|
|
433
|
-
this.displayName = this.config.displayName;
|
|
434
|
-
console.log(result);
|
|
435
|
-
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, this.config);
|
|
436
|
-
|
|
437
|
-
if (this.isApConnected) {
|
|
438
|
-
this.stopAllSubscriptions();
|
|
439
|
-
this.startAllSubscriptions();
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
addHeading(h1: number, h2: number) {
|
|
446
|
-
let h3 = h1 + h2;
|
|
447
|
-
while (h3 > 359) { h3 = h3 - 359; }
|
|
448
|
-
while (h3 < 0) { h3 = h3 + 359; }
|
|
449
|
-
return h3;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
powerBtnClick(event: Event) {
|
|
453
|
-
if (!this.isApConnected) {
|
|
454
|
-
this.startApHead();
|
|
455
|
-
} else {
|
|
456
|
-
this.stopApHead();
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
startApHead() {
|
|
461
|
-
this.startAllSubscriptions();
|
|
462
|
-
this.config.autoStart = true; // save power-on state to autostart or not
|
|
463
|
-
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, this.config);
|
|
464
|
-
|
|
465
|
-
this.isApConnected = true;
|
|
466
|
-
this.muteBtn.disabled = true;
|
|
467
|
-
this.messageBtn.disabled = false;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
stopApHead() {
|
|
471
|
-
this.muteBtn.disabled = true;
|
|
472
|
-
this.messageBtn.disabled = true;
|
|
473
|
-
this.windModeBtn.disabled = true;
|
|
474
|
-
this.trackModeBtn.disabled = true;
|
|
475
|
-
this.autoBtn.disabled = true;
|
|
476
|
-
this.standbyBtn.disabled = true;
|
|
477
|
-
this.plus1Btn.disabled = true;
|
|
478
|
-
this.plus10Btn.disabled = true;
|
|
479
|
-
this.minus1Btn.disabled = true;
|
|
480
|
-
this.minus10Btn.disabled = true;
|
|
481
|
-
this.prtTackBtn.disabled = true;
|
|
482
|
-
this.stbTackBtn.disabled = true;
|
|
483
|
-
|
|
484
|
-
this.apScreen.errorIconVisibility = 'hidden';
|
|
485
|
-
|
|
486
|
-
this.isApConnected = false; // hide ap screen
|
|
487
|
-
this.stopAllSubscriptions();
|
|
488
|
-
this.config.autoStart = false; // save power on state to autostart or not
|
|
489
|
-
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, this.config);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
SetKeyboardMode(apMode: string) {
|
|
493
|
-
switch (apMode) {
|
|
494
|
-
case "standby":
|
|
495
|
-
this.trackModeBtn.disabled = true;
|
|
496
|
-
this.autoBtn.disabled = false;
|
|
497
|
-
this.standbyBtn.disabled = false;
|
|
498
|
-
|
|
499
|
-
this.windModeBtn.disabled = false;
|
|
500
|
-
this.plus1Btn.disabled = true;
|
|
501
|
-
this.plus10Btn.disabled = true;
|
|
502
|
-
this.minus1Btn.disabled = true;
|
|
503
|
-
this.minus10Btn.disabled = true;
|
|
504
|
-
this.prtTackBtn.disabled = true;
|
|
505
|
-
this.stbTackBtn.disabled = true;
|
|
506
|
-
break;
|
|
507
|
-
|
|
508
|
-
case "auto":
|
|
509
|
-
this.trackModeBtn.disabled = false;
|
|
510
|
-
this.autoBtn.disabled = false;
|
|
511
|
-
this.standbyBtn.disabled = false;
|
|
512
|
-
|
|
513
|
-
this.windModeBtn.disabled = false;
|
|
514
|
-
this.plus1Btn.disabled = false;
|
|
515
|
-
this.plus10Btn.disabled = false;
|
|
516
|
-
this.minus1Btn.disabled = false;
|
|
517
|
-
this.minus10Btn.disabled = false;
|
|
518
|
-
this.prtTackBtn.disabled = true;
|
|
519
|
-
this.stbTackBtn.disabled = true;
|
|
520
|
-
break;
|
|
521
|
-
|
|
522
|
-
case "wind":
|
|
523
|
-
this.trackModeBtn.disabled = true;
|
|
524
|
-
this.autoBtn.disabled = false;
|
|
525
|
-
this.standbyBtn.disabled = false;
|
|
526
|
-
|
|
527
|
-
this.windModeBtn.disabled = false;
|
|
528
|
-
this.plus1Btn.disabled = false;
|
|
529
|
-
this.plus10Btn.disabled = false;
|
|
530
|
-
this.minus1Btn.disabled = false;
|
|
531
|
-
this.minus10Btn.disabled = false;
|
|
532
|
-
this.prtTackBtn.disabled = false;
|
|
533
|
-
this.stbTackBtn.disabled = false;
|
|
534
|
-
break;
|
|
535
|
-
|
|
536
|
-
case "route":
|
|
537
|
-
this.trackModeBtn.disabled = false;
|
|
538
|
-
this.autoBtn.disabled = false;
|
|
539
|
-
this.standbyBtn.disabled = false;
|
|
540
|
-
|
|
541
|
-
this.windModeBtn.disabled = true;
|
|
542
|
-
this.plus1Btn.disabled = true;
|
|
543
|
-
this.plus10Btn.disabled = true;
|
|
544
|
-
this.minus1Btn.disabled = true;
|
|
545
|
-
this.minus10Btn.disabled = true;
|
|
546
|
-
this.prtTackBtn.disabled = true;
|
|
547
|
-
this.stbTackBtn.disabled = true;
|
|
548
|
-
break;
|
|
549
|
-
|
|
550
|
-
default:
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
buildAndSendCommand(cmd: string) {
|
|
556
|
-
let cmdAction = commands[cmd];
|
|
557
|
-
if (typeof cmdAction === 'undefined') {
|
|
558
|
-
alert('Unknown Autopilot command: ' + cmd);
|
|
559
|
-
return null;
|
|
560
|
-
}
|
|
561
|
-
if ((this.actionToBeConfirmed !== '') && (this.actionToBeConfirmed !== cmd)) {
|
|
562
|
-
this.clearConfirmCmd();
|
|
563
|
-
}
|
|
564
|
-
if (((cmd === 'tackToPort')||(cmd === 'tackToStarboard'))&&(this.actionToBeConfirmed === '')) {
|
|
565
|
-
this.confirmTack(cmd);
|
|
566
|
-
return null;
|
|
567
|
-
}
|
|
568
|
-
if ((cmd === 'route')&&(this.currentAPState === 'route')&&(this.actionToBeConfirmed === '')) {
|
|
569
|
-
this.confirmAdvanceWaypoint(cmd);
|
|
570
|
-
return null;
|
|
571
|
-
}
|
|
572
|
-
if (this.actionToBeConfirmed === cmd) {
|
|
573
|
-
this.clearConfirmCmd();
|
|
574
|
-
if ((cmd === 'tackToPort')||(cmd === 'tackToStarboard')) {
|
|
575
|
-
this.sendCommand(cmdAction);
|
|
576
|
-
}
|
|
577
|
-
if ((cmd === 'route')&&(this.currentAPState === 'route')) {
|
|
578
|
-
this.sendCommand(commands['advanceWaypoint']);
|
|
579
|
-
}
|
|
580
|
-
return null;
|
|
581
|
-
}
|
|
582
|
-
this.sendCommand(cmdAction);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
confirmAdvanceWaypoint(cmd: string) {
|
|
586
|
-
let message: string = "Repeat key <b>[Next Wpt]</b><br>to confirm<br>Advance Waypoint";
|
|
587
|
-
this.startConfirmCmd(cmd, message);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
confirmTack(cmd: string) {
|
|
591
|
-
let message = "Repeat same key<br>to confirm<br>tack to ";
|
|
592
|
-
if (cmd === "tackToPort") {
|
|
593
|
-
message += "port";
|
|
594
|
-
this.actionToBeConfirmed = cmd;
|
|
595
|
-
} else if (cmd === "tackToStarboard") {
|
|
596
|
-
message += "starboard";
|
|
597
|
-
this.actionToBeConfirmed = cmd;
|
|
598
|
-
} else {
|
|
599
|
-
this.actionToBeConfirmed = "";
|
|
600
|
-
return null;
|
|
601
|
-
}
|
|
602
|
-
this.startConfirmCmd(cmd, message);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
sendCommand(cmdAction) {
|
|
606
|
-
let requestId = this.SignalkRequestsService.putRequest(cmdAction["path"], cmdAction["value"], this.widgetUUID);
|
|
607
|
-
this.apScreen.activityIconVisibility = "visible";
|
|
608
|
-
setTimeout(() => {this.apScreen.activityIconVisibility = 'hidden';}, timeoutBlink);
|
|
609
|
-
|
|
610
|
-
console.log("AP Action:\n" + JSON.stringify(cmdAction));
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
commandReceived(cmdResult: skRequest) {
|
|
614
|
-
this.apScreen.activityIconVisibility = "visible";
|
|
615
|
-
clearTimeout(this.handleReceiveTimeout);
|
|
616
|
-
this.handleReceiveTimeout = setTimeout(() => {this.apScreen.activityIconVisibility = 'hidden';}, timeoutBlink);
|
|
617
|
-
|
|
618
|
-
if (cmdResult.statusCode != 200){
|
|
619
|
-
this.displayApError(cmdResult);
|
|
620
|
-
} else {
|
|
621
|
-
console.log("AP Received: \n" + JSON.stringify(cmdResult));
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
startConfirmCmd(cmd: string, message: string) {
|
|
626
|
-
this.countDownValue = countDownDefault;
|
|
627
|
-
this.actionToBeConfirmed = cmd;
|
|
628
|
-
|
|
629
|
-
this.apScreen.msgStencilInnerHTML = "<p>" + message + "</p>";
|
|
630
|
-
this.apScreen.msgStencilVisibility = "visible";
|
|
631
|
-
|
|
632
|
-
this.updateCountDownCounter(message);
|
|
633
|
-
|
|
634
|
-
clearTimeout(this.handleConfirmActionTimeout);
|
|
635
|
-
|
|
636
|
-
this.handleConfirmActionTimeout = setTimeout(() => {
|
|
637
|
-
this.apScreen.msgStencilVisibility = "hidden";
|
|
638
|
-
this.apScreen.msgStencilInnerHTML = "";
|
|
639
|
-
this.actionToBeConfirmed = "";
|
|
640
|
-
}, 5000);
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
clearConfirmCmd() : boolean {
|
|
644
|
-
clearTimeout(this.handleConfirmActionTimeout);
|
|
645
|
-
clearTimeout(this.handleCountDownCounterTimeout);
|
|
646
|
-
this.countDownValue = -1;
|
|
647
|
-
this.apScreen.msgStencilVisibility = "hidden";
|
|
648
|
-
this.apScreen.msgStencilInnerHTML = "";
|
|
649
|
-
this.actionToBeConfirmed = '';
|
|
650
|
-
return null;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
updateCountDownCounter(message: string) {
|
|
654
|
-
if (this.countDownValue > 0) {
|
|
655
|
-
clearTimeout(this.handleCountDownCounterTimeout);
|
|
656
|
-
this.apScreen.msgStencilInnerHTML = "<p>" + message + "</p>" + "<h1 class='counterText'>" + this.countDownValue.toString() + "</h1>";
|
|
657
|
-
this.countDownValue -= 1;
|
|
658
|
-
this.handleCountDownCounterTimeout = setTimeout(() => {
|
|
659
|
-
this.updateCountDownCounter(message);
|
|
660
|
-
}, 1000);
|
|
661
|
-
} else {
|
|
662
|
-
clearTimeout(this.handleCountDownCounterTimeout);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
displayApError(cmdResult: skRequest) {
|
|
667
|
-
let errMsg = cmdResult.statusCode + " - " +cmdResult.statusCodeDescription;
|
|
668
|
-
if (cmdResult.message){
|
|
669
|
-
errMsg = errMsg + " Server Message: " + cmdResult.message;
|
|
670
|
-
}
|
|
671
|
-
this.apScreen.errorStencilInnerText = errMsg;
|
|
672
|
-
this.apScreen.errorStencilVisibility = "visible";
|
|
673
|
-
|
|
674
|
-
clearTimeout(this.handleDisplayErrorTimeout);
|
|
675
|
-
|
|
676
|
-
this.handleDisplayErrorTimeout = setTimeout(() => {
|
|
677
|
-
this.apScreen.errorStencilVisibility = "hidden";
|
|
678
|
-
this.apScreen.errorStencilInnerText = "";
|
|
679
|
-
}, 6000);
|
|
680
|
-
this.apScreen.errorIconVisibility = 'visible';
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
getNextNotification(skPath: string): string {
|
|
684
|
-
let notificationsKeys = Object.keys(this.notificationsArray);
|
|
685
|
-
let newSkPathToAck: string = "";
|
|
686
|
-
let index: number = 0;
|
|
687
|
-
if (notificationsKeys.length > 0) {
|
|
688
|
-
if (typeof skPath !== "undefined") {
|
|
689
|
-
index = notificationsKeys.indexOf(skPath) + 1;
|
|
690
|
-
} else {
|
|
691
|
-
index = 0;
|
|
692
|
-
}
|
|
693
|
-
if (notificationsKeys.length <= index) {
|
|
694
|
-
index = 0;
|
|
695
|
-
}
|
|
696
|
-
newSkPathToAck = notificationsKeys[index];
|
|
697
|
-
}
|
|
698
|
-
return newSkPathToAck;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
setNotificationMessage(value) {
|
|
702
|
-
this.apScreen.activityIconVisibility = "visible";
|
|
703
|
-
clearTimeout(this.handleReceiveTimeout);
|
|
704
|
-
this.handleReceiveTimeout = setTimeout(() => {this.apScreen.activityIconVisibility = 'hidden';}, timeoutBlink);
|
|
705
|
-
|
|
706
|
-
if (typeof value.path !== 'undefined') {
|
|
707
|
-
value.path = value.path.replace('notifications.', '');
|
|
708
|
-
if (typeof value.value !== 'undefined') {
|
|
709
|
-
if (value.value.state === 'normal') {
|
|
710
|
-
if (this.apScreen.messageInnerText === this.notificationsArray[value.path]) {
|
|
711
|
-
this.apScreen.messageInnerText = '';
|
|
712
|
-
}
|
|
713
|
-
delete this.notificationsArray[value.path]
|
|
714
|
-
} else {
|
|
715
|
-
this.notificationsArray[value.path] = value.value.message.replace("Pilot", "");
|
|
716
|
-
this.apScreen.messageInnerText = this.notificationsArray[value.path];
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
this.alarmsCount = Object.keys(this.notificationsArray).length;
|
|
721
|
-
if (this.alarmsCount > 0) {
|
|
722
|
-
this.muteBtn.disabled = false;
|
|
723
|
-
if (this.apScreen.messageInnerText == "") {
|
|
724
|
-
this.apScreen.messageInnerText = Object.keys(this.notificationsArray)[0];
|
|
725
|
-
}
|
|
726
|
-
} else {
|
|
727
|
-
this.muteBtn.disabled = true;
|
|
728
|
-
this.alarmsCount = 0;
|
|
729
|
-
this.apScreen.messageInnerText = "";
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
notificationToValue(skPathToAck: string): string {
|
|
734
|
-
let message: string = this.notificationsArray[skPathToAck];
|
|
735
|
-
if (typeof message == "undefined") {
|
|
736
|
-
message = "No alarm present...";
|
|
737
|
-
}
|
|
738
|
-
return message;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
notificationScroll() {
|
|
742
|
-
if ((Object.keys(this.notificationsArray).length > 0) && (this.skPathToAck == "")) {
|
|
743
|
-
this.skPathToAck = Object.keys(this.notificationsArray)[0];
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
this.skPathToAck = this.getNextNotification(this.skPathToAck);
|
|
747
|
-
// Not sure about this DIV ??? May be message area???
|
|
748
|
-
// silenceScreenTextDiv.innerHTML = notificationToValue(skPathToAck);
|
|
749
|
-
this.apScreen.messageInnerText = this.notificationToValue(this.skPathToAck);
|
|
750
|
-
this.apScreen.messageVisibility = 'visible';
|
|
751
|
-
clearTimeout(this.handleMessageTimeout);
|
|
752
|
-
this.handleMessageTimeout = setTimeout(() => {
|
|
753
|
-
this.apScreen.messageInnerText = "";
|
|
754
|
-
this.apScreen.messageVisibility = 'hidden';
|
|
755
|
-
}, 2000);
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
sendSilence() {
|
|
759
|
-
if (this.apScreen.messageVisibility != 'visible') {
|
|
760
|
-
this.apScreen.messageVisibility = 'visible';
|
|
761
|
-
|
|
762
|
-
if ((Object.keys(this.notificationsArray).length > 0) && (this.skPathToAck == "")) {
|
|
763
|
-
this.skPathToAck = Object.keys(this.notificationsArray)[0];
|
|
764
|
-
}
|
|
765
|
-
} else {
|
|
766
|
-
if (this.skPathToAck !== "") {
|
|
767
|
-
this.sendCommand({"path":"notifications." + this.skPathToAck + ".state","value":"normal"});
|
|
768
|
-
// this.sendCommand({"path":"notifications." + skPathToAck + ".method","value":[]});
|
|
769
|
-
}
|
|
770
|
-
this.apScreen.messageVisibility = 'hidden';
|
|
771
|
-
}
|
|
772
|
-
this.apScreen.messageInnerText = this.notificationToValue(this.skPathToAck);
|
|
773
|
-
}
|
|
774
|
-
}
|