@stoprocent/noble
Advanced tools
+25
-19
@@ -550,3 +550,4 @@ const debug = require('debug')('hci'); | ||
| ) { | ||
| const cmd = Buffer.alloc(this._isExtended ? 17 : 11); | ||
| const useCodedPhy = this._isExtended && this._supportsCodedPhy; | ||
| const cmd = Buffer.alloc(this._isExtended ? (useCodedPhy ? 17 : 12) : 11); | ||
@@ -564,3 +565,3 @@ // header | ||
| // length | ||
| cmd.writeUInt8(0x0d, 3); | ||
| cmd.writeUInt8(useCodedPhy ? 0x0d : 0x08, 3); | ||
@@ -570,3 +571,3 @@ // data | ||
| cmd.writeUInt8(0x00, 5); // filter: 0 -> all event types | ||
| cmd.writeUInt8(0x05, 6); // phy: LE 1M + LE CODED | ||
| cmd.writeUInt8(useCodedPhy ? 0x05 : 0x01, 6); // phy: LE 1M, plus LE Coded when supported | ||
| // phy 1M | ||
@@ -576,6 +577,8 @@ cmd.writeUInt8(0x01, 7); // type: 0 -> passive, 1 -> active | ||
| cmd.writeUInt16LE(window, 10); // window, ms * 1.6 | ||
| // phy coded | ||
| cmd.writeUInt8(0x01, 12); // type: 0 -> passive, 1 -> active | ||
| cmd.writeUInt16LE(interval, 13); // interval, ms * 1.6 | ||
| cmd.writeUInt16LE(window, 15); // window, ms * 1.6 | ||
| if (useCodedPhy) { | ||
| // phy coded | ||
| cmd.writeUInt8(0x01, 12); // type: 0 -> passive, 1 -> active | ||
| cmd.writeUInt16LE(interval, 13); // interval, ms * 1.6 | ||
| cmd.writeUInt16LE(window, 15); // window, ms * 1.6 | ||
| } | ||
| } else { | ||
@@ -652,3 +655,4 @@ // length | ||
| const cmd = Buffer.alloc(this._isExtended ? 46 : 29); | ||
| const useCodedPhy = this._isExtended && this._supportsCodedPhy; | ||
| const cmd = Buffer.alloc(this._isExtended ? (useCodedPhy ? 46 : 30) : 29); | ||
@@ -666,3 +670,3 @@ // header | ||
| // length | ||
| cmd.writeUInt8(0x2a, 3); | ||
| cmd.writeUInt8(useCodedPhy ? 0x2a : 0x1a, 3); | ||
@@ -674,3 +678,3 @@ // data | ||
| Buffer.from(address.split(':').reverse().join(''), 'hex').copy(cmd, 7); // peer address | ||
| cmd.writeUInt8(0x05, 13); // initiating PHYs: LE 1M + LE Coded | ||
| cmd.writeUInt8(useCodedPhy ? 0x05 : 0x01, 13); // initiating PHYs: LE 1M, plus LE Coded when supported | ||
@@ -687,11 +691,13 @@ // LE 1M PHY | ||
| // LE Coded PHY | ||
| cmd.writeUInt16LE(0x0060, 30); // scan interval 60 msec | ||
| cmd.writeUInt16LE(0x0060, 32); // scan window 60 msec | ||
| cmd.writeUInt16LE(minInterval, 34); // min interval | ||
| cmd.writeUInt16LE(maxInterval, 36); // max interval | ||
| cmd.writeUInt16LE(latency, 38); // latency | ||
| cmd.writeUInt16LE(timeout, 40); // supervision timeout | ||
| cmd.writeUInt16LE(0x0000, 42); // min ce length | ||
| cmd.writeUInt16LE(0x0000, 44); // max ce length | ||
| if (useCodedPhy) { | ||
| // LE Coded PHY | ||
| cmd.writeUInt16LE(0x0060, 30); // scan interval 60 msec | ||
| cmd.writeUInt16LE(0x0060, 32); // scan window 60 msec | ||
| cmd.writeUInt16LE(minInterval, 34); // min interval | ||
| cmd.writeUInt16LE(maxInterval, 36); // max interval | ||
| cmd.writeUInt16LE(latency, 38); // latency | ||
| cmd.writeUInt16LE(timeout, 40); // supervision timeout | ||
| cmd.writeUInt16LE(0x0000, 42); // min ce length | ||
| cmd.writeUInt16LE(0x0000, 44); // max ce length | ||
| } | ||
| } else { | ||
@@ -698,0 +704,0 @@ // length |
+1
-1
@@ -9,3 +9,3 @@ { | ||
| "description": "A Node.js BLE (Bluetooth Low Energy) central library.", | ||
| "version": "2.7.0", | ||
| "version": "2.7.1", | ||
| "repository": { | ||
@@ -12,0 +12,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
2578257
0.06%18909
0.13%