[672][device] 硬件设备模块 添加链路日志、添加语音设备物理按钮单独回调、调试窗硬件服务状态弹窗优化
This commit is contained in:
@@ -9,7 +9,7 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.datacenter.location.MoGoLocationDispatcher
|
||||
import com.mogo.eagle.core.function.datacenter.v2x.SpeedLimitDispatcher
|
||||
import com.mogo.eagle.core.function.datacenter.v2x.TrafficLightDispatcher
|
||||
import com.mogo.eagle.core.function.datacenter.iot.IotInItManager
|
||||
import com.mogo.eagle.core.function.datacenter.iot.IotManager
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_DATA_CENTER_MODULE)
|
||||
class DataCenterProvider : IDataCenterProvider {
|
||||
@@ -27,12 +27,13 @@ class DataCenterProvider : IDataCenterProvider {
|
||||
CallerMsgBoxManager.queryAllMessages(it)
|
||||
TrafficLightDispatcher.INSTANCE.initServer(it)
|
||||
SpeedLimitDispatcher.INSTANCE.initLimit(it)
|
||||
IotInItManager.init()
|
||||
IotManager.init()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
TrafficLightDispatcher.INSTANCE.destroy()
|
||||
SpeedLimitDispatcher.INSTANCE.destroy()
|
||||
IotManager.destroy()
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.eagle.core.function.datacenter.iot
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.support.device.DevicesManager
|
||||
|
||||
object IotInItManager : IMoGoCloudListener {
|
||||
private const val TAG = "IotInIt"
|
||||
|
||||
|
||||
fun init() {
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
hardwareDeviceBind(SharedPrefsMgr.getInstance().sn)
|
||||
}
|
||||
|
||||
override fun tokenGot(token: String, sn: String) {
|
||||
super.tokenGot(token, sn)
|
||||
hardwareDeviceBind(sn)
|
||||
}
|
||||
|
||||
private fun hardwareDeviceBind(sn: String) {
|
||||
if (sn.isNotEmpty()) {
|
||||
DevicesManager.init(AbsMogoApplication.getApp(), sn)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mogo.eagle.core.function.datacenter.iot
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.support.device.DevicesManager
|
||||
import com.mogo.support.device.IWriteChainLogListener
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
object IotManager : IMoGoCloudListener, IWriteChainLogListener {
|
||||
private val sdf: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS ", Locale.CHINA)
|
||||
private val TAG = IotManager::class.java.simpleName
|
||||
private const val EVENT_KEY_HARDWARE_DEVICES = "event_key_hardware_devices"
|
||||
|
||||
fun init() {
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
hardwareDeviceBind(SharedPrefsMgr.getInstance().sn)
|
||||
DevicesManager.registerWriteChainLogListener(this)
|
||||
}
|
||||
|
||||
override fun tokenGot(token: String, sn: String) {
|
||||
super.tokenGot(token, sn)
|
||||
hardwareDeviceBind(sn)
|
||||
}
|
||||
|
||||
private fun hardwareDeviceBind(sn: String) {
|
||||
if (sn.isNotEmpty()) {
|
||||
DevicesManager.init(AbsMogoApplication.getApp(), sn)
|
||||
}
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
DevicesManager.destroy()
|
||||
DevicesManager.unregisterWriteChainLogListener()
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_INIT,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_HARDWARE_DEVICES,
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
override fun onWriteChainLog(title: String, info: String) {
|
||||
try {
|
||||
i("${TAG}_${EVENT_KEY_HARDWARE_DEVICES}", "${title}_${info}")
|
||||
val params = HashMap<String, Any>()
|
||||
params["time"] = sdf.format(Date())
|
||||
params["title"] = title
|
||||
params["info"] = info
|
||||
MogoAnalyticUtils.track(EVENT_KEY_HARDWARE_DEVICES, params)
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user