diff --git a/it.unibo.sembrava_qualcuno.sprint4/parkmanagerservice/src/main/kotlin/parkmanagerservice/controller/BaseController.kt b/it.unibo.sembrava_qualcuno.sprint4/parkmanagerservice/src/main/kotlin/parkmanagerservice/controller/BaseController.kt index 000f6a6..13fdc5a 100644 --- a/it.unibo.sembrava_qualcuno.sprint4/parkmanagerservice/src/main/kotlin/parkmanagerservice/controller/BaseController.kt +++ b/it.unibo.sembrava_qualcuno.sprint4/parkmanagerservice/src/main/kotlin/parkmanagerservice/controller/BaseController.kt @@ -2,7 +2,6 @@ package parkmanagerservice.controller import fan.CoapFan import fan.FanInterface -import it.unibo.actor0.sysUtil import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value import org.springframework.http.HttpHeaders @@ -36,11 +35,17 @@ class BaseController() { @Autowired constructor (template: SimpMessagingTemplate) : this() { this.template = template + } + + //TODO Initialize temperature in ParkingAreaKb + init { try { val tmax = System.getenv("TMAX") - if(tmax != null) + if(tmax != null){ THERMOMETER_THRESHOLD = tmax.toInt() + println("BaseController: Use value TMAX=$THERMOMETER_THRESHOLD") + } else println("BaseController: Use default value TMAX=$THERMOMETER_THRESHOLD") } catch (e: NumberFormatException) { @@ -48,18 +53,16 @@ class BaseController() { } try { val dtfree = System.getenv("DTFREE") - if(dtfree != null) + if(dtfree != null) { TIMER_THRESHOLD = dtfree.toInt() + println("BaseController: Use value DTFREE=$TIMER_THRESHOLD") + } else println("BaseController: Use default value DTFREE=$TIMER_THRESHOLD") } catch (e: NumberFormatException) { println("BaseController: DTFREE must be an integer. Use default value $TIMER_THRESHOLD") } - } - //TODO Initialize temperature in ParkingAreaKb - - init { println("%%%%%% BaseController | START FOR OBSERVE: ThermometerController at $PARKINGAREA_HOSTNAME:$PARKINGAREA_PORT") ThermometerController(CoapThermometer("coap://$PARKINGAREA_HOSTNAME:$PARKINGAREA_PORT/parkingarea/thermometer"), THERMOMETER_THRESHOLD).addObserver{ println("%%%%%% BaseController | OBSERVE: ThermometerController") diff --git a/it.unibo.sembrava_qualcuno.sprint4/variables.env b/it.unibo.sembrava_qualcuno.sprint4/variables.env index 5b9dc84..044867d 100644 --- a/it.unibo.sembrava_qualcuno.sprint4/variables.env +++ b/it.unibo.sembrava_qualcuno.sprint4/variables.env @@ -21,5 +21,5 @@ WEIGHTSENSOR_START_VALUE=0 SONAR_START_VALUE=false # Requirements alarm trigger values -TMAX=20 -DTFREE=60 \ No newline at end of file +TMAX=30 +DTFREE=60