private void DisplayOnOffStatus() { ZclAttribute attributeOnOff = null; System.Object value; var onOffcluster = m_testedEndPoint.GetCluster(OnOffCluster.CLUSTER_ID); if (onOffcluster != null) { onOffcluster.InternalAttributeList.TryGetValue(OnOffCluster.ATTRIBUTE_ONOFF, out attributeOnOff); } if (attributeOnOff.Read(out value)) { if (value is bool) { var isOn = (bool)value; if (isOn) { Debug.WriteLine(" -> Light is on"); } else { Debug.WriteLine(" -> Light is off"); } } } }
private void TestBitronHome() { ZclAttribute attribute = null; System.Object value; var IasZoneCluster = m_testedEndPoint.GetCluster(IASZoneCluster.CLUSTER_ID); if (IasZoneCluster == null) { Debug.WriteLine("ERROR - CAN'T GET BitronHome IAS Zone cluster !!!!"); return; } IasZoneCluster.InternalAttributeList.TryGetValue(IASZoneCluster.ATTRIBUTE_ZONESTATUS, out attribute); if (attribute != null && attribute.Read(out value) && value is UInt16) { Debug.WriteLine("IAS Zone status = {0}", value); } else { Debug.WriteLine("ERROR - IAS Zone status !!!!"); } IasZoneCluster.InternalAttributeList.TryGetValue(IASZoneCluster.ATTRIBUTE_ZONETYPE, out attribute); if (attribute != null && attribute.Read(out value) && value is UInt16) { Debug.WriteLine("IAS Zone type = {0}", value); } else { Debug.WriteLine("ERROR - IAS Zone type !!!!"); } IasZoneCluster.InternalAttributeList.TryGetValue(IASZoneCluster.ATTRIBUTE_ZONESTATE, out attribute); if (attribute != null && attribute.Read(out value) && value is byte) { Debug.WriteLine("IAS Zone state = {0}", value); } else { Debug.WriteLine("ERROR - IAS Zone state !!!!"); } IasZoneCluster.InternalAttributeList.TryGetValue(IASZoneCluster.ATTRIBUTE_IASCIEADDRESS, out attribute); if (attribute != null && attribute.Read(out value) && value is UInt64) { UInt64 macAddr = (UInt64)value; Debug.WriteLine("IAS Zone Cie address = 0x{0:X}", macAddr); if (macAddr == 0) { attribute.Write(m_zigBeeAdapter.MacAddress); } } else { Debug.WriteLine("ERROR - IAS Zone Cie Address !!!!"); } }