Skip to content

Commit

Permalink
fix(uart): uart opening and closign at the right time
Browse files Browse the repository at this point in the history
  • Loading branch information
stoprocent committed Dec 17, 2024
1 parent fd7b168 commit df73718
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class BluetoothHciSocket extends EventEmitter {

start () {
if (this._mode === 'raw' || this._mode === 'user') {
this._serialDevice.open();
this._parser.removeAllListeners('data');
this._parser.on('data', (data) => {
if (this._isUp) {
Expand All @@ -156,6 +157,7 @@ class BluetoothHciSocket extends EventEmitter {
stop () {
if (this._mode === 'raw' || this._mode === 'user') {
this._parser.removeAllListeners('data');
this._serialDevice.close();
}
}

Expand Down

0 comments on commit df73718

Please sign in to comment.