dsc-itv2-client 1.0.27 → 1.0.28

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.27",
4
+ "version": "1.0.28",
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",
@@ -849,14 +849,16 @@ export class ITv2Session {
849
849
  const appSeq = this.appSequence;
850
850
  this.appSequence = (this.appSequence + 1) & 0xFF;
851
851
 
852
- // Build 0x0800 payload: [AppSeqNum][CommandToRequest BE][InnerPayload]
853
- const payload = Buffer.alloc(3 + innerPayload.length);
852
+ // Build 0x0800 payload: [AppSeqNum][CommandToRequest 2B BE][ByteArray(InnerPayload)]
853
+ // SDK uses StoreByteArray with sizeMode=-1 (VarBytes length prefix)
854
+ const wrappedPayload = this.encodeByteArray(innerPayload);
855
+ const payload = Buffer.alloc(3 + wrappedPayload.length);
854
856
  payload[0] = appSeq;
855
857
  payload.writeUInt16BE(innerCommand, 1); // Command in big-endian (per SDK CUInt16Map::StoreValue)
856
- innerPayload.copy(payload, 3);
858
+ wrappedPayload.copy(payload, 3);
857
859
 
858
860
  this.log(`[Session] Building 0x0800 Command Request: innerCmd=0x${innerCommand.toString(16)}, appSeq=${appSeq}`);
859
- this.log(`[Session] Inner payload: ${innerPayload.toString('hex')}`);
861
+ this.log(`[Session] Inner payload: ${innerPayload.toString('hex')}, wrapped: ${wrappedPayload.toString('hex')}`);
860
862
 
861
863
  return this.buildCommand(CMD.STATUS_REQUEST, payload);
862
864
  }