@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.
Files changed (273) hide show
  1. package/CHANGELOG.md +38 -3
  2. package/CONTRIBUTORS.md +4 -4
  3. package/KipGaugeSample3-1024x508.png +0 -0
  4. package/LICENSE +21 -0
  5. package/README.md +80 -42
  6. package/package.json +52 -46
  7. package/public/3rdpartylicenses.txt +61 -412
  8. package/public/assets/NoSleep.min.js +2 -2
  9. package/public/assets/icon-64x64.png +0 -0
  10. package/public/index.html +3 -3
  11. package/public/main.9dba30de44eed02b.js +1 -0
  12. package/public/manifest.json +9 -4
  13. package/public/polyfills.d1da7d2e907c253a.js +1 -0
  14. package/public/runtime.e75056c32c37f59d.js +1 -0
  15. package/public/styles.6b1c2c92be18a2cc.css +1 -0
  16. package/.angulardoc.json +0 -4
  17. package/angular.json +0 -162
  18. package/e2e/app.e2e-spec.ts +0 -14
  19. package/e2e/app.po.ts +0 -11
  20. package/e2e/tsconfig.e2e.json +0 -14
  21. package/karma.conf.js +0 -31
  22. package/public/main-es2018.98175eb4c61ccaf7eb17.js +0 -1
  23. package/public/main-es5.98175eb4c61ccaf7eb17.js +0 -1
  24. package/public/polyfills-es2018.3a61665863c173cd6ba3.js +0 -1
  25. package/public/polyfills-es5.44827ae4ff4e41de51fb.js +0 -1
  26. package/public/runtime-es2018.baedb88c6d2abacae2b8.js +0 -1
  27. package/public/runtime-es5.baedb88c6d2abacae2b8.js +0 -1
  28. package/public/styles.b92ae2c466c89712209d.css +0 -5
  29. package/src/app/alarm-menu/alarm-menu.component.html +0 -55
  30. package/src/app/alarm-menu/alarm-menu.component.scss +0 -52
  31. package/src/app/alarm-menu/alarm-menu.component.spec.ts +0 -25
  32. package/src/app/alarm-menu/alarm-menu.component.ts +0 -186
  33. package/src/app/app-help/app-help.component.css +0 -4
  34. package/src/app/app-help/app-help.component.html +0 -135
  35. package/src/app/app-help/app-help.component.ts +0 -45
  36. package/src/app/app-settings.service.spec.ts +0 -15
  37. package/src/app/app-settings.service.ts +0 -478
  38. package/src/app/app.component.css +0 -39
  39. package/src/app/app.component.html +0 -93
  40. package/src/app/app.component.scss +0 -79
  41. package/src/app/app.component.spec.ts +0 -32
  42. package/src/app/app.component.ts +0 -191
  43. package/src/app/app.module.ts +0 -200
  44. package/src/app/config.blank.const.ts +0 -52
  45. package/src/app/config.blank.notification.const.ts +0 -19
  46. package/src/app/config.blank.units.const.ts +0 -23
  47. package/src/app/config.demo.const.ts +0 -384
  48. package/src/app/data-browser/data-browser.component.css +0 -29
  49. package/src/app/data-browser/data-browser.component.html +0 -44
  50. package/src/app/data-browser/data-browser.component.spec.ts +0 -25
  51. package/src/app/data-browser/data-browser.component.ts +0 -91
  52. package/src/app/data-browser-row/data-browser-row-unit-modal.html +0 -17
  53. package/src/app/data-browser-row/data-browser-row.component.css +0 -10
  54. package/src/app/data-browser-row/data-browser-row.component.html +0 -5
  55. package/src/app/data-browser-row/data-browser-row.component.ts +0 -79
  56. package/src/app/data-set.service.spec.ts +0 -15
  57. package/src/app/data-set.service.ts +0 -273
  58. package/src/app/dynamic-widget.directive.spec.ts +0 -8
  59. package/src/app/dynamic-widget.directive.ts +0 -11
  60. package/src/app/filter-self.pipe.spec.ts +0 -8
  61. package/src/app/filter-self.pipe.ts +0 -14
  62. package/src/app/fit-text.directive.spec.ts +0 -8
  63. package/src/app/fit-text.directive.ts +0 -61
  64. package/src/app/gauge-steel/gauge-steel.component.css +0 -5
  65. package/src/app/gauge-steel/gauge-steel.component.html +0 -4
  66. package/src/app/gauge-steel/gauge-steel.component.spec.ts +0 -25
  67. package/src/app/gauge-steel/gauge-steel.component.ts +0 -282
  68. package/src/app/gauges-module/base-gauge.ts +0 -301
  69. package/src/app/gauges-module/gauges.module.ts +0 -17
  70. package/src/app/gauges-module/linear-gauge.ts +0 -50
  71. package/src/app/gauges-module/radial-gauge.ts +0 -48
  72. package/src/app/layout-split/layout-split.component.html +0 -30
  73. package/src/app/layout-split/layout-split.component.scss +0 -33
  74. package/src/app/layout-split/layout-split.component.spec.ts +0 -25
  75. package/src/app/layout-split/layout-split.component.ts +0 -59
  76. package/src/app/layout-splits.service.spec.ts +0 -15
  77. package/src/app/layout-splits.service.ts +0 -284
  78. package/src/app/modal-path-selector/modal-path-selector.component.html +0 -62
  79. package/src/app/modal-path-selector/modal-path-selector.component.scss +0 -39
  80. package/src/app/modal-path-selector/modal-path-selector.component.spec.ts +0 -25
  81. package/src/app/modal-path-selector/modal-path-selector.component.ts +0 -132
  82. package/src/app/modal-widget/modal-widget.component.css +0 -33
  83. package/src/app/modal-widget/modal-widget.component.html +0 -341
  84. package/src/app/modal-widget/modal-widget.component.spec.ts +0 -25
  85. package/src/app/modal-widget/modal-widget.component.ts +0 -84
  86. package/src/app/notifications.service.spec.ts +0 -12
  87. package/src/app/notifications.service.ts +0 -392
  88. package/src/app/object-keys.pipe.spec.ts +0 -8
  89. package/src/app/object-keys.pipe.ts +0 -13
  90. package/src/app/reset-config/reset-config.component.css +0 -0
  91. package/src/app/reset-config/reset-config.component.html +0 -3
  92. package/src/app/reset-config/reset-config.component.spec.ts +0 -25
  93. package/src/app/reset-config/reset-config.component.ts +0 -31
  94. package/src/app/root-display/root-display.component.css +0 -0
  95. package/src/app/root-display/root-display.component.html +0 -4
  96. package/src/app/root-display/root-display.component.spec.ts +0 -25
  97. package/src/app/root-display/root-display.component.ts +0 -57
  98. package/src/app/safe.pipe.ts +0 -16
  99. package/src/app/settings/settings.component.css +0 -9
  100. package/src/app/settings/settings.component.html +0 -25
  101. package/src/app/settings/settings.component.spec.ts +0 -25
  102. package/src/app/settings/settings.component.ts +0 -22
  103. package/src/app/settings-config/settings-config.component.css +0 -39
  104. package/src/app/settings-config/settings-config.component.html +0 -118
  105. package/src/app/settings-config/settings-config.component.spec.ts +0 -25
  106. package/src/app/settings-config/settings-config.component.ts +0 -161
  107. package/src/app/settings-datasets/settings-datasets.component.html +0 -43
  108. package/src/app/settings-datasets/settings-datasets.component.scss +0 -39
  109. package/src/app/settings-datasets/settings-datasets.component.spec.ts +0 -25
  110. package/src/app/settings-datasets/settings-datasets.component.ts +0 -98
  111. package/src/app/settings-datasets/settings-datasets.modal.html +0 -54
  112. package/src/app/settings-notifications/settings-notifications.component.css +0 -0
  113. package/src/app/settings-notifications/settings-notifications.component.html +0 -65
  114. package/src/app/settings-notifications/settings-notifications.component.spec.ts +0 -25
  115. package/src/app/settings-notifications/settings-notifications.component.ts +0 -29
  116. package/src/app/settings-signalk/settings-signalk.component.css +0 -3
  117. package/src/app/settings-signalk/settings-signalk.component.html +0 -89
  118. package/src/app/settings-signalk/settings-signalk.component.spec.ts +0 -25
  119. package/src/app/settings-signalk/settings-signalk.component.ts +0 -174
  120. package/src/app/settings-units/settings-units.component.css +0 -4
  121. package/src/app/settings-units/settings-units.component.html +0 -19
  122. package/src/app/settings-units/settings-units.component.spec.ts +0 -25
  123. package/src/app/settings-units/settings-units.component.ts +0 -62
  124. package/src/app/settings-zones/settings-zones.component.css +0 -22
  125. package/src/app/settings-zones/settings-zones.component.html +0 -70
  126. package/src/app/settings-zones/settings-zones.component.ts +0 -154
  127. package/src/app/settings-zones/settings-zones.modal.css +0 -14
  128. package/src/app/settings-zones/settings-zones.modal.html +0 -39
  129. package/src/app/signalk-connection.service.ts +0 -344
  130. package/src/app/signalk-delta.service.spec.ts +0 -15
  131. package/src/app/signalk-delta.service.ts +0 -97
  132. package/src/app/signalk-full.service.spec.ts +0 -15
  133. package/src/app/signalk-full.service.ts +0 -99
  134. package/src/app/signalk-interfaces.ts +0 -129
  135. package/src/app/signalk-requests.service.spec.ts +0 -12
  136. package/src/app/signalk-requests.service.ts +0 -180
  137. package/src/app/signalk.service.spec.ts +0 -15
  138. package/src/app/signalk.service.ts +0 -428
  139. package/src/app/svg-autopilot/svg-autopilot.component.html +0 -1036
  140. package/src/app/svg-autopilot/svg-autopilot.component.spec.ts +0 -25
  141. package/src/app/svg-autopilot/svg-autopilot.component.ts +0 -174
  142. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.html +0 -119
  143. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.scss +0 -0
  144. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.spec.ts +0 -25
  145. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.ts +0 -49
  146. package/src/app/svg-wind/svg-wind.component.css +0 -0
  147. package/src/app/svg-wind/svg-wind.component.html +0 -969
  148. package/src/app/svg-wind/svg-wind.component.scss +0 -76
  149. package/src/app/svg-wind/svg-wind.component.spec.ts +0 -25
  150. package/src/app/svg-wind/svg-wind.component.ts +0 -280
  151. package/src/app/unit-window/unit-window.component.css +0 -37
  152. package/src/app/unit-window/unit-window.component.html +0 -8
  153. package/src/app/unit-window/unit-window.component.spec.ts +0 -25
  154. package/src/app/unit-window/unit-window.component.ts +0 -134
  155. package/src/app/unit-window/unit-window.modal.html +0 -25
  156. package/src/app/units.service.ts +0 -300
  157. package/src/app/widget-autopilot/widget-autopilot.component.html +0 -78
  158. package/src/app/widget-autopilot/widget-autopilot.component.scss +0 -191
  159. package/src/app/widget-autopilot/widget-autopilot.component.spec.ts +0 -25
  160. package/src/app/widget-autopilot/widget-autopilot.component.ts +0 -774
  161. package/src/app/widget-blank/widget-blank.component.html +0 -5
  162. package/src/app/widget-blank/widget-blank.component.scss +0 -21
  163. package/src/app/widget-blank/widget-blank.component.spec.ts +0 -25
  164. package/src/app/widget-blank/widget-blank.component.ts +0 -17
  165. package/src/app/widget-gauge/widget-gauge.component.css +0 -26
  166. package/src/app/widget-gauge/widget-gauge.component.html +0 -29
  167. package/src/app/widget-gauge/widget-gauge.component.spec.ts +0 -25
  168. package/src/app/widget-gauge/widget-gauge.component.ts +0 -120
  169. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.html +0 -126
  170. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.scss +0 -94
  171. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.spec.ts +0 -25
  172. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.ts +0 -424
  173. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.html +0 -122
  174. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.scss +0 -69
  175. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.spec.ts +0 -25
  176. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.ts +0 -553
  177. package/src/app/widget-historical/widget-historical.component.css +0 -31
  178. package/src/app/widget-historical/widget-historical.component.html +0 -14
  179. package/src/app/widget-historical/widget-historical.component.scss +0 -0
  180. package/src/app/widget-historical/widget-historical.component.spec.ts +0 -25
  181. package/src/app/widget-historical/widget-historical.component.ts +0 -306
  182. package/src/app/widget-iframe/widget-iframe.component.css +0 -12
  183. package/src/app/widget-iframe/widget-iframe.component.html +0 -21
  184. package/src/app/widget-iframe/widget-iframe.component.spec.ts +0 -25
  185. package/src/app/widget-iframe/widget-iframe.component.ts +0 -63
  186. package/src/app/widget-list.service.spec.ts +0 -15
  187. package/src/app/widget-list.service.ts +0 -135
  188. package/src/app/widget-manager.service.spec.ts +0 -15
  189. package/src/app/widget-manager.service.ts +0 -141
  190. package/src/app/widget-numeric/widget-numeric.component.html +0 -13
  191. package/src/app/widget-numeric/widget-numeric.component.scss +0 -52
  192. package/src/app/widget-numeric/widget-numeric.component.spec.ts +0 -25
  193. package/src/app/widget-numeric/widget-numeric.component.ts +0 -457
  194. package/src/app/widget-simple-linear/widget-simple-linear.component.html +0 -28
  195. package/src/app/widget-simple-linear/widget-simple-linear.component.scss +0 -64
  196. package/src/app/widget-simple-linear/widget-simple-linear.component.spec.ts +0 -25
  197. package/src/app/widget-simple-linear/widget-simple-linear.component.ts +0 -199
  198. package/src/app/widget-state/widget-state.component.html +0 -27
  199. package/src/app/widget-state/widget-state.component.scss +0 -68
  200. package/src/app/widget-state/widget-state.component.spec.ts +0 -25
  201. package/src/app/widget-state/widget-state.component.ts +0 -178
  202. package/src/app/widget-switch/widget-switch.component.css +0 -70
  203. package/src/app/widget-switch/widget-switch.component.html +0 -17
  204. package/src/app/widget-switch/widget-switch.component.spec.ts +0 -25
  205. package/src/app/widget-switch/widget-switch.component.ts +0 -134
  206. package/src/app/widget-text-generic/widget-text-generic.component.css +0 -55
  207. package/src/app/widget-text-generic/widget-text-generic.component.html +0 -9
  208. package/src/app/widget-text-generic/widget-text-generic.component.spec.ts +0 -25
  209. package/src/app/widget-text-generic/widget-text-generic.component.ts +0 -253
  210. package/src/app/widget-tutorial/widget-tutorial.component.css +0 -0
  211. package/src/app/widget-tutorial/widget-tutorial.component.html +0 -34
  212. package/src/app/widget-tutorial/widget-tutorial.component.spec.ts +0 -25
  213. package/src/app/widget-tutorial/widget-tutorial.component.ts +0 -18
  214. package/src/app/widget-unknown/widget-unknown.component.css +0 -0
  215. package/src/app/widget-unknown/widget-unknown.component.html +0 -3
  216. package/src/app/widget-unknown/widget-unknown.component.spec.ts +0 -25
  217. package/src/app/widget-unknown/widget-unknown.component.ts +0 -15
  218. package/src/app/widget-wind/widget-wind.component.css +0 -24
  219. package/src/app/widget-wind/widget-wind.component.html +0 -20
  220. package/src/app/widget-wind/widget-wind.component.spec.ts +0 -25
  221. package/src/app/widget-wind/widget-wind.component.ts +0 -369
  222. package/src/assets/.gitkeep +0 -0
  223. package/src/assets/NoSleep.min.js +0 -2
  224. package/src/assets/alarm.mp3 +0 -0
  225. package/src/assets/alert.mp3 +0 -0
  226. package/src/assets/alertl.old.mp3 +0 -0
  227. package/src/assets/emergency.mp3 +0 -0
  228. package/src/assets/fontawesome6/css/all.min.css +0 -6
  229. package/src/assets/fontawesome6/webfonts/fa-brands-400.ttf +0 -0
  230. package/src/assets/fontawesome6/webfonts/fa-brands-400.woff2 +0 -0
  231. package/src/assets/fontawesome6/webfonts/fa-regular-400.ttf +0 -0
  232. package/src/assets/fontawesome6/webfonts/fa-regular-400.woff2 +0 -0
  233. package/src/assets/fontawesome6/webfonts/fa-solid-900.ttf +0 -0
  234. package/src/assets/fontawesome6/webfonts/fa-solid-900.woff2 +0 -0
  235. package/src/assets/fontawesome6/webfonts/fa-v4compatibility.ttf +0 -0
  236. package/src/assets/fontawesome6/webfonts/fa-v4compatibility.woff2 +0 -0
  237. package/src/assets/icon-192x192.png +0 -0
  238. package/src/assets/icon-256x256.png +0 -0
  239. package/src/assets/icon-384x384.png +0 -0
  240. package/src/assets/icon-512x512.png +0 -0
  241. package/src/assets/notification.mp3 +0 -0
  242. package/src/assets/steelseries-min.js +0 -25
  243. package/src/assets/steelseries-min.js.map +0 -8
  244. package/src/assets/steelseries.js +0 -15834
  245. package/src/assets/svg-autopilot-inkscape-plain.svg +0 -983
  246. package/src/assets/svg-wind-inkscape.svg +0 -1358
  247. package/src/assets/tween-min.js +0 -1
  248. package/src/assets/tween.js +0 -381
  249. package/src/assets/warn.mp3 +0 -0
  250. package/src/environments/environment.prod.ts +0 -3
  251. package/src/environments/environment.ts +0 -8
  252. package/src/favicon.ico +0 -0
  253. package/src/index.html +0 -20
  254. package/src/main.ts +0 -11
  255. package/src/manifest.json +0 -33
  256. package/src/polyfills.ts +0 -80
  257. package/src/styles.css +0 -47
  258. package/src/styles.scss +0 -157
  259. package/src/test.ts +0 -32
  260. package/src/themes/darkBlueTheme.scss +0 -117
  261. package/src/themes/defaultTheme.scss +0 -50
  262. package/src/themes/highContrastTheme.scss +0 -47
  263. package/src/themes/modernTheme.scss +0 -143
  264. package/src/themes/nightMode.scss +0 -185
  265. package/src/themes/platypusTheme.scss +0 -80
  266. package/src/themes/signalkTheme.scss +0 -112
  267. package/src/tsconfig.app.json +0 -15
  268. package/src/tsconfig.spec.json +0 -20
  269. package/src/typings.d.ts +0 -5
  270. package/tsconfig.json +0 -24
  271. package/tslint.json +0 -143
  272. /package/{KipGaugeSample-1-1024x545.png → KipGaugeSample1-1024x545.png} +0 -0
  273. /package/{KipMonitor-1024x488.png → KipGaugeSample2-1024x488.png} +0 -0
