Skip to content

Commit

Permalink
fixed renaming messup
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Mar 8, 2018
1 parent 1a3cfe6 commit ab1a277
Showing 1 changed file with 41 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteB
DataLength dataLength = DataLength.of(byteBuf);
AMSError errorCode = AMSError.of(byteBuf);
Invoke invoke = Invoke.of(byteBuf);
AMSPacket correlatedAMSPacket = requests.remove(invoke);
if (correlatedAMSPacket != null) {
LOGGER.debug("Correlated packet received {}", correlatedAMSPacket);
AMSPacket correlatedamsPacket = requests.remove(invoke);
if (correlatedamsPacket != null) {
LOGGER.debug("Correlated packet received {}", correlatedamsPacket);
}
if (dataLength.getAsLong() > Integer.MAX_VALUE) {
byteBuf.release();
Expand Down Expand Up @@ -127,7 +127,7 @@ protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteB
amsPacket = handleUnknownCommand(commandBuffer, amsHeader);
}
out.add(amsPacket);
LOGGER.trace("Set AMSPacket {} to out", amsPacket);
LOGGER.trace("Set amsPacket {} to out", amsPacket);
if (commandBuffer.readableBytes() > 0) {
commandBuffer.release();
byteBuf.release();
Expand All @@ -142,27 +142,27 @@ private AMSPacket handleInvalidCommand(ByteBuf commandBuffer, AMSHeader amsHeade
}

private AMSPacket handleADSReadDeviceInfoCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
AMSPacket = ADSReadDeviceInfoRequest.of(amsHeader);
amsPacket = ADSReadDeviceInfoRequest.of(amsHeader);
} else {
Result result = Result.of(commandBuffer);
MajorVersion majorVersion = MajorVersion.of(commandBuffer);
MinorVersion minorVersion = MinorVersion.of(commandBuffer);
Version version = Version.of(commandBuffer);
Device device = Device.of(commandBuffer);
AMSPacket = ADSReadDeviceInfoResponse.of(amsHeader, result, majorVersion, minorVersion, version, device);
amsPacket = ADSReadDeviceInfoResponse.of(amsHeader, result, majorVersion, minorVersion, version, device);
}
return AMSPacket;
return amsPacket;
}

private AMSPacket handleADSReadCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
IndexGroup indexGroup = IndexGroup.of(commandBuffer);
IndexOffset indexOffset = IndexOffset.of(commandBuffer);
Length length = Length.of(commandBuffer);
AMSPacket = ADSReadRequest.of(amsHeader, indexGroup, indexOffset, length);
amsPacket = ADSReadRequest.of(amsHeader, indexGroup, indexOffset, length);
} else {
Result result = Result.of(commandBuffer);
Length length = Length.of(commandBuffer);
Expand All @@ -172,13 +172,13 @@ private AMSPacket handleADSReadCommand(State stateId, ByteBuf commandBuffer, AMS
byte[] dataToRead = new byte[(int) length.getAsLong()];
commandBuffer.readBytes(dataToRead);
Data data = Data.of(dataToRead);
AMSPacket = ADSReadResponse.of(amsHeader, result, length, data);
amsPacket = ADSReadResponse.of(amsHeader, result, length, data);
}
return AMSPacket;
return amsPacket;
}

private AMSPacket handleADSWriteCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
IndexGroup indexGroup = IndexGroup.of(commandBuffer);
IndexOffset indexOffset = IndexOffset.of(commandBuffer);
Expand All @@ -189,28 +189,28 @@ private AMSPacket handleADSWriteCommand(State stateId, ByteBuf commandBuffer, AM
byte[] dataToRead = new byte[(int) length.getAsLong()];
commandBuffer.readBytes(dataToRead);
Data data = Data.of(dataToRead);
AMSPacket = ADSWriteRequest.of(amsHeader, indexGroup, indexOffset, length, data);
amsPacket = ADSWriteRequest.of(amsHeader, indexGroup, indexOffset, length, data);
} else {
Result result = Result.of(commandBuffer);
AMSPacket = ADSWriteResponse.of(amsHeader, result);
amsPacket = ADSWriteResponse.of(amsHeader, result);
}
return AMSPacket;
return amsPacket;
}


private AMSPacket handleADSReadStateCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
AMSPacket = ADSReadStateRequest.of(amsHeader);
amsPacket = ADSReadStateRequest.of(amsHeader);
} else {
Result result = Result.of(commandBuffer);
AMSPacket = ADSReadStateResponse.of(amsHeader, result);
amsPacket = ADSReadStateResponse.of(amsHeader, result);
}
return AMSPacket;
return amsPacket;
}

private AMSPacket handleADSWriteControlCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
ADSState adsState = ADSState.of(commandBuffer);
DeviceState deviceState = DeviceState.of(commandBuffer);
Expand All @@ -221,16 +221,16 @@ private AMSPacket handleADSWriteControlCommand(State stateId, ByteBuf commandBuf
byte[] dataToRead = new byte[(int) length.getAsLong()];
commandBuffer.readBytes(dataToRead);
Data data = Data.of(dataToRead);
AMSPacket = ADSWriteControlRequest.of(amsHeader, adsState, deviceState, length, data);
amsPacket = ADSWriteControlRequest.of(amsHeader, adsState, deviceState, length, data);
} else {
Result result = Result.of(commandBuffer);
AMSPacket = ADSWriteControlResponse.of(amsHeader, result);
amsPacket = ADSWriteControlResponse.of(amsHeader, result);
}
return AMSPacket;
return amsPacket;
}

