[680][device]硬件绑定服务修改成仅客户端进行绑定

This commit is contained in:
xinfengkun
2024-11-22 19:32:06 +08:00
parent 6b38a4317a
commit ffa486cf8d
2 changed files with 34 additions and 20 deletions

View File

@@ -49,8 +49,10 @@ object DevicesManager {
}
fun destroy() {
serialPortManager.close(DefaultDevices.VERIFICATION.path)
serialPortManager.close(DefaultDevices.SPEECH_CX830SE.path)
if (serviceBindState == SERVICE_STATE.BIND_SUCCEED) {
serialPortManager.close(DefaultDevices.VERIFICATION.path)
serialPortManager.close(DefaultDevices.SPEECH_CX830SE.path)
}
serialPortManager.unbindService()
}
@@ -396,16 +398,18 @@ object DevicesManager {
*/
@Define.Code
fun speechCx830seBroadcast(content: String?): Int {
val code = serialPortManager.speechCx830seBroadcastSpeech(
DefaultDevices.SPEECH_CX830SE,
content
)
writeChainLogListener?.onWriteChainLog(
"车外语音设备",
"播报内容=${content ?: " 调用结果=${code}"}"
)
return code
if (serviceBindState == SERVICE_STATE.BIND_SUCCEED) {
val code = serialPortManager.speechCx830seBroadcastSpeech(
DefaultDevices.SPEECH_CX830SE,
content
)
writeChainLogListener?.onWriteChainLog(
"车外语音设备",
"播报内容=${content ?: " 调用结果=${code}"}"
)
return code
}
return -1
}
/**
@@ -413,12 +417,15 @@ object DevicesManager {
* @param device [DefaultDevices.SPEECH_CX830SE] [DefaultDevices.VERIFICATION] [DefaultDevices.VERIFICATION_SK87R] [DefaultDevices.VERIFICATION_Q350]
*/
fun isDeviceOpen(device: Device): Boolean {
if (DefaultDevices.VERIFICATION.equals(device)) {
return serialPortManager.isOpen(DefaultDevices.VERIFICATION_SK87R.path) || serialPortManager.isOpen(
DefaultDevices.VERIFICATION_Q350.path
)
if (serviceBindState == SERVICE_STATE.BIND_SUCCEED) {
if (DefaultDevices.VERIFICATION.equals(device)) {
return serialPortManager.isOpen(DefaultDevices.VERIFICATION_SK87R.path) || serialPortManager.isOpen(
DefaultDevices.VERIFICATION_Q350.path
)
}
return serialPortManager.isOpen(device.path)
}
return serialPortManager.isOpen(device.path)
return false
}
/**