protected byte[] processFeatureGetAllRequest(BidibCommand bidibMessage) { byte[] response = null; try { FeatureCountResponse featureResponse = new FeatureCountResponse(bidibMessage.getAddr(), getNextSendNum(), features.size()); response = featureResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create feature count response failed.", ex); } currentFeature = 0; return response; }
public int getCount() { return ByteUtils.getInt(getData()[0]); } }
case BidibLibrary.MSG_FEATURE_COUNT: result = new FeatureCountResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break; case BidibLibrary.MSG_FEATURE_NA:
/** * Request the number of features of the node. This call will reset the internal counter for the next * <code>getNextFeature()</code> request. * * @return number of features on the node * @throws IOException * @throws ProtocolException * @throws InterruptedException */ public Integer getFeatureCount() throws ProtocolException { if (isBootloaderNode()) { LOGGER.warn("The current node is a bootloader node and does not support feature requests."); throw createNotSupportedByBootloaderNode("MSG_FEATURE_GETALL"); } BidibMessage response = send(requestFactory.createFeatureGetAll(), null, true, FeatureCountResponse.TYPE); if (response instanceof FeatureCountResponse) { Integer result = ((FeatureCountResponse) response).getCount(); return result; } if (ignoreWaitTimeout) { LOGGER.warn("No response received but ignoreWaitTimeout ist set! Current node: {}", this); return Integer.valueOf(0); } throw createNoResponseAvailable("get feature count"); }