-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
virtual-device-app: Add Doorlock/PowerSource repository (#29127)
Signed-off-by: Jaehoon You <jaehoon.you@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com>
- Loading branch information
1 parent
fba066d
commit e29cd6a
Showing
5 changed files
with
76 additions
and
0 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
11 changes: 11 additions & 0 deletions
11
...a/com/matter/virtual/device/app/core/data/repository/cluster/DoorLockManagerRepository.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,11 @@ | ||
package com.matter.virtual.device.app.core.data.repository.cluster | ||
|
||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
interface DoorLockManagerRepository { | ||
fun getLockStateFlow(): StateFlow<Boolean> | ||
|
||
suspend fun setLockState(value: Boolean) | ||
|
||
suspend fun sendLockAlarmEvent() | ||
} |
24 changes: 24 additions & 0 deletions
24
...m/matter/virtual/device/app/core/data/repository/cluster/DoorLockManagerRepositoryImpl.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,24 @@ | ||
package com.matter.virtual.device.app.core.data.repository.cluster | ||
|
||
import com.matter.virtual.device.app.core.matter.manager.DoorLockManagerStub | ||
import javax.inject.Inject | ||
import kotlinx.coroutines.flow.StateFlow | ||
import timber.log.Timber | ||
|
||
internal class DoorLockManagerRepositoryImpl | ||
@Inject | ||
constructor(private val doorLockManagerStub: DoorLockManagerStub) : DoorLockManagerRepository { | ||
|
||
override fun getLockStateFlow(): StateFlow<Boolean> { | ||
return doorLockManagerStub.lockState | ||
} | ||
|
||
override suspend fun setLockState(value: Boolean) { | ||
Timber.d("setLockState():$value") | ||
doorLockManagerStub.setLockState(value) | ||
} | ||
|
||
override suspend fun sendLockAlarmEvent() { | ||
doorLockManagerStub.sendLockAlarmEvent() | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...om/matter/virtual/device/app/core/data/repository/cluster/PowerSourceManagerRepository.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,9 @@ | ||
package com.matter.virtual.device.app.core.data.repository.cluster | ||
|
||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
interface PowerSourceManagerRepository { | ||
fun getBatPercent(): StateFlow<Int> | ||
|
||
suspend fun setBatPercentRemaining(batteryPercentRemaining: Int) | ||
} |
19 changes: 19 additions & 0 deletions
19
...atter/virtual/device/app/core/data/repository/cluster/PowerSourceManagerRepositoryImpl.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,19 @@ | ||
package com.matter.virtual.device.app.core.data.repository.cluster | ||
|
||
import com.matter.virtual.device.app.core.matter.manager.PowerSourceManagerStub | ||
import javax.inject.Inject | ||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
internal class PowerSourceManagerRepositoryImpl | ||
@Inject | ||
constructor(private val powerSourceManagerStub: PowerSourceManagerStub) : | ||
PowerSourceManagerRepository { | ||
|
||
override fun getBatPercent(): StateFlow<Int> { | ||
return powerSourceManagerStub.batPercent | ||
} | ||
|
||
override suspend fun setBatPercentRemaining(batteryPercentRemaining: Int) { | ||
powerSourceManagerStub.setBatPercentRemaining(batteryPercentRemaining) | ||
} | ||
} |