the autopilot device identifier
object containing values keyed by AutopilotInfo
Follow a route in the specified direction and starting at the specified point.
Object containing route information.
Cancels navigation to the current point or route being followed.
Retrieves the current course information.
Set course to a specified position / waypoint.
Object containing destination position information.
Returns the entry for the provided path starting from the root
of the full data model.
let baseStations = app.getPath('shore.basestations');
// baseStations:
{
'urn:mrn:imo:mmsi:2766140': {
url: 'basestations',
navigation: { position: {latitude: 45.2, longitude: 76.4} },
mmsi: '2766140'
},
'urn:mrn:imo:mmsi:2766160': {
url: 'basestations',
navigation: { position: {latitude: 46.9, longitude: 72.22} },
mmsi: '2766160'
}
}
Returns the entry for the provided path starting from vessels.self
in the full data model.
Emit a delta message.
Note: These deltas are handled by the server in the same way as any other incoming deltas.
Optional
skVersion: SKVersionOptional parameter to specify the Signal K version of the delta.
app.handleMessage('my-signalk-plugin', {
updates: [
{
values: [
{
path: 'navigation.courseOverGroundTrue',
value: 1.0476934
}
]
}
]
});
Plugins emitting deltas that use Signal K v2 paths (like the Course API paths) should call handleMessage
with the optional skVersion
parameter set to v2
. This prevents v2 API data getting mixed in v1 paths' data in full data model & the v1 http API.
Omitting the skVersion
parameter will cause the delta to be sent as v1
.
Register a function to intercept all delta messages before they are processed by the server.
The callback function should call next(delta)
with either:
Not calling next(delta)
will cause the incoming delta to be dropped and will only show in delta statistics.
Other, non-delta messages produced by provider pipe elements are emitted normally.
Returns the available APIs and Plugins.
Example:
let features = app.getFeatures();
{
"apis": [
"resources","course"
],
"plugins": [
{
"id": "anchoralarm",
"name": "Anchor Alarm",
"version": "1.13.0",
"enabled": true
},
{
"id": "autopilot",
"name": "Autopilot Control",
"version": "1.4.0",
"enabled": false
},
{
"id": "sk-to-nmea2000",
"name": "Signal K to NMEA 2000",
"version": "2.17.0",
"enabled": false
},
{
"id": "udp-nmea-sender",
"name": "UDP NMEA0183 Sender",
"version": "2.0.0",
"enabled": false
}
]
}
Optional
onlyEnabled: booleanundefined
(not provided): list all features
true
: list only enabled featuresfalse
: list only disabled featuresRegister a handler to action PUT
requests for a specific path.
The action handler can handle the request synchronously or asynchronously.
The callback
parameter should be a function which accepts the following arguments:
context
path
value
callback
For synchronous actions, the handler must return a value describing the response of the request:
{
state: 'COMPLETED',
statusCode: 200
}
or
{
state:'COMPLETED',
statusCode: 400,
message:'Some Error Message'
}
The statusCode
value can be any valid HTTP response code.
For asynchronous actions, that may take considerable time to complete and the requester should not be kept waiting for the result, the handler must return:
{ state: 'PENDING' }
When the action has completed the handler should call the callback
function with the result:
callback({ state: 'COMPLETED', statusCode: 200 })
or
callback({
state:'COMPLETED',
statusCode: 400,
message:'Some Error Message'
})
Example: Synchronous response:
function myActionHandler(context, path, value, callback) {
if(doSomething(context, path, value)){
return { state: 'COMPLETED', statusCode: 200 };
} else {
return { state: 'COMPLETED', statusCode: 400 };
}
}
plugin.start = (options) => {
app.registerPutHandler('vessels.self', 'some.path', myActionHandler, 'somesource.1');
}
Example: Asynchronous response:
function myActionHandler(context, path, value, callback) {
doSomethingAsync(context, path, value, (result) =>{
if(result) {
callback({ state: 'COMPLETED', result: 200 })
} else {
callback({ state: 'COMPLETED', result: 400 })
}
});
return { state: 'PENDING' };
}
plugin.start = (options) => {
app.registerPutHandler('vessels.self', 'some.path', myActionHandler);
}
Access the Resources API to list, get, set, and delete resources.
Used by Resource Provider plugins to register each resource type it handles.
See Resource Provider Plugins
for details.
Log debug messages.
This function exposes the debug
method from the debug module.
The npm module name is used as the debug name.
app.debug()
can take any type and will serialize it before outputting.
Do not use debug
from the debug module directly! Using app.debug()
provided by the server ensures that the plugin taps into the server's debug logging system, including the helper switches in Admin UI's Server Log page.
Report to the server that the plugin has sent data to other hosts, which will update the output message rate and icon in the Dashboard.
Note: This function is for use when the plugin is sending data to hosts other than the Signal K server (e.g. network packets, http requests or messages sent to a broker).
This function should NOT be used for deltas that the plugin sends with handleMessage()
!
Optional
count: numbernumber of handled messages between the last call and this one. If omitted the call will count as one output message.
Set the current error status of the plugin that is displayed in the plugin configuration UI and the Dashboard.
The msg
parameter should be a short text message describing the current status of the plugin.
Set the current status of the plugin that is displayed in the plugin configuration UI and the Dashboard.
The msg
parameter should be a short text message describing the current status of the plugin.
SignalK server provides an interface to allow Plugins to:
These functions are available via the app object passed to the plugin when it is invoked.
Typing is incomplete. If you find a missing or inaccurate type, please report it.