Remove unused variables

This commit is contained in:
Bart Sopers 2021-03-14 23:13:41 +01:00
parent 06de8a04e2
commit dd480134e2

View file

@ -8,7 +8,7 @@ object ResponseUtil {
@Throws(CouldNotParseResponseException::class, UnsupportedOperationException::class)
fun parseResponse(payload: ByteArray): Response {
return when (val responseType = byValue(payload[0], ResponseType.UNKNOWN)) {
return when (byValue(payload[0], ResponseType.UNKNOWN)) {
ResponseType.ACTIVATION_RESPONSE -> parseActivationResponse(payload)
ResponseType.DEFAULT_STATUS_RESPONSE -> DefaultStatusResponse(payload)
ResponseType.ADDITIONAL_STATUS_RESPONSE -> parseAdditionalStatusResponse(payload)
@ -19,7 +19,7 @@ object ResponseUtil {
@Throws(CouldNotParseResponseException::class)
private fun parseActivationResponse(payload: ByteArray): Response {
return when (val activationResponseType = byValue(payload[1], ResponseType.ActivationResponseType.UNKNOWN)) {
return when (byValue(payload[1], ResponseType.ActivationResponseType.UNKNOWN)) {
ResponseType.ActivationResponseType.GET_VERSION_RESPONSE -> VersionResponse(payload)
ResponseType.ActivationResponseType.SET_UNIQUE_ID_RESPONSE -> SetUniqueIdResponse(payload)
ResponseType.ActivationResponseType.UNKNOWN -> throw CouldNotParseResponseException("Unrecognized activation response type: ${payload[1]}")
@ -28,7 +28,7 @@ object ResponseUtil {
@Throws(CouldNotParseResponseException::class, UnsupportedOperationException::class)
private fun parseAdditionalStatusResponse(payload: ByteArray): Response {
return when (val additionalStatusResponseType = byValue(payload[2], ResponseType.StatusResponseType.UNKNOWN)) {
return when (byValue(payload[2], ResponseType.StatusResponseType.UNKNOWN)) {
ResponseType.StatusResponseType.DEFAULT_STATUS_RESPONSE -> DefaultStatusResponse(payload) // Unreachable; this response type is only used for requesting a default status response
ResponseType.StatusResponseType.STATUS_RESPONSE_PAGE_1 -> throw UnsupportedOperationException("Status response page 1 is not (yet) implemented")
ResponseType.StatusResponseType.ALARM_STATUS -> AlarmStatusResponse(payload)