增加蓝牙围栏设置,修改了对比测试bug
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| @@ -1 +0,0 @@ | ||||
| o/classes | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1 +0,0 @@ | ||||
| o/classes | ||||
										
											Binary file not shown.
										
									
								
							| @@ -1,12 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     package="com.clj.fastble" > | ||||
|  | ||||
|     <uses-sdk android:minSdkVersion="21" /> | ||||
|  | ||||
|     <uses-permission android:name="android.permission.BLUETOOTH" /> | ||||
|     <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||||
|  | ||||
| </manifest> | ||||
| @@ -1,18 +0,0 @@ | ||||
| { | ||||
|   "version": 3, | ||||
|   "artifactType": { | ||||
|     "type": "AAPT_FRIENDLY_MERGED_MANIFESTS", | ||||
|     "kind": "Directory" | ||||
|   }, | ||||
|   "applicationId": "com.clj.fastble", | ||||
|   "variantName": "release", | ||||
|   "elements": [ | ||||
|     { | ||||
|       "type": "SINGLE", | ||||
|       "filters": [], | ||||
|       "attributes": [], | ||||
|       "outputFile": "AndroidManifest.xml" | ||||
|     } | ||||
|   ], | ||||
|   "elementType": "File" | ||||
| } | ||||
| @@ -1,6 +0,0 @@ | ||||
| aarFormatVersion=1.0 | ||||
| aarMetadataVersion=1.0 | ||||
| minCompileSdk=1 | ||||
| minCompileSdkExtension=0 | ||||
| minAndroidGradlePluginVersion=1.0.0 | ||||
| coreLibraryDesugaringEnabled=false | ||||
| @@ -1 +0,0 @@ | ||||
| {} | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1 +1 @@ | ||||
| #Tue Sep 30 10:14:20 CST 2025 | ||||
| #Fri Oct 31 15:54:13 CST 2025 | ||||
|   | ||||
| @@ -1,2 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\assets"/></dataSet><dataSet config="release" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\release\assets"/></dataSet><dataSet config="generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\build\intermediates\shader_assets\release\compileReleaseShaders\out"/></dataSet></merger> | ||||
| @@ -1,2 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\jniLibs"/></dataSet><dataSet config="release" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\release\jniLibs"/></dataSet></merger> | ||||
| @@ -1,2 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\shaders"/></dataSet><dataSet config="release" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\release\shaders"/></dataSet></merger> | ||||
| @@ -1 +0,0 @@ | ||||
| #Fri Oct 17 18:14:44 CST 2025 | ||||
| @@ -1,2 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="release$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\release\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="release" generated-set="release$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\release\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\build\generated\res\resValues\release"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated" generated-set="generated$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\build\generated\res\resValues\release"/></dataSet><mergedItems/></merger> | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1,2 +0,0 @@ | ||||
| R_DEF: Internal format may change without notice | ||||
| local | ||||
| @@ -1,20 +0,0 @@ | ||||
| 1<?xml version="1.0" encoding="utf-8"?> | ||||
| 2<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 3    package="com.clj.fastble" > | ||||
| 4 | ||||
| 5    <uses-sdk android:minSdkVersion="21" /> | ||||
| 6 | ||||
| 7    <uses-permission android:name="android.permission.BLUETOOTH" /> | ||||
| 7-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:4:5-68 | ||||
| 7-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:4:22-65 | ||||
| 8    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | ||||
| 8-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:5:5-74 | ||||
| 8-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:5:22-71 | ||||
| 9    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||||
| 9-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:6:5-81 | ||||
| 9-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:6:22-78 | ||||
| 10    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||||
| 10-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:7:5-79 | ||||
| 10-->E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:7:22-76 | ||||
| 11 | ||||
| 12</manifest> | ||||
| @@ -1,12 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     package="com.clj.fastble" > | ||||
|  | ||||
|     <uses-sdk android:minSdkVersion="21" /> | ||||
|  | ||||
|     <uses-permission android:name="android.permission.BLUETOOTH" /> | ||||
|     <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||||
|  | ||||
| </manifest> | ||||
| @@ -1 +0,0 @@ | ||||
| [] | ||||
| @@ -1 +0,0 @@ | ||||
| 0 Warning/Error | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1 +0,0 @@ | ||||
| com.clj.fastble | ||||
| @@ -1,33 +0,0 @@ | ||||
| -- Merging decision tree log --- | ||||
| manifest | ||||
| ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:1:1-9:12 | ||||
| INJECTED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:1:1-9:12 | ||||
| 	package | ||||
| 		ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:2:5-30 | ||||
| 		INJECTED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml | ||||
| 	xmlns:android | ||||
| 		ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:1:11-69 | ||||
| uses-permission#android.permission.BLUETOOTH | ||||
| ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:4:5-68 | ||||
| 	android:name | ||||
| 		ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:4:22-65 | ||||
| uses-permission#android.permission.BLUETOOTH_ADMIN | ||||
| ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:5:5-74 | ||||
| 	android:name | ||||
| 		ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:5:22-71 | ||||
| uses-permission#android.permission.ACCESS_COARSE_LOCATION | ||||
| ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:6:5-81 | ||||
| 	android:name | ||||
| 		ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:6:22-78 | ||||
| uses-permission#android.permission.ACCESS_FINE_LOCATION | ||||
| ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:7:5-79 | ||||
| 	android:name | ||||
| 		ADDED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml:7:22-76 | ||||
| uses-sdk | ||||
| INJECTED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml reason: use-sdk injection requested | ||||
| INJECTED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml | ||||
| INJECTED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml | ||||
| 	android:targetSdkVersion | ||||
| 		INJECTED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml | ||||
| 	android:minSdkVersion | ||||
| 		INJECTED from E:\AndroidProject\LatestSdkProject\Tracker\FastBleLib\src\main\AndroidManifest.xml | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -74,13 +74,16 @@ public class BleManager { | ||||
|     public void init(Application app) { | ||||
|         if (context == null && app != null) { | ||||
|             context = app; | ||||
|             if (isSupportBle()) { | ||||
|                 bluetoothManager = | ||||
|                         (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE); | ||||
|                 bluetoothAdapter = bluetoothManager.getAdapter(); | ||||
|             } else { | ||||
|                 bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); | ||||
|             } | ||||
|             bluetoothManager = | ||||
|                     (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE); | ||||
|             bluetoothAdapter = bluetoothManager.getAdapter(); | ||||
|             // if (isSupportBle()) { | ||||
|             //     bluetoothManager = | ||||
|             //             (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE); | ||||
|             //     bluetoothAdapter = bluetoothManager.getAdapter(); | ||||
|             // } else { | ||||
|             //     bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); | ||||
|             // } | ||||
|             multipleBluetoothController = new MultipleBluetoothController(); | ||||
|             bleScanRuleConfig = new BleScanRuleConfig(); | ||||
|         } | ||||
| @@ -556,7 +559,7 @@ public class BleManager { | ||||
|      * @param uuid_service | ||||
|      * @param uuid_write | ||||
|      * @param data | ||||
|      * @param split | ||||
|      * @param split 是否自动分包 | ||||
|      * @param callback | ||||
|      */ | ||||
|     public void write(BleDevice bleDevice, String uuid_service, String uuid_write, byte[] data, | ||||
|   | ||||
| @@ -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蓝牙指令 | ||||
|      */ | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user
	 yezhiqiu
					yezhiqiu