|
@@ -3,10 +3,6 @@ package com.grkj.iscs.ble
|
|
|
import com.clj.fastble.data.BleDevice
|
|
import com.clj.fastble.data.BleDevice
|
|
|
import com.clj.fastble.exception.BleException
|
|
import com.clj.fastble.exception.BleException
|
|
|
import com.grkj.iscs.BusinessManager
|
|
import com.grkj.iscs.BusinessManager
|
|
|
-import com.grkj.iscs.extentions.crc16
|
|
|
|
|
-import com.grkj.iscs.extentions.startsWith
|
|
|
|
|
-import com.grkj.iscs.extentions.toByteArray
|
|
|
|
|
-import com.grkj.iscs.extentions.toHexStrings
|
|
|
|
|
import com.grkj.iscs.ble.BleConst.REQ_CURRENT_STATUS
|
|
import com.grkj.iscs.ble.BleConst.REQ_CURRENT_STATUS
|
|
|
import com.grkj.iscs.ble.BleConst.REQ_GET_TOKEN
|
|
import com.grkj.iscs.ble.BleConst.REQ_GET_TOKEN
|
|
|
import com.grkj.iscs.ble.BleConst.REQ_GET_VERSION
|
|
import com.grkj.iscs.ble.BleConst.REQ_GET_VERSION
|
|
@@ -17,6 +13,10 @@ import com.grkj.iscs.ble.BleConst.REQ_TRANSFER_FILE
|
|
|
import com.grkj.iscs.ble.BleConst.REQ_WORK_TICKET_RESULT
|
|
import com.grkj.iscs.ble.BleConst.REQ_WORK_TICKET_RESULT
|
|
|
import com.grkj.iscs.ble.BleConst.REQ_WORK_TICKET_RESULT_PART
|
|
import com.grkj.iscs.ble.BleConst.REQ_WORK_TICKET_RESULT_PART
|
|
|
import com.grkj.iscs.ble.BleConst.WRITE_UUID
|
|
import com.grkj.iscs.ble.BleConst.WRITE_UUID
|
|
|
|
|
+import com.grkj.iscs.extentions.crc16
|
|
|
|
|
+import com.grkj.iscs.extentions.startsWith
|
|
|
|
|
+import com.grkj.iscs.extentions.toByteArray
|
|
|
|
|
+import com.grkj.iscs.extentions.toHexStrings
|
|
|
import com.grkj.iscs.util.Executor
|
|
import com.grkj.iscs.util.Executor
|
|
|
import com.grkj.iscs.util.log.LogUtil
|
|
import com.grkj.iscs.util.log.LogUtil
|
|
|
import java.io.File
|
|
import java.io.File
|
|
@@ -36,7 +36,7 @@ object BleCmdManager {
|
|
|
/**
|
|
/**
|
|
|
* 拼接时间戳 + token
|
|
* 拼接时间戳 + token
|
|
|
*/
|
|
*/
|
|
|
- fun assembleData(bleBean: BleBean, byteArray: ByteArray): ByteArray? {
|
|
|
|
|
|
|
+ private fun assembleData(bleBean: BleBean, byteArray: ByteArray): ByteArray? {
|
|
|
bleBean.token?.let {
|
|
bleBean.token?.let {
|
|
|
return assembleTimeStamp(byteArray) + it
|
|
return assembleTimeStamp(byteArray) + it
|
|
|
} ?: run {
|
|
} ?: run {
|
|
@@ -295,7 +295,7 @@ object BleCmdManager {
|
|
|
/**
|
|
/**
|
|
|
* 获取工作票完成情况分包
|
|
* 获取工作票完成情况分包
|
|
|
*/
|
|
*/
|
|
|
- fun getTicketStatusPart(idx: ByteArray, total: ByteArray, res: ByteArray, bleDevice: BleDevice, callback: CustomBleWriteCallback?) {
|
|
|
|
|
|
|
+ private fun getTicketStatusPart(idx: ByteArray, total: ByteArray, res: ByteArray, bleDevice: BleDevice, callback: CustomBleWriteCallback?) {
|
|
|
BusinessManager.getBleDeviceByMac(bleDevice.mac)?.let {
|
|
BusinessManager.getBleDeviceByMac(bleDevice.mac)?.let {
|
|
|
BleUtil.instance?.write(it.bleDevice, cmd = assembleData(it, REQ_WORK_TICKET_RESULT_PART + idx + total + res), writeCallback = callback)
|
|
BleUtil.instance?.write(it.bleDevice, cmd = assembleData(it, REQ_WORK_TICKET_RESULT_PART + idx + total + res), writeCallback = callback)
|
|
|
}
|
|
}
|