dsc-itv2-client 1.0.20 → 1.0.21
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/package.json +1 -1
- package/src/ITV2Client.js +16 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsc-itv2-client",
|
|
3
3
|
"author": "fajitacat",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.21",
|
|
5
5
|
"description": "Reverse engineered DSC ITV2 Protocol Client Library for TL280R Communicator - Monitor and control DSC alarm panels",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"type": "module",
|
package/src/ITV2Client.js
CHANGED
|
@@ -210,13 +210,26 @@ export class ITV2Client extends EventEmitter {
|
|
|
210
210
|
// ==================== Authentication Methods ====================
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
* Authenticate with access code
|
|
214
|
-
*
|
|
213
|
+
* Authenticate with access code - simple format (0x0400)
|
|
214
|
+
* Uses 6-digit ASCII format matching interactive CLI
|
|
215
|
+
* @param {string} code - User/master code (e.g., "5555")
|
|
216
|
+
*/
|
|
217
|
+
authenticate(code) {
|
|
218
|
+
if (!this._checkEstablished()) return;
|
|
219
|
+
const codeStr = (code || this.masterCode).toString().padStart(6, '0').slice(0, 6);
|
|
220
|
+
const payload = Buffer.from(codeStr, 'ascii');
|
|
221
|
+
const packet = this.session.buildCommand(0x0400, payload);
|
|
222
|
+
this._sendPacket(packet);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Authenticate with access code - extended format (0x0400)
|
|
227
|
+
* Includes partition and access level metadata
|
|
215
228
|
* @param {number} partition - Partition number (1-8, or 0 for all)
|
|
216
229
|
* @param {string} code - User/master code (e.g., "5555")
|
|
217
230
|
* @param {number} accessLevel - 0=User, 1=Installer, 2=Master
|
|
218
231
|
*/
|
|
219
|
-
|
|
232
|
+
authenticateExtended(partition = 1, code, accessLevel = 0) {
|
|
220
233
|
if (!this._checkEstablished()) return;
|
|
221
234
|
const packet = this.session.buildAccessLevelEnter(
|
|
222
235
|
code || this.masterCode,
|