@mxtommy/kip 1.3.0 → 2.0.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/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 +47 -419
- package/public/assets/NoSleep.min.js +2 -2
- package/public/assets/icon-64x64.png +0 -0
- package/public/assets/icon-72x72.png +0 -0
- package/public/index.html +3 -3
- package/public/main.f3d15cc777474f5f.js +1 -0
- package/public/manifest.json +9 -4
- package/public/polyfills.64db6be9cdc8f808.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/protractor.conf.js +0 -28
- package/public/assets/svg-autopilot-inkscape-plain.svg +0 -983
- package/public/assets/svg-wind-inkscape.svg +0 -1358
- 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,99 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import { SignalKService } from './signalk.service';
|
|
4
|
-
|
|
5
|
-
@Injectable()
|
|
6
|
-
export class SignalKFullService {
|
|
7
|
-
|
|
8
|
-
constructor(private SignalKService: SignalKService,) { }
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
processFullUpdate(data) {
|
|
12
|
-
|
|
13
|
-
//set self urn
|
|
14
|
-
this.SignalKService.setSelf(data.self)
|
|
15
|
-
|
|
16
|
-
// set Sources
|
|
17
|
-
//this.SignalKService.setDataFull(data);
|
|
18
|
-
|
|
19
|
-
// so we will walk the array recusively
|
|
20
|
-
this.findKeys(data);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
findKeys(data, currentPath: string[] = []) {
|
|
24
|
-
let path = currentPath.join('.');
|
|
25
|
-
|
|
26
|
-
if (data === null) { //notifications don't have timestamp... hmmm TODO get notif into tree...
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (path == 'sources') { return; } // ignore the sources tree
|
|
30
|
-
|
|
31
|
-
if ( (typeof(data) == 'string') || (typeof(data) == 'number') || (typeof(data) == 'boolean')) { // is it a simple value?
|
|
32
|
-
let timestamp = Date.now();
|
|
33
|
-
let source = 'noSource'
|
|
34
|
-
this.SignalKService.updatePathData(path, source, timestamp, data);
|
|
35
|
-
this.SignalKService.setDefaultSource(path, source);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
else if ('timestamp' in data) { // is it a timestamped value?
|
|
39
|
-
|
|
40
|
-
// try and get source
|
|
41
|
-
let source: string;
|
|
42
|
-
if (typeof(data['$source']) == 'string') {
|
|
43
|
-
source = data['$source'];
|
|
44
|
-
} else if (typeof(data['source']) == 'object') {
|
|
45
|
-
source = data['source']['label'];
|
|
46
|
-
} else {
|
|
47
|
-
source = 'noSource';
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let timestamp = Date.parse(data.timestamp);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// is it a normal value, or a compound value?
|
|
54
|
-
if ('value' in data) {
|
|
55
|
-
if (typeof(data['value']) == 'object' && (data['value'] !== null)) {
|
|
56
|
-
// compound
|
|
57
|
-
Object.keys(data['value']).forEach(key => {
|
|
58
|
-
let compoundPath = path+"."+key;
|
|
59
|
-
this.SignalKService.updatePathData(compoundPath, source, timestamp, data.value[key]);
|
|
60
|
-
this.SignalKService.setDefaultSource(compoundPath, source);
|
|
61
|
-
// try and get metadata.
|
|
62
|
-
if (typeof(data['meta']) == 'object') {
|
|
63
|
-
//does meta have one with properties for each one?
|
|
64
|
-
if (typeof(data.meta['properties']) == 'object' && typeof(data.meta.properties[key]) == 'object') {
|
|
65
|
-
this.SignalKService.setMeta(compoundPath, data.meta.properties[key]);
|
|
66
|
-
} else {
|
|
67
|
-
this.SignalKService.setMeta(compoundPath, data['meta']);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
//simple
|
|
73
|
-
this.SignalKService.updatePathData(path, source, timestamp, data.value);
|
|
74
|
-
this.SignalKService.setDefaultSource(path, source);
|
|
75
|
-
// try and get metadata.
|
|
76
|
-
if (typeof(data['meta']) == 'object') {
|
|
77
|
-
this.SignalKService.setMeta(path, data['meta']);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// it's not a value, dig deaper
|
|
86
|
-
else {
|
|
87
|
-
// process children
|
|
88
|
-
let keys = Object.keys(data);
|
|
89
|
-
let len = keys.length;
|
|
90
|
-
for (let i = 0; i < len; i += 1) {
|
|
91
|
-
let newPath = currentPath.slice();
|
|
92
|
-
newPath.push(keys[i])
|
|
93
|
-
this.findKeys(data[keys[i]], newPath);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { ZoneState } from './app-settings.service';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// Metadata, Notification and Stream Subscription type restrictions.
|
|
5
|
-
const states = ["nominal", "normal", "alert", "warn", "alarm", "emergency"] as ["nominal", "normal", "alert", "warn", "alarm", "emergency"];
|
|
6
|
-
type State = typeof states[number];
|
|
7
|
-
|
|
8
|
-
const types = ["linear", "logarithmic", "squareroot", "power"] as ["linear", "logarithmic", "squareroot", "power"];
|
|
9
|
-
type Type = typeof types[number];
|
|
10
|
-
|
|
11
|
-
const methods = ["visual", "sound"] as ["visual", "sound"];
|
|
12
|
-
type Method = typeof methods[number];
|
|
13
|
-
|
|
14
|
-
const formats = ["delta", "full"] as ["delta", "full"];
|
|
15
|
-
export type Format = typeof formats[number];
|
|
16
|
-
|
|
17
|
-
const policies = ["instant", "ideal", "fixed"] as ["instant", "ideal", "fixed"];
|
|
18
|
-
export type Policy = typeof policies[number];
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Not used
|
|
22
|
-
*/
|
|
23
|
-
export interface IUpdateMessage {
|
|
24
|
-
source: {
|
|
25
|
-
label: string;
|
|
26
|
-
type: string;
|
|
27
|
-
pgn?: string;
|
|
28
|
-
src?: string;
|
|
29
|
-
talker?: string;
|
|
30
|
-
};
|
|
31
|
-
timestamp: string;
|
|
32
|
-
values: {
|
|
33
|
-
path: string;
|
|
34
|
-
value: any;
|
|
35
|
-
}[]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* SignalK Delta low level raw message interface.
|
|
40
|
-
*/
|
|
41
|
-
export interface IDeltaMessage {
|
|
42
|
-
updates?: IUpdateMessage[];
|
|
43
|
-
requestId?: string;
|
|
44
|
-
state?: string;
|
|
45
|
-
statusCode?: number;
|
|
46
|
-
context: string;
|
|
47
|
-
self?: string;
|
|
48
|
-
version?: string;
|
|
49
|
-
message?: string;
|
|
50
|
-
accessRequest?: {
|
|
51
|
-
permission?: string;
|
|
52
|
-
token?: string
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Kip SignalK path Objects interface. This object is used to contain all server received data
|
|
58
|
-
*/
|
|
59
|
-
export interface IPathObject {
|
|
60
|
-
path: string;
|
|
61
|
-
defaultSource: string; // default source
|
|
62
|
-
sources: {
|
|
63
|
-
[sourceName: string]: { // per source data
|
|
64
|
-
timestamp: number;
|
|
65
|
-
value: any;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
meta?: ISignalKMetadata;
|
|
69
|
-
type: string;
|
|
70
|
-
state: ZoneState;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* SignalK Metadata Object interface. Follow URL for full SignalK specification
|
|
75
|
-
* and description of fields:
|
|
76
|
-
* @url https://signalk.org/specification/1.4.0/doc/data_model_metadata.html
|
|
77
|
-
*/
|
|
78
|
-
export interface ISignalKMetadata {
|
|
79
|
-
// normal state value
|
|
80
|
-
description: string; //SK base required value
|
|
81
|
-
units: string; //SK base required value
|
|
82
|
-
displayName?: string;
|
|
83
|
-
longName?: string;
|
|
84
|
-
shortName?: string;
|
|
85
|
-
state?: State;
|
|
86
|
-
timeout?: number;
|
|
87
|
-
method?: Method[];
|
|
88
|
-
displayScale?: { //This object provides information regarding the recommended type and extent of the scale used for displaying values.
|
|
89
|
-
lower?: number;
|
|
90
|
-
upper?: number;
|
|
91
|
-
type?: Type;
|
|
92
|
-
}
|
|
93
|
-
// elevated state value
|
|
94
|
-
alertMethod?: Method[];
|
|
95
|
-
warnMethod?: Method[];
|
|
96
|
-
alarmMethod?: Method[];
|
|
97
|
-
emergencyMethod?: Method[];
|
|
98
|
-
zones?: { //This provides a series of hints to the consumer which can be used to properly set a range on a display gauge and also color sectors of a gauge to indicate normal or dangerous operating conditions.
|
|
99
|
-
state: string;
|
|
100
|
-
lower?: number;
|
|
101
|
-
upper?: number;
|
|
102
|
-
message?: string;
|
|
103
|
-
}[]
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Interface for Metadata by Paths
|
|
108
|
-
*/
|
|
109
|
-
export interface IPathAndMetaObjects {
|
|
110
|
-
path: string;
|
|
111
|
-
meta?: ISignalKMetadata;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* SignalK Notification Object interface. Follow URL for full SignalK specification
|
|
116
|
-
* and description of fields:
|
|
117
|
-
* @url https://signalk.org/specification/1.4.0/doc/notifications.html
|
|
118
|
-
*/
|
|
119
|
-
export interface ISignalKNotification {
|
|
120
|
-
method: Method[],
|
|
121
|
-
state: State,
|
|
122
|
-
message: string
|
|
123
|
-
timestamp: string,
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface IPathInfo {
|
|
127
|
-
path: string;
|
|
128
|
-
|
|
129
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SignalkRequestsService } from './signalk-requests.service';
|
|
4
|
-
|
|
5
|
-
describe('SignalkRequestsService', () => {
|
|
6
|
-
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
-
|
|
8
|
-
it('should be created', () => {
|
|
9
|
-
const service: SignalkRequestsService = TestBed.get(SignalkRequestsService);
|
|
10
|
-
expect(service).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { Subscription , Observable , Subject } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
import { AppSettingsService } from './app-settings.service';
|
|
5
|
-
import { SignalKConnectionService } from './signalk-connection.service';
|
|
6
|
-
import { IDeltaMessage } from './signalk-interfaces';
|
|
7
|
-
import { SignalKDeltaService } from './signalk-delta.service';
|
|
8
|
-
import { NotificationsService } from './notifications.service';
|
|
9
|
-
|
|
10
|
-
const deltaStatusCodes = {
|
|
11
|
-
200: "The request was successfully.",
|
|
12
|
-
202: "The request is awaiting authorization.",
|
|
13
|
-
400: "Bad Client request format.",
|
|
14
|
-
401: "The request has not been applied because it lacks valid authentication credentials.",
|
|
15
|
-
403: "You must be authenticated to send command. Request a Client Authorization Token from Kip configuration. The request must be approved by a SignalK admin in Security > Access Requests.",
|
|
16
|
-
405: "The server does not support the request.",
|
|
17
|
-
500: "The request failed.",
|
|
18
|
-
502: "Something went wrong carrying out the request on the server side.",
|
|
19
|
-
504: "Timeout on the server side trying to carry out the request."
|
|
20
|
-
}
|
|
21
|
-
export interface skRequest {
|
|
22
|
-
requestId: string;
|
|
23
|
-
state: string;
|
|
24
|
-
statusCode: number;
|
|
25
|
-
statusCodeDescription?: string;
|
|
26
|
-
widgetUUID?: string;
|
|
27
|
-
message?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Injectable({
|
|
31
|
-
providedIn: 'root'
|
|
32
|
-
})
|
|
33
|
-
export class SignalkRequestsService {
|
|
34
|
-
|
|
35
|
-
private requestStatus = new Subject<skRequest>(); // public Observable passing message post processing
|
|
36
|
-
private requests: skRequest[] = []; // Private array of all requests.
|
|
37
|
-
|
|
38
|
-
constructor(
|
|
39
|
-
private SignalKConnectionService: SignalKConnectionService,
|
|
40
|
-
private SignalKDeltaService: SignalKDeltaService,
|
|
41
|
-
private AppSettingsService: AppSettingsService,
|
|
42
|
-
private NotificationsService: NotificationsService,
|
|
43
|
-
) {
|
|
44
|
-
let requestsSub: Subscription; // used to get all the requests from signalk-delta while avoiding circular dependencies in services...
|
|
45
|
-
|
|
46
|
-
requestsSub = this.SignalKDeltaService.subscribeRequest().subscribe(
|
|
47
|
-
requestMessage => { this.updateRequest(requestMessage); }
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
let endPointStatus: Subscription; // Monitor if Endpoints are reset and clean up
|
|
51
|
-
endPointStatus = this.SignalKConnectionService.getSignalKConnectionsStatus().subscribe(
|
|
52
|
-
signalKConnections => {
|
|
53
|
-
if (!signalKConnections.rest.status) {
|
|
54
|
-
this.requests = []; // flush array to clean values that will become stale post error or server reconnect
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Submit a SignalK server Read/Write authorization request - only required if you need to
|
|
62
|
-
* submit data to SignalK.
|
|
63
|
-
*
|
|
64
|
-
* Once approved, an authorization Token will be sent and automatically saved in the Kip
|
|
65
|
-
* Config. The authorization is a manual process done on the
|
|
66
|
-
* server.
|
|
67
|
-
*/
|
|
68
|
-
public requestAuth() {
|
|
69
|
-
let requestId = this.newUuid();
|
|
70
|
-
let accessRequest = {
|
|
71
|
-
requestId: requestId,
|
|
72
|
-
accessRequest: {
|
|
73
|
-
clientId: this.AppSettingsService.getKipUUID(),
|
|
74
|
-
description: "Kip web app",
|
|
75
|
-
permissions: "admin"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.SignalKConnectionService.publishDelta(JSON.stringify(accessRequest));
|
|
80
|
-
let request = {
|
|
81
|
-
requestId: requestId,
|
|
82
|
-
state: null,
|
|
83
|
-
statusCode: null
|
|
84
|
-
}
|
|
85
|
-
this.requests.push(request);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Sends request to SignalK server and returns requestId.
|
|
90
|
-
* @param path SignalK full path. Automatically removes "self" if included in path.
|
|
91
|
-
* @param value Value to be sent.
|
|
92
|
-
* @param widgetUUID Optional - Subscriber's Widget UUID to be included as part of
|
|
93
|
-
* the subscribeRequest Subject response. Enables Widget specific filtering.
|
|
94
|
-
* @return requestId Identifier for this specific request. Enables Request specific filtering.
|
|
95
|
-
*/
|
|
96
|
-
public putRequest(path: string, value: any, widgetUUID: string): string {
|
|
97
|
-
let requestId = this.newUuid();
|
|
98
|
-
let noSelfPath = path.replace(/^(self\.)/,""); //no self in path...
|
|
99
|
-
let selfContext: string = "vessels.self"; // hard coded context. Could be dynamic at some point
|
|
100
|
-
let message = {
|
|
101
|
-
"context": selfContext,
|
|
102
|
-
"requestId": requestId,
|
|
103
|
-
"put": {
|
|
104
|
-
"path": noSelfPath,
|
|
105
|
-
"value": value
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
this.SignalKConnectionService.publishDelta(JSON.stringify(message)); //send request
|
|
109
|
-
|
|
110
|
-
let request: skRequest = {
|
|
111
|
-
requestId: requestId,
|
|
112
|
-
state: null,
|
|
113
|
-
statusCode: null,
|
|
114
|
-
widgetUUID: widgetUUID,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
this.requests.push(request); // save to private array pending response with widgetUUID so we can filter response from subscriber
|
|
118
|
-
return requestId; // return the ID to the Subscriber, if tracking of individual request is required
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Handles request updates, issue display and logging.
|
|
123
|
-
*
|
|
124
|
-
* @param delta SignalK Delta message
|
|
125
|
-
*/
|
|
126
|
-
private updateRequest(delta: IDeltaMessage) {
|
|
127
|
-
let index = this.requests.findIndex(r => r.requestId == delta.requestId);
|
|
128
|
-
if (index > -1) { // exists in local array
|
|
129
|
-
this.requests[index].state = delta.state;
|
|
130
|
-
this.requests[index].statusCode = delta.statusCode;
|
|
131
|
-
this.requests[index].message = delta.message;
|
|
132
|
-
|
|
133
|
-
const currentStatusCode = deltaStatusCodes[delta.statusCode];
|
|
134
|
-
|
|
135
|
-
if ((typeof currentStatusCode != 'undefined') && (this.requests[index].statusCode == 200 || this.requests[index].statusCode == 202)) {
|
|
136
|
-
this.requests[index].statusCodeDescription = currentStatusCode;
|
|
137
|
-
|
|
138
|
-
if (this.requests[index].statusCode == 202) {
|
|
139
|
-
this.NotificationsService.sendSnackbarNotification(this.requests[index].statusCodeDescription);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
if ((delta.accessRequest !== undefined) && (delta.accessRequest.token !== undefined)) {
|
|
143
|
-
this.AppSettingsService.setSignalKToken({token: delta.accessRequest.token, new: true});
|
|
144
|
-
this.NotificationsService.sendSnackbarNotification(delta.accessRequest.permission + ": Read/Write Token request response received from server.");
|
|
145
|
-
console.log(delta.accessRequest.permission + ": New R/W token response received");
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
this.NotificationsService.sendSnackbarNotification("Request Error received: " + this.requests[index].statusCode + " - " + deltaStatusCodes[this.requests[index].statusCode] + " - " + this.requests[index].message);
|
|
149
|
-
console.log("Request Error received: " + this.requests[index].statusCode + " - " + deltaStatusCodes[this.requests[index].statusCode] + " - " + this.requests[index].message);
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
this.requestStatus.next(this.requests[index]); // Broadcast results
|
|
153
|
-
this.requests.splice(index, 1); // result dispatched, cleanup array
|
|
154
|
-
} catch (err) {
|
|
155
|
-
this.requestStatus.error(err);
|
|
156
|
-
console.log(err);
|
|
157
|
-
this.requests = []; // flush array to clean values that will become stale post error
|
|
158
|
-
}
|
|
159
|
-
} else {
|
|
160
|
-
this.NotificationsService.sendSnackbarNotification("Received unknown Request delta:\n" + JSON.stringify(delta));
|
|
161
|
-
console.log("Received unknown Request delta:\n" + JSON.stringify(delta))
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Subscribe to SignalK request response. This allows you to inspect server response information such as State, Status Codes and such for further processing logic. Subscription object should be used for the Return :)
|
|
167
|
-
*
|
|
168
|
-
* @return Observable if type skRequest.
|
|
169
|
-
*/
|
|
170
|
-
public subscribeRequest(): Observable<skRequest> {
|
|
171
|
-
return this.requestStatus.asObservable();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private newUuid() {
|
|
175
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
176
|
-
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
|
177
|
-
return v.toString(16);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TestBed, inject } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SignalkService } from './signalk.service';
|
|
4
|
-
|
|
5
|
-
describe('SignalkService', () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
TestBed.configureTestingModule({
|
|
8
|
-
providers: [SignalkService]
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should be created', inject([SignalkService], (service: SignalkService) => {
|
|
13
|
-
expect(service).toBeTruthy();
|
|
14
|
-
}));
|
|
15
|
-
});
|