@stoprocent/noble 2.3.7 → 2.3.8
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.
package/lib/hci-socket/hci.js
CHANGED
|
@@ -158,20 +158,29 @@ Hci.prototype.init = function (options) {
|
|
|
158
158
|
this._socket.on('error', this.onSocketError.bind(this));
|
|
159
159
|
this._socket.on('state', this.pollIsDevUp.bind(this));
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
try {
|
|
162
|
+
// Bind first (either user channel or raw)
|
|
163
|
+
if (this._userChannel) {
|
|
164
|
+
this._socket.bindUser(this._deviceId, this._bindParams);
|
|
165
|
+
} else {
|
|
166
|
+
if (!this._bound) {
|
|
167
|
+
this._socket.bindRaw(this._deviceId, this._bindParams);
|
|
168
|
+
this._bound = true;
|
|
169
|
+
}
|
|
170
170
|
}
|
|
171
|
+
|
|
172
|
+
// Start and reset (common to both paths)
|
|
171
173
|
this._socket.start();
|
|
172
|
-
this._isStarted = true;
|
|
173
174
|
this.reset();
|
|
174
|
-
|
|
175
|
+
|
|
176
|
+
// Set started flag and poll only for non-userChannel
|
|
177
|
+
if (!this._userChannel) {
|
|
178
|
+
this._isStarted = true;
|
|
179
|
+
this.pollIsDevUp();
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
debug(`init error: ${error.message}`);
|
|
183
|
+
this.emit('stateChange', 'unsupported');
|
|
175
184
|
}
|
|
176
185
|
};
|
|
177
186
|
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|