Skip to content

Commit

Permalink
Merge pull request #3 from SignalK/master
Browse files Browse the repository at this point in the history
Merge from SignalK/master
  • Loading branch information
sbender9 authored Dec 6, 2016
2 parents 7ec7f2f + 1c32502 commit f6de91f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
21 changes: 16 additions & 5 deletions lib/interfaces/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,20 @@ function registerPlugin(app, pluginName) {
debug('Registering plugin ' + pluginName)
const plugin = require(pluginName)(app)
const options = getPluginOptions(plugin.id)
const restart = (newConfiguration) => {
const pluginOptions = getPluginOptions(plugin.id)
pluginOptions.configuration = newConfiguration
fs.writeFile(pathForPluginId(plugin.id), JSON.stringify(pluginOptions, null, 2), function(err) {
if(err) {
console.error(err)
}
plugin.stop()
plugin.start(newConfiguration, restart)
})
}
if (options && options.enabled) {
debug('Starting plugin ' + pluginName)
plugin.start(getPluginOptions(plugin.id).configuration)
plugin.start(getPluginOptions(plugin.id).configuration, restart)
}
app.plugins.push(plugin)

Expand All @@ -123,11 +134,11 @@ function registerPlugin(app, pluginName) {
return
}
res.send("Saved configuration for plugin " + plugin.id)
plugin.stop()
if (req.body && req.body.enabled) {
plugin.start(req.body.configuration, restart)
}
});
plugin.stop()
if (req.body && req.body.enabled) {
plugin.start(req.body.configuration)
}
})
if(typeof plugin.registerWithRouter != 'undefined') {
plugin.registerWithRouter(router)
Expand Down
1 change: 1 addition & 0 deletions lib/pipedproviders.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = function(app) {
app.signalk.addDelta(data);
}
});
app.emit("pipedProvidersStarted", providerConfig)
return result;
}

Expand Down
17 changes: 9 additions & 8 deletions raspberry_pi_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ Now we will download three tools; curl, git and build-essential. These tools wil

$ sudo apt-get install -y curl git build-essential

Then we use curl followed by "apt-get" again to add Nodesource repository and install Node.js, which is the runtime environment for Signal K Node server.
Node server requires Node version 6 or newer. For Raspberry Pi 2 and 3 follow the instructions below. If in doubt, test with

$ curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash -
$ sudo apt-get install -y nodejs
$ uname -m

If the result returned starts with “armv6”, you are running a Raspberry Pi based on the older ARMv6 chipset and these instructions will not work.

Once this has completed you can check that Node.js is installed OK, by typing...
Add NodeSource repository to the system so that we can install Node with `apt-get`:

$ node -v

and you should see "v0.12.11" appear or whatever the latest version is.
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt install nodejs

Finally we need to install a Bonjour (mDNS) service for LINUX called Avahi, which allows Apps and other network devices to Discover the Signal K server. To do this we will use "apt-get" again ...

Expand Down Expand Up @@ -109,7 +110,7 @@ So that is Signal K....looks good doesn't it ? Actually this is just some JSON d

To generate your own vessel settings file, starting with the same NMEA data from the demo file, type...

$ sudo sh rpi-setup.sh
$ sudo bash rpi-setup.sh
and type your vessel name. This generates a UUID and a settings file in json format in settings/<yourVessel>.json. This can be edited directly by looking at the example settings. When running this script, the server is running from boot using a systemd service called signalk.service.

## Step 3 - Install Signal K Consumers
Expand Down
1 change: 1 addition & 0 deletions rpi-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ socket="/etc/systemd/system/signalk.socket"

echo -n "Enter your vessel name and press [enter]:"
read vesselName
vesselName=${vesselName// /_}
echo ""
echo "Signal K default port is 3000 as per documentation"
echo "port 80 does not require \":3000\" in browser and app interfaces"
Expand Down

0 comments on commit f6de91f

Please sign in to comment.