gpt4 book ai didi

com.zsmartsystems.zigbee.zcl.ZclAttribute.isLastValueCurrent()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 22:55:31 25 4
gpt4 key购买 nike

本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.isLastValueCurrent()方法的一些代码示例,展示了ZclAttribute.isLastValueCurrent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZclAttribute.isLastValueCurrent()方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.zcl.ZclAttribute
类名称:ZclAttribute
方法名:isLastValueCurrent

ZclAttribute.isLastValueCurrent介绍

[英]Checks if the last value received for the attribute is still current. If the last update time is more recent than the allowedAge then this will return true. allowedAge is defined in milliseconds.
[中]检查为属性接收的最后一个值是否仍然是当前值。如果上一次更新时间比允许的时间更晚,则返回true。allowedAge是以毫秒为单位定义的。

代码示例

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>APSTxUcastRetry</i> attribute [attribute ID <b>266</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getApsTxUcastRetry(final long refreshPeriod) {
  if (attributes.get(ATTR_APSTXUCASTRETRY).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_APSTXUCASTRETRY).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_APSTXUCASTRETRY));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>NeighborStale</i> attribute [attribute ID <b>271</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getNeighborStale(final long refreshPeriod) {
  if (attributes.get(ATTR_NEIGHBORSTALE).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_NEIGHBORSTALE).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_NEIGHBORSTALE));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>JoinIndication</i> attribute [attribute ID <b>272</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getJoinIndication(final long refreshPeriod) {
  if (attributes.get(ATTR_JOININDICATION).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_JOININDICATION).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_JOININDICATION));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>APSUnauthorizedKey</i> attribute [attribute ID <b>276</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getApsUnauthorizedKey(final long refreshPeriod) {
  if (attributes.get(ATTR_APSUNAUTHORIZEDKEY).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_APSUNAUTHORIZEDKEY).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_APSUNAUTHORIZEDKEY));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>APSDecryptFailures</i> attribute [attribute ID <b>278</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getApsDecryptFailures(final long refreshPeriod) {
  if (attributes.get(ATTR_APSDECRYPTFAILURES).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_APSDECRYPTFAILURES).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_APSDECRYPTFAILURES));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>IAS_CIE_Address</i> attribute [attribute ID <b>16</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link IeeeAddress}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link IeeeAddress} attribute value, or null on error
 */
