增加蓝牙围栏设置,修改了对比测试bug
This commit is contained in:
@@ -28,9 +28,9 @@ android {
|
||||
applicationId "com.abbidot.tracker"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 35
|
||||
versionCode 2021
|
||||
// versionName "2.0.21"
|
||||
versionName "2.0.21-Beta1"
|
||||
versionCode 2022
|
||||
// versionName "2.0.22"
|
||||
versionName "2.0.22-Beta2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -406,6 +406,7 @@
|
||||
<activity
|
||||
android:name=".ui.activity.HomeV2Activity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.activity.set.AboutActivity"
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.abbidot.tracker.bean.CountryCodeBean
|
||||
import com.abbidot.tracker.bean.DeviceBean
|
||||
import com.abbidot.tracker.bean.DeviceDetailBean
|
||||
import com.abbidot.tracker.bean.FamilyPetBean
|
||||
import com.abbidot.tracker.bean.FencesBean
|
||||
import com.abbidot.tracker.bean.FirmwareBean
|
||||
import com.abbidot.tracker.bean.GetFencesBean
|
||||
import com.abbidot.tracker.bean.HistoryDataBean
|
||||
@@ -360,7 +361,7 @@ interface INetworkService {
|
||||
@Field("ancillaryOtherLatitude") ancillaryOtherLatitude: Double,
|
||||
@Field("ancillaryOtherLongitude") ancillaryOtherLongitude: Double
|
||||
// @Field("fenceId") fenceId: String
|
||||
): BaseResponse<String>
|
||||
): BaseResponse<FencesBean>
|
||||
|
||||
/**
|
||||
* 添加矩形围栏
|
||||
@@ -393,7 +394,7 @@ interface INetworkService {
|
||||
@Field("latitudeCenter") latitudeCenter: Double,
|
||||
@Field("longDistance") longDistance: Int,
|
||||
@Field("shortDistance") shortDistance: Int
|
||||
): BaseResponse<String>
|
||||
): BaseResponse<FencesBean>
|
||||
|
||||
/**
|
||||
* 添加矩形围栏
|
||||
@@ -426,7 +427,7 @@ interface INetworkService {
|
||||
@Field("latitudeCenter") latitudeCenter: Double,
|
||||
// @Field("longDistance") longDistance: Double,
|
||||
// @Field("shortDistance") shortDistance: Double
|
||||
): BaseResponse<String>
|
||||
): BaseResponse<FencesBean>
|
||||
|
||||
/**
|
||||
* 更新圆形围栏
|
||||
|
||||
@@ -349,6 +349,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
setSelectPetPos(mSelectPetPosition)
|
||||
//判断套餐有没有到期
|
||||
packageUnavailableState()
|
||||
//刚开始打开APP上传日志
|
||||
getPet(false)?.apply {
|
||||
mLogBleReportViewModel.uploadLog(mContext, macID)
|
||||
}
|
||||
|
||||
@@ -297,8 +297,12 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
mFencesManageViewModel.mFencesAddLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
sendNotifyData()
|
||||
successTips(R.string.txt_fence_saved)
|
||||
it.getOrNull()?.apply {
|
||||
// sendNotifyData()
|
||||
mFencesBean.fenceId = fenceId
|
||||
sendFenceData()
|
||||
successTips(R.string.txt_fence_saved)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
@@ -317,7 +321,10 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
XEventBus.post(EventName.DeleteFences)
|
||||
sendNotifyData()
|
||||
// sendNotifyData()
|
||||
//删除蓝牙标志
|
||||
mFencesBean.isOn = ConstantInt.Type2
|
||||
sendFenceData()
|
||||
showToast(
|
||||
R.string.txt_delete_success, isFinish = true, gravity = Gravity.CENTER
|
||||
)
|
||||
@@ -327,7 +334,8 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
mFencesManageViewModel.mUpdateFenceLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
sendNotifyData()
|
||||
// sendNotifyData()
|
||||
sendFenceData()
|
||||
successTips(R.string.txt_fence_saved)
|
||||
}
|
||||
})
|
||||
@@ -340,6 +348,15 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送围栏数据
|
||||
*/
|
||||
private fun sendFenceData() {
|
||||
mPetBean?.apply {
|
||||
SRBleUtil.instance.isConnectBleSendFenceData(macID, mFencesBean)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成功提示
|
||||
*/
|
||||
@@ -760,24 +777,18 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
when (mFencesBean.fenceShapeType) {
|
||||
ConstantInt.CircleShapeType -> {
|
||||
mFencesBean.radius = Utils.roundOffToInt(distances[0].toDouble())
|
||||
// val radiusStr = Util.metricConvertUnits(
|
||||
// mContext, distances[0].toFloat(), ConstantInt.Type3, 2
|
||||
// ).toString() + mDistanceUnit
|
||||
val radiusStr = mFencesBean.radius.toString() + mDistanceUnit
|
||||
val r = Util.metricConvertUnits(distances[0].toFloat(), ConstantInt.Type3, 2)
|
||||
val radiusStr = Utils.roundOffToInt(r.toDouble()).toString() + mDistanceUnit
|
||||
mViewBinding.fencesZoneCircleView.setShowDisDistance(radiusStr)
|
||||
}
|
||||
|
||||
ConstantInt.RectangleShapeType -> {
|
||||
mFencesBean.longDistance = Utils.roundOffToInt(distances[0].toDouble())
|
||||
mFencesBean.shortDistance = Utils.roundOffToInt(distances[1].toDouble())
|
||||
// val longStr = Util.metricConvertUnits(
|
||||
// mContext, distances[0].toFloat(), ConstantInt.Type3, 2
|
||||
// ).toString() + mDistanceUnit
|
||||
// val shortStr = Util.metricConvertUnits(
|
||||
// mContext, distances[0].toFloat(), ConstantInt.Type3, 2
|
||||
// ).toString() + mDistanceUnit
|
||||
val longStr = mFencesBean.longDistance.toString() + mDistanceUnit
|
||||
val shortStr = mFencesBean.shortDistance.toString() + mDistanceUnit
|
||||
val l = Util.metricConvertUnits(distances[0].toFloat(), ConstantInt.Type3, 2)
|
||||
val s = Util.metricConvertUnits(distances[1].toFloat(), ConstantInt.Type3, 2)
|
||||
val longStr = Utils.roundOffToInt(l.toDouble()).toString() + mDistanceUnit
|
||||
val shortStr = Utils.roundOffToInt(s.toDouble()).toString() + mDistanceUnit
|
||||
mViewBinding.fencesZoneRectView.setShowDisDistance(longStr, shortStr)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.abbidot.tracker.databinding.ActivityPreviewFencesZoneBinding
|
||||
import com.abbidot.tracker.ui.common.map.PreviewFencesZoneCommon
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||
import com.abbidot.tracker.vm.FencesManageViewModel
|
||||
import com.abbidot.tracker.vm.FencesMapViewModel
|
||||
import com.daimajia.androidanimations.library.Techniques
|
||||
@@ -154,6 +155,7 @@ class PreviewFencesZoneActivity :
|
||||
mFencesManageViewModel.getFenceList(
|
||||
this@PreviewFencesZoneActivity, mCurrentDeviceId
|
||||
)
|
||||
sendFenceData()
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -163,6 +165,9 @@ class PreviewFencesZoneActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
isCurrentActivityDelete = true
|
||||
//删除蓝牙标志
|
||||
mCurrentFences?.isOn = ConstantInt.Type2
|
||||
sendFenceData()
|
||||
XEventBus.post(EventName.DeleteFences)
|
||||
showToast(R.string.txt_delete_success, true, gravity = Gravity.CENTER)
|
||||
}
|
||||
@@ -182,6 +187,18 @@ class PreviewFencesZoneActivity :
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送围栏数据
|
||||
*/
|
||||
private fun sendFenceData() {
|
||||
mPetBean?.apply {
|
||||
mCurrentFences?.apply {
|
||||
SRBleUtil.instance.isConnectBleSendFenceData(macID, this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置当前围栏的信息
|
||||
*/
|
||||
|
||||
@@ -137,14 +137,14 @@ class PetHeightActivity : BaseActivity<ActivityPetHeightBinding>(ActivityPetHeig
|
||||
"${mViewBinding.npDialogPetHeightTens.value}.${mViewBinding.npDialogPetHeightUnit.value}"
|
||||
if (isFirstBind) {
|
||||
mPetBean?.apply {
|
||||
height = Util.convertMetricUnits(value.toFloat(), ConstantInt.Type0)
|
||||
height = Util.convertMetricUnits(value.toFloat(), ConstantInt.Type0,4)
|
||||
val intent = Intent(mContext, PetWeightActivity::class.java)
|
||||
intent.putExtra(ConstantString.Pet, this)
|
||||
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||
startActivity(intent)
|
||||
}
|
||||
} else {
|
||||
// val petHeight = Util.convertMetricUnits(mContext, value.toFloat(), ConstantInt.Type0)
|
||||
// val petHeight = Util.convertMetricUnits(mContext, value.toFloat(), ConstantInt.Type0,4)
|
||||
val intent = Intent()
|
||||
intent.putExtra(ConstantString.PetHeight, value.toFloat())
|
||||
setResult(ResultCode.ResultCode_2, intent)
|
||||
|
||||
@@ -424,13 +424,13 @@ class PetProfileActivity :
|
||||
//接收身高设置页面的值
|
||||
it.data?.extras?.getFloat(ConstantString.PetHeight)?.apply {
|
||||
mViewBinding.ilPetProfileHeight.etInputContent.setText("$this")
|
||||
mPetBean?.height = Util.convertMetricUnits(this, ConstantInt.Type0)
|
||||
mPetBean?.height = Util.convertMetricUnits(this, ConstantInt.Type0,4)
|
||||
}
|
||||
} else if (it.resultCode == ResultCode.ResultCode_3) {
|
||||
//接收体重设置页面的值
|
||||
it.data?.extras?.getFloat(ConstantString.PetWeight)?.apply {
|
||||
mViewBinding.ilPetProfileWeight.etInputContent.setText("$this")
|
||||
mPetBean?.weight = Util.convertMetricUnits(this, ConstantInt.Type1)
|
||||
mPetBean?.weight = Util.convertMetricUnits(this, ConstantInt.Type1,4)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,7 +502,7 @@ class PetProfileActivity :
|
||||
if (any is String) {
|
||||
mViewBinding.ilPetProfileWeight.etInputContent.setText(any)
|
||||
weight = Util.convertMetricUnits(
|
||||
any.toFloat(), ConstantInt.Type1
|
||||
any.toFloat(), ConstantInt.Type1,4
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,14 +119,14 @@ class PetWeightActivity : BaseActivity<ActivityPetWeightBinding>(ActivityPetWeig
|
||||
"${mViewBinding.npSetPetWeightTens.value}.${mViewBinding.npSetPetWeightUnit.value}"
|
||||
if (isFirstBind) {
|
||||
mPetBean?.apply {
|
||||
weight = Util.convertMetricUnits(value.toFloat(), ConstantInt.Type1)
|
||||
weight = Util.convertMetricUnits(value.toFloat(), ConstantInt.Type1,4)
|
||||
val intent = Intent(mContext, FirstPetProfileActivity::class.java)
|
||||
intent.putExtra(ConstantString.Pet, this)
|
||||
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||
startActivity(intent)
|
||||
}
|
||||
} else {
|
||||
// val petWeight = Util.convertMetricUnits(mContext, value.toFloat(), ConstantInt.Type1)
|
||||
// val petWeight = Util.convertMetricUnits(mContext, value.toFloat(), ConstantInt.Type1,4)
|
||||
val intent = Intent()
|
||||
intent.putExtra(ConstantString.PetWeight, value.toFloat())
|
||||
setResult(ResultCode.ResultCode_3, intent)
|
||||
|
||||
@@ -55,6 +55,10 @@ class SubscriptionHistoryActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
it.getOrNull()?.let { list ->
|
||||
if (mSubscriptionsOrderList.size > 0) {
|
||||
mHistoryAdapter.notifyItemRangeRemoved(0, mSubscriptionsOrderList.size)
|
||||
mSubscriptionsOrderList.clear()
|
||||
}
|
||||
for (l in list) {
|
||||
mSubscriptionsOrderList.add(l)
|
||||
if (l.annualCareType == ConstantInt.Type1) {
|
||||
|
||||
@@ -242,7 +242,7 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
||||
// getString(R.string.map_current_update_time),
|
||||
// DateUtils.getRelativeTimeSpanString(timeStamp * 1000)
|
||||
// )
|
||||
val timeString = Utils.formatTime(timeStamp * 1000, Utils.DATE_FORMAT_PATTERN_EN6)
|
||||
val timeString = Utils.formatTime(timeStamp * 1000, Utils.DATE_FORMAT_PATTERN_EN10)
|
||||
//更新位置时间
|
||||
dayTime = timeString
|
||||
|
||||
|
||||
@@ -91,12 +91,9 @@ class CreditCardPaymentFragment : BaseFragment<FragmentCreditCardPaymentBinding>
|
||||
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
|
||||
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CreditCardTableName)
|
||||
list?.let {
|
||||
if (it.isNotEmpty()) mActivity!!.runOnUiThread {
|
||||
mActivity?.runOnUiThread {
|
||||
val sortedByList = list.sortedByDescending { l -> l.isPrimary }.toMutableList()
|
||||
//卡管理 不需要点击效果
|
||||
if (null != mPaymentMethodActivity.mOrderBean) {
|
||||
setCheckAndPrimaryState(sortedByList)
|
||||
}
|
||||
setCheckAndPrimaryState(sortedByList)
|
||||
mCreditCardAdapter.setData(sortedByList, true)
|
||||
}
|
||||
}
|
||||
@@ -150,22 +147,30 @@ class CreditCardPaymentFragment : BaseFragment<FragmentCreditCardPaymentBinding>
|
||||
}
|
||||
|
||||
private fun setCheckAndPrimaryState(list: MutableList<CreditCardBean>) {
|
||||
if (list.size == 0) return
|
||||
var haveCheck = false
|
||||
for (l in list) {
|
||||
if (l.checked) {
|
||||
haveCheck = true
|
||||
break
|
||||
if (list.size == 0) {
|
||||
mViewBinding.apply {
|
||||
tvCreditCardPaymentChoose.visibility = View.GONE
|
||||
btnCreditCardPaymentAdd.visibility = View.GONE
|
||||
}
|
||||
return
|
||||
}
|
||||
if (!haveCheck) {
|
||||
list[0].checked = true
|
||||
//卡管理 不需要点击效果
|
||||
if (null == mPaymentMethodActivity.mOrderBean) {
|
||||
mViewBinding.btnMakePaymentCreditCard.visibility = View.GONE
|
||||
} else {
|
||||
var haveCheck = false
|
||||
for (l in list) {
|
||||
if (l.checked) {
|
||||
haveCheck = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!haveCheck) {
|
||||
list[0].checked = true
|
||||
}
|
||||
mViewBinding.btnMakePaymentCreditCard.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
mViewBinding.apply {
|
||||
btnMakePaymentCreditCard.visibility =
|
||||
if (null == mPaymentMethodActivity.mOrderBean) View.GONE
|
||||
else View.VISIBLE
|
||||
tvCreditCardPaymentChoose.visibility = View.VISIBLE
|
||||
btnCreditCardPaymentAdd.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.abbidot.tracker.util.bluetooth
|
||||
|
||||
import android.text.TextUtils
|
||||
import com.abbidot.tracker.bean.FencesBean
|
||||
import com.abbidot.tracker.bean.WiFiZoneBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import java.util.TimeZone
|
||||
import kotlin.experimental.xor
|
||||
|
||||
@@ -73,6 +75,17 @@ class SRBleCmdUtil private constructor() {
|
||||
return calcCrc8(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 将十六进制字符串转换为字节数组
|
||||
*/
|
||||
private fun hexStringToByteArray(hexString: String): ByteArray {
|
||||
require(hexString.length % 2 == 0) { "十六进制字符串长度必须为偶数" }
|
||||
return ByteArray(hexString.length / 2) { i ->
|
||||
val startIndex = i * 2
|
||||
hexString.substring(startIndex, startIndex + 2).toInt(16).toByte()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 长整型转换高低4个字节
|
||||
*/
|
||||
@@ -294,5 +307,40 @@ class SRBleCmdUtil private constructor() {
|
||||
val byteArray = byteArrayOf(0x1A, writeAndRed.toByte(), status.toByte())
|
||||
return getCrc8Cmd(byteArray)
|
||||
}
|
||||
|
||||
/**
|
||||
* 围栏设置
|
||||
*/
|
||||
fun setFences(fencesBean: FencesBean): ByteArray {
|
||||
var byteArray = byteArrayOf(0x13, CMD_WRITE.toByte())
|
||||
fencesBean.apply {
|
||||
val fenceIdByteArray = hexStringToByteArray(fenceId.takeLast(8))
|
||||
byteArray = byteArray.plus(fenceIdByteArray)
|
||||
byteArray = byteArray.plus(
|
||||
byteArrayOf(
|
||||
isOn.toByte(), fenceType.toByte(), fenceShapeType.toByte()
|
||||
)
|
||||
)
|
||||
if (fenceShapeType == ConstantInt.Type1) {
|
||||
byteArray = byteArray.plus(longTo4ByteArray((longitudeCenter * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((latitudeCenter * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((radius.toLong())))
|
||||
} else {
|
||||
byteArray = byteArray.plus(longTo4ByteArray((longitudeA * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((latitudeA * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((longitudeB * 1000000L).toLong()))
|
||||
}
|
||||
byteArray = byteArray.plus(longTo4ByteArray((latitudeB * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((longitudeC * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((latitudeC * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((longitudeD * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((latitudeD * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((longitudeE * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((latitudeE * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((longitudeF * 1000000L).toLong()))
|
||||
byteArray = byteArray.plus(longTo4ByteArray((latitudeF * 1000000L).toLong()))
|
||||
}
|
||||
return getCrc8Cmd(byteArray)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,12 @@ import com.abbidot.baselibrary.eventbus.XEventBus
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
||||
import com.abbidot.tracker.bean.FencesBean
|
||||
import com.abbidot.tracker.bean.ReceiveDeviceData
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.clj.fastble.BleManager
|
||||
import com.clj.fastble.callback.BleGattCallback
|
||||
import com.clj.fastble.callback.BleMtuChangedCallback
|
||||
import com.clj.fastble.callback.BleNotifyCallback
|
||||
import com.clj.fastble.callback.BleRssiCallback
|
||||
import com.clj.fastble.callback.BleWriteCallback
|
||||
@@ -27,7 +29,6 @@ import com.clj.fastble.data.BleDevice
|
||||
import com.clj.fastble.data.BleScanState
|
||||
import com.clj.fastble.exception.BleException
|
||||
import com.clj.fastble.utils.HexUtil
|
||||
import com.hjq.toast.Toaster
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
@@ -308,7 +309,7 @@ class SRBleUtil private constructor() {
|
||||
) {
|
||||
LogUtil.d("send cmd:" + HexUtil.formatHexString(data, true))
|
||||
BleManager.getInstance()
|
||||
.write(bleDevice, uuidService, uuidWrite, data, object : BleWriteCallback() {
|
||||
.write(bleDevice, uuidService, uuidWrite, data, false, object : BleWriteCallback() {
|
||||
override fun onWriteSuccess(current: Int, total: Int, justWrite: ByteArray?) {
|
||||
LogUtil.e(
|
||||
"writeData onWriteSuccess data:" + HexUtil.formatHexString(data, true)
|
||||
@@ -403,7 +404,7 @@ class SRBleUtil private constructor() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送参数同步提醒消息 0x017
|
||||
* 发送参数同步提醒消息 0x17
|
||||
*/
|
||||
fun isConnectBleSendNotifyData(mac: String) {
|
||||
if (TextUtils.isEmpty(mac)) {
|
||||
@@ -419,6 +420,25 @@ class SRBleUtil private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送围栏设置 0x13
|
||||
*/
|
||||
fun isConnectBleSendFenceData(mac: String, fencesBean: FencesBean) {
|
||||
if (TextUtils.isEmpty(mac)) {
|
||||
return
|
||||
}
|
||||
if (BleManager.getInstance().isConnected(mac)) {
|
||||
val trackDeviceBean = getConnectMacDevice(mac)
|
||||
trackDeviceBean?.let {
|
||||
|
||||
writeData(
|
||||
it.bleDevice, SRBleCmdUtil.instance.setFences(fencesBean)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*发送设备开启关闭led蓝牙指令
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ import kotlinx.coroutines.launch
|
||||
*/
|
||||
class FencesManageViewModel : ViewModel() {
|
||||
|
||||
val mFencesAddLiveData = MutableLiveData<Result<String>>()
|
||||
val mFencesAddLiveData = MutableLiveData<Result<FencesBean>>()
|
||||
val mDeleteFenceLiveData = MutableLiveData<Result<String>>()
|
||||
val mUpdateFenceLiveData = MutableLiveData<Result<String>>()
|
||||
val mFencesLiveData = MutableLiveData<Result<GetFencesBean>>()
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
style="@style/my_match_RoundRect_Button_style"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginHorizontal="@dimen/dp_16"
|
||||
android:visibility="gone"
|
||||
android:text="@string/txt_make_payment"
|
||||
android:visibility="gone"
|
||||
app:qmui_radius="@dimen/dp_64"
|
||||
app:typeface="@string/roboto_bold_font" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user