This repository has been archived by the owner on Aug 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2020-02-05 Version 1.1.0: Added Debug Monitor implementation for test…
…s and run the app without Arduino
- Loading branch information
Showing
28 changed files
with
342 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...ain/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/api/BtConnection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.smlnskgmail.jaman.remotetemperaturecontrol.logic.monitor.api | ||
|
||
abstract class BtConnection : Thread() { | ||
|
||
open fun connect() { | ||
|
||
} | ||
|
||
open fun disconnect() { | ||
|
||
} | ||
|
||
open fun handleOnResume() { | ||
|
||
} | ||
|
||
open fun send(btMonitorSignalType: BtMonitorSignalType) { | ||
|
||
} | ||
|
||
} |
6 changes: 3 additions & 3 deletions
6
...mperaturecontrol/logic/monitor/Monitor.kt → ...urecontrol/logic/monitor/api/BtMonitor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...trol/logic/monitor/MonitorHandleTarget.kt → ...trol/logic/monitor/api/BtMonitorTarget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...btmonitor/connection/entities/BtDevice.kt → ...ol/logic/monitor/api/entities/BtDevice.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tor/connection/targets/BtConnectTarget.kt → ...r/api/entities/targets/BtConnectTarget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../connection/targets/BtDisconnectTarget.kt → ...pi/entities/targets/BtDisconnectTarget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nitor/connection/targets/BtPauseTarget.kt → ...tor/api/entities/targets/BtPauseTarget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...mlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/impl/debugbt/DebugBtConnection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.smlnskgmail.jaman.remotetemperaturecontrol.logic.monitor.impl.debugbt | ||
|
||
import com.smlnskgmail.jaman.remotetemperaturecontrol.logic.monitor.api.BtConnection | ||
import com.smlnskgmail.jaman.remotetemperaturecontrol.logic.monitor.api.BtMonitor | ||
import com.smlnskgmail.jaman.remotetemperaturecontrol.logic.monitor.api.BtMonitorSignalType | ||
|
||
class DebugBtConnection( | ||
private val btMonitor: BtMonitor | ||
) : BtConnection() { | ||
|
||
companion object { | ||
|
||
private val temperature = arrayListOf( | ||
"25.3 C", | ||
"24.6 C", | ||
"23.5 C", | ||
"21.2 C", | ||
"22.4 C", | ||
"23.3 C", | ||
"24.7 C", | ||
"25.1 C", | ||
"25.6 C", | ||
"25.7 C" | ||
) | ||
|
||
private val humidity = arrayListOf( | ||
"78.1 %", | ||
"79.4 %", | ||
"77.3 %", | ||
"77.7 %", | ||
"77.8 %", | ||
"78.4 %", | ||
"79.5 %", | ||
"81.6 %", | ||
"79.4 %", | ||
"77.5 %" | ||
) | ||
|
||
} | ||
|
||
private var loopCounter = 0 | ||
|
||
override fun run() { | ||
super.run() | ||
while (true) { | ||
@Suppress("MagicNumber") | ||
sleep(5_000) | ||
btMonitor.onNewDataAvailable( | ||
BtMonitorSignalType.Temperature, | ||
temperature[loopCounter] | ||
) | ||
btMonitor.onNewDataAvailable( | ||
BtMonitorSignalType.TemperatureMaximum, | ||
"25.7 C" | ||
) | ||
btMonitor.onNewDataAvailable( | ||
BtMonitorSignalType.TemperatureMinimum, | ||
"21.2 C" | ||
) | ||
btMonitor.onNewDataAvailable( | ||
BtMonitorSignalType.Humidity, | ||
humidity[loopCounter] | ||
) | ||
btMonitor.onNewDataAvailable( | ||
BtMonitorSignalType.HumidityMaximum, | ||
"81.6 %" | ||
) | ||
btMonitor.onNewDataAvailable( | ||
BtMonitorSignalType.HumidityMinimum, | ||
"77.3 %" | ||
) | ||
if (loopCounter < temperature.size - 1) { | ||
loopCounter++ | ||
} else { | ||
loopCounter = 0 | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.