File tree Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,22 @@ daemon.devicesList.subscribe(({serial, network}) => {
38
38
// Open serial monitor
39
39
daemon .openSerialMonitor (' port-name' );
40
40
41
- // Read from serial monitor
41
+ // Read from serial monitor (ouputs string)
42
42
daemon .serialMonitorMessages .subscribe (message => {
43
43
console .log (message);
44
44
});
45
45
46
+ // Read from serial monitor, output object with source port name
47
+ /*
48
+ {
49
+ "P": "dev/ttyACM0",
50
+ "D":"output text here\r\n"
51
+ }
52
+ */
53
+ daemon .serialMonitorMessagesWithPort .subscribe (messageObj => {
54
+ console .log (messageObj);
55
+ });
56
+
46
57
// Write to serial monitor
47
58
daemon .writeSerial (' port-name' , ' message' );
48
59
@@ -72,7 +83,7 @@ daemon.downloading.subscribe(download => {
72
83
73
84
## Version 2
74
85
75
- Version 2 of the arduino-create-agent aims to provide a cleaner api based on promises.
86
+ Version 2 of the arduino-create-agent aims to provide a cleaner api based on promises.
76
87
It will remain confined to a v2 property on the daemon object until it will be stable.
77
88
At the moment it only supports tool management.
78
89
Original file line number Diff line number Diff line change @@ -134,6 +134,10 @@ class App extends React.Component {
134
134
scrollToBottom ( serialTextarea ) ;
135
135
} ) ;
136
136
137
+ daemon . serialMonitorMessagesWithPort . subscribe ( messageObj => {
138
+ console . log ( messageObj ) ;
139
+ } ) ;
140
+
137
141
daemon . uploading . subscribe ( upload => {
138
142
this . setState ( { uploadStatus : upload . status , uploadError : upload . err } ) ;
139
143
// console.log(upload);
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ export default class Daemon {
50
50
this . appMessages = new Subject ( ) ;
51
51
this . serialMonitorOpened = new BehaviorSubject ( false ) ;
52
52
this . serialMonitorMessages = new Subject ( ) ;
53
+ this . serialMonitorMessagesWithPort = new Subject ( ) ;
53
54
this . uploading = new BehaviorSubject ( { status : this . UPLOAD_NOPE } ) ;
54
55
this . uploadingDone = this . uploading . pipe ( filter ( upload => upload . status === this . UPLOAD_DONE ) )
55
56
. pipe ( first ( ) )
Original file line number Diff line number Diff line change @@ -240,6 +240,7 @@ export default class SocketDaemon extends Daemon {
240
240
// Serial monitor message
241
241
if ( message . D ) {
242
242
this . serialMonitorMessages . next ( message . D ) ;
243
+ this . serialMonitorMessagesWithPort . next ( message ) ;
243
244
}
244
245
245
246
if ( message . ProgrammerStatus ) {
You can’t perform that action at this time.
0 commit comments