dsc-itv2-client 1.0.28 → 1.0.29

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsc-itv2-client",
3
3
  "author": "fajitacat",
4
- "version": "1.0.28",
4
+ "version": "1.0.29",
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
@@ -943,13 +943,13 @@ export class ITV2Client extends EventEmitter {
943
943
  _log(message) {
944
944
  if (this.logLevel === 'verbose') {
945
945
  const timestamp = new Date().toISOString();
946
- console.log(`[${timestamp}] ${message}`);
946
+ console.log(`dsc itv2: [${timestamp}] ${message}`);
947
947
  }
948
948
  }
949
949
 
950
950
  _logMinimal(message) {
951
951
  if (this.logLevel === 'minimal' || this.logLevel === 'verbose') {
952
- console.log(message);
952
+ console.log(`dsc itv2: ${message}`);
953
953
  }
954
954
  }
955
955
 
@@ -966,7 +966,7 @@ export class ITV2Client extends EventEmitter {
966
966
  .join('');
967
967
 
968
968
  const offset = i.toString(16).padStart(4, '0').toUpperCase();
969
- console.log(`${offset} ${hex.padEnd(48)} |${ascii}|`);
969
+ console.log(`dsc itv2: ${offset} ${hex.padEnd(48)} |${ascii}|`);
970
970
  }
971
971
  }
972
972
  }
@@ -845,9 +845,10 @@ export class ITv2Session {
845
845
  * @returns {Buffer} - Complete packet ready to send
846
846
  */
847
847
  buildCommandRequest(innerCommand, innerPayload = Buffer.alloc(0)) {
848
- // Get next application sequence number
849
- const appSeq = this.appSequence;
850
- this.appSequence = (this.appSequence + 1) & 0xFF;
848
+ // Predict the appSeq that buildCommand will assign (it increments before using).
849
+ // The inner 0x0800 AppSequenceNumber MUST match the outer frame appSeq
850
+ // the panel uses the inner appSeq to correlate follow-up data responses.
851
+ const appSeq = (this.appSequence + 1) & 0xFF;
851
852
 
852
853
  // Build 0x0800 payload: [AppSeqNum][CommandToRequest 2B BE][ByteArray(InnerPayload)]
853
854
  // SDK uses StoreByteArray with sizeMode=-1 (VarBytes length prefix)