private AMSPacket handleADSAddDeviceNotificationCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
IndexGroup indexGroup = IndexGroup.of(commandBuffer);
IndexOffset indexOffset = IndexOffset.of(commandBuffer);
Expand All @@ -239,29 +239,29 @@ private AMSPacket handleADSAddDeviceNotificationCommand(State stateId, ByteBuf c
MaxDelay maxDelay = MaxDelay.of(commandBuffer);
CycleTime cycleTime = CycleTime.of(commandBuffer);
commandBuffer.skipBytes(ADSAddDeviceNotificationRequest.Reserved.NUM_BYTES);
AMSPacket = ADSAddDeviceNotificationRequest.of(amsHeader, indexGroup, indexOffset, length, transmissionMode, maxDelay, cycleTime);
amsPacket = ADSAddDeviceNotificationRequest.of(amsHeader, indexGroup, indexOffset, length, transmissionMode, maxDelay, cycleTime);
} else {
Result result = Result.of(commandBuffer);
NotificationHandle notificationHandle = NotificationHandle.of(commandBuffer);
AMSPacket = ADSAddDeviceNotificationResponse.of(amsHeader, result, notificationHandle);
amsPacket = ADSAddDeviceNotificationResponse.of(amsHeader, result, notificationHandle);
}
return AMSPacket;
return amsPacket;
}

private AMSPacket handADSDeleteDeviceNotificationCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
NotificationHandle notificationHandle = NotificationHandle.of(commandBuffer);
AMSPacket = ADSDeleteDeviceNotificationRequest.of(amsHeader, notificationHandle);
amsPacket = ADSDeleteDeviceNotificationRequest.of(amsHeader, notificationHandle);
} else {
Result result = Result.of(commandBuffer);
AMSPacket = ADSDeleteDeviceNotificationResponse.of(amsHeader, result);
amsPacket = ADSDeleteDeviceNotificationResponse.of(amsHeader, result);
}
return AMSPacket;
return amsPacket;
}

private AMSPacket handleADSDeviceNotificationCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
Length length = Length.of(commandBuffer);
if (length.getAsLong() > Integer.MAX_VALUE) {
Expand All @@ -278,11 +278,11 @@ private AMSPacket handleADSDeviceNotificationCommand(State stateId, ByteBuf comm
adsStampHeaders.add(adsStampHeader);
}
adsDeviceNotificationBuffer.release();
AMSPacket = ADSDeviceNotificationRequest.of(amsHeader, length, stamps, adsStampHeaders);
amsPacket = ADSDeviceNotificationRequest.of(amsHeader, length, stamps, adsStampHeaders);
} else {
AMSPacket = UnknownCommand.of(amsHeader, commandBuffer);
amsPacket = UnknownCommand.of(amsHeader, commandBuffer);
}
return AMSPacket;
return amsPacket;
}

private AdsStampHeader handleStampHeader(ByteBuf adsDeviceNotificationBuffer) {
Expand Down Expand Up @@ -312,7 +312,7 @@ private AdsNotificationSample handleAdsNotificartionSample(ByteBuf adsDeviceNoti
}

private AMSPacket handleADSReadWriteCommand(State stateId, ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket amsPacket;
if (stateId.isRequest()) {
IndexGroup indexGroup = IndexGroup.of(commandBuffer);
IndexOffset indexOffset = IndexOffset.of(commandBuffer);
Expand All @@ -330,7 +330,7 @@ private AMSPacket handleADSReadWriteCommand(State stateId, ByteBuf commandBuffer
byte[] dataToRead = new byte[(int) readLength.getAsLong()];
commandBuffer.readBytes(dataToRead);
Data data = Data.of(dataToRead);
AMSPacket = ADSReadWriteRequest.of(amsHeader, indexGroup, indexOffset, readLength, writeLength, data);
amsPacket = ADSReadWriteRequest.of(amsHeader, indexGroup, indexOffset, readLength, writeLength, data);
} else {
Result result = Result.of(commandBuffer);
Length length = Length.of(commandBuffer);
Expand All @@ -340,14 +340,12 @@ private AMSPacket handleADSReadWriteCommand(State stateId, ByteBuf commandBuffer
byte[] dataToRead = new byte[(int) length.getAsLong()];
commandBuffer.readBytes(dataToRead);
Data data = Data.of(dataToRead);
AMSPacket = ADSReadWriteResponse.of(amsHeader, result, length, data);
amsPacket = ADSReadWriteResponse.of(amsHeader, result, length, data);
}
return AMSPacket;
return amsPacket;
}

private AMSPacket handleUnknownCommand(ByteBuf commandBuffer, AMSHeader amsHeader) {
AMSPacket AMSPacket;
AMSPacket = UnknownCommand.of(amsHeader, commandBuffer);
return AMSPacket;
return UnknownCommand.of(amsHeader, commandBuffer);
}
}

0 comments on commit ab1a277

Please sign in to comment.