This commit is contained in:
mazengfei
2026-01-15 11:37:37 +08:00
parent 3ff58641aa
commit dbb7ccf8c7
4 changed files with 23 additions and 13 deletions
@@ -79,7 +79,7 @@ class HomeActivity : BaseActivity() {
//const val START_CMD= "${HEADER}0F01050020${FOOTER}" //const val START_CMD= "${HEADER}0F01050020${FOOTER}"
// const val ACTIVE_CMD = "${HEADER}000281C5D70A7D428948AD7254FADBB1516738938B4B9CBD73673E9D8E7F2E15062D$FOOTER" // const val ACTIVE_CMD = "${HEADER}000281C5D70A7D428948AD7254FADBB1516738938B4B9CBD73673E9D8E7F2E15062D$FOOTER"
//410激活码 // 410激活码
// const val ACTIVE_CMD = "${HEADER}000281C5D70A7D42894EA17650F5D0BB516838E7863C9ABD766C38958AFF0F3C062D${FOOTER}" // const val ACTIVE_CMD = "${HEADER}000281C5D70A7D42894EA17650F5D0BB516838E7863C9ABD766C38958AFF0F3C062D${FOOTER}"
//1楼餐厅激活码 //1楼餐厅激活码
const val ACTIVE_CMD = const val ACTIVE_CMD =
@@ -109,6 +109,9 @@ class HomeActivity : BaseActivity() {
var showHumidity = "0" var showHumidity = "0"
} }
//401-false1楼餐厅-true
private var isNeedOpenLock = true
private lateinit var binding: ActivityHomeBinding private lateinit var binding: ActivityHomeBinding
private val viewModel: NetViewModel by viewModels() private val viewModel: NetViewModel by viewModels()
@@ -401,7 +404,7 @@ class HomeActivity : BaseActivity() {
"${LOG_PREFIX}[温控信息上报]${cmdFlag}指令:${data},发送应答指令:${respCmd}" "${LOG_PREFIX}[温控信息上报]${cmdFlag}指令:${data},发送应答指令:${respCmd}"
log(logMsg) log(logMsg)
sendCmd(respCmd) sendCmd(respCmd)
val tempC = HexUtils.signedHexToDec(data.substring(0, 4)) * 0.1 val tempC = HexUtils.signedHexToDec(data.take(4)) * 0.1
updateLeftStatus("$deviceName ${"%.1f".format(tempC)}°C / -%") updateLeftStatus("$deviceName ${"%.1f".format(tempC)}°C / -%")
//D6DADEDB1001015D020000000027001E00020000001E001C00B40000000000010000000100040000001900440003000F00000000000FFFE6000200010002FFD80044000300010005001E0001FFD80056001400280000000000000000008300090000003C00D2000000000000007F003700000000A100000031323136334238423134303233303456322E313100FFFF //D6DADEDB1001015D020000000027001E00020000001E001C00B40000000000010000000100040000001900440003000F00000000000FFFE6000200010002FFD80044000300010005001E0001FFD80056001400280000000000000000008300090000003C00D2000000000000007F003700000000A100000031323136334238423134303233303456322E313100FFFF
@@ -610,11 +613,13 @@ class HomeActivity : BaseActivity() {
setOnItemClickListener { _, _, position -> setOnItemClickListener { _, _, position ->
shelfIndex = position shelfIndex = position
lifecycleScope.launch { lifecycleScope.launch {
if (isNeedOpenLock) {
val openCmd = if (list[position].deviceNo in 1..5) val openCmd = if (list[position].deviceNo in 1..5)
LEFT_SHELF_OPEN_CMD LEFT_SHELF_OPEN_CMD
else else
RIGHT_SHELF_OPEN_CMD RIGHT_SHELF_OPEN_CMD
val openState = SerialPortManager.send(openCmd) val openState = SerialPortManager.send(openCmd)
}
// if (openState.not()) { // if (openState.not()) {
// toast("${list[position].goodsName}柜门开启失败") // toast("${list[position].goodsName}柜门开启失败")
// return@launch // return@launch
@@ -0,0 +1,7 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<color android:color="@android:color/white" />
</item>
</ripple>
@@ -8,7 +8,7 @@
android:layout_margin="12dp" android:layout_margin="12dp"
app:cardBackgroundColor="@color/bg_card_blue" app:cardBackgroundColor="@color/bg_card_blue"
app:cardCornerRadius="12dp" app:cardCornerRadius="12dp"
app:cardElevation="5dp" app:cardElevation="0dp"
app:rippleColor="#B0BEC5"> app:rippleColor="#B0BEC5">
<LinearLayout <LinearLayout
+3 -5
View File
@@ -1,10 +1,8 @@
## This file is automatically generated by Android Studio. ## This file must *NOT* be checked into Version Control Systems,
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration. # as it contains information specific to your local configuration.
# #
# Location of the SDK. This is only used by Gradle. # Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the # For customization when using a Version Control System, please read the
# header note. # header note.
sdk.dir=D\:\\Android\\sdk #Tue Jan 13 10:38:32 CST 2026
sdk.dir=C\:\\Users\\HUAWEI\\AppData\\Local\\Android\\Sdk