mirror of
https://github.com/sbender9/signalk-raymarine-autopilot.git
synced 2020-11-18 19:37:28 -08:00
Updated to latest plugin stuff
This commit is contained in:
parent
12f75e991b
commit
e07658b21a
16
index.js
16
index.js
@ -43,15 +43,19 @@ const state_path = "steering.autopilot.state.value"
|
|||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
var unsubscribe = undefined
|
var unsubscribe = undefined
|
||||||
var plugin = {}
|
var plugin = {}
|
||||||
|
var deviceid
|
||||||
|
|
||||||
plugin.start = function(props) {
|
plugin.start = function(props) {
|
||||||
debug("starting...")
|
debug("starting...")
|
||||||
|
deviceid = props.deviceid
|
||||||
sendCommand(app, props.devicid, { "action": "changeHeading", "value": 10 })
|
|
||||||
//sendCommand(app, props.devicid, { "action": "advanceWaypoint" })
|
|
||||||
debug("started")
|
debug("started")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin.executeCommand = function(json) {
|
||||||
|
debug("executeCommand: " + util.inspect(json, {showHidden: false, depth: null}))
|
||||||
|
sendCommand(app, deviceid, json)
|
||||||
|
}
|
||||||
|
|
||||||
plugin.stop = function() {
|
plugin.stop = function() {
|
||||||
debug("stopping")
|
debug("stopping")
|
||||||
if (unsubscribe) {
|
if (unsubscribe) {
|
||||||
@ -148,15 +152,15 @@ function sendCommand(app, deviceid, command_json)
|
|||||||
var n2k_msgs = null
|
var n2k_msgs = null
|
||||||
var action = command_json["action"]
|
var action = command_json["action"]
|
||||||
debug("action: " + action)
|
debug("action: " + action)
|
||||||
if ( action === "setState" )
|
if ( action == "setState" )
|
||||||
{
|
{
|
||||||
n2k_msgs = setState(app, deviceid, command_json)
|
n2k_msgs = setState(app, deviceid, command_json)
|
||||||
}
|
}
|
||||||
else if ( action === "changeHeading" )
|
else if ( action == "changeHeading" )
|
||||||
{
|
{
|
||||||
n2k_msgs = changeHeading(app, deviceid, command_json)
|
n2k_msgs = changeHeading(app, deviceid, command_json)
|
||||||
}
|
}
|
||||||
else if ( action === 'advanceWaypoint' )
|
else if ( action == 'advanceWaypoint' )
|
||||||
{
|
{
|
||||||
n2k_msgs = advanceWaypoint(app, deviceid, command_json)
|
n2k_msgs = advanceWaypoint(app, deviceid, command_json)
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baconjs": "^0.7.88",
|
"baconjs": "^0.7.88",
|
||||||
"debug": "^2.2.0"
|
"debug": "^2.2.0",
|
||||||
|
"lodash": "^3.10.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user