incyclist-devices 2.0.10 → 2.0.11

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.
@@ -176,20 +176,22 @@ class SerialInterface extends events_1.default {
176
176
  openPort(path) {
177
177
  return __awaiter(this, void 0, void 0, function* () {
178
178
  this.logEvent({ message: 'opening port', path });
179
- const port = serialport_1.default.getInstance().getSerialPort(this.ifaceName, { path });
180
- if (!port) {
181
- return null;
182
- }
183
179
  const existing = this.ports.findIndex(p => p.path === path);
184
180
  if (existing !== -1) {
185
181
  const port = this.ports[existing].port;
186
182
  if (port.isOpen) {
183
+ this.logEvent({ message: 'opening port - port already exists', path });
187
184
  return port;
188
185
  }
189
186
  else {
190
187
  this.ports.splice(existing, 1);
191
188
  }
192
189
  }
190
+ this.logEvent({ message: 'opening port - getSerialPort()', path });
191
+ const port = serialport_1.default.getInstance().getSerialPort(this.ifaceName, { path });
192
+ if (!port) {
193
+ return null;
194
+ }
193
195
  return new Promise((resolve) => {
194
196
  port.once('error', (err) => {
195
197
  this.logEvent({ message: 'error', path, error: err.message || err });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "dependencies": {
5
5
  "@serialport/bindings-interface": "^1.2.2",
6
6
  "@serialport/parser-byte-length": "^9.0.1",