|
|
@@ -518,6 +518,7 @@ object BusinessManager {
|
|
|
prepareDoneCallBack: ((Boolean, BleBean?) -> Unit)?
|
|
|
) {
|
|
|
Executor.runOnMain {
|
|
|
+ // 如果是已经连上的设备,从indicate开始往下走,不需要再扫描了
|
|
|
if (BleManager.getInstance().isConnected(mac)) {
|
|
|
deviceList.find { it.bleDevice.mac == mac }?.let { itBleDevice ->
|
|
|
indicate(itBleDevice, isNeedLoading, prepareDoneCallBack)
|
|
|
@@ -710,7 +711,7 @@ object BusinessManager {
|
|
|
/**
|
|
|
* 下发工作票
|
|
|
*/
|
|
|
- fun sendTicketBusiness(
|
|
|
+ private fun sendTicketBusiness(
|
|
|
mac: String,
|
|
|
ticketDetail: TicketDetailRespVO,
|
|
|
lockList: MutableList<String?>?,
|
|
|
@@ -954,13 +955,14 @@ object BusinessManager {
|
|
|
}
|
|
|
|
|
|
fun getCurrentStatus(bleDevice: BleDevice) {
|
|
|
+ LogUtil.i("getCurrentStatus - ${bleDevice.mac}")
|
|
|
BleCmdManager.getCurrentStatus(bleDevice, object : CustomBleWriteCallback() {
|
|
|
override fun onWriteSuccess(current: Int, total: Int, justWrite: ByteArray?) {
|
|
|
- LogUtil.i("getCurrentStatus success")
|
|
|
+ LogUtil.i("getCurrentStatus success : ${bleDevice.mac}")
|
|
|
}
|
|
|
|
|
|
override fun onWriteFailure(exception: BleException?) {
|
|
|
- LogUtil.i("getCurrentStatus fail")
|
|
|
+ LogUtil.i("getCurrentStatus fail : ${bleDevice.mac}")
|
|
|
Executor.delayOnMain(500) {
|
|
|
getCurrentStatus(bleDevice)
|
|
|
}
|
|
|
@@ -972,7 +974,7 @@ object BusinessManager {
|
|
|
LogUtil.i("switchWorkMode - ${bleDevice.mac}")
|
|
|
BleCmdManager.switchMode(STATUS_WORK, bleDevice, object : CustomBleWriteCallback() {
|
|
|
override fun onWriteSuccess(current: Int, total: Int, justWrite: ByteArray?) {
|
|
|
- LogUtil.i("switch mode work success")
|
|
|
+ LogUtil.i("switch mode work success : ${bleDevice.mac}")
|
|
|
// 只能在这里断开,不能全部断开
|
|
|
BleManager.getInstance().disconnect(bleDevice)
|
|
|
|
|
|
@@ -1007,7 +1009,7 @@ object BusinessManager {
|
|
|
return@handleTicketStatus
|
|
|
}
|
|
|
if (isNeedLoading) mEventBus.postValue(MsgEvent(MSG_EVENT_LOADING, LoadingMsg(false, "工作票完成状态读取完成", null)))
|
|
|
- LogUtil.i("Get ticket status complete")
|
|
|
+ LogUtil.i("Get ticket status complete : ${bleDevice.mac}")
|
|
|
// TD:Ticket Done
|
|
|
if (isNeedLoading) mEventBus.postValue(MsgEvent(MSG_EVENT_LOADING, LoadingMsg(false, "TD$ticketJson}", true)))
|
|
|
// TODO 根据工作票完成情况,切换为待机模式
|