Skip to content

Commit

Permalink
FDP-2551 ~ Updates result handlers
Browse files Browse the repository at this point in the history
* Updates reboot success URC
* Fixes typos

Signed-off-by: Sander van der Heijden <[email protected]>
  • Loading branch information
smvdheijden committed Nov 29, 2024
1 parent 11fcf61 commit 16765c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class FirmwareCommandResultHandler(
val commandFeedbackService: CommandFeedbackService
) : CommandResultHandler(commandService, commandFeedbackService) {

private val succesUrc = "OTA:SUC"
private val successUrc = "OTA:SUC"
private val errorUrcs = listOf("OTA:CSER", "OTA:HSER", "OTA:RST", "OTA:SWNA", "OTA:FLER")

override val supportedCommandType = CommandType.FIRMWARE

override fun hasSucceeded(deviceId: String, body: JsonNode) = succesUrc in body.urcs()
override fun hasSucceeded(deviceId: String, body: JsonNode) = successUrc in body.urcs()

override fun hasFailed(deviceId: String, body: JsonNode) = body.urcs().any { it in errorUrcs }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import org.springframework.stereotype.Component
class PskCommandResultHandler(commandService: CommandService, commandFeedbackService: CommandFeedbackService) :
CommandResultHandler(commandService, commandFeedbackService) {

private val succesUrc = "PSK:TMP"
private val successUrc = "PSK:TMP"
private val errorUrcs = listOf("PSK:DLER", "PSK:HSER")

override val supportedCommandType = CommandType.PSK

override fun hasSucceeded(deviceId: String, body: JsonNode) = succesUrc in body.urcs()
override fun hasSucceeded(deviceId: String, body: JsonNode) = successUrc in body.urcs()

override fun hasFailed(deviceId: String, body: JsonNode) = body.urcs().any { it in errorUrcs }
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class PskSetCommandResultHandler(

private val logger = KotlinLogging.logger {}

private val succesUrc = "PSK:SET"
private val successUrc = "PSK:SET"
private val errorUrcs = listOf("PSK:DLER", "PSK:HSER", "PSK:EQER")

override val supportedCommandType = CommandType.PSK_SET

override fun hasSucceeded(deviceId: String, body: JsonNode) = succesUrc in body.urcs()
override fun hasSucceeded(deviceId: String, body: JsonNode) = successUrc in body.urcs()

override fun hasFailed(deviceId: String, body: JsonNode) = body.urcs().any { it in errorUrcs }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import org.springframework.stereotype.Component
class RebootCommandResultHandler(commandService: CommandService, commandFeedbackService: CommandFeedbackService) :
CommandResultHandler(commandService, commandFeedbackService) {

private val succesUrcs = listOf("INIT", "WDR")
private val successUrc = "INIT"

override val supportedCommandType = CommandType.REBOOT

override fun hasSucceeded(deviceId: String, body: JsonNode) = body.urcs().containsAll(succesUrcs)
override fun hasSucceeded(deviceId: String, body: JsonNode) = successUrc in body.urcs()

override fun hasFailed(deviceId: String, body: JsonNode) = false
}

0 comments on commit 16765c6

Please sign in to comment.