diff --git a/android/feature/infrared/src/main/kotlin/com/flagship/abox/manager/infrared/remote/RemoteModels.kt b/android/feature/infrared/src/main/kotlin/com/flagship/abox/manager/infrared/remote/RemoteModels.kt new file mode 100644 index 0000000..041790b --- /dev/null +++ b/android/feature/infrared/src/main/kotlin/com/flagship/abox/manager/infrared/remote/RemoteModels.kt @@ -0,0 +1,49 @@ +package com.flagship.abox.manager.infrared.remote + +enum class RemoteScene { + AIR_CONDITIONER, + TELEVISION, +} + +data class RemoteButtonSpec( + val id: String, + val defaultSlot: String, + val displayName: String, + val symbol: String, +) + +object RemoteSceneConfig { + object AirConditioner { + val POWER = RemoteButtonSpec("AC_POWER", "1", "空调-电源", "⏻") + val TEMP_UP = RemoteButtonSpec("AC_TEMP_UP", "2", "空调-温度+", "▲") + val TEMP_DOWN = RemoteButtonSpec("AC_TEMP_DOWN", "3", "空调-温度-", "▼") + val MODE = RemoteButtonSpec("AC_MODE", "4", "空调-模式", "模式 ❄/☀") + val FAN = RemoteButtonSpec("AC_FAN", "5", "空调-风速", "风速 💨") + val SWING = RemoteButtonSpec("AC_SWING", "6", "空调-扫风", "扫风 ↔") + val TIMER = RemoteButtonSpec("AC_TIMER", "7", "空调-定时", "定时 ⏱") + + val buttons = listOf(POWER, TEMP_UP, TEMP_DOWN, MODE, FAN, SWING, TIMER) + } + + object Television { + val POWER = RemoteButtonSpec("TV_POWER", "21", "电视-电源", "⏻") + val MUTE = RemoteButtonSpec("TV_MUTE", "22", "电视-静音", "🔇") + val NAV_UP = RemoteButtonSpec("TV_NAV_UP", "23", "电视-上", "▲") + val NAV_DOWN = RemoteButtonSpec("TV_NAV_DOWN", "24", "电视-下", "▼") + val NAV_LEFT = RemoteButtonSpec("TV_NAV_LEFT", "25", "电视-左", "◀") + val NAV_RIGHT = RemoteButtonSpec("TV_NAV_RIGHT", "26", "电视-右", "▶") + val OK = RemoteButtonSpec("TV_OK", "27", "电视-确定", "OK") + val VOL_UP = RemoteButtonSpec("TV_VOL_UP", "28", "电视-音量+", "VOL +") + val VOL_DOWN = RemoteButtonSpec("TV_VOL_DOWN", "29", "电视-音量-", "VOL -") + val CH_UP = RemoteButtonSpec("TV_CH_UP", "30", "电视-频道+", "CH +") + val CH_DOWN = RemoteButtonSpec("TV_CH_DOWN", "31", "电视-频道-", "CH -") + val HOME = RemoteButtonSpec("TV_HOME", "32", "电视-主页", "🏠") + val BACK = RemoteButtonSpec("TV_BACK", "33", "电视-返回", "↩") + val MENU = RemoteButtonSpec("TV_MENU", "34", "电视-菜单", "☰") + + val buttons = listOf( + POWER, MUTE, NAV_UP, NAV_DOWN, NAV_LEFT, NAV_RIGHT, OK, + VOL_UP, VOL_DOWN, CH_UP, CH_DOWN, HOME, BACK, MENU, + ) + } +} diff --git a/android/feature/infrared/src/test/kotlin/com/flagship/abox/manager/infrared/remote/RemoteModelsTest.kt b/android/feature/infrared/src/test/kotlin/com/flagship/abox/manager/infrared/remote/RemoteModelsTest.kt new file mode 100644 index 0000000..b10d25a --- /dev/null +++ b/android/feature/infrared/src/test/kotlin/com/flagship/abox/manager/infrared/remote/RemoteModelsTest.kt @@ -0,0 +1,21 @@ +package com.flagship.abox.manager.infrared.remote + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Test + +class RemoteModelsTest { + @Test + fun acSpecsHaveUniqueSlotsBetween1And20() { + val slots = RemoteSceneConfig.AirConditioner.buttons.map { it.defaultSlot } + assertEquals(slots.size, slots.distinct().size) + assertTrue(slots.all { it.toInt() in 1..20 }) + } + + @Test + fun tvSpecsHaveUniqueSlotsBetween21And50() { + val slots = RemoteSceneConfig.Television.buttons.map { it.defaultSlot } + assertEquals(slots.size, slots.distinct().size) + assertTrue(slots.all { it.toInt() in 21..50 }) + } +}