-
Notifications
You must be signed in to change notification settings - Fork 6
Add port initialization and validation for SerialCommunicator #22
base: GUIelectron
Are you sure you want to change the base?
Conversation
1. test all serial devices for AT COM support 1. proceed with first valid port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work, thanks @sabicalija 👍
console.log( | ||
`Found AT COM device at ${comName}` | ||
); | ||
port.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we use the parser event for a fully received line?
parser.on('data' ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I didn't know about this possibility.
Sure. I think you're right. It's probably better to safeguard the communication/transmission somehow.
this.getPorts = function() { | ||
if(_port) { | ||
var list = new Array(); | ||
_port.list().forEach( function(port) { | ||
list.push(port['path'] + port['manufacturer']); | ||
}); | ||
return list; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep
I've implemented the search strategy as discussed today. The easiest solution I could come up with is to provide a
init()
function forSerialCommunicator
.The
init()
function returns aPromise
which is resolved after the correct port is set.I've changed the communication with the serial device a bit. Right now the program tests if the serial device responds with
FABI v2.3
after anAT ID
command. This should be changed of course for the correct device (i.e., FlipMouse).Wouldn't it be better to test for multiple FlipMouse devices and let the user select which one should be used?