新增启动APP,连接上蓝牙检测固件新版本,弹窗提示更新并自动升级
This commit is contained in:
@@ -32,13 +32,15 @@ data class PetBean(
|
|||||||
var macID: String,
|
var macID: String,
|
||||||
var mealType: Int,
|
var mealType: Int,
|
||||||
var deviceType: Int,
|
var deviceType: Int,
|
||||||
|
var serviceVersion: String,//服务器上最新固件版本号
|
||||||
|
var showDFUDialog: Boolean,//是否显示了固件升级弹窗
|
||||||
var availableOrder: Int,//判断套餐是否可用或过期,1是可用 0不可用
|
var availableOrder: Int,//判断套餐是否可用或过期,1是可用 0不可用
|
||||||
var deviceId: String
|
var deviceId: String
|
||||||
) : Parcelable, BaseDiffBean() {
|
) : Parcelable, BaseDiffBean() {
|
||||||
constructor() : this(
|
constructor() : this(
|
||||||
"", "", "", "", 0, 1, MMKVUtil.getString(MMKVKey.UserId), "", 0, Utils.formatTime(
|
"", "", "", "", 0, 1, MMKVUtil.getString(MMKVKey.UserId), "", 0, Utils.formatTime(
|
||||||
System.currentTimeMillis(), Utils.DATE_FORMAT_PATTERN_CN
|
System.currentTimeMillis(), Utils.DATE_FORMAT_PATTERN_CN
|
||||||
), "", 0f, 0f, "", "", "", 1, 1, 1, ""
|
), "", 0f, 0f, "", "", "", 1, 1, "",false, 1, ""
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun isSameObject(other: Any): Boolean {
|
override fun isSameObject(other: Any): Boolean {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class DFUNewDialog(context: Context) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun startDfuState(version: String, onClick: () -> Unit) {
|
fun startDfuState(version: String, autoDfu: Boolean, onClick: () -> Unit) {
|
||||||
mVersion = "\t$version"
|
mVersion = "\t$version"
|
||||||
val ver = String.format(mContext.getString(R.string.txt_about_version), mVersion)
|
val ver = String.format(mContext.getString(R.string.txt_about_version), mVersion)
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
@@ -38,6 +38,10 @@ class DFUNewDialog(context: Context) :
|
|||||||
onClick()
|
onClick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (autoDfu) {
|
||||||
|
inDFUState()
|
||||||
|
onClick()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun inDFUState() {
|
private fun inDFUState() {
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ import com.abbidot.tracker.vm.CountDownTimerViewModel
|
|||||||
import com.abbidot.tracker.vm.DataViewModel
|
import com.abbidot.tracker.vm.DataViewModel
|
||||||
import com.abbidot.tracker.vm.FamilyViewModel
|
import com.abbidot.tracker.vm.FamilyViewModel
|
||||||
import com.abbidot.tracker.vm.LogBleReportViewModel
|
import com.abbidot.tracker.vm.LogBleReportViewModel
|
||||||
import com.abbidot.tracker.vm.SocketSendMessageViewModel
|
|
||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
import com.google.android.material.navigation.NavigationBarView
|
import com.google.android.material.navigation.NavigationBarView
|
||||||
import com.hjq.permissions.XXPermissions
|
import com.hjq.permissions.XXPermissions
|
||||||
@@ -81,7 +80,8 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
private val mAutomaticConnectionDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
private val mAutomaticConnectionDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
||||||
private val mLogBleReportViewModel: LogBleReportViewModel by viewModels()
|
private val mLogBleReportViewModel: LogBleReportViewModel by viewModels()
|
||||||
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
|
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
|
||||||
private val mSocketSendMessageViewModel: SocketSendMessageViewModel by viewModels()
|
|
||||||
|
// private val mSocketSendMessageViewModel: SocketSendMessageViewModel by viewModels()
|
||||||
private val mFamilyViewModel: FamilyViewModel by viewModels()
|
private val mFamilyViewModel: FamilyViewModel by viewModels()
|
||||||
|
|
||||||
private var mChangePetDialog: CommonListDialog? = null
|
private var mChangePetDialog: CommonListDialog? = null
|
||||||
@@ -108,6 +108,9 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
//是否一键定位
|
//是否一键定位
|
||||||
var isNotifyRefreshLocation = false
|
var isNotifyRefreshLocation = false
|
||||||
|
|
||||||
|
//自动升级固件
|
||||||
|
var isAutoDfu = false
|
||||||
|
|
||||||
private val mFragments = mutableListOf<Fragment>(
|
private val mFragments = mutableListOf<Fragment>(
|
||||||
ActivityV2Fragment.newInstance(this),
|
ActivityV2Fragment.newInstance(this),
|
||||||
RouteV3Fragment.newInstance(this),
|
RouteV3Fragment.newInstance(this),
|
||||||
@@ -643,6 +646,15 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转固件升级弹窗
|
||||||
|
*/
|
||||||
|
fun goDFU() {
|
||||||
|
isAutoDfu = true
|
||||||
|
mViewBinding.homeV2ViewPager2.setCurrentItem(3, false)
|
||||||
|
(mFragments[3] as PetV2Fragment).goDeviceDfu()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCurrentClick() {
|
override fun onCurrentClick() {
|
||||||
mChangePetDialog?.dismiss()
|
mChangePetDialog?.dismiss()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,6 +341,7 @@ class HomeTrackFragment :
|
|||||||
mTrackMenuList, getString(R.string.txt_firmware_version)
|
mTrackMenuList, getString(R.string.txt_firmware_version)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
autoDfu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,6 +428,23 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动固件升级
|
||||||
|
*/
|
||||||
|
fun autoDfu() {
|
||||||
|
getHomeV2Activity()?.let { h ->
|
||||||
|
if (h.isAutoDfu) {
|
||||||
|
//NestedScrollView缓慢自动滑倒底部
|
||||||
|
mViewBinding.root.let { scroll ->
|
||||||
|
scroll.post {
|
||||||
|
scroll.smoothScrollTo(0, scroll.bottom)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
firmwareCheckUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getShowError(): Boolean {
|
private fun getShowError(): Boolean {
|
||||||
var showCodeError = false
|
var showCodeError = false
|
||||||
getHomeV2Activity()?.apply {
|
getHomeV2Activity()?.apply {
|
||||||
@@ -452,8 +470,10 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getPetTrackerInfoData(switchPet: Boolean = false) {
|
fun getPetTrackerInfoData(switchPet: Boolean = false) {
|
||||||
isSwitchPet = switchPet
|
|
||||||
getHomeV2Activity()?.let {
|
getHomeV2Activity()?.let {
|
||||||
|
//防止多次执行
|
||||||
|
if (it.isLimitClick()) return
|
||||||
|
isSwitchPet = switchPet
|
||||||
it.getPet()?.apply {
|
it.getPet()?.apply {
|
||||||
if (isSwitchPet) {
|
if (isSwitchPet) {
|
||||||
isSwitchPet = false
|
isSwitchPet = false
|
||||||
@@ -863,8 +883,9 @@ class HomeTrackFragment :
|
|||||||
// }
|
// }
|
||||||
if (null == mDFUNewDialogDialog) mDFUNewDialogDialog = DFUNewDialog(mContext!!)
|
if (null == mDFUNewDialogDialog) mDFUNewDialogDialog = DFUNewDialog(mContext!!)
|
||||||
mDFUNewDialogDialog?.apply {
|
mDFUNewDialogDialog?.apply {
|
||||||
|
getHomeV2Activity()?.let { h ->
|
||||||
show()
|
show()
|
||||||
startDfuState(version) {
|
startDfuState(version, h.isAutoDfu) {
|
||||||
if (TextUtils.isEmpty(firmwareUrl)) {
|
if (TextUtils.isEmpty(firmwareUrl)) {
|
||||||
showToast(R.string.txt_no_down_url)
|
showToast(R.string.txt_no_down_url)
|
||||||
} else {
|
} else {
|
||||||
@@ -873,6 +894,8 @@ class HomeTrackFragment :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
h.isAutoDfu = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showToast(R.string.txt_latest_version)
|
showToast(R.string.txt_latest_version)
|
||||||
@@ -917,7 +940,7 @@ class HomeTrackFragment :
|
|||||||
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
||||||
}
|
}
|
||||||
findItem(mTrackMenuList, getString(R.string.txt_firmware_version))?.let { m ->
|
findItem(mTrackMenuList, getString(R.string.txt_firmware_version))?.let { m ->
|
||||||
m.menuValue = ""
|
// m.menuValue = ""
|
||||||
m.isSwitch = false
|
m.isSwitch = false
|
||||||
mTrackMenuAdapter.notifyItemChanged(
|
mTrackMenuAdapter.notifyItemChanged(
|
||||||
findIndexOf(
|
findIndexOf(
|
||||||
@@ -998,7 +1021,9 @@ class HomeTrackFragment :
|
|||||||
// mTrackMenuList[3].isSwitch = false
|
// mTrackMenuList[3].isSwitch = false
|
||||||
// mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
// mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
||||||
// mTrackMenuAdapter.notifyItemRangeChanged(1, 4)
|
// mTrackMenuAdapter.notifyItemRangeChanged(1, 4)
|
||||||
} else if (data0 == 0x18 && data1 == 1 && data2 == 0) {
|
}
|
||||||
|
//强制关机消息
|
||||||
|
else if (data0 == 0x18 && data1 == 1 && data2 == 0) {
|
||||||
mBleTrackDeviceBean?.apply {
|
mBleTrackDeviceBean?.apply {
|
||||||
SRBleUtil.instance.disconnectToMac(mac)
|
SRBleUtil.instance.disconnectToMac(mac)
|
||||||
}
|
}
|
||||||
@@ -1006,7 +1031,7 @@ class HomeTrackFragment :
|
|||||||
mTrackerSetViewModel.turnOff(ble.deviceServerId)
|
mTrackerSetViewModel.turnOff(ble.deviceServerId)
|
||||||
}
|
}
|
||||||
findItem(mTrackMenuList, getString(R.string.txt_firmware_version))?.let {
|
findItem(mTrackMenuList, getString(R.string.txt_firmware_version))?.let {
|
||||||
it.menuValue = ""
|
// it.menuValue = ""
|
||||||
//取消红点显示
|
//取消红点显示
|
||||||
it.isSwitch = false
|
it.isSwitch = false
|
||||||
mTrackMenuAdapter.notifyItemChanged(
|
mTrackMenuAdapter.notifyItemChanged(
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.abbidot.tracker.bean.BleReportDataBean
|
|||||||
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
||||||
import com.abbidot.tracker.bean.DataBean
|
import com.abbidot.tracker.bean.DataBean
|
||||||
import com.abbidot.tracker.bean.MapDeviceBean
|
import com.abbidot.tracker.bean.MapDeviceBean
|
||||||
|
import com.abbidot.tracker.bean.ReceiveDeviceData
|
||||||
import com.abbidot.tracker.constant.ConstantInt
|
import com.abbidot.tracker.constant.ConstantInt
|
||||||
import com.abbidot.tracker.constant.ConstantString
|
import com.abbidot.tracker.constant.ConstantString
|
||||||
import com.abbidot.tracker.constant.GetResultCallback
|
import com.abbidot.tracker.constant.GetResultCallback
|
||||||
@@ -50,6 +51,7 @@ import com.abbidot.tracker.util.ViewUtil
|
|||||||
import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil
|
import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil
|
||||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||||
import com.abbidot.tracker.vm.CountDownTimerViewModel
|
import com.abbidot.tracker.vm.CountDownTimerViewModel
|
||||||
|
import com.abbidot.tracker.vm.DeviceDFUViewModel
|
||||||
import com.abbidot.tracker.vm.FencesMapViewModel
|
import com.abbidot.tracker.vm.FencesMapViewModel
|
||||||
import com.abbidot.tracker.vm.MapViewModel
|
import com.abbidot.tracker.vm.MapViewModel
|
||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
@@ -70,6 +72,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
|
|
||||||
private val mFencesMapViewModel: FencesMapViewModel by viewModels()
|
private val mFencesMapViewModel: FencesMapViewModel by viewModels()
|
||||||
private val mMapViewModel: MapViewModel by viewModels()
|
private val mMapViewModel: MapViewModel by viewModels()
|
||||||
|
private val mDeviceDFUViewModel: DeviceDFUViewModel by viewModels()
|
||||||
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
|
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
|
||||||
|
|
||||||
private lateinit var mLocationManager: LocationManager
|
private lateinit var mLocationManager: LocationManager
|
||||||
@@ -331,6 +334,32 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
if (macID == reportData.mac) updateBleReportData(reportData)
|
if (macID == reportData.mac) updateBleReportData(reportData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//接收固件版本消息
|
||||||
|
XEventBus.observe(this, EventName.BleFirmwareVersion) { receiveData: ReceiveDeviceData ->
|
||||||
|
getHomeV2Activity()?.let { home ->
|
||||||
|
home.getPet(false)?.apply {
|
||||||
|
if (macID == receiveData.mac && !showDFUDialog) {
|
||||||
|
receiveData.data?.let { data ->
|
||||||
|
val version = String(data.sliceArray(3..11))
|
||||||
|
if (mDeviceDFUViewModel.checkVersionUpdate(version, serviceVersion)) {
|
||||||
|
showDFUDialog = true
|
||||||
|
val str = String.format(
|
||||||
|
getString(R.string.txt_new_firmware_version), serviceVersion
|
||||||
|
)
|
||||||
|
ViewUtil.instance.showDialog(
|
||||||
|
mContext!!, str, object : BaseDialog.OnDialogOkListener {
|
||||||
|
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||||
|
dialog.dismiss()
|
||||||
|
home.goDFU()
|
||||||
|
}
|
||||||
|
}, okTextResId = R.string.txt_upgrade
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//设备获取手机位置
|
//设备获取手机位置
|
||||||
XEventBus.observe(this, EventName.BleGetLocation) { mac: String ->
|
XEventBus.observe(this, EventName.BleGetLocation) { mac: String ->
|
||||||
getHomeV2Activity()?.getPet(false)?.apply {
|
getHomeV2Activity()?.getPet(false)?.apply {
|
||||||
|
|||||||
@@ -185,6 +185,16 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun goDeviceDfu() {
|
||||||
|
mViewBinding.apply {
|
||||||
|
if (vp2SwitchPetTrack.currentItem != 1) {
|
||||||
|
vp2SwitchPetTrack.setCurrentItem(1, false)
|
||||||
|
} else {
|
||||||
|
(mFragments[1] as HomeTrackFragment).autoDfu()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
|
|||||||
@@ -640,29 +640,31 @@ class ViewUtil private constructor() {
|
|||||||
vararg transformations: Transformation
|
vararg transformations: Transformation
|
||||||
) {
|
) {
|
||||||
var isEnableNetCache = true
|
var isEnableNetCache = true
|
||||||
val fileName = url.substring(url.lastIndexOf("/") + 1, url.length) + ".temp"
|
var fileName = url.substring(url.lastIndexOf("/") + 1, url.length)
|
||||||
var file: File? = null
|
var file: File? = null
|
||||||
if (!TextUtils.isEmpty(fileName)) {
|
if (!TextUtils.isEmpty(fileName)) {
|
||||||
|
fileName = "${fileName}.temp"
|
||||||
file = File(
|
file = File(
|
||||||
FileUtil.getDiskCacheDirectory(context, FileUtil.TEMP_DIRECTORY_NAME), fileName
|
FileUtil.getDiskCacheDirectory(context, FileUtil.TEMP_DIRECTORY_NAME), fileName
|
||||||
)
|
)
|
||||||
if (file.exists()) isEnableNetCache = false
|
if (file.exists()) {
|
||||||
|
LogUtil.e("${fileName}:图片文件存在")
|
||||||
|
isEnableNetCache = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
imageView.load(url) {
|
imageView.load(url) {
|
||||||
listener(object : ImageRequest.Listener {
|
listener(object : ImageRequest.Listener {
|
||||||
override fun onStart(request: ImageRequest) {
|
|
||||||
super.onStart(request)
|
|
||||||
LogUtil.e("onStart")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(request: ImageRequest, throwable: Throwable) {
|
override fun onError(request: ImageRequest, throwable: Throwable) {
|
||||||
super.onError(request, throwable)
|
super.onError(request, throwable)
|
||||||
LogUtil.e("onError:${throwable.message}")
|
LogUtil.e("${fileName}:imageLoadUrl onError:${throwable.message}")
|
||||||
|
file?.let {
|
||||||
|
if (it.exists()) it.delete()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(request: ImageRequest, metadata: ImageResult.Metadata) {
|
override fun onSuccess(request: ImageRequest, metadata: ImageResult.Metadata) {
|
||||||
super.onSuccess(request, metadata)
|
super.onSuccess(request, metadata)
|
||||||
LogUtil.e("onSuccess")
|
LogUtil.e("${fileName}:imageLoadUrl onSuccess")
|
||||||
file?.let {
|
file?.let {
|
||||||
if (!it.exists()) it.createNewFile()
|
if (!it.exists()) it.createNewFile()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class SRBleUtil private constructor() {
|
|||||||
//保存已连接成功设备的全局变量
|
//保存已连接成功设备的全局变量
|
||||||
private val mTrackDeviceList = mutableListOf<BleTrackDeviceBean>()
|
private val mTrackDeviceList = mutableListOf<BleTrackDeviceBean>()
|
||||||
private var mContext: Context? = null
|
private var mContext: Context? = null
|
||||||
|
private var isNotifyFirmware = false
|
||||||
|
|
||||||
//SRBleUtil单例模式
|
//SRBleUtil单例模式
|
||||||
companion object {
|
companion object {
|
||||||
@@ -230,6 +231,9 @@ class SRBleUtil private constructor() {
|
|||||||
} else if (data0 == 0x16 && data1 == 0x01 && data2 == 0x00) {
|
} else if (data0 == 0x16 && data1 == 0x01 && data2 == 0x00) {
|
||||||
//同步时间成功返回
|
//同步时间成功返回
|
||||||
LogUtil.e("${bleDevice.mac},同步时间成功")
|
LogUtil.e("${bleDevice.mac},同步时间成功")
|
||||||
|
isNotifyFirmware = true
|
||||||
|
//获取固件版本并通知map页
|
||||||
|
writeData(bleDevice, SRBleCmdUtil.instance.getFirmwareVersion())
|
||||||
openBleReportNotify(
|
openBleReportNotify(
|
||||||
bleDevice, notifyServiceUUID, bleNotifyCharacteristicUUID
|
bleDevice, notifyServiceUUID, bleNotifyCharacteristicUUID
|
||||||
)
|
)
|
||||||
@@ -242,6 +246,14 @@ class SRBleUtil private constructor() {
|
|||||||
mContext?.let {
|
mContext?.let {
|
||||||
mSocketUtilManage?.initEasySocket(it, bleDevice.mac, data)
|
mSocketUtilManage?.initEasySocket(it, bleDevice.mac, data)
|
||||||
}
|
}
|
||||||
|
} else if (data0 == 0x09 && data1 == 0x00) {
|
||||||
|
val deviceData = ReceiveDeviceData(bleDevice, data, bleDevice.mac)
|
||||||
|
if (isNotifyFirmware) {
|
||||||
|
isNotifyFirmware = false
|
||||||
|
XEventBus.post(EventName.BleFirmwareVersion, deviceData)
|
||||||
|
} else {
|
||||||
|
XEventBus.post(EventName.DeviceReceiveData, deviceData)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val deviceData = ReceiveDeviceData(bleDevice, data, bleDevice.mac)
|
val deviceData = ReceiveDeviceData(bleDevice, data, bleDevice.mac)
|
||||||
XEventBus.post(EventName.DeviceReceiveData, deviceData)
|
XEventBus.post(EventName.DeviceReceiveData, deviceData)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class DeviceDFUViewModel(application: Application) : AndroidViewModel(applicatio
|
|||||||
val localVersionInt = (localVersion.replace(".", "").substring(1, 4)).toInt()
|
val localVersionInt = (localVersion.replace(".", "").substring(1, 4)).toInt()
|
||||||
val serviceVersionInt = serviceVersion.replace(".", "").toInt()
|
val serviceVersionInt = serviceVersion.replace(".", "").toInt()
|
||||||
LogUtil.e("对比固件版本localVersionInt=$localVersionInt,serviceVersionInt=$serviceVersionInt")
|
LogUtil.e("对比固件版本localVersionInt=$localVersionInt,serviceVersionInt=$serviceVersionInt")
|
||||||
return serviceVersionInt > localVersionInt
|
return serviceVersionInt >= localVersionInt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import androidx.annotation.StringDef
|
|||||||
EventName.RefreshMessage,
|
EventName.RefreshMessage,
|
||||||
EventName.BluetoothSwitch,
|
EventName.BluetoothSwitch,
|
||||||
EventName.BleReport,
|
EventName.BleReport,
|
||||||
|
EventName.BleFirmwareVersion,
|
||||||
EventName.BleGetLocation,
|
EventName.BleGetLocation,
|
||||||
EventName.BleReportData,
|
EventName.BleReportData,
|
||||||
EventName.LogReport,
|
EventName.LogReport,
|
||||||
@@ -105,7 +106,11 @@ annotation class EventName {
|
|||||||
|
|
||||||
//日志上报数据
|
//日志上报数据
|
||||||
const val LogReport = "logReport"
|
const val LogReport = "logReport"
|
||||||
|
|
||||||
//设备获取手机位置
|
//设备获取手机位置
|
||||||
const val BleGetLocation = "bleGetLocation"
|
const val BleGetLocation = "bleGetLocation"
|
||||||
|
|
||||||
|
//设备固件版本
|
||||||
|
const val BleFirmwareVersion = "firmwareVersion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user