dsc-itv2-client 1.0.19 → 1.0.20

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/ITV2Client.js +30 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsc-itv2-client",
3
3
  "author": "fajitacat",
4
- "version": "1.0.19",
4
+ "version": "1.0.20",
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
@@ -207,6 +207,36 @@ export class ITV2Client extends EventEmitter {
207
207
  this._sendPacket(packet);
208
208
  }
209
209
 
210
+ // ==================== Authentication Methods ====================
211
+
212
+ /**
213
+ * Authenticate with access code to enable privileged commands (0x0400)
214
+ * May be required before status queries work
215
+ * @param {number} partition - Partition number (1-8, or 0 for all)
216
+ * @param {string} code - User/master code (e.g., "5555")
217
+ * @param {number} accessLevel - 0=User, 1=Installer, 2=Master
218
+ */
219
+ authenticate(partition = 1, code, accessLevel = 0) {
220
+ if (!this._checkEstablished()) return;
221
+ const packet = this.session.buildAccessLevelEnter(
222
+ code || this.masterCode,
223
+ partition,
224
+ accessLevel,
225
+ 'bcd'
226
+ );
227
+ this._sendPacket(packet);
228
+ }
229
+
230
+ /**
231
+ * Exit authenticated access level (0x0401)
232
+ * @param {number} partition - Partition number
233
+ */
234
+ deauthenticate(partition = 1) {
235
+ if (!this._checkEstablished()) return;
236
+ const packet = this.session.buildAccessLevelExit(partition);
237
+ this._sendPacket(packet);
238
+ }
239
+
210
240
  // ==================== State Accessors ====================
211
241
 
212
242
  /**