dsc-itv2-client 1.0.18 → 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.
- package/package.json +1 -1
- package/src/ITV2Client.js +89 -2
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.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
|
@@ -152,18 +152,105 @@ export class ITV2Client extends EventEmitter {
|
|
|
152
152
|
this._sendPacket(packet);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
// ==================== Status Query Methods ====================
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Query global system status (0x0810)
|
|
159
|
+
* Note: May not be supported by all panels
|
|
160
|
+
*/
|
|
161
|
+
queryGlobalStatus() {
|
|
162
|
+
if (!this._checkEstablished()) return;
|
|
163
|
+
const packet = this.session.buildGlobalStatusRequest();
|
|
164
|
+
this._sendPacket(packet);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Query zone status (0x0811)
|
|
169
|
+
* @param {number} zone - Zone number (0 = all zones)
|
|
170
|
+
* Note: May not be supported by all panels
|
|
171
|
+
*/
|
|
172
|
+
queryZoneStatus(zone = 0) {
|
|
173
|
+
if (!this._checkEstablished()) return;
|
|
174
|
+
const packet = this.session.buildZoneStatusRequest(zone);
|
|
175
|
+
this._sendPacket(packet);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Query partition status (0x0812)
|
|
180
|
+
* @param {number} partition - Partition number (0 = all partitions)
|
|
181
|
+
* Note: May not be supported by all panels
|
|
182
|
+
*/
|
|
183
|
+
queryPartitionStatus(partition = 0) {
|
|
184
|
+
if (!this._checkEstablished()) return;
|
|
185
|
+
const packet = this.session.buildPartitionStatusRequest(partition);
|
|
186
|
+
this._sendPacket(packet);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Query zone bypass status (0x0813)
|
|
191
|
+
* @param {number} zone - Zone number (0 = all zones)
|
|
192
|
+
* Note: May not be supported by all panels
|
|
193
|
+
*/
|
|
194
|
+
queryZoneBypassStatus(zone = 0) {
|
|
195
|
+
if (!this._checkEstablished()) return;
|
|
196
|
+
const packet = this.session.buildZoneBypassStatusRequest(zone);
|
|
197
|
+
this._sendPacket(packet);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Query system trouble status (0x0814)
|
|
202
|
+
* Note: May not be supported by all panels
|
|
203
|
+
*/
|
|
204
|
+
queryTroubleStatus() {
|
|
205
|
+
if (!this._checkEstablished()) return;
|
|
206
|
+
const packet = this.session.buildTroubleStatusRequest();
|
|
207
|
+
this._sendPacket(packet);
|
|
208
|
+
}
|
|
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
|
+
|
|
240
|
+
// ==================== State Accessors ====================
|
|
241
|
+
|
|
155
242
|
/**
|
|
156
243
|
* Get current zone states
|
|
157
244
|
*/
|
|
158
245
|
getZones() {
|
|
159
|
-
return this.eventHandler.
|
|
246
|
+
return this.eventHandler.getAllZones();
|
|
160
247
|
}
|
|
161
248
|
|
|
162
249
|
/**
|
|
163
250
|
* Get current partition states
|
|
164
251
|
*/
|
|
165
252
|
getPartitions() {
|
|
166
|
-
return this.eventHandler.
|
|
253
|
+
return this.eventHandler.getAllPartitions();
|
|
167
254
|
}
|
|
168
255
|
|
|
169
256
|
// ==================== Internal Methods ====================
|