public IeeeAddress getIasCieAddress(final long refreshPeriod) {
  if (attributes.get(ATTR_IAS_CIE_ADDRESS).isLastValueCurrent(refreshPeriod)) {
    return (IeeeAddress) attributes.get(ATTR_IAS_CIE_ADDRESS).getLastValue();
  }
  return (IeeeAddress) readSync(attributes.get(ATTR_IAS_CIE_ADDRESS));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>OffTime</i> attribute [attribute ID <b>16385</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is 
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getOffTime(final long refreshPeriod) {
  if (attributes.get(ATTR_OFFTIME).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_OFFTIME).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_OFFTIME));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>BatteryVoltageThreshold2</i> attribute [attribute ID <b>56</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is OPTIONAL
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getBatteryVoltageThreshold2(final long refreshPeriod) {
  if (attributes.get(ATTR_BATTERYVOLTAGETHRESHOLD2).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_BATTERYVOLTAGETHRESHOLD2).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_BATTERYVOLTAGETHRESHOLD2));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>BatteryPercentageThreshold1</i> attribute [attribute ID <b>59</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is OPTIONAL
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getBatteryPercentageThreshold1(final long refreshPeriod) {
  if (attributes.get(ATTR_BATTERYPERCENTAGETHRESHOLD1).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_BATTERYPERCENTAGETHRESHOLD1).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_BATTERYPERCENTAGETHRESHOLD1));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>ManufacturerID</i> attribute [attribute ID <b>7</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is OPTIONAL
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getManufacturerId(final long refreshPeriod) {
  if (attributes.get(ATTR_MANUFACTURERID).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_MANUFACTURERID).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_MANUFACTURERID));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>MacRxUcast</i> attribute [attribute ID <b>258</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getMacRxUcast(final long refreshPeriod) {
  if (attributes.get(ATTR_MACRXUCAST).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_MACRXUCAST).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_MACRXUCAST));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>MacTxUcastFail</i> attribute [attribute ID <b>261</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getMacTxUcastFail(final long refreshPeriod) {
  if (attributes.get(ATTR_MACTXUCASTFAIL).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_MACTXUCASTFAIL).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_MACTXUCASTFAIL));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>APSRxBcast</i> attribute [attribute ID <b>262</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getApsRxBcast(final long refreshPeriod) {
  if (attributes.get(ATTR_APSRXBCAST).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_APSRXBCAST).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_APSRXBCAST));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>APSTxBcast</i> attribute [attribute ID <b>263</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getApsTxBcast(final long refreshPeriod) {
  if (attributes.get(ATTR_APSTXBCAST).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_APSTXBCAST).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_APSTXBCAST));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>RouteDiscInitiated</i> attribute [attribute ID <b>268</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getRouteDiscInitiated(final long refreshPeriod) {
  if (attributes.get(ATTR_ROUTEDISCINITIATED).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_ROUTEDISCINITIATED).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_ROUTEDISCINITIATED));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>NWKDecryptFailures</i> attribute [attribute ID <b>277</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getNwkDecryptFailures(final long refreshPeriod) {
  if (attributes.get(ATTR_NWKDECRYPTFAILURES).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_NWKDECRYPTFAILURES).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_NWKDECRYPTFAILURES));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>LastMessageLQI</i> attribute [attribute ID <b>284</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getLastMessageLqi(final long refreshPeriod) {
  if (attributes.get(ATTR_LASTMESSAGELQI).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_LASTMESSAGELQI).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_LASTMESSAGELQI));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>ScaledValue</i> attribute [attribute ID <b>16</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is OPTIONAL
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getScaledValue(final long refreshPeriod) {
  if (attributes.get(ATTR_SCALEDVALUE).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_SCALEDVALUE).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_SCALEDVALUE));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
 * Synchronously get the <i>LocationMethod</i> attribute [attribute ID <b>1</b>].
 * <p>
 * This method can return cached data if the attribute has already been received.
 * The parameter <i>refreshPeriod</i> is used to control this. If the attribute has been received
 * within <i>refreshPeriod</i> milliseconds, then the method will immediately return the last value
 * received. If <i>refreshPeriod</i> is set to 0, then the attribute will always be updated.
 * <p>
 * This method will block until the response is received or a timeout occurs unless the current value is returned.
 * <p>
 * The attribute is of type {@link Integer}.
 * <p>
 * The implementation of this attribute by a device is MANDATORY
 *
 * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed
 * @return the {@link Integer} attribute value, or null on error
 */
public Integer getLocationMethod(final long refreshPeriod) {
  if (attributes.get(ATTR_LOCATIONMETHOD).isLastValueCurrent(refreshPeriod)) {
    return (Integer) attributes.get(ATTR_LOCATIONMETHOD).getLastValue();
  }
  return (Integer) readSync(attributes.get(ATTR_LOCATIONMETHOD));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
  public void getLastReportTime() {
    ZclAttribute attribute = new ZclAttribute(ZclClusterType.ON_OFF, 0, "Test Name",
        ZclDataType.UNSIGNED_8_BIT_INTEGER, false, false, false, false);

    // No value has been set, so should always be false
    assertFalse(attribute.isLastValueCurrent(Long.MAX_VALUE));

    Calendar start = Calendar.getInstance();
    attribute.updateValue(0);
    Calendar stop = Calendar.getInstance();

    assertEquals(0, attribute.getLastValue());
    assertTrue(attribute.getLastReportTime().compareTo(start) >= 0);
    assertTrue(attribute.getLastReportTime().compareTo(stop) <= 0);

    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    assertFalse(attribute.isLastValueCurrent(50));
    assertTrue(attribute.isLastValueCurrent(Long.MAX_VALUE));
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com