@@ -1,392 +0,0 @@
1
- /**
2
- * This class handles both App notifications Snackbar and SignalK Notifications
3
- */
4
- import { Injectable } from '@angular/core';
5
- import { Subject, BehaviorSubject, Observable, Subscription } from 'rxjs';
6
- import { ISignalKNotification } from "./signalk-interfaces";
7
- import { AppSettingsService, INotificationConfig } from "./app-settings.service";
8
- import { isNull } from 'util';
9
-
10
- import { Howl } from 'howler';
11
-
12
- const alarmTrack = {
13
- 1000 : 'notification', //filler
14
- 1001 : 'alert',
15
- 1002 : 'warn',
16
- 1003 : 'alarm',
17
- 1004 : 'emergency',
18
- };
19
-
20
-
21
- /**
22
- * Snack-bar notification message interface.
23
- */
24
- export interface AppNotification {
25
- message: string;
26
- duration: number;
27
- }
28
-
29
- /**
30
- * Kip Alarm object. Alarm index key is the path string. Alarm contains native SignalK Notification
31
- * values in and additional feature enhancing alarm properties.
32
- *
33
- * @path SignalK alarm path - Defines source of the alarm
34
- * @ack Optional Alarm acknowledgment property
35
- * @notification Native SignalK Notification message as Object ISignalKNotification
36
- */
37
- export interface Alarm {
38
- path: string;
39
- type: string;
40
- isAck: boolean;
41
- notification: ISignalKNotification;
42
- }
43
-
44
- /**
45
- * Alarm information, some stats used
46
- */
47
- export interface IAlarmInfo {
48
- audioSev: number;
49
- visualSev: number;
50
- alarmCount: number;
51
- unackCount: number;
52
- isMuted: boolean;
53
- }
54
-
55
- @Injectable({
56
- providedIn: 'root'
57
- })
58
- export class NotificationsService {
59
- private notificationServiceSettings: Subscription;
60
- private notificationConfig: INotificationConfig;
61
-
62
- private alarms: { [path: string]: Alarm } = {}; // local array of Alarms with path as index key
63
- private activeAlarmsSubject = new BehaviorSubject<any>({});
64
- private alarmsInfo: BehaviorSubject<IAlarmInfo> = new BehaviorSubject<IAlarmInfo>({
65
- audioSev: 0,
66
- visualSev: 0,
67
- alarmCount: 0,
68
- unackCount: 0,
69
- isMuted: false
70
- });
71
- public snackbarAppNotifications: Subject<AppNotification> = new Subject<AppNotification>(); // for snackbar message
72
-
73
- // sounds properties
74
- howlPlayer: Howl;
75
- activeAlarmSoundtrack: number;
76
- activeHowlId: number;
77
- isHowlIdMuted: boolean = false;
78
-
79
-
80
- constructor(
81
- private appSettingsService: AppSettingsService,
82
- ) {
83
- // Observe Notification configuration
84
- this.notificationServiceSettings = this.appSettingsService.getNotificationConfigService().subscribe(config => {
85
- this.notificationConfig = config;
86
- if (this.notificationConfig.disableNotifications) {
87
- this.resetAlarms();
88
- }
89
- if (this.notificationConfig.sound.disableSound) {
90
- this.playAlarm(1000); // will stop any playing track if any
91
- } else {
92
- this.checkAlarms(); //see if any we need to start playing again
93
- }
94
- });
95
-
96
- // init alarm player
97
- this.howlPlayer = this.getPlayer(1000);
98
- }
99
-
100
- /**
101
- * Display Kip Snackbar notification.
102
- *
103
- * @param message Text to be displayed.
104
- * @param duration Display duration in milliseconds before automatic dismissal.
105
- * Duration value of 0 is indefinite or until use clicks Dismiss button. Defaults
106
- * to 10000 of no value is provided.
107
- */
108
- sendSnackbarNotification(message: string, duration: number = 10000) {
109
- this.snackbarAppNotifications.next({ message: message, duration: duration});
110
- }
111
-
112
- public subscribeAlarms() {}
113
- public unsubscribeAlarms() {}
114
- public listAlarms() {}
115
-
116
- /**
117
- * Clears all Kip internal Notification Alarm system/array.
118
- * Used when server connection is reset/changed or the notification disabled.
119
- *
120
- * @usageNotes Internal function - Do not use.
121
- */
122
- public resetAlarms() {
123
- this.alarms = {};
124
- this.activeAlarmsSubject.next(this.alarms);
125
- }
126
-
127
- /**
128
- * Returns an Observable of type alarms containing alarms. Used
129
- * by observers whom are interested in Alarms such as Widgets and Alarm menu.
130
- */
131
- public getAlarms(): Observable<any> {
132
- return this.activeAlarmsSubject.asObservable();
133
- }
134
-
135
- /**
136
- * Add new Alarm and send
137
- * @param path SignalK path of the notification
138
- * @param notification Raw content of the notification message from SignalK server as ISignalKNotification
139
- */
140
- public addAlarm(path: string, notification: ISignalKNotification) {
141
-
142
- if (/^notifications.security./.test(path)) {
143
- return; // as per sbender this part is not ready in the spec - Don't add to alarms
144
- }
145
-
146
- if (this.notificationConfig.disableNotifications) { return; }
147
-
148
- if (path in this.alarms) {
149
- this.alarms[path].notification = notification;
150
- } else {
151
- let newAlarm: Alarm = {
152
- path: path, // duplicate from Alarm Object key index for added scope from individual alarm context
153
- type: "device",
154
- isAck: false,
155
- notification: notification,
156
- };
157
- this.alarms[path] = newAlarm;
158
- }
159
- this.checkAlarms();
160
- this.activeAlarmsSubject.next(this.alarms);
161
- }
162
-
163
- /**
164
- * Update Alarm notification data (data from SignalK) only. ie. alarm.notification
165
- * @param path
166
- * @param notification
167
- */
168
- public updateAlarm(path: string, notification: ISignalKNotification) {
169
- this.alarms[path].notification = notification;
170
- this.checkAlarms();
171
- this.activeAlarmsSubject.next(this.alarms);
172
- }
173
-
174
- /**
175
- * Deletes one alarm and notifies all observers
176
- * @param path String path for the alarm to delete
177
- * @return True If path exists, false if not found.
178
- */
179
- public deleteAlarm(path: string): boolean {
180
- if (path in this.alarms) {
181
- delete this.alarms[path];
182
- this.checkAlarms();
183
- this.activeAlarmsSubject.next(this.alarms);
184
- return true;
185
- }
186
- return false;
187
- }
188
-
189
- /**
190
- * Set Acknowledgement and send to other observers so they can react accordingly
191
- * @param path alarm to acknowledge
192
- * @param timeout if set will unacknowledge in this time
193
- * @return true of alarms found, else false
194
- */
195
- public acknowledgeAlarm(path: string, timeout: number = 0): boolean {
196
- if (path in this.alarms) {
197
- this.alarms[path].isAck = true;
198
- this.activeAlarmsSubject.next(this.alarms);
199
- if (timeout > 0) {
200
- setTimeout(()=>{
201
- console.log("unack: "+ path);
202
- if (path in this.alarms) {
203
- this.alarms[path].isAck = false;
204
- this.activeAlarmsSubject.next(this.alarms);
205
- }
206
- }, timeout);
207
- }
208
- this.checkAlarms();
209
- return true;
210
- }
211
- return false
212
- }
213
-
214
- /**
215
- * Checks all alarms for worst state, and sets any visualSev/AudioSev
216
- * @returns
217
- */
218
- public checkAlarms() {
219
- // find worse alarm state
220
- let unAckAlarms = 0;
221
- let audioSev = 0;
222
- let visualSev = 0;
223
- for (const [path, alarm] of Object.entries(this.alarms))
224
- {
225
- if (alarm.isAck) { continue; }
226
- unAckAlarms++;
227
- let aSev = 0;
228
- let vSev = 0;
229
-
230
- //seems ISignalKNotification can sometimes not have method set. (Problem from server?)
231
- if (!('method' in alarm.notification)) {
232
- continue; // if there's no method, don't alarm...
233
- }
234
-
235
- switch (alarm.notification['state']) {
236
- //case 'nominal': // not sure yet... spec not clear. Maybe only relevant for Zones
237
- case 'normal': // information only ie.: engine temperature normal. Not usually displayed
238
- if (alarm.notification['method'].includes('sound') && !this.notificationConfig.sound.muteNormal) { aSev = 0; }
239
- if (alarm.notification['method'].includes('visual')) { aSev = 0; }
240
- break;
241
-
242
- case 'alert': // user informational event ie.: auto-pilot waypoint reached, Engine Started/stopped, ect.
243
- if (alarm.notification['method'].includes('sound') && !this.notificationConfig.sound.muteAlert) { aSev = 1; }
244
- if (alarm.notification['method'].includes('visual')) { vSev = 1; }
245
- break;
246
-
247
- case 'warn': // user attention needed ie.: auto-pilot detected Wind Shift (go check if it's all fine), bilge pump activated (check if you have an issue).
248
- if (alarm.notification['method'].includes('sound') && !this.notificationConfig.sound.muteWarning) { aSev = 2; }
249
- if (alarm.notification['method'].includes('visual')) { vSev = 1; }
250
- break;
251
-
252
- case 'alarm': // a problem that requires immediate user attention ie.: auto-pilot can't stay on course, engine temp above specs.
253
- if (alarm.notification['method'].includes('sound') && !this.notificationConfig.sound.muteAlarm) { aSev = 3; }
254
- if (alarm.notification['method'].includes('visual')) { vSev = 2; }
255
- break;
256
-
257
- case 'emergency': // safety threatening event ie.: MOB, collision eminent (AIS related), ran aground (water depth lower than keel draft)
258
- if (alarm.notification['method'].includes('sound') && !this.notificationConfig.sound.muteEmergency) { aSev = 4; }
259
- if (alarm.notification['method'].includes('visual')) { vSev = 2; }
260
- break;
261
-
262
- default: // we don;t know this one. Tell the user.
263
- aSev = 0;
264
- vSev = 0;
265
- this.sendSnackbarNotification("Unknown Notification State received from SignalK", 0);
266
- console.log("Unknown Notification State received from SignalK\n" + JSON.stringify(alarm));
267
- }
268
- audioSev = Math.max(audioSev, aSev);
269
- visualSev = Math.max(visualSev, vSev);
270
- }
271
-
272
- if (!this.notificationConfig.sound.disableSound) {
273
- this.playAlarm(1000 + audioSev);
274
- }
275
- this.alarmsInfo.next({
276
- audioSev: audioSev,
277
- visualSev: visualSev,
278
- alarmCount: Object.keys(this.alarms).length,
279
- unackCount: unAckAlarms,
280
- isMuted: this.isHowlIdMuted
281
- });
282
- }
283
-
284
- getAlarmInfoAsO() {
285
- return this.alarmsInfo.asObservable();
286
- }
287
-
288
- /**
289
- * Observable to receive Kip app Snackbar notification. Use in app.component ONLY.
290
- *
291
- * @usageNotes To send a Snackbar notification, use sendSnackbarNotification().
292
- * Notifications are purely client side and have no relationship or
293
- * interactions with the SignalK server.
294
- */
295
- public getSnackbarAppNotifications() {
296
- return this.snackbarAppNotifications.asObservable();
297
- }
298
-
299
- /**
300
- * Processes SignalK Delta metadata containing Notifications information and
301
- * routes to Kip Notification system as Alarms and Notifications.
302
- *
303
- * @param path path of message ie. the subject of the message
304
- * @param notificationValue Content of the message. Must conform to ISignalKNotification interface.
305
- * @usageNotes This function is internal and should not be used.
306
- */
307
- public processNotificationDelta(path: string, notificationValue: ISignalKNotification) {
308
- if (this.notificationConfig.disableNotifications) {
309
- return;
310
- }
311
-
312
- if (isNull(notificationValue)) {
313
- // Alarm removed/cleared on server.
314
- if (this.deleteAlarm(path)) {};
315
- } else {
316
- if (path in this.alarms) {
317
- //already know of this alarm. Just check if updated (no need to update doc/etc if no change)
318
- if ( (this.alarms[path].notification['state'] != notificationValue['state'])
319
- ||(this.alarms[path].notification['message'] != notificationValue['message'])
320
- ||(JSON.stringify(this.alarms[path].notification['method']) != JSON.stringify(notificationValue['method'])) ) { // no easy way to compare arrays??? ok...
321
- this.updateAlarm(path, notificationValue);
322
- }
323
- } else {
324
- // New Alarm, send it
325
- this.addAlarm(path, notificationValue);
326
- }
327
- }
328
- }
329
-
330
- /**
331
- * Load player with a specific track in loop mode.
332
- * @param track track ID to play. See const for definition
333
- */
334
- getPlayer(track: number): Howl {
335
- this.activeAlarmSoundtrack = track;
336
- let player = new Howl({
337
- src: ['assets/' + alarmTrack[track] + '.mp3'],
338
- autoUnlock: true,
339
- autoSuspend: false,
340
- autoplay: false,
341
- preload: true,
342
- loop: true,
343
- onend: function() {
344
- // console.log('Finished!');
345
- },
346
- onloaderror: function() {
347
- console.log("player onload error");
348
- },
349
- onplayerror: function() {
350
- console.log("player locked");
351
- this.howlPlayer.once('unlock', function() {
352
- this.howlPlayer.play();
353
- });
354
- }
355
- });
356
- return player;
357
- }
358
-
359
- /**
360
- * mute Howl Player active track ei.: howlId. Note Howl howlId is not the
361
- * same as Player Soundtrack TrackId which represents the selected sound file.
362
- * @param state sound muted boolean state
363
- */
364
- mutePlayer(state) {
365
- this.howlPlayer.mute(state, this.activeHowlId);
366
- this.isHowlIdMuted = state;
367
- this.checkAlarms(); //make sure to push updated info tro alarm menu
368
- }
369
-
370
- /**
371
- * play audio notification sound
372
- * @param trackId track to play
373
- */
374
- playAlarm(trackId: number) {
375
- console.log(this.notificationConfig);
376
- if (this.activeAlarmSoundtrack == trackId) { // same track, do nothing
377
- return;
378
- }
379
- if (trackId == 1000) { // Stop track
380
- if (this.howlPlayer) {
381
- this.howlPlayer.stop();
382
- }
383
- this.activeAlarmSoundtrack = 1000;
384
- return;
385
- }
386
- this.howlPlayer.stop();
387
- this.howlPlayer = this.getPlayer(trackId);
388
- this.activeHowlId = this.howlPlayer.play();
389
- }
390
-
391
-
392
- }
@@ -1,8 +0,0 @@
1
- import { ObjectKeysPipe } from './object-keys.pipe';
2
-
3
- describe('ObjectKeysPipe', () => {
4
- it('create an instance', () => {
5
- const pipe = new ObjectKeysPipe();
6
- expect(pipe).toBeTruthy();
7
- });
8
- });
@@ -1,13 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
-
3
- @Pipe({
4
- name: 'objectKeys'
5
- })
6
- export class ObjectKeysPipe implements PipeTransform {
7
-
8
- transform(value: any, args?: any): any {
9
- return Object.keys(value)//.map(key => value[key]);
10
- }
11
-
12
-
13
- }
File without changes
@@ -1,3 +0,0 @@
1
- <p>
2
- reset-config works!
3
- </p>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
-
3
- import { ResetConfigComponent } from './reset-config.component';
4
-
5
- describe('ResetConfigComponent', () => {
6
- let component: ResetConfigComponent;
7
- let fixture: ComponentFixture<ResetConfigComponent>;
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ ResetConfigComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(ResetConfigComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should be created', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,31 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
- import { ActivatedRoute } from '@angular/router';
3
-
4
-
5
- import { AppSettingsService } from '../app-settings.service';
6
-
7
-
8
-
9
- @Component({
10
- selector: 'app-reset-config',
11
- templateUrl: './reset-config.component.html',
12
- styleUrls: ['./reset-config.component.css']
13
- })
14
- export class ResetConfigComponent implements OnInit {
15
-
16
- constructor(
17
- private AppSettingsService: AppSettingsService,
18
- private route: ActivatedRoute) { }
19
-
20
-
21
- ngOnInit() {
22
- this.route.url.subscribe(url => {
23
- if (url[0].path == 'demo') {
24
- this.AppSettingsService.loadDemoConfig();
25
- } else {
26
- this.AppSettingsService.resetSettings();
27
- }
28
- });
29
- }
30
-
31
- }
File without changes
@@ -1,4 +0,0 @@
1
- <layout-split
2
- [unlockStatus]=unlockStatus
3
- [splitUUID]=currentRootUUID
4
- ></layout-split>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
-
3
- import { RootDisplayComponent } from './root-display.component';
4
-
5
- describe('RootDisplayComponent', () => {
6
- let component: RootDisplayComponent;
7
- let fixture: ComponentFixture<RootDisplayComponent>;
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ RootDisplayComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(RootDisplayComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should be created', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,57 +0,0 @@
1
- import { Component, OnInit, OnDestroy } from '@angular/core';
2
- import { Subscription } from 'rxjs';
3
- import { ActivatedRoute } from '@angular/router';
4
-
5
- import { AppSettingsService } from '../app-settings.service';
6
- import { LayoutSplitsService } from '../layout-splits.service';
7
-
8
-
9
- @Component({
10
- selector: 'app-root-display',
11
- templateUrl: './root-display.component.html',
12
- styleUrls: []
13
- })
14
- export class RootDisplayComponent implements OnInit, OnDestroy {
15
-
16
- rootUUIDSub: Subscription;
17
- currentRootUUID: string = null;
18
- pageNumber: number;
19
- pageNumberSub: Subscription;
20
-
21
-
22
- unlockStatusSub: Subscription;
23
- unlockStatus: boolean;
24
-
25
- constructor( private AppSettingsService: AppSettingsService,
26
- private LayoutSplitsService: LayoutSplitsService,
27
- private route: ActivatedRoute,
28
- ) { }
29
-
30
- ngOnInit() {
31
-
32
- this.pageNumberSub = this.route.params.subscribe(params => {
33
- this.pageNumber = +params['id'];
34
- this.LayoutSplitsService.setActiveRootIndex(this.pageNumber);
35
- })
36
-
37
- // when root uuid changes, update page.
38
- this.rootUUIDSub = this.LayoutSplitsService.getActiveRootSub().subscribe(
39
- uuid => {
40
- if (uuid === null) {return; }// no root UUID yet...
41
- this.currentRootUUID = uuid;
42
- }
43
- );
44
-
45
- // get Unlock Status
46
- this.unlockStatusSub = this.AppSettingsService.getUnlockStatusAsO().subscribe(
47
- unlockStatus => {
48
- this.unlockStatus = unlockStatus;
49
- }
50
- );
51
- }
52
-
53
- ngOnDestroy() {
54
- this.rootUUIDSub.unsubscribe();
55
- this.unlockStatusSub.unsubscribe();
56
- }
57
- }
@@ -1,16 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { DomSanitizer } from '@angular/platform-browser';
3
-
4
-
5
- @Pipe({
6
- name: 'safe'
7
- })
8
-
9
- export class SafePipe implements PipeTransform {
10
-
11
- constructor(private sanitizer: DomSanitizer) { }
12
- transform(url) {
13
- return this.sanitizer.bypassSecurityTrustResourceUrl(url);
14
- }
15
-
16
- }
@@ -1,9 +0,0 @@
1
- .settingsWindow {
2
- padding-left: 0px;
3
- }
4
-
5
- .settingsPanels {
6
- display: block;
7
- padding: 3px;
8
- }
9
-
@@ -1,25 +0,0 @@
1
- <mat-tab-group class="settingsWindow">
2
- <mat-tab label="SignalK">
3
- <app-settings-signalk class="settingsPanels"></app-settings-signalk>
4
- </mat-tab>
5
- <mat-tab label="Historical Data">
6
- <app-settings-datasets class="settingsPanels"></app-settings-datasets>
7
- </mat-tab>
8
- <!--<mat-tab class="settingsPanels" label="Derived Data">
9
- <app-settings-derived></app-settings-derived>
10
- </mat-tab> -->
11
- <mat-tab label="Units">
12
- <app-settings-units class="settingsPanels"></app-settings-units>
13
- </mat-tab>
14
- <mat-tab label="Zones">
15
- <app-settings-zones class="settingsPanels"></app-settings-zones>
16
- </mat-tab>
17
- <mat-tab label="Notifications">
18
- <settings-notifications class="settingsPanels"></settings-notifications>
19
- </mat-tab>
20
- <mat-tab label="Configuration">
21
- <ng-template matTabContent>
22
- <app-settings-config class="settingsPanels"></app-settings-config>
23
- </ng-template>
24
- </mat-tab>
25
- </mat-tab-group>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
-
3
- import { SettingsComponent } from './settings.component';
4
-
5
- describe('SettingsComponent', () => {
6
- let component: SettingsComponent;
7
- let fixture: ComponentFixture<SettingsComponent>;
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ SettingsComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(SettingsComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should be created', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,22 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
-
3
-
4
- @Component({
5
- selector: 'app-settings',
6
- templateUrl: './settings.component.html',
7
- styleUrls: ['./settings.component.css']
8
- })
9
- export class SettingsComponent implements OnInit {
10
-
11
- constructor() { }
12
-
13
-
14
- ngOnInit() {
15
- }
16
-
17
-
18
-
19
-
20
-
21
-
22
- }