dsc-itv2-client 1.0.16 → 1.0.18

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 +10 -7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsc-itv2-client",
3
3
  "author": "fajitacat",
4
- "version": "1.0.16",
4
+ "version": "1.0.18",
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
@@ -198,18 +198,12 @@ export class ITV2Client extends EventEmitter {
198
198
  this.session = new ITv2Session(this.integrationId, this.accessCode, logger);
199
199
  }
200
200
 
201
- // DEBUG: Log all incoming packets
202
- this._logMinimal(`[DEBUG] RX ${data.length} bytes, state=${this.handshakeState}`);
203
-
204
201
  const parsed = this.session.parsePacket(data);
205
202
  if (!parsed) {
206
- this._logMinimal('[DEBUG] Failed to parse packet');
203
+ this._log('[Error] Failed to parse packet');
207
204
  return;
208
205
  }
209
206
 
210
- // DEBUG: Log parsed command
211
- this._logMinimal(`[DEBUG] Parsed cmd=${parsed.command} (${CMD_NAMES[parsed.command] || 'unknown'})`);
212
-
213
207
  // Verbose logging only
214
208
  this._log(`\n[UDP] RX from ${this.panelAddress}:${this.panelPort} (${data.length} bytes)`);
215
209
  this._hexDump(data);
@@ -486,6 +480,15 @@ export class ITV2Client extends EventEmitter {
486
480
  if (this.handshakeState === 'SENT_OPEN_SESSION') {
487
481
  // Panel accepted our OPEN_SESSION
488
482
  this.handshakeState = 'WAITING_REQUEST_ACCESS';
483
+ } else if (this.handshakeState === 'SENT_REQUEST_ACCESS') {
484
+ // Panel accepted our REQUEST_ACCESS - session established!
485
+ this.handshakeState = 'ESTABLISHED';
486
+ this._logMinimal(`[Handshake] Session established (Type ${this.detectedEncryptionType} encryption)`);
487
+ this.emit('session:established', {
488
+ encryptionType: this.detectedEncryptionType,
489
+ sendKey: this.session.derivedSendKey?.toString('hex'),
490
+ recvKey: this.session.pendingReceiveKey?.toString('hex')
491
+ });
489
492
  }
490
493
  }
491
494