Skip to content

Commit

Permalink
Merge branch 'master' into feat-S57-support
Browse files Browse the repository at this point in the history
  • Loading branch information
wdantuma committed Mar 1, 2024
2 parents c700b59 + 2681d07 commit ea4fb16
Show file tree
Hide file tree
Showing 238 changed files with 6,601 additions and 6,173 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package.json
projects
src
helper
font_resources
tsconfig.json
tsconfig.app.json
tsconfig-helper.json
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# CHANGELOG: Freeboard

### v2.6.0

- **Added**: Ability to show/hide toolbar buttons on both sides of the screen.
- **Added**: Route builder. 1st release allows creating a route from waypoints.
- **Fixed**: Wind speed values in vessel popover showing 0 rather than - when no value is present.

### v2.5.0

- **Added**: In the chart list, toggle the display of the bounds of all available charts on the map.
- **Added**: Displaying vector charts with defined styles in a Mapbox style JSON file.
- **Updated**: New Map icons for waypoints and AIS targets.

**Weather** moves from `experiment` -> feature with the introduction of the `meteo` context as per [nmea0183-signalk PR #245 - VDM Msg 8](https://github.com/SignalK/nmea0183-signalk).

- **Added**: Display weather stations on the map and view observation data.
- **Added**: Weather data relative to vessel position, sourced from _OpenWeather_, including hourly forecasts is available via the `meteo.freeboard-sk` context.
- **Removed**: Option to use NOAA as weather source.

**Experiments**:
- **Routes**: Render start / Finish line for the active route when values are present in route meta data.

### v2.4.0

- **Added**: Ability to shift anchor position.
- **Fixed**: Issues where "Constrain Zoom" button did not toggle color to reflect status.

### v2.3.2

- **Fixed**: GPX load screen not displaying list of resources to select.
- **Updated**: Openlayers version 8.

### v2.3.1

- **Fixed**: Issue in autopilot display where +/- adjustment buttons were not sending data to Pypilot.

### v2.3.0

- **Added**: Display a badge on menu icon when server has security enabled and client is not authenticated.
- **Added**: Autopilot console for use with built-in PyPyilot integration.
- **Added**: Display location of Man Overboard alarm on map.
- **Added**: Additional remove AIS target timeout options.
- **Updated**: Align anchor watch UI to anchor-alarm API operation.
- **Updated**: Display the waypoint name when a route point is a reference to a waypoint resource.
- **Updated**: Use updated typings in `@signalk/server-api`.

### v2.2.6

- **Fixed**: Issue where anchor watch could not be set when Signal K server had security enabled. _(Requires signalk-anchoralarm-plugin v1.13.0 or later)_
Expand Down
110 changes: 36 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Freeboard-SK
Freeboard-SK is a stateless, multi-station, Openlayers based chart plotter for Signal K for displaying and managing routes, waypoints, notes, alarms, notifications and more from any web enabled device.
Freeboard-SK is a stateless, multi-station, Openlayers based chart plotter for Signal K.
Use it to display:
- Resources _(i.e. routes, waypoints, notes, charts, etc)_
- Alarms & notifications
- AIS information
- Weather information
- Signal K instrument WebApps.

and more from any web enabled device.

![screen](https://user-images.githubusercontent.com/38519157/128667564-0f5e1ed6-eaae-40c7-ad62-5e7011c1f082.png)


## Features:
---

### Vessel / Chart Display:

Expand Down Expand Up @@ -72,52 +79,19 @@ Whilst not specifically defined in the Signal K specification, Freeboard-SK supp

Freeboard-SK can display alarms _(visual and audio)_ & messages contained in *Notification* messages transmitted by the Signal K server.

Alarm types supported include:
Additionally you can set alarms, including _anchor watch_, as well as raise alarms such as _man overboard_, _sinking_, etc directly from the user interface.

Supported alarm types include:
- Depth
- Closest Approach
- Anchor drag
- Anchor drag / watch
- "Buddy" notifications
- All standard Signal K Alarms (i.e. `Man overboard`, `Sinking`, etc.)

Additionally you can raise `anchor watch` and a number of the standard alarms such as `Man overboard`, `Sinking`, etc directly from the user interface.

Freeboard-SK also implements the following API endpoint to accept requests for raising and clearing notifications for Signal K Standard Alarms:
```
/signalk/v2/api/notifications/<standard_alarm>
```

_Example: Raise Man overboard alarm (default message):_
```
HTTP PUT 'http://host:port/signalk.v2/api/notifications/mob'
```

_Example: Raise Man overboard alarm (custom message):_
```
HTTP PUT 'http://host:port/signalk.v2/api/notifications/mob' {
"message": "Man Overboard!"
}
```
- All Signal K specification defined alarms.

_Example: Clear Man overboard alarm:_
```
HTTP DELETE 'http://host:port/signalk.v2/api/notifications/mob'
```

_**Signal K Standard Alarms:**_
- mob
- fire
- sinking
- flooding
- collision
- grounding
- listing
- adrift
- piracy
- abandon

_Vessel Closest Approach alarm:_
![screen](https://user-images.githubusercontent.com/38519157/128667564-0f5e1ed6-eaae-40c7-ad62-5e7011c1f082.png)
Freeboard-SK also implements API endpoints to accept requests for raising and clearing Signal K specification defined alarms.

_See OpenAPI documentation in Signal K Server Admin UI for details._


---
Expand All @@ -130,31 +104,32 @@ Freeboard-SK supports the Siganl K `playback` api and can replay recorded time-s

### Instruments:

Freeboard-SK allows you to use your favourite instrumentation app installed on the Signal K server.
Freeboard-SK allows you to use your favourite instrumentation apps installed on the Signal K server.

Select one or more from the installed applications listed in the `settings` screen and they will displayed in the instrument panel drawer.
Select one or more installed applications listed in the `settings` screen and they will displayed in the instrument drawer.

When more than one app is selected you can cycle through them within the instrument panel.
When more than one app is selected you can cycle through them within the instrument drawer.

_Note: The `Instrument Panel` app is the default application if no user selection has been made._
_Note: The `Signal K Instrument Panel` app will be displayed if no user selection has been made._

![instruments](https://user-images.githubusercontent.com/38519157/128668406-02cbb8d8-2353-4e93-ae5e-12e0c7d507fe.png)

---

### Experiments:

To get access to experimental Freeboard-SK features ensure you check the **Experimental Features** option in **Settings**.
Features that are not ready for "prime time" are made available as experiments.

Checking this option will make these features appear in the user interface.
To make experimental features available from within the Freeboard-SK user interface, you need to ensure the **Experimental Features** option is checked in **Settings**.

_Note: Some experiments will require configuration of Freeboard-SK via the _Plugin Config_ screen of the Signal K Server Admin UI._

---

## System Requirements:

Freeboard-SK requires **Signal K API Version 2** as it makes use of both the v2 `Resources` and `Course` APIs.
**Freeboard-SK requires _Signal K Server Version 2.0 or above**.

_If installed on Signal K v1.x.x Freeboard features may not be fully functional!_

The following features require that the Signal K server have plugins / providers installed to service the following paths:

Expand All @@ -176,6 +151,7 @@ The following features require that the Signal K server have plugins / providers
The following plugins are recommended for the *Signal K node server* to enable full functionality:

- @signalk/charts-plugin *(Charts provider)*
- signalk-pmtiles-plugin *(ProtoMaps chart provider)*
- signalk-anchoralarm-plugin _(anchor alarm settings & notifications)_
- signalk-simple-notifications _(depth alarm notifications)_
- @signalk/course-provider _(course calculations e.g. XTE, DTG, etc.)_
Expand Down Expand Up @@ -209,43 +185,29 @@ DEV_SERVER {

_Note: These settings apply in **Development Mode** only!_

```
npm start
ng serve
ng build
```


_They will __NOT__ apply when using **Production Mode**, the generated application will attempt to connect to a Signal K api / stream on the hosting server._

```
ng build -c production
or
npm run build:web
```

---

### Building a Release:

__Building the Application:__

To build all components of the application ready for release use the `npm run build:all` command.

__Building individual components:__
To build all components of the application _(plugin and webapp)_ ready for release use the `npm run build:prod` command.

- To build only the _web application_ use the `npm run build:web` command.
- To build only the _helper plugin_ use the `npm run build:helper` command.
__Building components individually:__

- To build only the _webapp_ use the command `npm run build:web`.
- To build only the _helper plugin_ use the command `npm run build:helper`.

Built files for deployment are placed in the following folders:
- `/public` (web application)
- `/plugin` (helper plugin)
Built files _(for deployment)_ are placed in the following folders:
- `/public` _(Freeboard-SK web app)_
- `/plugin` _(Freeboard-SK plugin)_

__Building NPM package:__
__Building the NPM package:__

To build the NPM package use `npm pack` command which will:
1. Execute `npm run build:all`
To build the NPM package use the `npm pack` command to:
1. Execute `npm run build:prod`
1. Create the NPM package (`.tgz`) file in the root folder of the project.

---
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
54 changes: 32 additions & 22 deletions helper/alarms/alarms.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// **** Signal K Standard ALARMS notifier ****
import { NextFunction, Request, Response } from 'express';
import {
Notification,
DeltaMessage,
ActionResult,
ALARM_METHOD,
ALARM_STATE
} from '../lib/types';
ALARM_STATE,
Path,
PathValue
} from '@signalk/server-api';
import { FreeboardHelperApp } from '../index';

const STANDARD_ALARMS = [
Expand Down Expand Up @@ -65,7 +64,7 @@ const initAlarmEndpoints = () => {

const r = handlePutAlarmState(
'vessels.self',
`notifications.${req.params.alarmType}`,
`notifications.${req.params.alarmType}` as Path,
{
message: msg,
method: [ALARM_METHOD.sound, ALARM_METHOD.visual],
Expand Down Expand Up @@ -95,7 +94,7 @@ const initAlarmEndpoints = () => {
try {
const r = handlePutAlarmState(
'vessels.self',
`notifications.${req.params.alarmType}`,
`notifications.${req.params.alarmType}` as Path,
null
);
res.status(200).json(r);
Expand All @@ -112,13 +111,13 @@ const initAlarmEndpoints = () => {

const handlePutAlarmState = (
context: string,
path: string,
path: Path,
value: {
message: string;
state: ALARM_STATE;
method: ALARM_METHOD[];
}
): ActionResult => {
) => {
server.debug(context);
server.debug(path);
server.debug(JSON.stringify(value));
Expand All @@ -135,14 +134,21 @@ const handlePutAlarmState = (
const pa = path.split('.');
const alarmType = pa[pa.length - 1];
server.debug(JSON.stringify(alarmType));
let noti: Notification | DeltaMessage;
let noti: PathValue;
if (value) {
noti = new Notification(
alarmType,
buildAlarmMessage(value.message, alarmType),
value.state ?? null,
value.method ?? null
);
const alm = buildAlarmMessage(value.message, alarmType);
noti = {
path: `notifications.${alarmType}` as Path,
value: {
state: value.state ?? null,
method: value.method ?? null,
message: alm.message
}
};
if (alm.data) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(noti.value as any).data = alm.data;
}
} else {
noti = {
path,
Expand All @@ -164,19 +170,23 @@ const handlePutAlarmState = (
}
};

const buildAlarmMessage = (message: string, alarmType?: string): string => {
let msgAttrib = '';
const buildAlarmMessage = (message: string, alarmType?: string) => {
let data = null;
if (['mob', 'sinking'].includes(alarmType)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const pos: any = server.getSelfPath('navigation.position');
msgAttrib = pos ? JSON.stringify(pos?.value) : '';
data = {
position: pos ? pos.value : null
};
}
return `${message}\n\r${msgAttrib}`;
return {
message: message,
data: data
};
};

// ** send notification delta message **
const emitNotification = (n: Notification | DeltaMessage) => {
const msg = n instanceof Notification ? n.message : n;
const emitNotification = (msg: PathValue) => {
const delta = {
updates: [{ values: [msg] }]
};
Expand Down
Loading

0 comments on commit ea4fb16

Please sign in to comment.