public boolean notifyZclFrame(short clusterId, IZclFrame zclFrame) throws Exception { boolean handled; handled = super.notifyZclFrame(clusterId, zclFrame); if (handled) { return handled; } int commandId = zclFrame.getCommandId(); if (zclFrame.isClientToServer()) { throw new ZclValidationException("invalid direction field"); } IZclFrame responseZclFrame = null; ZigBeeDevice device = getZigBeeDevice(); int statusCode = ZCL.SUCCESS; IASZoneClient c = ((IASZoneClient) getSinglePeerCluster((IASZoneClient.class.getName()))); switch (commandId) { case 0: responseZclFrame = parseZoneStatusChangeNotification(c, zclFrame); break; case 1: responseZclFrame = parseZoneEnrollRequest(c, zclFrame); break; default: return false; } if (responseZclFrame == null) { if (!zclFrame.isDefaultResponseDisabled()) { responseZclFrame = getDefaultResponse(zclFrame, statusCode); } } else { device.post(ZclIASZoneServer.CLUSTER_ID, responseZclFrame); } return true; }
public void setIAS_CIE_Address(byte[] IAS_CIE_Address, IEndPointRequestContext context) throws ApplianceException, ServiceClusterException { int attrId = 16; int size = 3; size += ZclDataTypeIEEEAddress.zclSize(IAS_CIE_Address.length); IZclFrame zclFrame = new ZclFrame(0, size); zclFrame.appendUInt16(attrId); zclFrame.appendUInt8(ZclDataTypeIEEEAddress.ZCL_DATA_TYPE); ZclDataTypeIEEEAddress.zclSerialize(zclFrame, IAS_CIE_Address); issueSet(ZclIASZoneServer.CLUSTER_ID, zclFrame, attrId, context); }
protected IZclFrame parseZoneEnrollRequest(IASZoneClient o, IZclFrame zclFrame) throws ApplianceException, ServiceClusterException { int ZoneType = ZclDataTypeEnum16.zclParse(zclFrame); int ManufacturerCode = ZclDataTypeUI16.zclParse(zclFrame); ZoneEnrollResponse r = o.execZoneEnrollRequest(ZoneType, ManufacturerCode, endPoint.getDefaultRequestContext()); int size = ZclZoneEnrollResponse.zclSize(r); IZclFrame zclResponseFrame = zclFrame.createResponseFrame(size); zclResponseFrame.setCommandId(0); ZclZoneEnrollResponse.zclSerialize(zclResponseFrame, r); return zclResponseFrame; }
public static void zclSerialize(IZclFrame zclFrame, int uint16) throws ZclValidationException { zclFrame.appendUInt16(uint16); }
public static int zclParse(IZclFrame zclFrame) throws ZclValidationException { return zclFrame.parseUInt16(); }