新增LED设置,gps时间设置,开关机,直播蓝牙下发;修改添加设备没有支付,返回再次扫描不到设备bug
This commit is contained in:
@@ -1 +1 @@
|
|||||||
#Fri Oct 31 15:54:13 CST 2025
|
#Thu Nov 13 11:09:24 CST 2025
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ android {
|
|||||||
applicationId "com.abbidot.tracker"
|
applicationId "com.abbidot.tracker"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 35
|
targetSdkVersion 35
|
||||||
versionCode 2022
|
versionCode 2100
|
||||||
// versionName "2.0.22"
|
// versionName "2.1.0"
|
||||||
versionName "2.0.22-Beta4"
|
versionName "2.1.0-Beta1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.abbidot.tracker.bean
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Created by .yzq on 2025/11/13/周四.
|
||||||
|
* @link
|
||||||
|
* @description:
|
||||||
|
*/
|
||||||
|
data class ActionConStateBean(var conState: Int, var mac: String) {
|
||||||
|
constructor() : this(0, "")
|
||||||
|
}
|
||||||
@@ -16,16 +16,16 @@ 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
|
||||||
import com.abbidot.tracker.databinding.ActivityMapLiveBinding
|
import com.abbidot.tracker.databinding.ActivityMapLiveBinding
|
||||||
import com.abbidot.tracker.vm.MapLiveViewModel
|
import com.abbidot.tracker.deprecated.ui.activity.vm.LedLightViewModel
|
||||||
import com.abbidot.tracker.vm.FencesManageViewModel
|
|
||||||
import com.abbidot.tracker.vm.FencesMapViewModel
|
|
||||||
import com.abbidot.tracker.vm.FindBleDeviceViewModel
|
|
||||||
import com.abbidot.tracker.vm.TrackerSetViewModel
|
|
||||||
import com.abbidot.tracker.ui.common.map.MapLiveCommon
|
import com.abbidot.tracker.ui.common.map.MapLiveCommon
|
||||||
import com.abbidot.tracker.util.Util
|
import com.abbidot.tracker.util.Util
|
||||||
import com.abbidot.tracker.util.ViewUtil
|
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.FencesManageViewModel
|
||||||
|
import com.abbidot.tracker.vm.FencesMapViewModel
|
||||||
|
import com.abbidot.tracker.vm.FindBleDeviceViewModel
|
||||||
|
import com.abbidot.tracker.vm.MapLiveViewModel
|
||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
import com.clj.fastble.data.BleDevice
|
import com.clj.fastble.data.BleDevice
|
||||||
import com.daimajia.androidanimations.library.Techniques
|
import com.daimajia.androidanimations.library.Techniques
|
||||||
@@ -40,7 +40,7 @@ class MapLiveActivity : BaseActivity<ActivityMapLiveBinding>(ActivityMapLiveBind
|
|||||||
private val mMapLiveViewModel: MapLiveViewModel by viewModels()
|
private val mMapLiveViewModel: MapLiveViewModel by viewModels()
|
||||||
val mFencesMapViewModel: FencesMapViewModel by viewModels()
|
val mFencesMapViewModel: FencesMapViewModel by viewModels()
|
||||||
val mFencesManageViewModel: FencesManageViewModel by viewModels()
|
val mFencesManageViewModel: FencesManageViewModel by viewModels()
|
||||||
private val mTrackerManageViewModel: TrackerSetViewModel by viewModels()
|
private val mLedLightViewModel: LedLightViewModel by viewModels()
|
||||||
private val mFindBleDeviceViewModel: FindBleDeviceViewModel by viewModels()
|
private val mFindBleDeviceViewModel: FindBleDeviceViewModel by viewModels()
|
||||||
lateinit var mPet: PetBean
|
lateinit var mPet: PetBean
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ class MapLiveActivity : BaseActivity<ActivityMapLiveBinding>(ActivityMapLiveBind
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
mMapLiveViewModel.setupDeviceLiveStatus(this, mPet.deviceId, mLiveStatus)
|
mMapLiveViewModel.setupDeviceLiveStatus(this, mPet.deviceId, mLiveStatus,0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
@@ -113,7 +113,7 @@ class MapLiveActivity : BaseActivity<ActivityMapLiveBinding>(ActivityMapLiveBind
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mTrackerManageViewModel.mLedSwitchLiveData.observe(this) {
|
mLedLightViewModel.mLedSwitchLiveData.observe(this) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
mViewBinding.mapLiveDeviceLedSwitch.isChecked =
|
mViewBinding.mapLiveDeviceLedSwitch.isChecked =
|
||||||
@@ -193,6 +193,7 @@ class MapLiveActivity : BaseActivity<ActivityMapLiveBinding>(ActivityMapLiveBind
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
|
super.onBackPressed()
|
||||||
stopMapLive()
|
stopMapLive()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +204,7 @@ class MapLiveActivity : BaseActivity<ActivityMapLiveBinding>(ActivityMapLiveBind
|
|||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
mLiveStatus = 0
|
mLiveStatus = 0
|
||||||
mMapLiveViewModel.setupDeviceLiveStatus(
|
mMapLiveViewModel.setupDeviceLiveStatus(
|
||||||
this@MapLiveActivity, mPet.deviceId, mLiveStatus
|
this@MapLiveActivity, mPet.deviceId, mLiveStatus,0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, okTextResId = R.string.txt_sure
|
}, okTextResId = R.string.txt_sure
|
||||||
@@ -224,7 +225,7 @@ class MapLiveActivity : BaseActivity<ActivityMapLiveBinding>(ActivityMapLiveBind
|
|||||||
setBleLedMode(mPet.macID, mHistoryDataBean!!.lightMode)
|
setBleLedMode(mPet.macID, mHistoryDataBean!!.lightMode)
|
||||||
ConstantInt.Open
|
ConstantInt.Open
|
||||||
}
|
}
|
||||||
mTrackerManageViewModel.setLedSwitch(this, mHistoryDataBean!!.deviceInfoId, ledSwitch)
|
mLedLightViewModel.setLedSwitch(this, mHistoryDataBean!!.deviceInfoId, ledSwitch,0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,20 +14,41 @@ import kotlinx.coroutines.launch
|
|||||||
* @description:
|
* @description:
|
||||||
*/
|
*/
|
||||||
class LedLightViewModel : ViewModel() {
|
class LedLightViewModel : ViewModel() {
|
||||||
|
|
||||||
val mSetLedLightLiveData = MutableLiveData<Result<String>>()
|
val mSetLedLightLiveData = MutableLiveData<Result<String>>()
|
||||||
|
val mLedSwitchLiveData = MutableLiveData<Result<String>>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置light灯光
|
* 设置light灯光
|
||||||
*/
|
*/
|
||||||
fun setLedLight(activity: BaseActivity<*>, mapDeviceBean: MapDeviceBean) {
|
fun setLedLight(activity: BaseActivity<*>, mapDeviceBean: MapDeviceBean, modeType: Int) {
|
||||||
activity.showLoading(true)
|
activity.showLoading(true)
|
||||||
mapDeviceBean.apply {
|
mapDeviceBean.apply {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val result = NetworkApi.setLedLight(
|
val result = NetworkApi.setLedLight(
|
||||||
deviceServerId, ledRedValue, ledGreenValue, ledBlueValue, ledMode, ledSwitch
|
deviceServerId,
|
||||||
|
ledRedValue,
|
||||||
|
ledGreenValue,
|
||||||
|
ledBlueValue,
|
||||||
|
ledMode,
|
||||||
|
ledSwitch,
|
||||||
|
modeType
|
||||||
)
|
)
|
||||||
mSetLedLightLiveData.value = result
|
mSetLedLightLiveData.value = result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置ledSwitch开关
|
||||||
|
*/
|
||||||
|
fun setLedSwitch(
|
||||||
|
activity: BaseActivity<*>?, deviceInfoId: String, ledSwitch: Int, modeType: Int
|
||||||
|
) {
|
||||||
|
activity?.showLoading(true)
|
||||||
|
viewModelScope.launch {
|
||||||
|
val result = NetworkApi.setLedSwitch(deviceInfoId, ledSwitch, modeType)
|
||||||
|
mLedSwitchLiveData.value = result
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -827,7 +827,8 @@ interface INetworkService {
|
|||||||
suspend fun setupDeviceLiveStatus(
|
suspend fun setupDeviceLiveStatus(
|
||||||
@Query("deviceId") deviceId: String,
|
@Query("deviceId") deviceId: String,
|
||||||
@Query("liveState") liveState: Int,
|
@Query("liveState") liveState: Int,
|
||||||
@Query("sendState") sendState: Int
|
@Query("sendState") sendState: Int,
|
||||||
|
@Query("modeType") modeType: Int,
|
||||||
): BaseResponse<String>
|
): BaseResponse<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -957,7 +958,9 @@ interface INetworkService {
|
|||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("device/turnoff")
|
@POST("device/turnoff")
|
||||||
suspend fun turnoff(
|
suspend fun turnoff(
|
||||||
@Field("deviceInfoId") deviceInfoId: String, @Field("turnOff") turnOff: Int
|
@Field("deviceInfoId") deviceInfoId: String,
|
||||||
|
@Field("turnOff") turnOff: Int,
|
||||||
|
@Field("modeType") modeType: Int
|
||||||
): BaseResponse<String>
|
): BaseResponse<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -966,7 +969,9 @@ interface INetworkService {
|
|||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("device/gnssInterval")
|
@POST("device/gnssInterval")
|
||||||
suspend fun reportInterval(
|
suspend fun reportInterval(
|
||||||
@Field("deviceInfoId") deviceInfoId: String, @Field("gnssInterval") gnssInterval: Int
|
@Field("deviceInfoId") deviceInfoId: String,
|
||||||
|
@Field("gnssInterval") gnssInterval: Int,
|
||||||
|
@Field("modeType") modeType: Int
|
||||||
): BaseResponse<String>
|
): BaseResponse<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -984,7 +989,9 @@ interface INetworkService {
|
|||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("device/ledSwitch")
|
@POST("device/ledSwitch")
|
||||||
suspend fun setLedSwitch(
|
suspend fun setLedSwitch(
|
||||||
@Field("deviceInfoId") deviceInfoId: String, @Field("ledSwitch") ledSwitch: Int
|
@Field("deviceInfoId") deviceInfoId: String,
|
||||||
|
@Field("ledSwitch") ledSwitch: Int,
|
||||||
|
@Field("modeType") modeType: Int
|
||||||
): BaseResponse<String>
|
): BaseResponse<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -998,7 +1005,8 @@ interface INetworkService {
|
|||||||
@Field("green") green: Int,
|
@Field("green") green: Int,
|
||||||
@Field("blue") blue: Int,
|
@Field("blue") blue: Int,
|
||||||
@Field("lightMode") lightMode: Int,
|
@Field("lightMode") lightMode: Int,
|
||||||
@Field("ledSwitch") ledSwitch: Int
|
@Field("ledSwitch") ledSwitch: Int,
|
||||||
|
@Field("modeType") modeType: Int
|
||||||
): BaseResponse<String>
|
): BaseResponse<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -453,8 +453,8 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
|||||||
/**
|
/**
|
||||||
* 移除围栏
|
* 移除围栏
|
||||||
*/
|
*/
|
||||||
suspend fun removeFence(fenceId: String, deviceServiceId: String,modeType:Int) = getResult {
|
suspend fun removeFence(fenceId: String, deviceServiceId: String, modeType: Int) = getResult {
|
||||||
service.removeFence(fenceId, deviceServiceId,modeType)
|
service.removeFence(fenceId, deviceServiceId, modeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -731,8 +731,8 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
|||||||
/**
|
/**
|
||||||
* 打开关闭直播
|
* 打开关闭直播
|
||||||
*/
|
*/
|
||||||
suspend fun setupDeviceLiveStatus(deviceId: String, liveState: Int) = getResult {
|
suspend fun setupDeviceLiveStatus(deviceId: String, liveState: Int, modeType: Int) = getResult {
|
||||||
service.setupDeviceLiveStatus(deviceId, liveState, 0)
|
service.setupDeviceLiveStatus(deviceId, liveState, 0, modeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -857,14 +857,14 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
|||||||
* 关闭设备
|
* 关闭设备
|
||||||
*/
|
*/
|
||||||
suspend fun turnoff(deviceInfoId: String, turnOff: Int) = getResult {
|
suspend fun turnoff(deviceInfoId: String, turnOff: Int) = getResult {
|
||||||
service.turnoff(deviceInfoId, turnOff)
|
service.turnoff(deviceInfoId, turnOff, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置设备上报下发时间
|
* 设置设备上报下发时间
|
||||||
*/
|
*/
|
||||||
suspend fun reportInterval(deviceInfoId: String, gnssInterval: Int) = getResult {
|
suspend fun reportInterval(deviceInfoId: String, gnssInterval: Int, modeType: Int) = getResult {
|
||||||
service.reportInterval(deviceInfoId, gnssInterval)
|
service.reportInterval(deviceInfoId, gnssInterval, modeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -877,17 +877,23 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
|||||||
/**
|
/**
|
||||||
* 设置ledSwitch开关
|
* 设置ledSwitch开关
|
||||||
*/
|
*/
|
||||||
suspend fun setLedSwitch(deviceInfoId: String, ledSwitch: Int) = getResult {
|
suspend fun setLedSwitch(deviceInfoId: String, ledSwitch: Int, modeType: Int) = getResult {
|
||||||
service.setLedSwitch(deviceInfoId, ledSwitch)
|
service.setLedSwitch(deviceInfoId, ledSwitch, modeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置light灯光
|
* 设置light灯光
|
||||||
*/
|
*/
|
||||||
suspend fun setLedLight(
|
suspend fun setLedLight(
|
||||||
deviceServerId: String, red: Int, green: Int, blue: Int, lightMode: Int, ledSwitch: Int
|
deviceServerId: String,
|
||||||
|
red: Int,
|
||||||
|
green: Int,
|
||||||
|
blue: Int,
|
||||||
|
lightMode: Int,
|
||||||
|
ledSwitch: Int,
|
||||||
|
modeType: Int
|
||||||
) = getResult {
|
) = getResult {
|
||||||
service.setLedLight(deviceServerId, red, green, blue, lightMode, ledSwitch)
|
service.setLedLight(deviceServerId, red, green, blue, lightMode, ledSwitch, modeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.abbidot.tracker.ui.activity.device
|
package com.abbidot.tracker.ui.activity.device
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.text.TextUtils
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.NumberPicker
|
import android.widget.NumberPicker
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
@@ -17,9 +18,9 @@ import com.abbidot.tracker.constant.GetResultCallback
|
|||||||
import com.abbidot.tracker.databinding.ActivityAddNewTracker3Binding
|
import com.abbidot.tracker.databinding.ActivityAddNewTracker3Binding
|
||||||
import com.abbidot.tracker.util.Util
|
import com.abbidot.tracker.util.Util
|
||||||
import com.abbidot.tracker.util.ViewUtil
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
|
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||||
import com.abbidot.tracker.vm.ConnectionDeviceViewModel
|
import com.abbidot.tracker.vm.ConnectionDeviceViewModel
|
||||||
import com.abbidot.tracker.vm.TrackerSetViewModel
|
import com.abbidot.tracker.vm.TrackerSetViewModel
|
||||||
import com.clj.fastble.BleManager
|
|
||||||
|
|
||||||
class AddNewTracker3Activity :
|
class AddNewTracker3Activity :
|
||||||
BaseActivity<ActivityAddNewTracker3Binding>(ActivityAddNewTracker3Binding::inflate),
|
BaseActivity<ActivityAddNewTracker3Binding>(ActivityAddNewTracker3Binding::inflate),
|
||||||
@@ -32,6 +33,7 @@ class AddNewTracker3Activity :
|
|||||||
private var mDeviceOutId = ""
|
private var mDeviceOutId = ""
|
||||||
private var mDeviceId = ""
|
private var mDeviceId = ""
|
||||||
private var mScanDeviceList: ArrayList<DataBean>? = null
|
private var mScanDeviceList: ArrayList<DataBean>? = null
|
||||||
|
private var mConBleMac = ""
|
||||||
|
|
||||||
override fun getTopBar() = mViewBinding.ilAddNewTracker3TopBar.titleTopBar
|
override fun getTopBar() = mViewBinding.ilAddNewTracker3TopBar.titleTopBar
|
||||||
|
|
||||||
@@ -93,6 +95,7 @@ class AddNewTracker3Activity :
|
|||||||
XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean ->
|
XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean ->
|
||||||
setButtonEnabled(mViewBinding.btnPairTrackerYes, ConstantInt.Type1)
|
setButtonEnabled(mViewBinding.btnPairTrackerYes, ConstantInt.Type1)
|
||||||
if (ble.conState == ConState.CONNECTED) {
|
if (ble.conState == ConState.CONNECTED) {
|
||||||
|
mConBleMac = ble.mac
|
||||||
val intent = Intent(mContext, AddPairedSuccessActivity::class.java)
|
val intent = Intent(mContext, AddPairedSuccessActivity::class.java)
|
||||||
intent.putExtra(ConstantString.DeviceOutId, mDeviceOutId)
|
intent.putExtra(ConstantString.DeviceOutId, mDeviceOutId)
|
||||||
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||||
@@ -136,6 +139,20 @@ class AddNewTracker3Activity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun leftBackOnClick() {
|
||||||
|
disconnectBle()
|
||||||
|
super.leftBackOnClick()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防止没支付后退页面。扫描不到设备情况
|
||||||
|
*/
|
||||||
|
private fun disconnectBle() {
|
||||||
|
if (!TextUtils.isEmpty(mConBleMac)) {
|
||||||
|
SRBleUtil.instance.disconnectToMac(mConBleMac)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
@@ -146,7 +163,7 @@ class AddNewTracker3Activity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
btnPairTrackerYes -> {
|
btnPairTrackerYes -> {
|
||||||
BleManager.getInstance().disconnectAllDevice()
|
disconnectBle()
|
||||||
setButtonEnabled(mViewBinding.btnPairTrackerYes, ConstantInt.Type0)
|
setButtonEnabled(mViewBinding.btnPairTrackerYes, ConstantInt.Type0)
|
||||||
mTrackerSetViewModel.bindDevice(
|
mTrackerSetViewModel.bindDevice(
|
||||||
this@AddNewTracker3Activity, mDeviceOutId
|
this@AddNewTracker3Activity, mDeviceOutId
|
||||||
@@ -154,6 +171,7 @@ class AddNewTracker3Activity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
mRightImageButton -> {
|
mRightImageButton -> {
|
||||||
|
disconnectBle()
|
||||||
val intent = Intent(mContext, AddNewTracker2Activity::class.java)
|
val intent = Intent(mContext, AddNewTracker2Activity::class.java)
|
||||||
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||||
startActivityFinish(intent)
|
startActivityFinish(intent)
|
||||||
|
|||||||
@@ -199,13 +199,6 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
mLedLightViewModel.mSetLedLightLiveData.observe(this) {
|
mLedLightViewModel.mSetLedLightLiveData.observe(this) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
// XEventBus.post(EventName.UpdateData + "TrackerManageSetActivity")
|
|
||||||
// XEventBus.post(EventName.UpdateData + "TrackerManageFragment")
|
|
||||||
mPetBean?.apply {
|
|
||||||
SRBleUtil.instance.isConnectBleSendCmdData(
|
|
||||||
macID, SRBleCmdUtil.instance.setNotifySyncData()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
showToast(R.string.txt_change_successful, isFinish = true)
|
showToast(R.string.txt_change_successful, isFinish = true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -270,7 +263,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
if (null != mBleTrackDeviceBean) {
|
if (null != mBleTrackDeviceBean) {
|
||||||
//判断是否有蓝牙连接
|
//判断是否有蓝牙连接
|
||||||
if (BleManager.getInstance().isConnected(mBleTrackDeviceBean!!.bleDevice)) {
|
if (BleManager.getInstance().isConnected(mBleTrackDeviceBean!!.bleDevice)) {
|
||||||
finishAndSave()
|
finishAndSave(ConstantInt.Type1)
|
||||||
} else {
|
} else {
|
||||||
super.leftBackOnClick()
|
super.leftBackOnClick()
|
||||||
}
|
}
|
||||||
@@ -282,10 +275,10 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
/**
|
/**
|
||||||
* 保存设置数据
|
* 保存设置数据
|
||||||
*/
|
*/
|
||||||
private fun finishAndSave() {
|
private fun finishAndSave(modeType: Int) {
|
||||||
mMapDeviceBean?.apply {
|
mMapDeviceBean?.apply {
|
||||||
isFinishSave = true
|
isFinishSave = true
|
||||||
mLedLightViewModel.setLedLight(this@LedLightActivity, this)
|
mLedLightViewModel.setLedLight(this@LedLightActivity, this, modeType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,7 +368,14 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
when (v) {
|
when (v) {
|
||||||
//手动连接设备
|
//手动连接设备
|
||||||
ledLightBluetoothTips.trbBleConnectState -> connectionBtn(ledLightBluetoothTips.trbBleConnectState.text.toString())
|
ledLightBluetoothTips.trbBleConnectState -> connectionBtn(ledLightBluetoothTips.trbBleConnectState.text.toString())
|
||||||
btnLedLightSetSave -> finishAndSave()
|
btnLedLightSetSave -> {
|
||||||
|
val modeType = if (null != mBleTrackDeviceBean && BleManager.getInstance()
|
||||||
|
.isConnected(mBleTrackDeviceBean!!.bleDevice)
|
||||||
|
) ConstantInt.Type1
|
||||||
|
else ConstantInt.Type2
|
||||||
|
finishAndSave(modeType)
|
||||||
|
}
|
||||||
|
|
||||||
btnLedLightIssue -> showLedIssue()
|
btnLedLightIssue -> showLedIssue()
|
||||||
ilLedLightIssueLayout.tvCloseIssueBtn -> showLedIssue()
|
ilLedLightIssueLayout.tvCloseIssueBtn -> showLedIssue()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class PowerOffActivity : BaseActivity<ActivityPowerOffBinding>(ActivityPowerOffB
|
|||||||
}
|
}
|
||||||
|
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
setOnClickListenerViews(btnPowerOffYes,ilPowerOffBluetoothTips.trbBleConnectState)
|
setOnClickListenerViews(btnPowerOffYes, ilPowerOffBluetoothTips.trbBleConnectState)
|
||||||
}
|
}
|
||||||
|
|
||||||
connectBle()
|
connectBle()
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.abbidot.tracker.ui.activity.device.set
|
|||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
|
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
@@ -9,6 +11,7 @@ import com.abbidot.tracker.adapter.DurationSetAdapter
|
|||||||
import com.abbidot.tracker.base.BaseActivity
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
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
|
||||||
@@ -18,6 +21,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.TrackerSetViewModel
|
import com.abbidot.tracker.vm.TrackerSetViewModel
|
||||||
|
import com.clj.fastble.BleManager
|
||||||
|
|
||||||
class TrackingDurationSetActivity :
|
class TrackingDurationSetActivity :
|
||||||
BaseActivity<ActivityTrackingDurationSetBinding>(ActivityTrackingDurationSetBinding::inflate) {
|
BaseActivity<ActivityTrackingDurationSetBinding>(ActivityTrackingDurationSetBinding::inflate) {
|
||||||
@@ -61,13 +65,49 @@ class TrackingDurationSetActivity :
|
|||||||
ViewUtil.instance.updateDataBeanOnlySelectedItem(
|
ViewUtil.instance.updateDataBeanOnlySelectedItem(
|
||||||
mDurationSetAdapter, mDurationSetAdapter.getData(), mSelectIndex
|
mDurationSetAdapter, mDurationSetAdapter.getData(), mSelectIndex
|
||||||
)
|
)
|
||||||
mMapDeviceBean?.apply {
|
}
|
||||||
SRBleUtil.instance.isConnectBleSendCmdData(
|
})
|
||||||
deviceMacId, SRBleCmdUtil.instance.setNotifySyncData()
|
}
|
||||||
|
|
||||||
|
//接收发送指令后设备返回的数据
|
||||||
|
XEventBus.observe(this, EventName.DeviceReceiveData) { receiveData: ReceiveDeviceData ->
|
||||||
|
mMapDeviceBean?.let {
|
||||||
|
if (it.deviceMacId == receiveData.mac) {
|
||||||
|
val data = receiveData.data
|
||||||
|
parseData(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析数据
|
||||||
|
*/
|
||||||
|
private fun parseData(data: ByteArray?) {
|
||||||
|
data?.apply {
|
||||||
|
val data0 = SRBleCmdUtil.instance.byteToInt(data[0])
|
||||||
|
val data1 = SRBleCmdUtil.instance.byteToInt(data[1])
|
||||||
|
val data2 = SRBleCmdUtil.instance.byteToInt(data[2])
|
||||||
|
if (data0 == 0x12 && data1 == 1) {
|
||||||
|
mMapDeviceBean?.apply {
|
||||||
|
val dataBean = mDurationSetAdapter.getData()[mSelectIndex]
|
||||||
|
if (data2 == 0) {
|
||||||
|
mTrackerSetViewModel.reportInterval(
|
||||||
|
this@TrackingDurationSetActivity,
|
||||||
|
deviceServerId,
|
||||||
|
dataBean.imageId,
|
||||||
|
ConstantInt.Type1
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
mTrackerSetViewModel.reportInterval(
|
||||||
|
this@TrackingDurationSetActivity,
|
||||||
|
deviceServerId,
|
||||||
|
dataBean.imageId,
|
||||||
|
ConstantInt.Type3
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +117,7 @@ class TrackingDurationSetActivity :
|
|||||||
for (time in timeList) {
|
for (time in timeList) {
|
||||||
DataBean().apply {
|
DataBean().apply {
|
||||||
imageId = time
|
imageId = time
|
||||||
name = String.format(getString(R.string.txt_duration_min_unit), time)
|
name = String.format(getString(R.string.txt_duration_min_unit), "$time")
|
||||||
durationList.add(this)
|
durationList.add(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,9 +145,19 @@ class TrackingDurationSetActivity :
|
|||||||
mMapDeviceBean?.apply {
|
mMapDeviceBean?.apply {
|
||||||
mSelectIndex = pos
|
mSelectIndex = pos
|
||||||
val dataBean = mDurationSetAdapter.getData()[pos]
|
val dataBean = mDurationSetAdapter.getData()[pos]
|
||||||
mTrackerSetViewModel.reportInterval(
|
if (BleManager.getInstance().isConnected(deviceMacId)) {
|
||||||
this@TrackingDurationSetActivity, deviceServerId, dataBean.imageId
|
SRBleUtil.instance.isConnectBleSendCmdData(
|
||||||
)
|
deviceMacId,
|
||||||
|
SRBleCmdUtil.instance.setAndRedGpsDuration(duration = dataBean.imageId * 60L)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
mTrackerSetViewModel.reportInterval(
|
||||||
|
this@TrackingDurationSetActivity,
|
||||||
|
deviceServerId,
|
||||||
|
dataBean.imageId,
|
||||||
|
ConstantInt.Type2
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@ 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
|
||||||
import com.abbidot.tracker.databinding.ActivityLiveV2Binding
|
import com.abbidot.tracker.databinding.ActivityLiveV2Binding
|
||||||
|
import com.abbidot.tracker.deprecated.ui.activity.vm.LedLightViewModel
|
||||||
import com.abbidot.tracker.dialog.CommonDialog1
|
import com.abbidot.tracker.dialog.CommonDialog1
|
||||||
import com.abbidot.tracker.dialog.SelectMapTypeDialog
|
import com.abbidot.tracker.dialog.SelectMapTypeDialog
|
||||||
import com.abbidot.tracker.ui.DebugActivity
|
import com.abbidot.tracker.ui.DebugActivity
|
||||||
@@ -47,7 +48,6 @@ import com.abbidot.tracker.vm.FencesMapViewModel
|
|||||||
import com.abbidot.tracker.vm.FindBleDeviceViewModel
|
import com.abbidot.tracker.vm.FindBleDeviceViewModel
|
||||||
import com.abbidot.tracker.vm.MapLiveViewModel
|
import com.abbidot.tracker.vm.MapLiveViewModel
|
||||||
import com.abbidot.tracker.vm.MapViewModel
|
import com.abbidot.tracker.vm.MapViewModel
|
||||||
import com.abbidot.tracker.vm.TrackerSetViewModel
|
|
||||||
import com.abbidot.tracker.widget.MapDeviceNetView
|
import com.abbidot.tracker.widget.MapDeviceNetView
|
||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
import com.daimajia.androidanimations.library.Techniques
|
import com.daimajia.androidanimations.library.Techniques
|
||||||
@@ -64,7 +64,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
private val mMapViewModel: MapViewModel by viewModels()
|
private val mMapViewModel: MapViewModel by viewModels()
|
||||||
private val mFindBleDeviceViewModel: FindBleDeviceViewModel by viewModels()
|
private val mFindBleDeviceViewModel: FindBleDeviceViewModel by viewModels()
|
||||||
private val mMapLiveViewModel: MapLiveViewModel by viewModels()
|
private val mMapLiveViewModel: MapLiveViewModel by viewModels()
|
||||||
private val mTrackerManageViewModel: TrackerSetViewModel by viewModels()
|
private val mLedLightViewModel: LedLightViewModel by viewModels()
|
||||||
private val mCountDownViewModel: CountDownTimerViewModel by viewModels()
|
private val mCountDownViewModel: CountDownTimerViewModel by viewModels()
|
||||||
private val mConDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
private val mConDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
||||||
|
|
||||||
@@ -115,6 +115,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
|
|
||||||
//设备Led灯开关
|
//设备Led灯开关
|
||||||
private var isLedOpen = false
|
private var isLedOpen = false
|
||||||
|
private var mRequestModeType = ConstantInt.Type1
|
||||||
|
|
||||||
override fun getTopBar() = null
|
override fun getTopBar() = null
|
||||||
|
|
||||||
@@ -197,6 +198,13 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地图加载好了
|
||||||
|
*/
|
||||||
|
private fun mapLoadOk() {
|
||||||
|
showPetNameAndHead()
|
||||||
|
}
|
||||||
|
|
||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
mCountDownViewModel.mCountDownEndLiveData.observe(this) {
|
mCountDownViewModel.mCountDownEndLiveData.observe(this) {
|
||||||
when (mStartLiveIndex) {
|
when (mStartLiveIndex) {
|
||||||
@@ -311,7 +319,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
} else {
|
} else {
|
||||||
mPetBean?.apply {
|
mPetBean?.apply {
|
||||||
mMapLiveViewModel.setupDeviceLiveStatus(
|
mMapLiveViewModel.setupDeviceLiveStatus(
|
||||||
this@LiveActivityV2, deviceId, mLiveStatus
|
this@LiveActivityV2, deviceId, mLiveStatus, mRequestModeType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,11 +352,11 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
//搜索蓝牙的设备状态
|
//搜索蓝牙的设备状态
|
||||||
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
||||||
if (conState == ConState.DEVICE_NOT_FOUND) {
|
if (conState == ConState.DEVICE_NOT_FOUND) {
|
||||||
openNetLive()
|
openNetLive(ConstantInt.Type2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTrackerManageViewModel.mLedSwitchLiveData.observe(this) {
|
mLedLightViewModel.mLedSwitchLiveData.observe(this) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
// mViewBinding.cbLiveV2DeviceLightSwitch.isChecked =
|
// mViewBinding.cbLiveV2DeviceLightSwitch.isChecked =
|
||||||
@@ -401,11 +409,44 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
if (data0 == 0x06 && data1 == 1) {
|
if (data0 == 0x06 && data1 == 1) {
|
||||||
val data3 = SRBleCmdUtil.instance.byteToInt(data[3])
|
val data3 = SRBleCmdUtil.instance.byteToInt(data[3])
|
||||||
//开启直播
|
//开启直播
|
||||||
if (data2 == 1 && data3 == 0) {
|
if (data2 == 1) {
|
||||||
LogUtil.e("开启直播")
|
if (data3 == 0) {
|
||||||
} else if (data2 == 0 && data3 == 0) {
|
LogUtil.e("蓝牙开启直播成功")
|
||||||
//停止轨迹Live直播
|
mPetBean?.apply {
|
||||||
LogUtil.e("//停止轨迹Live直播")
|
mRequestModeType = ConstantInt.Type1
|
||||||
|
mMapLiveViewModel.setupDeviceLiveStatus(
|
||||||
|
this@LiveActivityV2, deviceId, mLiveStatus, mRequestModeType
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtil.e("蓝牙开启直播失败")
|
||||||
|
openNetLive(ConstantInt.Type3)
|
||||||
|
}
|
||||||
|
} else if (data2 == 0) {
|
||||||
|
mPetBean?.apply {
|
||||||
|
//停止Live直播
|
||||||
|
mRequestModeType = if (data3 == 0) {
|
||||||
|
LogUtil.e("蓝牙停止直播成功")
|
||||||
|
ConstantInt.Type1
|
||||||
|
} else {
|
||||||
|
LogUtil.e("蓝牙停止直播失败")
|
||||||
|
ConstantInt.Type3
|
||||||
|
}
|
||||||
|
mMapLiveViewModel.setupDeviceLiveStatus(
|
||||||
|
this@LiveActivityV2, deviceId, 0, mRequestModeType
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (data0 == 3 && data1 == 1) {
|
||||||
|
val modeType = if (data2 == 0) {
|
||||||
|
ConstantInt.Type1
|
||||||
|
} else {
|
||||||
|
ConstantInt.Type3
|
||||||
|
}
|
||||||
|
mMapDeviceBean?.apply {
|
||||||
|
mLedLightViewModel.setLedSwitch(
|
||||||
|
null, deviceServerId, ledSwitch, modeType
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,16 +455,15 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
/**
|
/**
|
||||||
* 开启网络上报直播
|
* 开启网络上报直播
|
||||||
*/
|
*/
|
||||||
private fun openNetLive() {
|
private fun openNetLive(modeType: Int) {
|
||||||
if (isLiveJump) {
|
if (isLiveJump) {
|
||||||
mPetBean?.apply {
|
mPetBean?.apply {
|
||||||
if (!BleManager.getInstance().isConnected(macID)) {
|
//刚开始显示Starting Live.
|
||||||
//刚开始显示Starting Live.
|
mCountDownViewModel.startCountDown(2)
|
||||||
mCountDownViewModel.startCountDown(2)
|
mRequestModeType = modeType
|
||||||
mMapLiveViewModel.setupDeviceLiveStatus(
|
mMapLiveViewModel.setupDeviceLiveStatus(
|
||||||
this@LiveActivityV2, deviceId, mLiveStatus
|
this@LiveActivityV2, deviceId, mLiveStatus, modeType
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -493,9 +533,15 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
val ledSwitch = if (isLedOpen) ConstantInt.Open
|
val ledSwitch = if (isLedOpen) ConstantInt.Open
|
||||||
else ConstantInt.Close
|
else ConstantInt.Close
|
||||||
|
|
||||||
setLedSwitch(ledSwitch)
|
|
||||||
mMapDeviceBean?.apply {
|
mMapDeviceBean?.apply {
|
||||||
mTrackerManageViewModel.setLedSwitch(null, deviceServerId, ledSwitch)
|
this.ledSwitch = ledSwitch
|
||||||
|
if (BleManager.getInstance().isConnected(deviceMacId)) {
|
||||||
|
setLedSwitch(ledSwitch)
|
||||||
|
} else {
|
||||||
|
mLedLightViewModel.setLedSwitch(
|
||||||
|
null, deviceServerId, ledSwitch, ConstantInt.Type2
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,6 +561,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
private fun updateConState(trackBleDevice: BleTrackDeviceBean) {
|
private fun updateConState(trackBleDevice: BleTrackDeviceBean) {
|
||||||
mTrackBleDevice = trackBleDevice
|
mTrackBleDevice = trackBleDevice
|
||||||
if (trackBleDevice.conState == ConState.CONNECTED) {
|
if (trackBleDevice.conState == ConState.CONNECTED) {
|
||||||
|
LogUtil.e("更新设备连接状态")
|
||||||
if (isLiveJump) {
|
if (isLiveJump) {
|
||||||
if (isStartLive) {
|
if (isStartLive) {
|
||||||
mMapLiveViewModel.stopGetData()
|
mMapLiveViewModel.stopGetData()
|
||||||
@@ -535,7 +582,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
// mViewBinding.ilLiveV2BluetoothFindDevice.ivMapLiveV2BleConState.setValue(2)
|
// mViewBinding.ilLiveV2BluetoothFindDevice.ivMapLiveV2BleConState.setValue(2)
|
||||||
} else if (trackBleDevice.conState == ConState.CONNECTION_FAIL) {
|
} else if (trackBleDevice.conState == ConState.CONNECTION_FAIL) {
|
||||||
if (isLiveJump) {
|
if (isLiveJump) {
|
||||||
openNetLive()
|
openNetLive(ConstantInt.Type2)
|
||||||
}
|
}
|
||||||
} else if (trackBleDevice.conState == ConState.DISCONNECTED) {
|
} else if (trackBleDevice.conState == ConState.DISCONNECTED) {
|
||||||
if (isLiveJump && isStartLive) {
|
if (isLiveJump && isStartLive) {
|
||||||
@@ -597,7 +644,6 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
val bleConDevice = SRBleUtil.instance.getConnectMacDevice(macID)
|
val bleConDevice = SRBleUtil.instance.getConnectMacDevice(macID)
|
||||||
if (null == bleConDevice) {
|
if (null == bleConDevice) {
|
||||||
if (isLiveJump) {
|
if (isLiveJump) {
|
||||||
openNetLive()
|
|
||||||
//没有连接,一进入页面就尝试连接
|
//没有连接,一进入页面就尝试连接
|
||||||
mConDeviceViewModel.connectDeviceToMac(this@LiveActivityV2, macID)
|
mConDeviceViewModel.connectDeviceToMac(this@LiveActivityV2, macID)
|
||||||
}
|
}
|
||||||
@@ -841,13 +887,6 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 地图加载好了
|
|
||||||
*/
|
|
||||||
private fun mapLoadOk() {
|
|
||||||
showPetNameAndHead()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 找蓝牙设备
|
* 找蓝牙设备
|
||||||
*/
|
*/
|
||||||
@@ -898,14 +937,19 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
* 停止直播
|
* 停止直播
|
||||||
*/
|
*/
|
||||||
private fun stopLive() {
|
private fun stopLive() {
|
||||||
mTrackBleDevice?.apply {
|
mPetBean?.apply {
|
||||||
SRBleUtil.instance.writeData(
|
if (BleManager.getInstance().isConnected(macID)) {
|
||||||
bleDevice, SRBleCmdUtil.instance.setLiveSwitch(0, 0)
|
SRBleUtil.instance.isConnectBleSendCmdData(
|
||||||
)
|
macID, SRBleCmdUtil.instance.setLiveSwitch(0, 0)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
mRequestModeType = ConstantInt.Type2
|
||||||
|
mMapLiveViewModel.setupDeviceLiveStatus(
|
||||||
|
this@LiveActivityV2, mPetBean!!.deviceId, 0, mRequestModeType
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mMapLiveViewModel.setupDeviceLiveStatus(
|
|
||||||
this@LiveActivityV2, mPetBean!!.deviceId, 0
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.abbidot.tracker.constant.ConstantString
|
|||||||
import com.abbidot.tracker.constant.GetResultCallback
|
import com.abbidot.tracker.constant.GetResultCallback
|
||||||
import com.abbidot.tracker.constant.MultipleEntity
|
import com.abbidot.tracker.constant.MultipleEntity
|
||||||
import com.abbidot.tracker.databinding.FragmentHomeTrackBinding
|
import com.abbidot.tracker.databinding.FragmentHomeTrackBinding
|
||||||
|
import com.abbidot.tracker.deprecated.ui.activity.vm.LedLightViewModel
|
||||||
import com.abbidot.tracker.dialog.DFUNewDialog
|
import com.abbidot.tracker.dialog.DFUNewDialog
|
||||||
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
||||||
import com.abbidot.tracker.ui.activity.device.fences.VirtualFencesActivity
|
import com.abbidot.tracker.ui.activity.device.fences.VirtualFencesActivity
|
||||||
@@ -62,6 +63,7 @@ class HomeTrackFragment :
|
|||||||
|
|
||||||
private val mTrackerInfoViewModel: TrackerInfoViewModel by viewModels()
|
private val mTrackerInfoViewModel: TrackerInfoViewModel by viewModels()
|
||||||
private val mTrackerSetViewModel: TrackerSetViewModel by viewModels()
|
private val mTrackerSetViewModel: TrackerSetViewModel by viewModels()
|
||||||
|
private val mLedLightViewModel: LedLightViewModel by viewModels()
|
||||||
private val mConnectionDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
private val mConnectionDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
||||||
private val mDeviceDFUViewModel: DeviceDFUViewModel by viewModels()
|
private val mDeviceDFUViewModel: DeviceDFUViewModel by viewModels()
|
||||||
private val mDownLoadFileViewModel: DownLoadFileViewModel by viewModels()
|
private val mDownLoadFileViewModel: DownLoadFileViewModel by viewModels()
|
||||||
@@ -211,20 +213,22 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
//接收开蓝牙操作,然后搜索连接设备
|
//接收开蓝牙操作,然后搜索连接设备
|
||||||
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
||||||
if (conState == ConState.CONNECTING || conState == ConState.CONNECTING_MAC) {
|
mHomeV2Activity.getPet()?.apply {
|
||||||
// mConnectionDeviceViewModel.connectingFailCountDown()
|
if (BleManager.getInstance().isConnected(macID)) return@apply
|
||||||
mTrackStateList[4].apply {
|
if (conState == ConState.CONNECTING || conState == ConState.CONNECTING_MAC) {
|
||||||
menuValue = getString(R.string.txt_connecting)
|
mTrackStateList[4].apply {
|
||||||
colorRedId = R.color.gray
|
menuValue = getString(R.string.txt_connecting)
|
||||||
isSwitch = true
|
colorRedId = R.color.gray
|
||||||
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
isSwitch = true
|
||||||
}
|
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
||||||
} else {
|
}
|
||||||
mTrackStateList[4].apply {
|
} else {
|
||||||
menuValue = getString(R.string.txt_unconnect_no)
|
mTrackStateList[4].apply {
|
||||||
isSwitch = false
|
menuValue = getString(R.string.txt_unconnect_no)
|
||||||
colorRedId = R.color.orange_color3
|
isSwitch = false
|
||||||
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
colorRedId = R.color.orange_color3
|
||||||
|
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,19 +328,25 @@ class HomeTrackFragment :
|
|||||||
mTurnoffLiveData.observe(viewLifecycleOwner) {
|
mTurnoffLiveData.observe(viewLifecycleOwner) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
// mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
||||||
mTrackMenuAdapter.notifyItemChanged(4)
|
// mTrackMenuAdapter.notifyItemChanged(4)
|
||||||
bleTurnOff()
|
// bleTurnOff()
|
||||||
|
mBleTrackDeviceBean?.apply {
|
||||||
|
SRBleUtil.instance.writeData(
|
||||||
|
bleDevice, SRBleCmdUtil.instance.forcedShutdown()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
mLedSwitchLiveData.observe(viewLifecycleOwner) {
|
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
|
||||||
override fun onResult(any: Any) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
mLedLightViewModel.mLedSwitchLiveData.observe(viewLifecycleOwner) {
|
||||||
}
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
|
override fun onResult(any: Any) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,22 +731,42 @@ class HomeTrackFragment :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data0 == 3 && data1 == 0 && data2 == 0) {
|
} else if (data0 == 3 && data1 == 1) {
|
||||||
val data3 = SRBleCmdUtil.instance.byteToInt(data[3])
|
val ledSwitch =
|
||||||
if (data3 in 1..3) setLedState(ConstantInt.Open)
|
if (mTrackStateList[5].menuValue == getString(R.string.tracker_manage_set_led_on)) {
|
||||||
else setLedState(ConstantInt.Close)
|
ConstantInt.Close
|
||||||
} else if (data0 == 4) {
|
} else {
|
||||||
if (data1 == 1 && data2 == 0) {
|
ConstantInt.Open
|
||||||
mTrackMenuList[1].menuValue = ""
|
|
||||||
mTrackMenuList[2].menuValue = ""
|
|
||||||
mTrackMenuList[3].menuValue = ""
|
|
||||||
//取消红点显示
|
|
||||||
mTrackMenuList[3].isSwitch = false
|
|
||||||
mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
|
||||||
mTrackMenuAdapter.notifyItemRangeChanged(1, 4)
|
|
||||||
mBleTrackDeviceBean?.apply {
|
|
||||||
SRBleUtil.instance.disconnectToMac(mac)
|
|
||||||
}
|
}
|
||||||
|
val modeType = if (data2 == 0) {
|
||||||
|
val data3 = SRBleCmdUtil.instance.byteToInt(data[3])
|
||||||
|
if (data3 in 1..3) setLedState(ConstantInt.Open)
|
||||||
|
else setLedState(ConstantInt.Close)
|
||||||
|
ConstantInt.Type1
|
||||||
|
} else {
|
||||||
|
ConstantInt.Type3
|
||||||
|
}
|
||||||
|
mMapDeviceBean?.let {
|
||||||
|
setLedState(ledSwitch)
|
||||||
|
//远程控制
|
||||||
|
mLedLightViewModel.setLedSwitch(
|
||||||
|
null, it.deviceServerId, ledSwitch, modeType
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else if (data0 == 4 && data1 == 1 && data2 == 0) {
|
||||||
|
mMapDeviceBean?.let {
|
||||||
|
mTrackerSetViewModel.turnOff(mHomeV2Activity, it.deviceServerId)
|
||||||
|
}
|
||||||
|
mTrackMenuList[1].menuValue = ""
|
||||||
|
mTrackMenuList[2].menuValue = ""
|
||||||
|
mTrackMenuList[3].menuValue = ""
|
||||||
|
//取消红点显示
|
||||||
|
mTrackMenuList[3].isSwitch = false
|
||||||
|
mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
||||||
|
mTrackMenuAdapter.notifyItemRangeChanged(1, 4)
|
||||||
|
} else if (data0 == 0x18 && data1 == 1 && data2 == 0) {
|
||||||
|
mBleTrackDeviceBean?.apply {
|
||||||
|
SRBleUtil.instance.disconnectToMac(mac)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -850,16 +880,21 @@ class HomeTrackFragment :
|
|||||||
} else {
|
} else {
|
||||||
ConstantInt.Open
|
ConstantInt.Open
|
||||||
}
|
}
|
||||||
//蓝牙控制
|
|
||||||
getBleTrackDeviceBean(false)?.let {
|
|
||||||
SRBleUtil.instance.setBleLedSwitch(mContext!!, it.bleDevice, ledSwitch)
|
|
||||||
}
|
|
||||||
//远程控制
|
|
||||||
mMapDeviceBean?.let {
|
|
||||||
mTrackerSetViewModel.setLedSwitch(null, it.deviceServerId, ledSwitch)
|
|
||||||
}
|
|
||||||
|
|
||||||
setLedState(ledSwitch)
|
mMapDeviceBean?.let {
|
||||||
|
if (BleManager.getInstance().isConnected(it.deviceMacId)) {
|
||||||
|
//蓝牙控制
|
||||||
|
getBleTrackDeviceBean(false)?.let { ble ->
|
||||||
|
SRBleUtil.instance.setBleLedSwitch(mContext!!, ble.bleDevice, ledSwitch)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setLedState(ledSwitch)
|
||||||
|
//远程控制
|
||||||
|
mLedLightViewModel.setLedSwitch(
|
||||||
|
null, it.deviceServerId, ledSwitch, ConstantInt.Type2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,13 +87,13 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
|||||||
activity?.apply {
|
activity?.apply {
|
||||||
mHomeV2Activity = this as HomeV2Activity
|
mHomeV2Activity = this as HomeV2Activity
|
||||||
}
|
}
|
||||||
|
(mFragments[1] as HomeTrackFragment).onResume()
|
||||||
//其他页面是否选择了宠物
|
//其他页面是否选择了宠物
|
||||||
if (mCurrentShowPetPos != mHomeV2Activity.mSelectPetPosition) {
|
if (mCurrentShowPetPos != mHomeV2Activity.mSelectPetPosition) {
|
||||||
showPetNameAndHead(mHomeV2Activity.mSelectPetPosition)
|
showPetNameAndHead(mHomeV2Activity.mSelectPetPosition)
|
||||||
} else {
|
} else {
|
||||||
(mFragments[1] as HomeTrackFragment).getPetTrackerInfoData()
|
(mFragments[1] as HomeTrackFragment).getPetTrackerInfoData()
|
||||||
}
|
}
|
||||||
(mFragments[1] as HomeTrackFragment).onResume()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
|||||||
@@ -175,13 +175,21 @@ class SRBleCmdUtil private constructor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关机
|
* 关机,设备会上报关机状态后关机
|
||||||
*/
|
*/
|
||||||
fun shutdownDevice(): ByteArray {
|
fun shutdownDevice(): ByteArray {
|
||||||
val byteArray = byteArrayOf(0x04, CMD_WRITE.toByte())
|
val byteArray = byteArrayOf(0x04, CMD_WRITE.toByte())
|
||||||
return getCrc8Cmd(byteArray)
|
return getCrc8Cmd(byteArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制关机消息,设备不会上报,立马关机
|
||||||
|
*/
|
||||||
|
fun forcedShutdown(): ByteArray {
|
||||||
|
val byteArray = byteArrayOf(0x18, CMD_WRITE.toByte())
|
||||||
|
return getCrc8Cmd(byteArray)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取固件版本号
|
* 获取固件版本号
|
||||||
*/
|
*/
|
||||||
@@ -350,5 +358,14 @@ class SRBleCmdUtil private constructor() {
|
|||||||
val byteArray = byteArrayOf(0x13, CMD_READ.toByte(), 0)
|
val byteArray = byteArrayOf(0x13, CMD_READ.toByte(), 0)
|
||||||
return getCrc8Cmd(byteArray)
|
return getCrc8Cmd(byteArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置/查询定位时间间隔
|
||||||
|
*/
|
||||||
|
fun setAndRedGpsDuration(writeAndRed: Int = CMD_WRITE, duration: Long = 0): ByteArray {
|
||||||
|
var byteArray = byteArrayOf(0x12, writeAndRed.toByte())
|
||||||
|
byteArray = byteArray.plus(longTo2ByteArray(duration))
|
||||||
|
return getCrc8Cmd(byteArray)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,6 +439,9 @@ class SRBleUtil private constructor() {
|
|||||||
fun cancelBleScan(log: String = "") {
|
fun cancelBleScan(log: String = "") {
|
||||||
if (BleManager.getInstance().scanSate == BleScanState.STATE_SCANNING) {
|
if (BleManager.getInstance().scanSate == BleScanState.STATE_SCANNING) {
|
||||||
isScanInterrupt = true
|
isScanInterrupt = true
|
||||||
|
XEventBus.post(
|
||||||
|
EventName.ActionConDeviceState, ConState.DEVICE_NOT_FOUND
|
||||||
|
)
|
||||||
if (TextUtils.isEmpty(log)) LogUtil.e("正在扫描设备,取消蓝牙扫描")
|
if (TextUtils.isEmpty(log)) LogUtil.e("正在扫描设备,取消蓝牙扫描")
|
||||||
else LogUtil.e(log)
|
else LogUtil.e(log)
|
||||||
BleManager.getInstance().cancelScan()
|
BleManager.getInstance().cancelScan()
|
||||||
|
|||||||
@@ -118,17 +118,17 @@ class ConnectionDeviceViewModel : ViewModel() {
|
|||||||
/**
|
/**
|
||||||
* 连接中倒计时20s变为未连接状态
|
* 连接中倒计时20s变为未连接状态
|
||||||
*/
|
*/
|
||||||
fun connectingFailCountDown() {
|
// fun connectingFailCountDown() {
|
||||||
mCountDownTimer = object : CountDownTimer(20 * 1000, 1000) {
|
// mCountDownTimer = object : CountDownTimer(20 * 1000, 1000) {
|
||||||
override fun onTick(time: Long) {
|
// override fun onTick(time: Long) {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onFinish() {
|
// override fun onFinish() {
|
||||||
LogUtil.e("连接中倒计时20s变为未连接状态")
|
// LogUtil.e("连接中倒计时20s变为未连接状态")
|
||||||
XEventBus.post(EventName.ActionConDeviceState, ConState.CONNECTION_FAIL)
|
// XEventBus.post(EventName.ActionConDeviceState, ConState.CONNECTION_FAIL)
|
||||||
}
|
// }
|
||||||
}.start()
|
// }.start()
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接成功后取消倒计时
|
* 连接成功后取消倒计时
|
||||||
@@ -276,7 +276,7 @@ class ConnectionDeviceViewModel : ViewModel() {
|
|||||||
super.onCleared()
|
super.onCleared()
|
||||||
LogUtil.e("ConnectionDeviceViewModel,onCleared")
|
LogUtil.e("ConnectionDeviceViewModel,onCleared")
|
||||||
SRBleUtil.instance.isBleConnecting = false
|
SRBleUtil.instance.isBleConnecting = false
|
||||||
SRBleUtil.instance.cancelBleScan("退出APP,取消扫描蓝")
|
SRBleUtil.instance.cancelBleScan("onCleared,退出当前页面,取消扫描蓝牙")
|
||||||
cancelFailCountDown()
|
cancelFailCountDown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,10 +23,12 @@ class MapLiveViewModel : ViewModel() {
|
|||||||
/**
|
/**
|
||||||
* 打开关闭直播
|
* 打开关闭直播
|
||||||
*/
|
*/
|
||||||
fun setupDeviceLiveStatus(activity: BaseActivity<*>, deviceId: String, liveState: Int) {
|
fun setupDeviceLiveStatus(
|
||||||
|
activity: BaseActivity<*>, deviceId: String, liveState: Int, modeType: Int
|
||||||
|
) {
|
||||||
activity.showLoading(true)
|
activity.showLoading(true)
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val result = NetworkApi.setupDeviceLiveStatus(deviceId, liveState)
|
val result = NetworkApi.setupDeviceLiveStatus(deviceId, liveState, modeType)
|
||||||
mMapLiveStatusLiveData.value = result
|
mMapLiveStatusLiveData.value = result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +62,7 @@ class MapLiveViewModel : ViewModel() {
|
|||||||
/**
|
/**
|
||||||
* 停止获取数据
|
* 停止获取数据
|
||||||
*/
|
*/
|
||||||
fun stopGetData() {
|
fun stopGetData() {
|
||||||
if (null != mCountDownTimer) {
|
if (null != mCountDownTimer) {
|
||||||
mCountDownTimer!!.cancel()
|
mCountDownTimer!!.cancel()
|
||||||
mCountDownTimer = null
|
mCountDownTimer = null
|
||||||
|
|||||||
@@ -17,24 +17,12 @@ import kotlinx.coroutines.launch
|
|||||||
*/
|
*/
|
||||||
class TrackerSetViewModel : ViewModel() {
|
class TrackerSetViewModel : ViewModel() {
|
||||||
val mAddBindDeviceLiveData = MutableLiveData<Result<DeviceDetailBean>>()
|
val mAddBindDeviceLiveData = MutableLiveData<Result<DeviceDetailBean>>()
|
||||||
val mLedSwitchLiveData = MutableLiveData<Result<String>>()
|
|
||||||
val mTurnoffLiveData = MutableLiveData<Result<String>>()
|
val mTurnoffLiveData = MutableLiveData<Result<String>>()
|
||||||
val mReportIntervalLiveData = MutableLiveData<Result<String>>()
|
val mReportIntervalLiveData = MutableLiveData<Result<String>>()
|
||||||
val mSetLiveTimeLiveData = MutableLiveData<Result<String>>()
|
val mSetLiveTimeLiveData = MutableLiveData<Result<String>>()
|
||||||
val mUnbindDeviceLiveData = MutableLiveData<Result<String>>()
|
val mUnbindDeviceLiveData = MutableLiveData<Result<String>>()
|
||||||
val mAssignOtherTrackerLiveData = MutableLiveData<Result<String>>()
|
val mAssignOtherTrackerLiveData = MutableLiveData<Result<String>>()
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置ledSwitch开关
|
|
||||||
*/
|
|
||||||
fun setLedSwitch(activity: BaseActivity<*>?, deviceInfoId: String, ledSwitch: Int) {
|
|
||||||
activity?.showLoading(true)
|
|
||||||
viewModelScope.launch {
|
|
||||||
val result = NetworkApi.setLedSwitch(deviceInfoId, ledSwitch)
|
|
||||||
mLedSwitchLiveData.value = result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭设备
|
* 关闭设备
|
||||||
*/
|
*/
|
||||||
@@ -49,10 +37,12 @@ class TrackerSetViewModel : ViewModel() {
|
|||||||
/**
|
/**
|
||||||
* 设置设备上报下发时间
|
* 设置设备上报下发时间
|
||||||
*/
|
*/
|
||||||
fun reportInterval(activity: BaseActivity<*>, deviceInfoId: String, gnssInterval: Int) {
|
fun reportInterval(
|
||||||
|
activity: BaseActivity<*>, deviceInfoId: String, gnssInterval: Int, modeType: Int
|
||||||
|
) {
|
||||||
activity.showLoading(true)
|
activity.showLoading(true)
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val result = NetworkApi.reportInterval(deviceInfoId, gnssInterval)
|
val result = NetworkApi.reportInterval(deviceInfoId, gnssInterval, modeType)
|
||||||
mReportIntervalLiveData.value = result
|
mReportIntervalLiveData.value = result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<include
|
<include
|
||||||
android:id="@+id/il_live_v2_data_light_switch"
|
android:id="@+id/il_live_v2_data_light_switch"
|
||||||
layout="@layout/layout_device_light_image_button"
|
layout="@layout/layout_device_light_image_button"
|
||||||
android:layout_width="@dimen/dp_160"
|
android:layout_width="@dimen/dp_150"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/tv_live_v2_direction_title"
|
android:layout_below="@id/tv_live_v2_direction_title"
|
||||||
android:layout_alignEnd="@id/tv_live_v2_direction_title"
|
android:layout_alignEnd="@id/tv_live_v2_direction_title"
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
android:background="@drawable/shape44_gray_yellow_bg"
|
android:background="@drawable/shape44_gray_yellow_bg"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingHorizontal="@dimen/dp_40">
|
android:paddingHorizontal="@dimen/dp_30">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:layout_width="@dimen/dp_10"
|
android:layout_width="@dimen/dp_10"
|
||||||
|
|||||||
Reference in New Issue
Block a user