Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add support for the Actisense W2K-1 #1524

Merged
merged 3 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/server-admin-ui/src/views/ServerConfig/BasicProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,12 @@ const NMEA2000 = (props) => {
Yacht Devices RAW USB (canboatjs)
</option>
<option value="canbus-canboatjs">Canbus (canboatjs)</option>
<option value="w2k-1-n2k-ascii-canboatjs">
W2K-1 N2K ASCII (canboatjs)
</option>
<option value="w2k-1-n2k-actisense-canboatjs">
W2K-1 N2K ACTISENSE (canboatjs)
</option>
<option value="canbus" disabled={!props.hasAnalyzer}>
Canbus (canboat)
</option>
Expand Down Expand Up @@ -805,6 +811,17 @@ const NMEA2000 = (props) => {
onChange={props.onChange}
/>
)}
{(props.value.options.type === 'w2k-1-n2k-ascii-canboatjs' ||
props.value.options.type === 'w2k-1-n2k-actisense-canboatjs') && (
<div>
<HostInput value={props.value.options} onChange={props.onChange} />
<PortInput value={props.value.options} onChange={props.onChange} />
<NoDataReceivedTimeoutInput
value={props.value.options}
onChange={props.onChange}
/>
</div>
)}
<UseCanNameInput value={props.value.options} onChange={props.onChange} />
</div>
)
Expand Down
36 changes: 35 additions & 1 deletion packages/streams/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const TimestampThrottle = require('./timestamp-throttle')
const CanboatJs = require('./canboatjs')
const iKonvert = require('@canboat/canboatjs').iKonvert
const Ydwg02 = require('@canboat/canboatjs').Ydwg02
const W2k01 = require('@canboat/canboatjs').W2k01
const gpsd = require('./gpsd')
const pigpioSeatalk = require('./pigpio-seatalk')

Expand Down Expand Up @@ -58,7 +59,9 @@ function Simple(options) {
if (options.type === 'NMEA2000' && options.subOptions) {
if (
options.subOptions.type === 'ngt-1-canboatjs' ||
options.subOptions.type === 'canbus-canboatjs'
options.subOptions.type === 'canbus-canboatjs' ||
options.subOptions.type === 'w2k-1-n2k-actisense-canboatjs' ||
options.subOptions.type === 'w2k-1-n2k-ascii-canboatjs'
) {
mappingType = 'NMEA2000JS'
} else if (
Expand Down Expand Up @@ -203,6 +206,20 @@ const dataTypeMapping = {
}
return result.concat([new N2kToSignalK(options.subOptions)])
},
NMEA2000W2K_ASCII: (options) => {
const result = [new W2k01({ format: 'ascii', ...options.subOptions })]
if (options.type === 'FileStream') {
result.push(new TimestampThrottle())
}
return result.concat([new N2kToSignalK(options.subOptions)])
},
NMEA2000W2K_ACTISENSE: (options) => {
const result = [new W2k01({ format: 'actisense', ...options.subOptions })]
if (options.type === 'FileStream') {
result.push(new TimestampThrottle())
}
return result.concat([new N2kToSignalK(options.subOptions)])
},
Multiplexed: (options) => [new MultiplexedLog(options.subOptions)],
}

Expand Down Expand Up @@ -268,6 +285,23 @@ function nmea2000input(subOptions, logging) {
}),
new Liner(subOptions),
]
} else if (subOptions.type === 'w2k-1-n2k-ascii-canboatjs') {
return [
new Tcp({
...subOptions,
outEvent: 'w2k-1-out',
}),
new Liner(subOptions),
new W2k01(subOptions, 'ascii', 'w2k-1-out'),
]
} else if (subOptions.type === 'w2k-1-n2k-actisense-canboatjs') {
return [
new Tcp({
...subOptions,
outEvent: 'w2k-1-out',
}),
new W2k01(subOptions, 'actisense', 'w2k-1-out'),
]
} else if (subOptions.type === 'navlink2-udp-canboatjs') {
return [new Udp(subOptions), new Liner(subOptions)]
} else if (subOptions.type === 'ydwg02-usb-canboatjs') {
Expand Down