@signalk/streams 3.1.0 → 4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/logging.js +5 -1
- package/package.json +3 -3
- package/serialport.js +5 -0
- package/simple.js +10 -0
- package/tcp.js +5 -0
package/logging.js
CHANGED
|
@@ -18,6 +18,7 @@ const { FileTimestampStream } = require('file-timestamp-stream')
|
|
|
18
18
|
const path = require('path')
|
|
19
19
|
let debug = require('debug')('signalk:streams:logging')
|
|
20
20
|
const fs = require('fs')
|
|
21
|
+
const { isUndefined } = require('lodash')
|
|
21
22
|
|
|
22
23
|
const filenamePattern = /skserver\-raw\_\d\d\d\d\-\d\d\-\d\dT\d\d\.log/
|
|
23
24
|
const loggers = {}
|
|
@@ -85,7 +86,10 @@ function getLogger(app, discriminator = '', logdir) {
|
|
|
85
86
|
debug(`logging to ${fileName}`)
|
|
86
87
|
|
|
87
88
|
let fileTimestampStream
|
|
88
|
-
if (
|
|
89
|
+
if (
|
|
90
|
+
isUndefined(app.config.settings.keepMostRecentLogsOnly) ||
|
|
91
|
+
app.config.settings.keepMostRecentLogsOnly
|
|
92
|
+
) {
|
|
89
93
|
// Delete old logs
|
|
90
94
|
fileTimestampStream = new FileTimestampStreamWithDelete(
|
|
91
95
|
app,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalk/streams",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "Utilities for handling streams of Signal K data",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/SignalK/signalk-server-node#readme",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@canboat/canboatjs": "^
|
|
25
|
+
"@canboat/canboatjs": "^2.0.0",
|
|
26
26
|
"@signalk/client": "^2.3.0",
|
|
27
|
-
"@signalk/n2k-signalk": "^
|
|
27
|
+
"@signalk/n2k-signalk": "^3.0.0-beta.1",
|
|
28
28
|
"@signalk/nmea0183-signalk": "^3.0.0",
|
|
29
29
|
"@signalk/nmea0183-utilities": "^0.8.0",
|
|
30
30
|
"@signalk/signalk-schema": "^1.5.0",
|
package/serialport.js
CHANGED
|
@@ -166,6 +166,11 @@ SerialStream.prototype.start = function () {
|
|
|
166
166
|
} else {
|
|
167
167
|
that.serial.write(d + '\r\n')
|
|
168
168
|
}
|
|
169
|
+
setImmediate(() => {
|
|
170
|
+
that.options.app.emit('connectionwrite', {
|
|
171
|
+
providerId: that.options.providerId,
|
|
172
|
+
})
|
|
173
|
+
})
|
|
169
174
|
pendingWrites++
|
|
170
175
|
that.serial.drain(onDrain)
|
|
171
176
|
})
|
package/simple.js
CHANGED
|
@@ -76,6 +76,16 @@ function Simple(options) {
|
|
|
76
76
|
) {
|
|
77
77
|
mappingType = 'NMEA2000YD'
|
|
78
78
|
}
|
|
79
|
+
options.app.on('nmea2000out', () => {
|
|
80
|
+
setImmediate(() =>
|
|
81
|
+
options.app.emit('connectionwrite', { providerId: options.providerId })
|
|
82
|
+
)
|
|
83
|
+
})
|
|
84
|
+
options.app.on('nmea2000JsonOut', () => {
|
|
85
|
+
setImmediate(() =>
|
|
86
|
+
options.app.emit('connectionwrite', { providerId: options.providerId })
|
|
87
|
+
)
|
|
88
|
+
})
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
const pipeline = [].concat(
|
package/tcp.js
CHANGED
|
@@ -53,6 +53,11 @@ TcpStream.prototype.pipe = function (pipeTo) {
|
|
|
53
53
|
if (that.tcpStream) {
|
|
54
54
|
that.debug('sending %s', d)
|
|
55
55
|
that.tcpStream.write(d)
|
|
56
|
+
setImmediate(() => {
|
|
57
|
+
that.options.app.emit('connectionwrite', {
|
|
58
|
+
providerId: that.options.providerId,
|
|
59
|
+
})
|
|
60
|
+
})
|
|
56
61
|
}
|
|
57
62
|
})
|
|
58
63
|
}
|