Skip to content

Commit

Permalink
Merge branch 'master' into v2_api_autopilot
Browse files Browse the repository at this point in the history
  • Loading branch information
panaaj authored Feb 3, 2024
2 parents 024538f + 4dd31cc commit 432a622
Show file tree
Hide file tree
Showing 28 changed files with 483 additions and 141 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,13 @@ jobs:
runs-on: ubuntu-latest
needs: docker_image
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Set TAG for build-arg
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/*/})
- name: Deploy demo.signalk.org at fly.io
working-directory: ./fly_io/demo_signalk_org
run: flyctl deploy --remote-only --build-arg SK_VERSION=${{ steps.vars.outputs.tag }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/require_pr_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v1
- uses: mheap/github-action-required-labels@v5
with:
mode: exactly
count: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ src = "src"
build-dir = "built"
create-missing = false

[output.html]
edit-url-template = "https://github.com/SignalK/signalk-server/tree/master/docs/src"


34 changes: 16 additions & 18 deletions docs/src/installation/raspberry_pi_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ Once the OS installation has been completed, you are ready to commence.

1. Update the list of install packages.
```
$ sudo apt update
sudo apt update
```
1. Install NodeJS and npm.
```
$ curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
$ sudo apt-get install -y nodejs
```
1. Install NodeJS 18 and npm.
Follow [instructions for Ubuntu and Debian based distributions like Raspberry Pi OS at NodeSource Distributions](https://github.com/nodesource/distributions#installation-instructions).
1. Ensure that we're using the latest version of npm.
```
$ sudo npm install -g npm@latest
sudo npm install -g npm@latest
```
Use the following command to check the versions of NodeJS and npm installed.
Expand All @@ -51,25 +49,25 @@ Once the OS installation has been completed, you are ready to commence.
1. Install a Bonjour (mDNS) service for Linux called Avahi, which allows Apps and other network devices to Discover the Signal K server.
```
$ sudo apt install libnss-mdns avahi-utils libavahi-compat-libdnssd-dev
sudo apt install libnss-mdns avahi-utils libavahi-compat-libdnssd-dev
```
## Install Signal K Server
```
$ sudo npm install -g signalk-server
sudo npm install -g signalk-server
```
You can test that installation was successful by starting the server using some
sample data.
```
$ signalk-server --sample-nmea0183-data
signalk-server --sample-nmea0183-data
```
You should see the terminal output "signalk-server running at 0.0.0.0:3000" as shown below...
```
$ signalk-server --sample-nmea0183-data
signalk-server --sample-nmea0183-data
Using sample data from /usr/lib/node_modules/signalk-server/samples/plaka.log
signalk-server running at 0.0.0.0:3000
```
Expand Down Expand Up @@ -101,7 +99,7 @@ Now that you have Signal K server installed, you will want to generate a setting
and configure your RPi to start the server automatically. To do this run the setup script by entering the following command and follow the prompts.

```
$ sudo signalk-server-setup
sudo signalk-server-setup
```

You can re-run this command at any time in the future to change the settings.
Expand All @@ -114,20 +112,20 @@ Signal K server will now be started automatically when your RPi boots up.

If you want to temporarily stop the Signal K server, you can do so by entering the following commands:
```
$ sudo systemctl stop signalk.service
$ sudo systemctl stop signalk.socket
sudo systemctl stop signalk.service
sudo systemctl stop signalk.socket
```

To start Signal K server again enter the following commands:
```
$ sudo systemctl start signalk.service
$ sudo systemctl start signalk.socket
sudo systemctl start signalk.service
sudo systemctl start signalk.socket
```

To stop Signal K server from starting automatically enter the following commands:
```
$ sudo systemctl disable signalk.service
$ sudo systemctl disable signalk.socket
sudo systemctl disable signalk.service
sudo systemctl disable signalk.socket
```


Expand Down
Binary file added docs/src/setup/SK_file_stream_N2K.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion docs/src/setup/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,26 @@ The options presented will vary based on the data type chosen.

Please refer to the [Canboat PGN database](https://canboat.github.io/canboat/canboat.html) to see what PGNs are supported.


**_NMEA0183_**: The processing of NMEA0183 sentences is done by [nmea0183-signalk](https://github.com/SignalK/signalk-parser-nmea0183)

**Connection type "File Stream"**

Sample files are available which can be set up as input for the server.

Use below command to get the path to a NMEA 2000 file with navigation data and AIS targets.

```
sudo find / -name "aava-n2k.data"
```
Set up according to picture.

![SK_N2K_file](./SK_file_stream_N2K.png)

To get the path for the sample file, data type NMEA 0183, use below command.

```
sudo find / -name "plaka.log"
```
### Install Plugins and Webapps

Signal K server functionality can be extended through the use of plugins and webapps.
Expand Down
15 changes: 10 additions & 5 deletions docs/src/setup/seatalk/seatalk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Introduction

Please note that this setup will [not, for the moment, run on a Raspberry Pi 5](https://github.com/SignalK/signalk-server/issues/1658) !!

The Signal K Server supports a variety of data connection types including _Seatalk (GPIO)_ which provides the ability to receive Raymarine Seatalk 1 (ST1) data, via simple DIY hardware connected to a Raspberry Pi GPIO, and convert it to Signal K deltas. This information can then be forwarded by the Signal K Server to a NMEA 0183 or NMEA 2000 network using appropriate hardware and plugins.

A guide to SeaTalk can be found [here](http://boatprojects.blogspot.com/2012/12/beginners-guide-to-raymarines-seatalk.html).
Expand All @@ -10,11 +12,15 @@ _Inspired by [Read SeaTalk1 from the Raspberry Pi GPIO using pigpio](https://git

### Hardware

![ST1_opto_SK](./seatalk_circuit_1.jpg)

Using an optocoupler as the hardware interface is recommended as it creates electrical isolation from hazardous voltages and avoids ground loops.

The circuit above uses the [PC817 optocoupler](https://www.amazon.com/ARCELI-Optocoupler-Isolation-Converter-Photoelectric/dp/B07M78S8LB/ref=sr_1_2?dchild=1&keywords=pc817+optocoupler&qid=1593516071&sr=8-2) but any equivlent product can be used. The LED in the circuit will flicker when there is ST1 traffic.
The circuit below uses the [PC817 optocoupler board](https://www.amazon.com/ARCELI-Optocoupler-Isolation-Converter-Photoelectric/dp/B07M78S8LB/ref=sr_1_2?dchild=1&keywords=pc817+optocoupler&qid=1593516071&sr=8-2) but any equivlent product can be used. The LED in the circuit will flicker when there is ST1 traffic.

![ST1_opto_SK](./seatalk_circuit_3.jpg)

If you are building the interface yourself use the below circuit instead. If you don't want any flickering just drop the LED at the input.

![ST1_opto_SK](./seatalk_circuit_4.jpg)

A simpler, non-electrically isolated, solution is detailed below, using a low signal NPN transistor which inverts and shifts the voltage from 12V DC to 3.3V DC.

Expand Down Expand Up @@ -70,8 +76,7 @@ _Example Data Connection:_

![GPIO](./gpio.png)

- Set _Invert Signal_ based on the hardware interface you have used _(e.g. Select **Yes** if using the hardware setup above. Select **No** if using a hardware interface that does not invert the ST1 signal)_.

- Set _Invert Signal_ based on the hardware interface you have used _(e.g. Select **No** if using the optocoupler hardware setup above. Select **Yes** if using a hardware interface that inverts the ST1 signal)_.

- Click **Apply** to save your data connection settings.

Expand Down
Binary file removed docs/src/setup/seatalk/seatalk_circuit_1.jpg
Binary file not shown.
Binary file added docs/src/setup/seatalk/seatalk_circuit_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/setup/seatalk/seatalk_circuit_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "signalk-server",
"version": "2.2.0",
"version": "2.5.0",
"description": "An implementation of a [Signal K](http://signalk.org) server for boats.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -72,13 +72,13 @@
],
"dependencies": {
"@signalk/course-provider": "^1.0.0",
"@signalk/n2k-signalk": "^2.0.0",
"@signalk/n2k-signalk": "^3.0.0",
"@signalk/nmea0183-signalk": "^3.0.0",
"@signalk/resources-provider": "^1.0.0",
"@signalk/server-admin-ui": "2.1.x",
"@signalk/server-api": "2.1.x",
"@signalk/server-admin-ui": "2.4.x",
"@signalk/server-api": "2.3.x",
"@signalk/signalk-schema": "^1.7.1",
"@signalk/streams": "^3.2.0",
"@signalk/streams": "^4.1.0",
"api-schema-builder": "^2.0.11",
"baconjs": "^1.0.1",
"bcryptjs": "^2.4.3",
Expand All @@ -93,7 +93,6 @@
"cookie-parser": "^1.4.3",
"cors": "^2.5.2",
"debug": "^4.3.3",
"devcert": "^1.2.2",
"dnssd2": "1.0.0",
"errorhandler": "^1.3.0",
"express": "^4.10.4",
Expand All @@ -117,6 +116,7 @@
"ncp": "^2.0.0",
"node-fetch": "^2.6.0",
"primus": "^7.0.0",
"selfsigned": "^2.4.1",
"semver": "^7.5.4",
"split": "^1.0.0",
"stat-mode": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/server-admin-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signalk/server-admin-ui",
"version": "2.1.0",
"version": "2.4.0",
"description": "Signal K server admin webapp",
"author": "Scott Bender, Teppo Kurki",
"contributors": [
Expand Down
1 change: 0 additions & 1 deletion packages/server-admin-ui/src/components/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class Sidebar extends Component {

// nav dropdown
const navDropdown = (item, key) => {
console.log('****', item)
return (
<li key={key} className={activeRoute(item.url, props)}>
<a
Expand Down
2 changes: 1 addition & 1 deletion packages/server-admin-ui/src/views/Webapps/Embedded.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Embedded extends Component {
return r
}),
openWebsocket: (params) => {
const knownParams = ['subscribe', 'sendCachedValues']
const knownParams = ['subscribe', 'sendCachedValues', 'events']
const queryParam = knownParams
.map((p, i) => [i, params[p]])
.filter((x) => x[1] !== undefined)
Expand Down
18 changes: 10 additions & 8 deletions packages/server-admin-ui/src/views/security/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,14 @@ class Settings extends Component {
<FormGroup row>
<Col md="12">
<Label>
Simple CORS requests are allowed from all hosts by
default. You can restrict CORS requests to named hosts
by configuring allowed CORS origins below. The host
where this page is loaded from is automatically
included in the allowed CORS origins so that the Admin
UI continues to work. Changes to the Allowed CORS
origins requires a server restart.
With no configuration all CORS origins are accepted,
but client requests with credentials:include do not
work. Add a single * origin to allow all origins with
credentials. You can also restrict CORS requests to
specific origins. The origin that this UI was loaded
from is automatically added to the allowed origins so
that requests from the UI work. Changes to the Allowed
CORS origins requires a server restart.
</Label>
</Col>
</FormGroup>{' '}
Expand All @@ -232,7 +233,8 @@ class Settings extends Component {
value={this.state.allowedCorsOrigins}
/>
<FormText color="muted">
Use comma delimited list, example:
Use either * or a comma delimited list of origins,
example:
http://host1.name.com:3000,http://host2.name.com:3000
</FormText>
</Col>
Expand Down
2 changes: 1 addition & 1 deletion packages/server-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signalk/server-api",
"version": "2.1.0",
"version": "2.3.0",
"description": "signalk-server Typescript API for plugins etc with relevant implementation classes",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
13 changes: 11 additions & 2 deletions packages/streams/autodetect.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ Splitter.prototype._transform = function (msg, encoding, _done) {
default:
try {
const parsed = JSON.parse(msg.data)
const timestamp = new Date(Number(msg.timestamp))
parsed.updates &&
parsed.updates.forEach((update) => (update.timestamp = timestamp))
this.push(parsed)
this.demuxEmitData(parsed)
} catch (e) {
Expand All @@ -137,10 +140,12 @@ function ToTimestamped(deMultiplexer, options) {
}
require('util').inherits(ToTimestamped, Transform)

// runs only once, self-assigns the actual transform functions
// on first call
ToTimestamped.prototype._transform = function (msg, encoding, done) {
const line = msg.toString()
this.multiplexedFormat =
line.length > 16 && line.charAt(13) === ';' && line.charAt(15) === ';'
line.length > 16 && line.charAt(13) === ';' && line.split(';').length >= 3
if (this.multiplexedFormat) {
if (this.options.noThrottle) {
this.deMultiplexer.toTimestamped.pipe(this.deMultiplexer.splitter)
Expand Down Expand Up @@ -176,7 +181,11 @@ ToTimestamped.prototype.handleMixed = function (msg, encoding, done) {
ToTimestamped.prototype.handleMultiplexed = function (msg, encoding, done) {
const line = msg.toString()
const parts = line.split(';')
this.push({ timestamp: parts[0], discriminator: parts[1], data: parts[2] })
this.push({
timestamp: parts[0],
discriminator: parts[1],
data: parts.slice(2).join(';'),
})
done()
}

Expand Down
6 changes: 6 additions & 0 deletions packages/streams/canboatjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ function CanboatJs(options) {

this.fromPgn.on('warning', (pgn, warning) => {
debug(`[warning] ${pgn.pgn} ${warning}`)
options.app.emit(`canboatjs:warning`, warning)
})

this.fromPgn.on('error', (pgn, err) => {
console.error(pgn.input, err.message)
options.app.emit(`canboatjs:error`, err)
})

this.app = options.app
Expand All @@ -48,12 +50,16 @@ CanboatJs.prototype._transform = function (chunk, encoding, done) {
pgnData.timestamp = new Date(Number(chunk.timestamp)).toISOString()
this.push(pgnData)
this.app.emit(this.analyzerOutEvent, pgnData)
} else {
this.app.emit('canboatjs:unparsed:object', chunk)
}
} else {
const pgnData = this.fromPgn.parse(chunk)
if (pgnData) {
this.push(pgnData)
this.app.emit(this.analyzerOutEvent, pgnData)
} else {
this.app.emit('canboatjs:unparsed:data', chunk)
}
}
done()
Expand Down
6 changes: 3 additions & 3 deletions packages/streams/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signalk/streams",
"version": "3.2.0",
"version": "4.1.0",
"description": "Utilities for handling streams of Signal K data",
"main": "index.js",
"scripts": {
Expand All @@ -22,9 +22,9 @@
},
"homepage": "https://github.com/SignalK/signalk-server-node#readme",
"dependencies": {
"@canboat/canboatjs": "^1.4.0",
"@canboat/canboatjs": "^2.0.0",
"@signalk/client": "^2.3.0",
"@signalk/n2k-signalk": "^2.0.0",
"@signalk/n2k-signalk": "^3.0.0",
"@signalk/nmea0183-signalk": "^3.0.0",
"@signalk/nmea0183-utilities": "^0.8.0",
"@signalk/signalk-schema": "^1.5.0",
Expand Down
Loading

0 comments on commit 432a622

Please sign in to comment.