浏览代码

add(依赖):
- 新增viewmodel和room

周文健 5 月之前
父节点
当前提交
072aa7259b

+ 11 - 0
app/build.gradle

@@ -1,6 +1,7 @@
 plugins {
     alias(libs.plugins.android.application)
     alias(libs.plugins.jetbrains.kotlin.android)
+    id("com.google.devtools.ksp")
 }
 
 android {
@@ -83,6 +84,16 @@ dependencies {
     implementation libs.autosize
     implementation libs.fastble
 
+    implementation(libs.viewmodel.ktx)
+    implementation(libs.viewmodel.livedata.ktx)
+    implementation(libs.viewmodel.savestate)
+    ksp(libs.viewmodel.compiler)
+
+    implementation(libs.room.runtime)
+    implementation(libs.room.ktx)
+    implementation(libs.room.testing)
+    ksp(libs.room.compiler)
+
     implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
 
     // RV通用Adapter  https://github.com/hongyangAndroid/base-adapter

+ 240 - 185
app/src/main/java/com/grkj/iscs/BusinessManager.kt

@@ -24,6 +24,7 @@ import com.grkj.iscs.extentions.serialNo
 import com.grkj.iscs.extentions.startsWith
 import com.grkj.iscs.extentions.toHexStrings
 import com.grkj.iscs.modbus.DockBean
+import com.grkj.iscs.modbus.MBFrame
 import com.grkj.iscs.modbus.ModBusController
 import com.grkj.iscs.modbus.ModBusController.dockList
 import com.grkj.iscs.model.Constants.PERMISSION_REQUEST_CODE
@@ -248,233 +249,287 @@ object BusinessManager {
      * 总的监听,做预处理,其余的所有监听均使用本监听处理后的数据,只允许调用一次
      */
     fun registerMainListener() {
-        ModBusController.registerStatusListener(this) { res ->
-            LogUtil.i("硬件状态:${(res as List<ByteArray>).map { it.toHexStrings() }}")
-            if (res.isEmpty() || res.any { it.isEmpty() }) {
-                var tipStr = CommonUtils.getStr(R.string.no_response_board_exists) + " : "
-                val addressList = mutableListOf<String>()
-
-                ModBusController.modBusManager?.mSlaveAddressList?.forEach { itDock ->
-                    if (res.none { it.isNotEmpty() && it[0] == itDock }) {
-                        addressList.add("0x${String.format("%02X", itDock)}")
-                    }
+        ModBusController.registerStatusListener(this) { mbFrame, res ->
+            when (mbFrame) {
+                MBFrame.READ_STATUS -> {
+                    deviceStatusHandle(res)
+                }
+
+                MBFrame.READ_BUCKLE_STATUS -> {
+                    lockBuckleStatus(res)
+                }
+
+                MBFrame.READ_LOCK_BUCKLE_EXTRA_STATUS -> {
+                    lockBuckleExtraStatus(res)
                 }
-                tipStr += addressList
-                ToastUtils.tip(tipStr)
             }
-            res.forEach { bytes ->
-                val dockBean = ModBusController.updateStatus(bytes) ?: return@forEach
-                ModBusController.isInitReady = true
-                if (!CAN_RETURN) {
-                    return@forEach
+        }
+    }
+
+    /**
+     * 第9,10锁位卡扣状态
+     */
+    private fun lockBuckleExtraStatus(res: Any) {
+        LogUtil.i("硬件状态:${(res as List<ByteArray>).map { it.toHexStrings() }}")
+        if (res.isEmpty() || res.any { it.isEmpty() }) {
+            var tipStr = CommonUtils.getStr(R.string.no_response_board_exists) + " : "
+            val addressList = mutableListOf<String>()
+
+            ModBusController.modBusManager?.mSlaveAddressList?.forEach { itDock ->
+                if (res.none { it.isNotEmpty() && it[0] == itDock }) {
+                    addressList.add("0x${String.format("%02X", itDock)}")
+                }
+            }
+            tipStr += addressList
+            ToastUtils.tip(tipStr)
+        }
+    }
+
+    /**
+     * 第1-8锁位卡扣状态
+     */
+    private fun lockBuckleStatus(res: Any) {
+        LogUtil.i("硬件状态:${(res as List<ByteArray>).map { it.toHexStrings() }}")
+        if (res.isEmpty() || res.any { it.isEmpty() }) {
+            var tipStr = CommonUtils.getStr(R.string.no_response_board_exists) + " : "
+            val addressList = mutableListOf<String>()
+
+            ModBusController.modBusManager?.mSlaveAddressList?.forEach { itDock ->
+                if (res.none { it.isNotEmpty() && it[0] == itDock }) {
+                    addressList.add("0x${String.format("%02X", itDock)}")
+                }
+            }
+            tipStr += addressList
+            ToastUtils.tip(tipStr)
+        }
+    }
+
+    /**
+     * 硬件状态
+     */
+    private fun deviceStatusHandle(res: Any) {
+        LogUtil.i("硬件状态:${(res as List<ByteArray>).map { it.toHexStrings() }}")
+        if (res.isEmpty() || res.any { it.isEmpty() }) {
+            var tipStr = CommonUtils.getStr(R.string.no_response_board_exists) + " : "
+            val addressList = mutableListOf<String>()
+
+            ModBusController.modBusManager?.mSlaveAddressList?.forEach { itDock ->
+                if (res.none { it.isNotEmpty() && it[0] == itDock }) {
+                    addressList.add("0x${String.format("%02X", itDock)}")
                 }
-                when (dockBean.type) {
-                    DOCK_TYPE_KEY -> {
-                        dockBean.getKeyList().forEach { keyBean ->
-                            if (keyBean.isExist) {
-                                sendLoadingEventMsg(CommonUtils.getStr(R.string.ble_connecting))
-                                // 放回钥匙,读取rfid
-                                ModBusController.readKeyRfid(
+            }
+            tipStr += addressList
+            ToastUtils.tip(tipStr)
+        }
+        res.forEach { bytes ->
+            val dockBean = ModBusController.updateStatus(bytes) ?: return@forEach
+            ModBusController.isInitReady = true
+            if (!CAN_RETURN) {
+                return@forEach
+            }
+            when (dockBean.type) {
+                DOCK_TYPE_KEY -> {
+                    dockBean.getKeyList().forEach { keyBean ->
+                        if (keyBean.isExist) {
+                            sendLoadingEventMsg(CommonUtils.getStr(R.string.ble_connecting))
+                            // 放回钥匙,读取rfid
+                            ModBusController.readKeyRfid(
+                                dockBean.addr,
+                                if (keyBean.isLeft) 0 else 1
+                            ) { isLeft, res ->
+                                if (res.size < 11) {
+                                    LogUtil.e("Key rfid error")
+                                    return@readKeyRfid
+                                }
+                                val rfid = res.copyOfRange(3, 11).toHexStrings(false)
+                                    .removeLeadingZeros()
+                                ModBusController.updateKeyRfid(
                                     dockBean.addr,
-                                    if (keyBean.isLeft) 0 else 1
-                                ) { isLeft, res ->
-                                    if (res.size < 11) {
-                                        LogUtil.e("Key rfid error")
-                                        return@readKeyRfid
-                                    }
-                                    val rfid = res.copyOfRange(3, 11).toHexStrings(false)
-                                        .removeLeadingZeros()
-                                    ModBusController.updateKeyRfid(
-                                        dockBean.addr,
-                                        keyBean.isLeft,
-                                        rfid
-                                    )
-                                    NetApi.getKeyInfo(rfid) {
-                                        if (it != null && !it.macAddress.isNullOrEmpty()) {
-                                            ModBusController.updateKeyMac(
-                                                dockBean.addr,
-                                                keyBean.isLeft,
-                                                it.macAddress
-                                            )
-                                            ModBusController.updateKeyReadyStatus(
-                                                it.macAddress,
-                                                false,
-                                                5
-                                            )
-                                            // TODO 移动到HomePresenter里,根据业务进行处理
-//                                            showKeyReturnDialog(it.macAddress, isLeft, dockBean.addr.toInt())
-//                                            registerConnectListener(it.macAddress)
-                                        } else {
-                                            LogUtil.e("Get key info fail : $rfid")
-                                            ToastUtils.tip(R.string.get_key_info_fail)
-                                        }
+                                    keyBean.isLeft,
+                                    rfid
+                                )
+                                NetApi.getKeyInfo(rfid) {
+                                    if (it != null && !it.macAddress.isNullOrEmpty()) {
+                                        ModBusController.updateKeyMac(
+                                            dockBean.addr,
+                                            keyBean.isLeft,
+                                            it.macAddress
+                                        )
+                                        ModBusController.updateKeyReadyStatus(
+                                            it.macAddress,
+                                            false,
+                                            5
+                                        )
+                                    } else {
+                                        LogUtil.e("Get key info fail : $rfid")
+                                        ToastUtils.tip(R.string.get_key_info_fail)
                                     }
-                                    // TODO 蓝牙通信
                                 }
+                                // TODO 蓝牙通信
+                            }
 //                                ModBusController.controlKeyBuckle(false, isLeft = true, dockBean.addr.toInt() - 1)
-                            } else {
-                                // 移出待连监听集合,防止connectKey循环失败
-                                keyBean.mac?.let {
-                                    unregisterConnectListener(it)
-                                }
-                                sendEventMsg(
-                                    MsgEvent(
-                                        MSG_EVENT_DEVICE_TAKE_UPDATE,
-                                        DeviceTakeUpdateMsg(DEVICE_TYPE_KEY, keyBean.rfid)
-                                    )
-                                )
+                        } else {
+                            // 移出待连监听集合,防止connectKey循环失败
+                            keyBean.mac?.let {
+                                unregisterConnectListener(it)
                             }
+                            sendEventMsg(
+                                MsgEvent(
+                                    MSG_EVENT_DEVICE_TAKE_UPDATE,
+                                    DeviceTakeUpdateMsg(DEVICE_TYPE_KEY, keyBean.rfid)
+                                )
+                            )
                         }
                     }
+                }
 
-                    DOCK_TYPE_LOCK -> {
-                        dockBean.getLockList().forEach { lockBean ->
-                            if (lockBean.isExist) {
-                                ModBusController.readLockRfid(dockBean.addr, lockBean.idx) { res ->
-                                    if (res.size < 11) {
-                                        LogUtil.e("Lock rfid error")
-                                        return@readLockRfid
-                                    }
-                                    val rfid = res.copyOfRange(3, 11).toHexStrings(false)
-                                        .removeLeadingZeros()
-                                    ModBusController.updateLockRfid(
-                                        dockBean.addr,
-                                        lockBean.idx,
-                                        rfid
-                                    )
-                                    NetApi.getLockInfo(rfid) {
-                                        if (it != null) {
-                                            // TODO 考虑快速拿取
-                                            ModBusController.controlLockBuckle(
-                                                false,
-                                                dockBean.addr,
-                                                lockBean.idx
-                                            ) { itRst ->
-                                                if (itRst.isNotEmpty()) {
-                                                    // 上报锁具信息
-                                                    NetApi.updateLockReturn(
-                                                        rfid,
-                                                        MyApplication.instance!!.serialNo()
-                                                    ) {}
-                                                }
+                DOCK_TYPE_LOCK -> {
+                    dockBean.getLockList().forEach { lockBean ->
+                        if (lockBean.isExist) {
+                            ModBusController.readLockRfid(dockBean.addr, lockBean.idx) { res ->
+                                if (res.size < 11) {
+                                    LogUtil.e("Lock rfid error")
+                                    return@readLockRfid
+                                }
+                                val rfid = res.copyOfRange(3, 11).toHexStrings(false)
+                                    .removeLeadingZeros()
+                                ModBusController.updateLockRfid(
+                                    dockBean.addr,
+                                    lockBean.idx,
+                                    rfid
+                                )
+                                NetApi.getLockInfo(rfid) {
+                                    if (it != null) {
+                                        // TODO 考虑快速拿取
+                                        ModBusController.controlLockBuckle(
+                                            false,
+                                            dockBean.addr,
+                                            lockBean.idx
+                                        ) { itRst ->
+                                            if (itRst.isNotEmpty()) {
+                                                // 上报锁具信息
+                                                NetApi.updateLockReturn(
+                                                    rfid,
+                                                    MyApplication.instance!!.serialNo()
+                                                ) {}
                                             }
                                         }
                                     }
                                 }
-                            } else {
-                                sendEventMsg(
-                                    MsgEvent(
-                                        MSG_EVENT_DEVICE_TAKE_UPDATE,
-                                        DeviceTakeUpdateMsg(DEVICE_TYPE_LOCK, lockBean.rfid)
-                                    )
-                                )
                             }
+                        } else {
+                            sendEventMsg(
+                                MsgEvent(
+                                    MSG_EVENT_DEVICE_TAKE_UPDATE,
+                                    DeviceTakeUpdateMsg(DEVICE_TYPE_LOCK, lockBean.rfid)
+                                )
+                            )
                         }
                     }
+                }
 
-                    DOCK_TYPE_ELEC_LOCK_BOARD -> {
-                        // TODO 占位
-                    }
+                DOCK_TYPE_ELEC_LOCK_BOARD -> {
+                    // TODO 占位
+                }
 
-                    DOCK_TYPE_PORTABLE -> {
-                        // TODO 便携式待完善
-                        dockBean.deviceList.forEach { deviceBean ->
-                            if (deviceBean.isExist) {
-                                when (deviceBean.type) {
-                                    DEVICE_TYPE_KEY -> {
-                                        ModBusController.readKeyRfid(
+                DOCK_TYPE_PORTABLE -> {
+                    // TODO 便携式待完善
+                    dockBean.deviceList.forEach { deviceBean ->
+                        if (deviceBean.isExist) {
+                            when (deviceBean.type) {
+                                DEVICE_TYPE_KEY -> {
+                                    ModBusController.readKeyRfid(
+                                        dockBean.addr,
+                                        deviceBean.idx
+                                    ) { isLeft, res ->
+                                        if (res.size < 11) {
+                                            LogUtil.e("Key rfid error")
+                                            return@readKeyRfid
+                                        }
+                                        val rfid = res.copyOfRange(3, 11).toHexStrings(false)
+                                            .removeLeadingZeros()
+                                        ModBusController.updateKeyRfid(
                                             dockBean.addr,
-                                            deviceBean.idx
-                                        ) { isLeft, res ->
-                                            if (res.size < 11) {
-                                                LogUtil.e("Key rfid error")
-                                                return@readKeyRfid
-                                            }
-                                            val rfid = res.copyOfRange(3, 11).toHexStrings(false)
-                                                .removeLeadingZeros()
-                                            ModBusController.updateKeyRfid(
-                                                dockBean.addr,
-                                                true,
-                                                rfid
-                                            )
-                                            NetApi.getKeyInfo(rfid) {
-                                                if (it != null && !it.macAddress.isNullOrEmpty()) {
-                                                    ModBusController.updateKeyMac(
-                                                        dockBean.addr,
-                                                        isLeft,
-                                                        it.macAddress
-                                                    )
+                                            true,
+                                            rfid
+                                        )
+                                        NetApi.getKeyInfo(rfid) {
+                                            if (it != null && !it.macAddress.isNullOrEmpty()) {
+                                                ModBusController.updateKeyMac(
+                                                    dockBean.addr,
+                                                    isLeft,
+                                                    it.macAddress
+                                                )
 //                                                    showKeyReturnDialog(it.macAddress, isLeft, dockBean.addr)
-                                                } else {
-                                                    ToastUtils.tip(R.string.get_key_info_fail)
-                                                }
+                                            } else {
+                                                ToastUtils.tip(R.string.get_key_info_fail)
                                             }
-                                            // TODO 蓝牙通信
                                         }
-//                                        ModBusController.controlKeyBuckle(false, isLeft = true, dockBean.addr.toInt() - 1)
+                                        // TODO 蓝牙通信
                                     }
+//                                        ModBusController.controlKeyBuckle(false, isLeft = true, dockBean.addr.toInt() - 1)
+                                }
 
-                                    DEVICE_TYPE_LOCK -> {
-                                        ModBusController.readLockRfid(
+                                DEVICE_TYPE_LOCK -> {
+                                    ModBusController.readLockRfid(
+                                        dockBean.addr,
+                                        deviceBean.idx
+                                    ) { res ->
+                                        if (res.size < 11) {
+                                            LogUtil.e("Lock rfid error")
+                                            return@readLockRfid
+                                        }
+                                        val rfid = res.copyOfRange(3, 11).toHexStrings(false)
+                                            .removeLeadingZeros()
+                                        ModBusController.updateLockRfid(
                                             dockBean.addr,
-                                            deviceBean.idx
-                                        ) { res ->
-                                            if (res.size < 11) {
-                                                LogUtil.e("Lock rfid error")
-                                                return@readLockRfid
-                                            }
-                                            val rfid = res.copyOfRange(3, 11).toHexStrings(false)
-                                                .removeLeadingZeros()
-                                            ModBusController.updateLockRfid(
-                                                dockBean.addr,
-                                                deviceBean.idx,
-                                                rfid
-                                            )
-
-                                            NetApi.getLockInfo(rfid) {
-                                                if (it != null) {
-                                                    // TODO 考虑快速拿取
-                                                    ModBusController.controlLockBuckle(
-                                                        false,
-                                                        dockBean.addr,
-                                                        deviceBean.idx
-                                                    ) { itRst ->
-                                                        if (itRst.isNotEmpty()) {
-                                                            // 上报锁具信息
-                                                            NetApi.updateLockReturn(
-                                                                rfid,
-                                                                MyApplication.instance!!.serialNo()
-                                                            ) {}
-                                                        }
+                                            deviceBean.idx,
+                                            rfid
+                                        )
+
+                                        NetApi.getLockInfo(rfid) {
+                                            if (it != null) {
+                                                // TODO 考虑快速拿取
+                                                ModBusController.controlLockBuckle(
+                                                    false,
+                                                    dockBean.addr,
+                                                    deviceBean.idx
+                                                ) { itRst ->
+                                                    if (itRst.isNotEmpty()) {
+                                                        // 上报锁具信息
+                                                        NetApi.updateLockReturn(
+                                                            rfid,
+                                                            MyApplication.instance!!.serialNo()
+                                                        ) {}
                                                     }
                                                 }
                                             }
                                         }
                                     }
+                                }
 
-                                    DEVICE_TYPE_CARD -> {
-                                        ModBusController.readPortalCaseCardRfid(dockBean.addr) { res ->
-                                            if (res.size < 11) {
-                                                LogUtil.e("Portal Case card rfid error")
-                                                return@readPortalCaseCardRfid
-                                            }
-                                            val rfid = res.copyOfRange(3, 11).toHexStrings(false)
-                                                .removeLeadingZeros()
-                                            LogUtil.i("卡片RFID : $rfid")
+                                DEVICE_TYPE_CARD -> {
+                                    ModBusController.readPortalCaseCardRfid(dockBean.addr) { res ->
+                                        if (res.size < 11) {
+                                            LogUtil.e("Portal Case card rfid error")
+                                            return@readPortalCaseCardRfid
                                         }
+                                        val rfid = res.copyOfRange(3, 11).toHexStrings(false)
+                                            .removeLeadingZeros()
+                                        LogUtil.i("卡片RFID : $rfid")
                                     }
+                                }
 
-                                    DEVICE_TYPE_FINGERPRINT -> {
+                                DEVICE_TYPE_FINGERPRINT -> {
 
-                                    }
                                 }
                             }
                         }
                     }
                 }
-                Executor.delayOnMain(200) {
-                    listeners.forEach { it.callBack(dockBean) }
-                }
+            }
+            Executor.delayOnMain(200) {
+                listeners.forEach { it.callBack(dockBean) }
             }
         }
     }

+ 27 - 4
app/src/main/java/com/grkj/iscs/modbus/ModBusController.kt

@@ -48,7 +48,7 @@ object ModBusController {
 
     class StatusListener(
         val key: Any,
-        val listener: (Any) -> Unit,
+        val listener: (MBFrame, Any) -> Unit,
         val type: Int
     )
 
@@ -68,13 +68,36 @@ object ModBusController {
             ?.repeatSendToAll(MBFrame.READ_STATUS, {
                 interruptReadStatus
             }, { res ->
-//                // Logger.d("ModbusController", "res: ${res.map { it.toHexString() }}")
                 LogUtil.i("****************************************************************************")
                 // 过滤非空的数据,重置slaveCount
                 // 不再使用slaveCount,改用地址池
                 for (l in listeners) {
                     if (l.type == LISTENER_TYPE_STATUS) {
-                        l.listener(res)
+                        l.listener(MBFrame.READ_STATUS, res)
+                    }
+                }
+            }, REPEAT_FREQUENCY)
+            ?.repeatSendToAll(MBFrame.READ_BUCKLE_STATUS, {
+                interruptReadStatus
+            }, { res ->
+                LogUtil.i("****************************************************************************")
+                // 过滤非空的数据,重置slaveCount
+                // 不再使用slaveCount,改用地址池
+                for (l in listeners) {
+                    if (l.type == LISTENER_TYPE_STATUS) {
+                        l.listener(MBFrame.READ_BUCKLE_STATUS, res)
+                    }
+                }
+            }, REPEAT_FREQUENCY)
+            ?.repeatSendToAll(MBFrame.READ_LOCK_BUCKLE_EXTRA_STATUS, {
+                interruptReadStatus
+            }, { res ->
+                LogUtil.i("****************************************************************************")
+                // 过滤非空的数据,重置slaveCount
+                // 不再使用slaveCount,改用地址池
+                for (l in listeners) {
+                    if (l.type == LISTENER_TYPE_STATUS) {
+                        l.listener(MBFrame.READ_LOCK_BUCKLE_EXTRA_STATUS, res)
                     }
                 }
             }, REPEAT_FREQUENCY)
@@ -84,7 +107,7 @@ object ModBusController {
             ?.start()
     }
 
-    fun registerStatusListener(key: Any, listener: (Any) -> Unit) {
+    fun registerStatusListener(key: Any, listener: (MBFrame, Any) -> Unit) {
         listeners.add(StatusListener(key, listener, LISTENER_TYPE_STATUS))
     }
 

+ 0 - 1
app/src/main/java/com/grkj/iscs/modbus/ModBusManager.kt

@@ -192,7 +192,6 @@ class ModBusManager(
      * @param done 所有从机都发送完成后的回调
      */
     fun sendToAll(frame: MBFrame, done: ((res: List<ByteArray>) -> Unit)? = null) {
-//        if (slaveCount == 0) {
         if (mSlaveAddressList.size == 0) {
             done?.let { it(listOf()) }
             return

+ 1 - 1
app/src/main/java/com/grkj/iscs/model/UrlConsts.kt

@@ -4,7 +4,7 @@ object UrlConsts {
 //    const val BASE_URL = "http://192.168.28.82:9190"  // 本地
 //    const val BASE_URL = "http://192.168.28.97:9190"    // 车
 //    const val BASE_URL = "http://36.133.174.236:9190"    // 外
-    const val BASE_URL = "http://192.168.1.121:9190"    // 外
+    const val BASE_URL = "http://192.168.0.10:9190"    // 外
 //    const val BASE_URL = "http://120.27.232.27:9190"    // 外
     const val WEB_SOCKET = "ws://192.168.1.127:9090/websocket/iot/127"
 

+ 1 - 0
build.gradle

@@ -2,4 +2,5 @@
 plugins {
     alias(libs.plugins.android.application) apply false
     alias(libs.plugins.jetbrains.kotlin.android) apply false
+    id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
 }

+ 12 - 0
gradle/libs.versions.toml

@@ -14,6 +14,8 @@ okhttps = "4.1.0"
 log-interceptor = "3.14.9"
 autosize = "v1.2.1"
 fastble = "2.4.0"
+lifecycle-version = "2.9.0"
+room-version = "2.7.1"
 
 [libraries]
 androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -31,6 +33,16 @@ log-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor"
 autosize = { group = "com.github.JessYanCoding", name = "AndroidAutoSize", version.ref = "autosize" }
 fastble = { group = "com.github.Jasonchenlijian", name = "FastBle", version.ref = "fastble" }
 
+viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle-version" }
+viewmodel-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycle-version" }
+viewmodel-savestate = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-savedstate", version.ref = "lifecycle-version" }
+viewmodel-compiler = { group = "androidx.lifecycle", name = "lifecycle-compiler", version.ref = "lifecycle-version" }
+
+room-runtime = { group = "androidx.room",name = "room-runtime",version.ref = "room-version" }
+room-compiler = { group = "androidx.room",name = "room-ktx",version.ref = "room-version" }
+room-ktx = { group = "androidx.room",name = "room-ktx",version.ref = "room-version" }
+room-testing = { group = "androidx.room",name = "room-testing",version.ref = "room-version" }
+
 [plugins]
 android-application = { id = "com.android.application", version.ref = "agp" }
 jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }