File tree Expand file tree Collapse file tree 5 files changed +107
-1
lines changed Expand file tree Collapse file tree 5 files changed +107
-1
lines changed Original file line number Diff line number Diff line change 16
16
"signalk-send-delta" : " signalk-send-delta.js" ,
17
17
"signalk-send-pathvalue" : " signalk-send-pathvalue.js" ,
18
18
"signalk-send-put" : " signalk-send-put.js" ,
19
- "signalk-send-notification" : " signalk-send-notification.js"
19
+ "signalk-send-notification" : " signalk-send-notification.js" ,
20
+ "signalk-send-nmea2000" : " signalk-send-nmea2000.js" ,
21
+ "signalk-send-nmea0183" : " signalk-send-nmea0183.js"
20
22
}
21
23
}
22
24
}
Original file line number Diff line number Diff line change
1
+ < script type ="text/javascript ">
2
+ RED . nodes . registerType ( 'signalk-send-nmea0183' , {
3
+ category : 'output' ,
4
+ color : '#a6bbcf' ,
5
+ defaults : {
6
+ name : { value :"" } ,
7
+ nmea0183Event : { value : "nmea0183out" }
8
+ } ,
9
+ inputs :1 ,
10
+ outputs :0 ,
11
+ icon : "bridge.png" ,
12
+ align : 'right' ,
13
+ label : function ( ) {
14
+ return this . name || "signalk-send-nmea0183" ;
15
+ }
16
+ } ) ;
17
+ </ script >
18
+
19
+ < script type ="text/x-red " data-template-name ="signalk-send-nmea0183 ">
20
+ < div class = "form-row" >
21
+ < label for = "node-input-name" > < i class = "icon-tag" > </ i > Name</ label >
22
+ < input type = "text" id = "node-input-name" placeholder = "Name" >
23
+ </ div >
24
+ < div class = "form-row" >
25
+ < label for = "node-input-nmea0183Event" > < i class = "icon-tag" > </ i > NMEA0183 Event</ label >
26
+ < input type = "text" id = "node-input-nmea0183Event" placeholder = "NMEA0183 Event" >
27
+ </ div >
28
+ </ script >
29
+
30
+ < script type ="text/x-red " data-help-name ="signalk-send-nmea0183 ">
31
+ < p > Output that sends out NMEA 0183 messages. Input payload can be an 0183 formatted string. </ p >
32
+ </ script >
Original file line number Diff line number Diff line change
1
+
2
+
3
+ module . exports = function ( RED ) {
4
+ function send ( config ) {
5
+ RED . nodes . createNode ( this , config ) ;
6
+ var node = this ;
7
+
8
+ let app = node . context ( ) . global . get ( 'app' )
9
+
10
+ node . on ( 'input' , msg => {
11
+ app . emit ( config . nmea0183Event , msg . payload )
12
+ } )
13
+ }
14
+ RED . nodes . registerType ( "signalk-send-nmea0183" , send ) ;
15
+ }
Original file line number Diff line number Diff line change
1
+ < script type ="text/javascript ">
2
+ RED . nodes . registerType ( 'signalk-send-nmea2000' , {
3
+ category : 'output' ,
4
+ color : '#a6bbcf' ,
5
+ defaults : {
6
+ name : { value :"" } ,
7
+ nmea2000Event : { value : "nmea2000out" } ,
8
+ nmea2000JsonEvent : { value : "nmea2000JsonOut" }
9
+ } ,
10
+ inputs :1 ,
11
+ outputs :0 ,
12
+ icon : "bridge.png" ,
13
+ align : 'right' ,
14
+ label : function ( ) {
15
+ return this . name || "signalk-send-nmea2000" ;
16
+ }
17
+ } ) ;
18
+ </ script >
19
+
20
+ < script type ="text/x-red " data-template-name ="signalk-send-nmea2000 ">
21
+ < div class = "form-row" >
22
+ < label for = "node-input-name" > < i class = "icon-tag" > </ i > Name</ label >
23
+ < input type = "text" id = "node-input-name" placeholder = "Name" >
24
+ </ div >
25
+ < div class = "form-row" >
26
+ < label for = "node-input-nmea2000Event" > < i class = "icon-tag" > </ i > NMEA2000 Event</ label >
27
+ < input type = "text" id = "node-input-nmea2000Event" placeholder = "NMEA2000 Event" >
28
+ </ div >
29
+ < div class = "form-row" >
30
+ < label for = "node-input-nmea2000JsonEvent" > < i class = "icon-tag" > </ i > NMEA2000 Json Event</ label >
31
+ < input type = "text" id = "node-input-nmea2000JsonEvent" placeholder = "NMEA2000 Json Event" >
32
+ </ div >
33
+ </ script >
34
+
35
+ < script type ="text/x-red " data-help-name ="signalk-send-nmea2000 ">
36
+ < p > Output that sends out NMEA 2000 messages. Input payload can be canboat json format or a raw Actisense formatted string </ p >
37
+ </ script >
Original file line number Diff line number Diff line change
1
+
2
+
3
+ module . exports = function ( RED ) {
4
+ function send ( config ) {
5
+ RED . nodes . createNode ( this , config ) ;
6
+ var node = this ;
7
+
8
+ let app = node . context ( ) . global . get ( 'app' )
9
+ let _ = node . context ( ) . global . get ( 'lodash' )
10
+
11
+ node . on ( 'input' , msg => {
12
+ if ( _ . isObject ( msg . payload ) ) {
13
+ app . emit ( config . nmea2000JsonEvent , msg . payload )
14
+ } else {
15
+ app . emit ( config . nmea2000Event , msg . payload )
16
+ }
17
+ } )
18
+ }
19
+ RED . nodes . registerType ( "signalk-send-nmea2000" , send ) ;
20
+ }
You can’t perform that action at this time.
0 commit comments