protected byte[] processSysGetErrorRequest(BidibCommand bidibMessage) { LOGGER.info("Process the SysGetError request: {}", bidibMessage); byte[] response = null; try { SysErrorResponse sysErrorResponse = new SysErrorResponse(bidibMessage.getAddr(), getNextSendNum(), SysErrorEnum.BIDIB_ERR_NONE); response = sysErrorResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create sysError response failed.", ex); } return response; }
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; }
protected byte[] processNodeTabGetAllRequest(BidibCommand bidibMessage) { byte[] response = null; try { NodeTabCountResponse nodeTabCountResponse = new NodeTabCountResponse(bidibMessage.getAddr(), getNextSendNum(), (byte) 0x01); response = nodeTabCountResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create nodeTabCount response failed.", ex); } return response; }
protected byte[] processVendorDisableRequest(BidibCommand bidibMessage) { byte[] response = null; try { // VendorDisableMessage vendorDisableMessage = (VendorDisableMessage) bidibMessage; LOGGER.info("Disable the user config mode"); byte userConfigModeActive = 0; VendorAckResponse vendorAckResponse = new VendorAckResponse(bidibMessage.getAddr(), getNextSendNum(), userConfigModeActive); response = vendorAckResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create vendor ack response failed.", ex); } return response; }
protected byte[] processSysGetSwVersionRequest(BidibCommand bidibMessage) { LOGGER.info("Process the SysGetSwVersion request: {}", bidibMessage); byte[] response = null; try { LOGGER.info("Current softwareVersion: {}", softwareVersion); SysSwVersionResponse sysSwVersionResponse = new SysSwVersionResponse(bidibMessage.getAddr(), getNextSendNum(), softwareVersion.asByteArray()); response = sysSwVersionResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create sysSwVersion response failed.", ex); } return response; }
protected byte[] processSysGetUniqueIdRequest(BidibCommand bidibMessage) { LOGGER.info("Process the SysGetUniqueId request: {}, do nothing ...", bidibMessage); byte[] response = null; try { SysUniqueIdResponse sysUniqueIdResponse = new SysUniqueIdResponse(bidibMessage.getAddr(), getNextSendNum(), getUniqueId()); response = sysUniqueIdResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create sysUniqueId response failed.", ex); } return response; }
protected byte[] processSysGetMagicRequest(BidibCommand bidibMessage) { byte[] response = null; try { LOGGER.info("Reset the sendNum because the SYS_MAGIC is tranferred with 0."); resetSendNum(); SysMagicResponse magicResponse = new SysMagicResponse(bidibMessage.getAddr(), getNextSendNum(), (byte) 0xFE, (byte) 0xAF); response = magicResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create magic response failed.", ex); } return response; }
protected byte[] processVendorGetRequest(BidibCommand bidibMessage) { byte[] response = null; try { VendorGetMessage vendorGetMessage = (VendorGetMessage) bidibMessage; String vendorDataName = vendorGetMessage.getVendorDataName(); LOGGER.info("Get the vendor data with name: {}", vendorDataName); // fetch the value from the stored data ... String vendorDataValue = configurationVariables.get(vendorDataName); if (StringUtils.isBlank(vendorDataValue)) { vendorDataValue = ""; } VendorResponse vendorResponse = new VendorResponse(bidibMessage.getAddr(), getNextSendNum(), vendorDataName, vendorDataValue); response = vendorResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create vendor response failed.", ex); } return response; }
protected byte[] processVendorEnableRequest(BidibCommand bidibMessage) { byte[] response = null; try { VendorEnableMessage vendorEnableMessage = (VendorEnableMessage) bidibMessage; long uniqueId = vendorEnableMessage.getUniqueId(); LOGGER.info("Enable the user config mode for uniqueId: {}", uniqueId); byte userConfigModeActive = 1; VendorAckResponse vendorAckResponse = new VendorAckResponse(bidibMessage.getAddr(), getNextSendNum(), userConfigModeActive); response = vendorAckResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create vendor ack response failed.", ex); } return response; }
protected byte[] processSysPingRequest(BidibCommand bidibMessage) { LOGGER.info("Process the SysPing request: {}", bidibMessage); byte[] response = null; try { SysPingMessage sysPingMessage = (SysPingMessage) bidibMessage; SysPongResponse sysPongResponse = new SysPongResponse(bidibMessage.getAddr(), getNextSendNum(), sysPingMessage.getMarker()); response = sysPongResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create sysPong response failed.", ex); } return response; }
protected byte[] processSysGetPVersionRequest(BidibCommand bidibMessage) { LOGGER.info("Process the SysGetPVersion request: {}, do nothing ...", bidibMessage); byte[] response = null; try { LOGGER.info("Current protocolVersion: {}", protocolVersion); SysPVersionResponse sysPVersionResponse = new SysPVersionResponse(bidibMessage.getAddr(), getNextSendNum(), protocolVersion.getMajorVersion(), protocolVersion.getMinorVersion()); response = sysPVersionResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create sysPVersion response failed.", ex); } return response; }
LOGGER.info("Process the current bidibCommand: {}", bidibCommand); String nodeAddress = NodeUtils.formatAddress(bidibCommand.getAddr());
protected byte[] processNodeTabGetNextRequest(BidibCommand bidibMessage) { // 01.01.2014 20:35:29.917: receive NodeTabResponse[[0],num=2,type=137,data=[1, 0, 210, 0, 13, 104, 0, 0, 54]] : // 0C 00 02 89 01 00 D2 00 0D 68 00 00 36 byte[] response = null; byte nodeTabVersion = 1; byte localAddr = 0; try { NodeTabResponse nodeTabResponse = new NodeTabResponse(bidibMessage.getAddr(), getNextSendNum(), nodeTabVersion, localAddr, uniqueId); response = nodeTabResponse.getContent(); LOGGER.info("Prepared nodeTab response: {}", ByteUtils.bytesToHex(response)); } catch (ProtocolException ex) { LOGGER.warn("Create nodeTab response failed.", ex); } return response; }
try { FeatureNotAvailableResponse featureResponse = new FeatureNotAvailableResponse(bidibMessage.getAddr(), getNextSendNum(), 255); response = featureResponse.getContent(); new FeatureResponse(bidibMessage.getAddr(), getNextSendNum(), feature.getType(), feature.getValue()); response = featureResponse.getContent();
protected byte[] processVendorSetRequest(BidibCommand bidibMessage) { byte[] response = null; try { VendorSetMessage vendorSetMessage = (VendorSetMessage) bidibMessage; VendorData vendorData = vendorSetMessage.getVendorData(); LOGGER.info("Set the vendor data: {}", vendorData); // store the vendor data ... configurationVariables.put(vendorData.getName(), vendorData.getValue()); VendorResponse vendorResponse = new VendorResponse(bidibMessage.getAddr(), getNextSendNum(), vendorData.getName(), vendorData.getValue()); response = vendorResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create vendor response failed.", ex); } return response; }
protected byte[] processStringGetRequest(BidibCommand bidibMessage) { byte[] response = null; try { StringGetMessage stringGetMessage = (StringGetMessage) bidibMessage; int stringId = stringGetMessage.getStringId(); LOGGER.info("Get STRING[{}]: {}", stringId, stringValue[stringId]); StringResponse stringResponse = new StringResponse(bidibMessage.getAddr(), getNextSendNum(), ByteUtils.getLowByte(stringGetMessage.getNamespace()), ByteUtils.getLowByte(stringGetMessage.getStringId()), stringValue[stringId]); response = stringResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create string response failed.", ex); } return response; }
new FwUpdateStatResponse(bidibMessage.getAddr(), getNextSendNum(), ByteUtils.getLowByte(status), ByteUtils.getLowByte(timeout)); response = fwUpdateStatResponse.getContent();
new FeatureNotAvailableResponse(bidibMessage.getAddr(), getNextSendNum(), featureNum); response = featureResponse.getContent();
new FeatureNotAvailableResponse(bidibMessage.getAddr(), getNextSendNum(), featureNum); response = featureResponse.getContent();
protected byte[] processStringSetRequest(BidibCommand bidibMessage) { byte[] response = null; try { StringSetMessage stringSetMessage = (StringSetMessage) bidibMessage; int stringId = stringSetMessage.getStringId(); stringValue[stringId] = stringSetMessage.getString(); StringResponse stringResponse = new StringResponse(bidibMessage.getAddr(), getNextSendNum(), ByteUtils.getLowByte(stringSetMessage.getNamespace()), ByteUtils.getLowByte(stringSetMessage.getStringId()), stringValue[stringId]); response = stringResponse.getContent(); } catch (ProtocolException ex) { LOGGER.warn("Create string response failed.", ex); } return response; }