Devices
属性
| facilityID (integer) - read only |
|---|
| facilityID 属性获取设备所属设施的唯一标识符 |
| 示例 |
| let devices = env.facility.devices; env.log(devices.facilityID) |
| count (integer) - read only |
|---|
| count 属性获取设施中存在的设备数量 |
| 示例 |
| let devices = env.facility.devices; env.log(devices.count) |
方法
| byAddress(string deviceAddress) |
|---|
| byAddress 方法返回地址与 deviceAddress 参数中指定地址匹配的设备对象。如果未找到具有指定地址的设备,该方法返回 null。更多信息请参见 device |
| 示例 |
| let devices = env.facility.devices; let device = devices.byAddress('1') env.log(device) |
| byIndex(integer index) |
|---|
| byIndex 方法返回索引与 index 参数中指定索引匹配的设备对象。值为零等同于第一个设备。如果未找到具有指定索引的设备,该方法返回 null。更多信息请参见 device |
| 示例 |
| let devices = env.facility.devices; let device = devices.byIndex(0) env.log(device) |
| toArray() |
|---|
| toArray 方法返回设备对象的数组。更多信息请参见 device |
| 示例 |
| let devices = env.facility.devices; let deviceArr = devices.toArray() env.log(deviceArr) |