@pmouli/isy-matter-server
Version:
Service to expose an ISY device as a Matter Border router
42 lines • 1.39 kB
JavaScript
import { ISYDeviceNode } from './Devices/ISYDeviceNode.js';
export var ISYDevice;
(function (ISYDevice) {
function isDevice(device) {
return device instanceof ISYDeviceNode;
}
ISYDevice.isDevice = isDevice;
function isNode(factoryOrDevice) {
if ('Class' in factoryOrDevice) {
return 'Drivers' in factoryOrDevice;
}
return factoryOrDevice instanceof ISYDeviceNode;
}
ISYDevice.isNode = isNode;
function isDynamic(node) {
return 'nodeTypeId' in node;
}
ISYDevice.isDynamic = isDynamic;
function isNodeFactory(factory) {
return 'Drivers' in factory;
}
ISYDevice.isNodeFactory = isNodeFactory;
function isComposite(deviceOrFactory) {
if ('Class' in deviceOrFactory)
return 'Nodes' in deviceOrFactory;
return 'root' in deviceOrFactory;
}
ISYDevice.isComposite = isComposite;
function isQueryable(device) {
if (device?.commands && typeof device.commands == 'object')
return 'QUERY' in device.commands;
return false;
}
ISYDevice.isQueryable = isQueryable;
})(ISYDevice || (ISYDevice = {}));
export function isDevice(device) {
return device instanceof ISYDeviceNode;
}
export function isDeviceClass(device) {
return device.prototype instanceof ISYDeviceNode;
}
//# sourceMappingURL=ISYDevice.js.map