diff --git a/app/build.gradle b/app/build.gradle
index 737be31..b9ee987 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5080
- versionName "5.0.8"
+ versionCode 5090
+ versionName "5.0.9"
ndk {
moduleName "serial_port"
@@ -67,6 +67,13 @@
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
daoPackage "${defaultConfig.applicationId}.greendao"//设置DaoMaster、DaoSession、Dao包名
}
+
+ //引入千寻
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
}
static def getBuildDate() {
@@ -120,4 +127,6 @@
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
//图片压缩
implementation 'top.zibin:Luban:1.1.8'
+ //千寻RTK服务
+ implementation(name: 'libqxwz_release_v1.1.0', ext: 'aar')
}
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 737be31..b9ee987 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5080
- versionName "5.0.8"
+ versionCode 5090
+ versionName "5.0.9"
ndk {
moduleName "serial_port"
@@ -67,6 +67,13 @@
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
daoPackage "${defaultConfig.applicationId}.greendao"//设置DaoMaster、DaoSession、Dao包名
}
+
+ //引入千寻
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
}
static def getBuildDate() {
@@ -120,4 +127,6 @@
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
//图片压缩
implementation 'top.zibin:Luban:1.1.8'
+ //千寻RTK服务
+ implementation(name: 'libqxwz_release_v1.1.0', ext: 'aar')
}
\ No newline at end of file
diff --git a/app/libs/libqxwz_release_v1.1.0.aar b/app/libs/libqxwz_release_v1.1.0.aar
new file mode 100644
index 0000000..4ff2c1e
--- /dev/null
+++ b/app/libs/libqxwz_release_v1.1.0.aar
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
index 737be31..b9ee987 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5080
- versionName "5.0.8"
+ versionCode 5090
+ versionName "5.0.9"
ndk {
moduleName "serial_port"
@@ -67,6 +67,13 @@
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
daoPackage "${defaultConfig.applicationId}.greendao"//设置DaoMaster、DaoSession、Dao包名
}
+
+ //引入千寻
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
}
static def getBuildDate() {
@@ -120,4 +127,6 @@
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
//图片压缩
implementation 'top.zibin:Luban:1.1.8'
+ //千寻RTK服务
+ implementation(name: 'libqxwz_release_v1.1.0', ext: 'aar')
}
\ No newline at end of file
diff --git a/app/libs/libqxwz_release_v1.1.0.aar b/app/libs/libqxwz_release_v1.1.0.aar
new file mode 100644
index 0000000..4ff2c1e
--- /dev/null
+++ b/app/libs/libqxwz_release_v1.1.0.aar
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4d5076a..2319b98 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -66,6 +66,9 @@
+
-
+
+ android:value="71aef156f96b58d616bc78cfc2f1fbc3" />
+
-
+
+ android:value="71aef156f96b58d616bc78cfc2f1fbc3" />
+
-
+
+ android:value="71aef156f96b58d616bc78cfc2f1fbc3" />
() {
+
+ private val kTag = "ConfigServiceActivity"
+
+ override fun initEvent() {
+ binding.saveButton.setOnClickListener {
+ val account = binding.accountView.text.toString().trim()
+ if (account.isBlank()) {
+ "请输入差分定位服务账号!".show(this)
+ return@setOnClickListener
+ }
+
+ val password = binding.passwordView.text.toString().trim()
+ if (password.isBlank()) {
+ "请输入密码!".show(this)
+ return@setOnClickListener
+ }
+
+ val ip = binding.serverIpView.text.toString().trim()
+ if (ip.isBlank()) {
+ "请输入差分定位服务器IP!".show(this)
+ return@setOnClickListener
+ }
+
+ val port = binding.serverPortView.text.toString().trim()
+ if (port.isBlank()) {
+ "请输入差分定位服务器端口号!".show(this)
+ return@setOnClickListener
+ }
+
+ SaveKeyValues.putValue(LocaleConstant.ACK, account)
+ SaveKeyValues.putValue(LocaleConstant.ACS, password)
+ SaveKeyValues.putValue(LocaleConstant.RTK_SERVER, ip)
+ SaveKeyValues.putValue(LocaleConstant.RTK_PORT, port)
+
+ "差分定位服务器配置成功".show(this)
+ finish()
+ }
+ }
+
+ override fun initOnCreate(savedInstanceState: Bundle?) {
+ binding.accountView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+ )
+
+ binding.passwordView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+ )
+
+ binding.serverIpView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_SERVER, "") as String
+ )
+
+ binding.serverPortView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_PORT, "") as String
+ )
+ }
+
+ override fun initViewBinding(): ActivityConfigRtkServiceBinding {
+ return ActivityConfigRtkServiceBinding.inflate(layoutInflater)
+ }
+
+ override fun observeRequestState() {
+
+ }
+
+ override fun setupTopBarLayout() {
+ binding.titleView.setOnClickListener(object : TitleBarView.OnClickListener {
+ override fun onLeftClick() {
+
+ }
+
+ override fun onRightClick() {
+ finish()
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 737be31..b9ee987 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5080
- versionName "5.0.8"
+ versionCode 5090
+ versionName "5.0.9"
ndk {
moduleName "serial_port"
@@ -67,6 +67,13 @@
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
daoPackage "${defaultConfig.applicationId}.greendao"//设置DaoMaster、DaoSession、Dao包名
}
+
+ //引入千寻
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
}
static def getBuildDate() {
@@ -120,4 +127,6 @@
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
//图片压缩
implementation 'top.zibin:Luban:1.1.8'
+ //千寻RTK服务
+ implementation(name: 'libqxwz_release_v1.1.0', ext: 'aar')
}
\ No newline at end of file
diff --git a/app/libs/libqxwz_release_v1.1.0.aar b/app/libs/libqxwz_release_v1.1.0.aar
new file mode 100644
index 0000000..4ff2c1e
--- /dev/null
+++ b/app/libs/libqxwz_release_v1.1.0.aar
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4d5076a..2319b98 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -66,6 +66,9 @@
+
-
+
+ android:value="71aef156f96b58d616bc78cfc2f1fbc3" />
() {
+
+ private val kTag = "ConfigServiceActivity"
+
+ override fun initEvent() {
+ binding.saveButton.setOnClickListener {
+ val account = binding.accountView.text.toString().trim()
+ if (account.isBlank()) {
+ "请输入差分定位服务账号!".show(this)
+ return@setOnClickListener
+ }
+
+ val password = binding.passwordView.text.toString().trim()
+ if (password.isBlank()) {
+ "请输入密码!".show(this)
+ return@setOnClickListener
+ }
+
+ val ip = binding.serverIpView.text.toString().trim()
+ if (ip.isBlank()) {
+ "请输入差分定位服务器IP!".show(this)
+ return@setOnClickListener
+ }
+
+ val port = binding.serverPortView.text.toString().trim()
+ if (port.isBlank()) {
+ "请输入差分定位服务器端口号!".show(this)
+ return@setOnClickListener
+ }
+
+ SaveKeyValues.putValue(LocaleConstant.ACK, account)
+ SaveKeyValues.putValue(LocaleConstant.ACS, password)
+ SaveKeyValues.putValue(LocaleConstant.RTK_SERVER, ip)
+ SaveKeyValues.putValue(LocaleConstant.RTK_PORT, port)
+
+ "差分定位服务器配置成功".show(this)
+ finish()
+ }
+ }
+
+ override fun initOnCreate(savedInstanceState: Bundle?) {
+ binding.accountView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+ )
+
+ binding.passwordView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+ )
+
+ binding.serverIpView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_SERVER, "") as String
+ )
+
+ binding.serverPortView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_PORT, "") as String
+ )
+ }
+
+ override fun initViewBinding(): ActivityConfigRtkServiceBinding {
+ return ActivityConfigRtkServiceBinding.inflate(layoutInflater)
+ }
+
+ override fun observeRequestState() {
+
+ }
+
+ override fun setupTopBarLayout() {
+ binding.titleView.setOnClickListener(object : TitleBarView.OnClickListener {
+ override fun onLeftClick() {
+
+ }
+
+ override fun onRightClick() {
+ finish()
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt
index 33f8643..a90a927 100644
--- a/app/src/main/java/com/casic/detector/view/MainActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt
@@ -106,7 +106,12 @@
import com.pengxh.kt.lite.widget.dialog.AlertInputDialog
import com.pengxh.kt.lite.widget.dialog.AlertMessageDialog
import com.pengxh.kt.lite.widget.dialog.BottomActionSheet
+import com.qxwz.sdk.core.CapInfo
+import com.qxwz.sdk.core.Constants
+import com.qxwz.sdk.core.IRtcmSDKCallback
+import com.qxwz.sdk.core.RtcmSDKManager
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
@@ -119,7 +124,7 @@
import kotlin.math.atan2
class MainActivity : SerialPortActivity(), SensorEventListener,
- Handler.Callback {
+ Handler.Callback, IRtcmSDKCallback {
private val kTag = "MainActivity"
private val context = this
@@ -135,6 +140,13 @@
private val rotationMatrix = FloatArray(9)//旋转矩阵缓存
private val valueArray = FloatArray(3)//方位角数值
private var clickTime: Long = 0
+
+ /***千寻配置*****start*/
+ private var isStart = false
+ private val GGA = "\$GPGGA,000001,3112.518576,N,12127.901251,E,1,8,1,0,M,-32,M,3,0*4B"
+
+ /***千寻配置****start*/
+
private var markers = ArrayList()
private var clusterOverlay: ClusterOverlay? = null
private var isFreeTask = false
@@ -285,11 +297,11 @@
}).build().show()
} else {
lifecycleScope.launch(Dispatchers.Main) {
- val labels = withContext(Dispatchers.IO) {
+ val markers = withContext(Dispatchers.IO) {
DataBaseManager.get.queryMarkerByState("0")
}
//如果有需要补全的标识器,Popup右侧会有小圆点提示
- if (labels.isNotEmpty()) {
+ if (markers.isNotEmpty()) {
samplePopupWindow.setShowPosition(4)
}
val x =
@@ -303,11 +315,15 @@
SamplePopupWindow.OnPopupWindowClickListener {
override fun onPopupItemClicked(position: Int) {
when (position) {
- 0 -> updateLabels()
+ 0 -> updateMarkers()
1 -> downloadTask()
2 -> navigatePageTo()
3 -> uploadEvent()
4 -> completionMarker()
+ 5 -> {
+ "尽情期待".show(context)
+// navigatePageTo()
+ }
}
}
})
@@ -586,11 +602,11 @@
//显示标识器详细信息
if (!detailDialog.isShowing) {
- val labelBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
- if (labelBean == null) {
+ val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
+ if (markerBean == null) {
"无法查询到此ID【${markerId}】的信息".show(context)
} else {
- detailDialog.setMarker(labelBean)
+ detailDialog.setMarker(markerBean)
detailDialog.show()
}
}
@@ -833,7 +849,7 @@
}
//更新标识器数据
- private fun updateLabels() {
+ private fun updateMarkers() {
AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?")
.setNegativeButton("取消").setPositiveButton("确定")
.setOnDialogButtonClickListener(object :
@@ -872,7 +888,7 @@
private fun uploadEvent() {
val taskId = SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String
- if (taskId.isBlank()) {
+ if (taskId == "") {
"已完成全部巡检".show(this)
return
}
@@ -990,12 +1006,66 @@
//注册磁场传感器监听
val magnetic = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)
sensorManager.registerListener(this, magnetic, SensorManager.SENSOR_DELAY_NORMAL)
+
+ //千寻(application access key and application access secret)
+// val ack = SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+// val acs = SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+// val deviceId = Settings.System.getString(contentResolver, Settings.Secure.ANDROID_ID)
+// val accountInfo = AccountInfo.builder()
+// .setKeyType(KeyType.QXWZ_SDK_KEY_TYPE_AK).setKey(ack).setSecret(acs)
+// .setDeviceId(deviceId).setDeviceType(android.os.Build.BOARD)
+// .build()
+// val config = SDKConfig.builder()
+// .setAccountInfo(accountInfo).setRtcmSDKCallback(this).build()
+// RtcmSDKManager.getInstance().init(config)
+// RtcmSDKManager.getInstance().auth()
+ }
+
+ override fun onData(type: Int, bytes: ByteArray) {
+ Log.d(kTag, "rtcm data received, data length is ${bytes.size}")
+ }
+
+ override fun onStatus(status: Int) {
+ Log.d(kTag, "status changed to $status")
+ }
+
+ override fun onAuth(code: Int, caps: MutableList?) {
+ if (code == Constants.QXWZ_SDK_STAT_AUTH_SUCC) {
+ Log.d(kTag, "onAuth: successfully")
+ caps?.forEach {
+ Log.d(kTag, "capInfo: $it")
+ }
+
+ lifecycleScope.launch(Dispatchers.IO) {
+ RtcmSDKManager.getInstance().start(Constants.QXWZ_SDK_CAP_ID_NOSR)
+ }
+ } else {
+ Log.d(kTag, "onAuth: failed, code is $code")
+ }
+ }
+
+ override fun onStart(code: Int, capId: Int) {
+ if (code == Constants.QXWZ_SDK_STAT_CAP_START_SUCC) {
+ Log.d(kTag, "onStart: successfully")
+ isStart = true
+ lifecycleScope.launch(Dispatchers.IO) {
+ while (isStart) {
+ RtcmSDKManager.getInstance().sendGga(GGA)
+ delay(100)
+ }
+ }
+ } else {
+ Log.d(kTag, "onStart: failed, code is $code")
+ }
}
override fun onPause() {
super.onPause()
binding.mapView.onPause()
sensorManager.unregisterListener(this)
+ //千寻
+ isStart = false
+ RtcmSDKManager.getInstance().stop(Constants.QXWZ_SDK_CAP_ID_NOSR)
}
override fun onSaveInstanceState(outState: Bundle) {
@@ -1010,6 +1080,7 @@
locationHub.stopLocation()
//降低串口电位
gpioManager.setGpioLow("18")
+ RtcmSDKManager.getInstance().cleanup()
}
/**安装标识器对话框******************************************************************************/
diff --git a/app/build.gradle b/app/build.gradle
index 737be31..b9ee987 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5080
- versionName "5.0.8"
+ versionCode 5090
+ versionName "5.0.9"
ndk {
moduleName "serial_port"
@@ -67,6 +67,13 @@
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
daoPackage "${defaultConfig.applicationId}.greendao"//设置DaoMaster、DaoSession、Dao包名
}
+
+ //引入千寻
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
}
static def getBuildDate() {
@@ -120,4 +127,6 @@
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
//图片压缩
implementation 'top.zibin:Luban:1.1.8'
+ //千寻RTK服务
+ implementation(name: 'libqxwz_release_v1.1.0', ext: 'aar')
}
\ No newline at end of file
diff --git a/app/libs/libqxwz_release_v1.1.0.aar b/app/libs/libqxwz_release_v1.1.0.aar
new file mode 100644
index 0000000..4ff2c1e
--- /dev/null
+++ b/app/libs/libqxwz_release_v1.1.0.aar
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4d5076a..2319b98 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -66,6 +66,9 @@
+
-
+
+ android:value="71aef156f96b58d616bc78cfc2f1fbc3" />
() {
+
+ private val kTag = "ConfigServiceActivity"
+
+ override fun initEvent() {
+ binding.saveButton.setOnClickListener {
+ val account = binding.accountView.text.toString().trim()
+ if (account.isBlank()) {
+ "请输入差分定位服务账号!".show(this)
+ return@setOnClickListener
+ }
+
+ val password = binding.passwordView.text.toString().trim()
+ if (password.isBlank()) {
+ "请输入密码!".show(this)
+ return@setOnClickListener
+ }
+
+ val ip = binding.serverIpView.text.toString().trim()
+ if (ip.isBlank()) {
+ "请输入差分定位服务器IP!".show(this)
+ return@setOnClickListener
+ }
+
+ val port = binding.serverPortView.text.toString().trim()
+ if (port.isBlank()) {
+ "请输入差分定位服务器端口号!".show(this)
+ return@setOnClickListener
+ }
+
+ SaveKeyValues.putValue(LocaleConstant.ACK, account)
+ SaveKeyValues.putValue(LocaleConstant.ACS, password)
+ SaveKeyValues.putValue(LocaleConstant.RTK_SERVER, ip)
+ SaveKeyValues.putValue(LocaleConstant.RTK_PORT, port)
+
+ "差分定位服务器配置成功".show(this)
+ finish()
+ }
+ }
+
+ override fun initOnCreate(savedInstanceState: Bundle?) {
+ binding.accountView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+ )
+
+ binding.passwordView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+ )
+
+ binding.serverIpView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_SERVER, "") as String
+ )
+
+ binding.serverPortView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_PORT, "") as String
+ )
+ }
+
+ override fun initViewBinding(): ActivityConfigRtkServiceBinding {
+ return ActivityConfigRtkServiceBinding.inflate(layoutInflater)
+ }
+
+ override fun observeRequestState() {
+
+ }
+
+ override fun setupTopBarLayout() {
+ binding.titleView.setOnClickListener(object : TitleBarView.OnClickListener {
+ override fun onLeftClick() {
+
+ }
+
+ override fun onRightClick() {
+ finish()
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt
index 33f8643..a90a927 100644
--- a/app/src/main/java/com/casic/detector/view/MainActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt
@@ -106,7 +106,12 @@
import com.pengxh.kt.lite.widget.dialog.AlertInputDialog
import com.pengxh.kt.lite.widget.dialog.AlertMessageDialog
import com.pengxh.kt.lite.widget.dialog.BottomActionSheet
+import com.qxwz.sdk.core.CapInfo
+import com.qxwz.sdk.core.Constants
+import com.qxwz.sdk.core.IRtcmSDKCallback
+import com.qxwz.sdk.core.RtcmSDKManager
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
@@ -119,7 +124,7 @@
import kotlin.math.atan2
class MainActivity : SerialPortActivity(), SensorEventListener,
- Handler.Callback {
+ Handler.Callback, IRtcmSDKCallback {
private val kTag = "MainActivity"
private val context = this
@@ -135,6 +140,13 @@
private val rotationMatrix = FloatArray(9)//旋转矩阵缓存
private val valueArray = FloatArray(3)//方位角数值
private var clickTime: Long = 0
+
+ /***千寻配置*****start*/
+ private var isStart = false
+ private val GGA = "\$GPGGA,000001,3112.518576,N,12127.901251,E,1,8,1,0,M,-32,M,3,0*4B"
+
+ /***千寻配置****start*/
+
private var markers = ArrayList()
private var clusterOverlay: ClusterOverlay? = null
private var isFreeTask = false
@@ -285,11 +297,11 @@
}).build().show()
} else {
lifecycleScope.launch(Dispatchers.Main) {
- val labels = withContext(Dispatchers.IO) {
+ val markers = withContext(Dispatchers.IO) {
DataBaseManager.get.queryMarkerByState("0")
}
//如果有需要补全的标识器,Popup右侧会有小圆点提示
- if (labels.isNotEmpty()) {
+ if (markers.isNotEmpty()) {
samplePopupWindow.setShowPosition(4)
}
val x =
@@ -303,11 +315,15 @@
SamplePopupWindow.OnPopupWindowClickListener {
override fun onPopupItemClicked(position: Int) {
when (position) {
- 0 -> updateLabels()
+ 0 -> updateMarkers()
1 -> downloadTask()
2 -> navigatePageTo()
3 -> uploadEvent()
4 -> completionMarker()
+ 5 -> {
+ "尽情期待".show(context)
+// navigatePageTo()
+ }
}
}
})
@@ -586,11 +602,11 @@
//显示标识器详细信息
if (!detailDialog.isShowing) {
- val labelBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
- if (labelBean == null) {
+ val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
+ if (markerBean == null) {
"无法查询到此ID【${markerId}】的信息".show(context)
} else {
- detailDialog.setMarker(labelBean)
+ detailDialog.setMarker(markerBean)
detailDialog.show()
}
}
@@ -833,7 +849,7 @@
}
//更新标识器数据
- private fun updateLabels() {
+ private fun updateMarkers() {
AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?")
.setNegativeButton("取消").setPositiveButton("确定")
.setOnDialogButtonClickListener(object :
@@ -872,7 +888,7 @@
private fun uploadEvent() {
val taskId = SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String
- if (taskId.isBlank()) {
+ if (taskId == "") {
"已完成全部巡检".show(this)
return
}
@@ -990,12 +1006,66 @@
//注册磁场传感器监听
val magnetic = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)
sensorManager.registerListener(this, magnetic, SensorManager.SENSOR_DELAY_NORMAL)
+
+ //千寻(application access key and application access secret)
+// val ack = SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+// val acs = SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+// val deviceId = Settings.System.getString(contentResolver, Settings.Secure.ANDROID_ID)
+// val accountInfo = AccountInfo.builder()
+// .setKeyType(KeyType.QXWZ_SDK_KEY_TYPE_AK).setKey(ack).setSecret(acs)
+// .setDeviceId(deviceId).setDeviceType(android.os.Build.BOARD)
+// .build()
+// val config = SDKConfig.builder()
+// .setAccountInfo(accountInfo).setRtcmSDKCallback(this).build()
+// RtcmSDKManager.getInstance().init(config)
+// RtcmSDKManager.getInstance().auth()
+ }
+
+ override fun onData(type: Int, bytes: ByteArray) {
+ Log.d(kTag, "rtcm data received, data length is ${bytes.size}")
+ }
+
+ override fun onStatus(status: Int) {
+ Log.d(kTag, "status changed to $status")
+ }
+
+ override fun onAuth(code: Int, caps: MutableList?) {
+ if (code == Constants.QXWZ_SDK_STAT_AUTH_SUCC) {
+ Log.d(kTag, "onAuth: successfully")
+ caps?.forEach {
+ Log.d(kTag, "capInfo: $it")
+ }
+
+ lifecycleScope.launch(Dispatchers.IO) {
+ RtcmSDKManager.getInstance().start(Constants.QXWZ_SDK_CAP_ID_NOSR)
+ }
+ } else {
+ Log.d(kTag, "onAuth: failed, code is $code")
+ }
+ }
+
+ override fun onStart(code: Int, capId: Int) {
+ if (code == Constants.QXWZ_SDK_STAT_CAP_START_SUCC) {
+ Log.d(kTag, "onStart: successfully")
+ isStart = true
+ lifecycleScope.launch(Dispatchers.IO) {
+ while (isStart) {
+ RtcmSDKManager.getInstance().sendGga(GGA)
+ delay(100)
+ }
+ }
+ } else {
+ Log.d(kTag, "onStart: failed, code is $code")
+ }
}
override fun onPause() {
super.onPause()
binding.mapView.onPause()
sensorManager.unregisterListener(this)
+ //千寻
+ isStart = false
+ RtcmSDKManager.getInstance().stop(Constants.QXWZ_SDK_CAP_ID_NOSR)
}
override fun onSaveInstanceState(outState: Bundle) {
@@ -1010,6 +1080,7 @@
locationHub.stopLocation()
//降低串口电位
gpioManager.setGpioLow("18")
+ RtcmSDKManager.getInstance().cleanup()
}
/**安装标识器对话框******************************************************************************/
diff --git a/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt b/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
index d0da098..6dd4cfb 100644
--- a/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
@@ -1,11 +1,13 @@
package com.casic.detector.view
+import android.app.ActionBar.LayoutParams
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.Gravity
import android.view.View
+import android.widget.LinearLayout
import androidx.lifecycle.ViewModelProvider
import com.amap.api.location.AMapLocation
import com.casic.detector.adapter.EditableImageAdapter
@@ -71,7 +73,7 @@
window.setGravity(Gravity.CENTER)
val params = window.attributes
params.width = ((getScreenWidth() * 0.9).toInt())
- params.height = ((getScreenHeight() * 0.8).toInt())
+ params.height = LinearLayout.LayoutParams.WRAP_CONTENT
window.attributes = params
taskViewModel = ViewModelProvider(this)[TaskViewModel::class.java]
diff --git a/app/build.gradle b/app/build.gradle
index 737be31..b9ee987 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5080
- versionName "5.0.8"
+ versionCode 5090
+ versionName "5.0.9"
ndk {
moduleName "serial_port"
@@ -67,6 +67,13 @@
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
daoPackage "${defaultConfig.applicationId}.greendao"//设置DaoMaster、DaoSession、Dao包名
}
+
+ //引入千寻
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
}
static def getBuildDate() {
@@ -120,4 +127,6 @@
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
//图片压缩
implementation 'top.zibin:Luban:1.1.8'
+ //千寻RTK服务
+ implementation(name: 'libqxwz_release_v1.1.0', ext: 'aar')
}
\ No newline at end of file
diff --git a/app/libs/libqxwz_release_v1.1.0.aar b/app/libs/libqxwz_release_v1.1.0.aar
new file mode 100644
index 0000000..4ff2c1e
--- /dev/null
+++ b/app/libs/libqxwz_release_v1.1.0.aar
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4d5076a..2319b98 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -66,6 +66,9 @@
+
-
+
+ android:value="71aef156f96b58d616bc78cfc2f1fbc3" />
() {
+
+ private val kTag = "ConfigServiceActivity"
+
+ override fun initEvent() {
+ binding.saveButton.setOnClickListener {
+ val account = binding.accountView.text.toString().trim()
+ if (account.isBlank()) {
+ "请输入差分定位服务账号!".show(this)
+ return@setOnClickListener
+ }
+
+ val password = binding.passwordView.text.toString().trim()
+ if (password.isBlank()) {
+ "请输入密码!".show(this)
+ return@setOnClickListener
+ }
+
+ val ip = binding.serverIpView.text.toString().trim()
+ if (ip.isBlank()) {
+ "请输入差分定位服务器IP!".show(this)
+ return@setOnClickListener
+ }
+
+ val port = binding.serverPortView.text.toString().trim()
+ if (port.isBlank()) {
+ "请输入差分定位服务器端口号!".show(this)
+ return@setOnClickListener
+ }
+
+ SaveKeyValues.putValue(LocaleConstant.ACK, account)
+ SaveKeyValues.putValue(LocaleConstant.ACS, password)
+ SaveKeyValues.putValue(LocaleConstant.RTK_SERVER, ip)
+ SaveKeyValues.putValue(LocaleConstant.RTK_PORT, port)
+
+ "差分定位服务器配置成功".show(this)
+ finish()
+ }
+ }
+
+ override fun initOnCreate(savedInstanceState: Bundle?) {
+ binding.accountView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+ )
+
+ binding.passwordView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+ )
+
+ binding.serverIpView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_SERVER, "") as String
+ )
+
+ binding.serverPortView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_PORT, "") as String
+ )
+ }
+
+ override fun initViewBinding(): ActivityConfigRtkServiceBinding {
+ return ActivityConfigRtkServiceBinding.inflate(layoutInflater)
+ }
+
+ override fun observeRequestState() {
+
+ }
+
+ override fun setupTopBarLayout() {
+ binding.titleView.setOnClickListener(object : TitleBarView.OnClickListener {
+ override fun onLeftClick() {
+
+ }
+
+ override fun onRightClick() {
+ finish()
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt
index 33f8643..a90a927 100644
--- a/app/src/main/java/com/casic/detector/view/MainActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt
@@ -106,7 +106,12 @@
import com.pengxh.kt.lite.widget.dialog.AlertInputDialog
import com.pengxh.kt.lite.widget.dialog.AlertMessageDialog
import com.pengxh.kt.lite.widget.dialog.BottomActionSheet
+import com.qxwz.sdk.core.CapInfo
+import com.qxwz.sdk.core.Constants
+import com.qxwz.sdk.core.IRtcmSDKCallback
+import com.qxwz.sdk.core.RtcmSDKManager
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
@@ -119,7 +124,7 @@
import kotlin.math.atan2
class MainActivity : SerialPortActivity(), SensorEventListener,
- Handler.Callback {
+ Handler.Callback, IRtcmSDKCallback {
private val kTag = "MainActivity"
private val context = this
@@ -135,6 +140,13 @@
private val rotationMatrix = FloatArray(9)//旋转矩阵缓存
private val valueArray = FloatArray(3)//方位角数值
private var clickTime: Long = 0
+
+ /***千寻配置*****start*/
+ private var isStart = false
+ private val GGA = "\$GPGGA,000001,3112.518576,N,12127.901251,E,1,8,1,0,M,-32,M,3,0*4B"
+
+ /***千寻配置****start*/
+
private var markers = ArrayList()
private var clusterOverlay: ClusterOverlay? = null
private var isFreeTask = false
@@ -285,11 +297,11 @@
}).build().show()
} else {
lifecycleScope.launch(Dispatchers.Main) {
- val labels = withContext(Dispatchers.IO) {
+ val markers = withContext(Dispatchers.IO) {
DataBaseManager.get.queryMarkerByState("0")
}
//如果有需要补全的标识器,Popup右侧会有小圆点提示
- if (labels.isNotEmpty()) {
+ if (markers.isNotEmpty()) {
samplePopupWindow.setShowPosition(4)
}
val x =
@@ -303,11 +315,15 @@
SamplePopupWindow.OnPopupWindowClickListener {
override fun onPopupItemClicked(position: Int) {
when (position) {
- 0 -> updateLabels()
+ 0 -> updateMarkers()
1 -> downloadTask()
2 -> navigatePageTo()
3 -> uploadEvent()
4 -> completionMarker()
+ 5 -> {
+ "尽情期待".show(context)
+// navigatePageTo()
+ }
}
}
})
@@ -586,11 +602,11 @@
//显示标识器详细信息
if (!detailDialog.isShowing) {
- val labelBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
- if (labelBean == null) {
+ val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
+ if (markerBean == null) {
"无法查询到此ID【${markerId}】的信息".show(context)
} else {
- detailDialog.setMarker(labelBean)
+ detailDialog.setMarker(markerBean)
detailDialog.show()
}
}
@@ -833,7 +849,7 @@
}
//更新标识器数据
- private fun updateLabels() {
+ private fun updateMarkers() {
AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?")
.setNegativeButton("取消").setPositiveButton("确定")
.setOnDialogButtonClickListener(object :
@@ -872,7 +888,7 @@
private fun uploadEvent() {
val taskId = SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String
- if (taskId.isBlank()) {
+ if (taskId == "") {
"已完成全部巡检".show(this)
return
}
@@ -990,12 +1006,66 @@
//注册磁场传感器监听
val magnetic = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)
sensorManager.registerListener(this, magnetic, SensorManager.SENSOR_DELAY_NORMAL)
+
+ //千寻(application access key and application access secret)
+// val ack = SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+// val acs = SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+// val deviceId = Settings.System.getString(contentResolver, Settings.Secure.ANDROID_ID)
+// val accountInfo = AccountInfo.builder()
+// .setKeyType(KeyType.QXWZ_SDK_KEY_TYPE_AK).setKey(ack).setSecret(acs)
+// .setDeviceId(deviceId).setDeviceType(android.os.Build.BOARD)
+// .build()
+// val config = SDKConfig.builder()
+// .setAccountInfo(accountInfo).setRtcmSDKCallback(this).build()
+// RtcmSDKManager.getInstance().init(config)
+// RtcmSDKManager.getInstance().auth()
+ }
+
+ override fun onData(type: Int, bytes: ByteArray) {
+ Log.d(kTag, "rtcm data received, data length is ${bytes.size}")
+ }
+
+ override fun onStatus(status: Int) {
+ Log.d(kTag, "status changed to $status")
+ }
+
+ override fun onAuth(code: Int, caps: MutableList?) {
+ if (code == Constants.QXWZ_SDK_STAT_AUTH_SUCC) {
+ Log.d(kTag, "onAuth: successfully")
+ caps?.forEach {
+ Log.d(kTag, "capInfo: $it")
+ }
+
+ lifecycleScope.launch(Dispatchers.IO) {
+ RtcmSDKManager.getInstance().start(Constants.QXWZ_SDK_CAP_ID_NOSR)
+ }
+ } else {
+ Log.d(kTag, "onAuth: failed, code is $code")
+ }
+ }
+
+ override fun onStart(code: Int, capId: Int) {
+ if (code == Constants.QXWZ_SDK_STAT_CAP_START_SUCC) {
+ Log.d(kTag, "onStart: successfully")
+ isStart = true
+ lifecycleScope.launch(Dispatchers.IO) {
+ while (isStart) {
+ RtcmSDKManager.getInstance().sendGga(GGA)
+ delay(100)
+ }
+ }
+ } else {
+ Log.d(kTag, "onStart: failed, code is $code")
+ }
}
override fun onPause() {
super.onPause()
binding.mapView.onPause()
sensorManager.unregisterListener(this)
+ //千寻
+ isStart = false
+ RtcmSDKManager.getInstance().stop(Constants.QXWZ_SDK_CAP_ID_NOSR)
}
override fun onSaveInstanceState(outState: Bundle) {
@@ -1010,6 +1080,7 @@
locationHub.stopLocation()
//降低串口电位
gpioManager.setGpioLow("18")
+ RtcmSDKManager.getInstance().cleanup()
}
/**安装标识器对话框******************************************************************************/
diff --git a/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt b/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
index d0da098..6dd4cfb 100644
--- a/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
@@ -1,11 +1,13 @@
package com.casic.detector.view
+import android.app.ActionBar.LayoutParams
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.Gravity
import android.view.View
+import android.widget.LinearLayout
import androidx.lifecycle.ViewModelProvider
import com.amap.api.location.AMapLocation
import com.casic.detector.adapter.EditableImageAdapter
@@ -71,7 +73,7 @@
window.setGravity(Gravity.CENTER)
val params = window.attributes
params.width = ((getScreenWidth() * 0.9).toInt())
- params.height = ((getScreenHeight() * 0.8).toInt())
+ params.height = LinearLayout.LayoutParams.WRAP_CONTENT
window.attributes = params
taskViewModel = ViewModelProvider(this)[TaskViewModel::class.java]
diff --git a/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt b/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt
index 5fd6585..a8c8511 100644
--- a/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt
+++ b/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt
@@ -21,7 +21,7 @@
}
init {
- width = ((context.getScreenWidth() * 0.35).toInt())
+ width = ((context.getScreenWidth() * 0.4).toInt())
height = ViewGroup.LayoutParams.WRAP_CONTENT
isOutsideTouchable = true
isFocusable = true
diff --git a/app/build.gradle b/app/build.gradle
index 737be31..b9ee987 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5080
- versionName "5.0.8"
+ versionCode 5090
+ versionName "5.0.9"
ndk {
moduleName "serial_port"
@@ -67,6 +67,13 @@
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
daoPackage "${defaultConfig.applicationId}.greendao"//设置DaoMaster、DaoSession、Dao包名
}
+
+ //引入千寻
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
}
static def getBuildDate() {
@@ -120,4 +127,6 @@
implementation 'io.github.lucksiege:pictureselector:v3.11.1'
//图片压缩
implementation 'top.zibin:Luban:1.1.8'
+ //千寻RTK服务
+ implementation(name: 'libqxwz_release_v1.1.0', ext: 'aar')
}
\ No newline at end of file
diff --git a/app/libs/libqxwz_release_v1.1.0.aar b/app/libs/libqxwz_release_v1.1.0.aar
new file mode 100644
index 0000000..4ff2c1e
--- /dev/null
+++ b/app/libs/libqxwz_release_v1.1.0.aar
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4d5076a..2319b98 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -66,6 +66,9 @@
+
-
+
+ android:value="71aef156f96b58d616bc78cfc2f1fbc3" />
() {
+
+ private val kTag = "ConfigServiceActivity"
+
+ override fun initEvent() {
+ binding.saveButton.setOnClickListener {
+ val account = binding.accountView.text.toString().trim()
+ if (account.isBlank()) {
+ "请输入差分定位服务账号!".show(this)
+ return@setOnClickListener
+ }
+
+ val password = binding.passwordView.text.toString().trim()
+ if (password.isBlank()) {
+ "请输入密码!".show(this)
+ return@setOnClickListener
+ }
+
+ val ip = binding.serverIpView.text.toString().trim()
+ if (ip.isBlank()) {
+ "请输入差分定位服务器IP!".show(this)
+ return@setOnClickListener
+ }
+
+ val port = binding.serverPortView.text.toString().trim()
+ if (port.isBlank()) {
+ "请输入差分定位服务器端口号!".show(this)
+ return@setOnClickListener
+ }
+
+ SaveKeyValues.putValue(LocaleConstant.ACK, account)
+ SaveKeyValues.putValue(LocaleConstant.ACS, password)
+ SaveKeyValues.putValue(LocaleConstant.RTK_SERVER, ip)
+ SaveKeyValues.putValue(LocaleConstant.RTK_PORT, port)
+
+ "差分定位服务器配置成功".show(this)
+ finish()
+ }
+ }
+
+ override fun initOnCreate(savedInstanceState: Bundle?) {
+ binding.accountView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+ )
+
+ binding.passwordView.setText(
+ SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+ )
+
+ binding.serverIpView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_SERVER, "") as String
+ )
+
+ binding.serverPortView.setText(
+ SaveKeyValues.getValue(LocaleConstant.RTK_PORT, "") as String
+ )
+ }
+
+ override fun initViewBinding(): ActivityConfigRtkServiceBinding {
+ return ActivityConfigRtkServiceBinding.inflate(layoutInflater)
+ }
+
+ override fun observeRequestState() {
+
+ }
+
+ override fun setupTopBarLayout() {
+ binding.titleView.setOnClickListener(object : TitleBarView.OnClickListener {
+ override fun onLeftClick() {
+
+ }
+
+ override fun onRightClick() {
+ finish()
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt
index 33f8643..a90a927 100644
--- a/app/src/main/java/com/casic/detector/view/MainActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt
@@ -106,7 +106,12 @@
import com.pengxh.kt.lite.widget.dialog.AlertInputDialog
import com.pengxh.kt.lite.widget.dialog.AlertMessageDialog
import com.pengxh.kt.lite.widget.dialog.BottomActionSheet
+import com.qxwz.sdk.core.CapInfo
+import com.qxwz.sdk.core.Constants
+import com.qxwz.sdk.core.IRtcmSDKCallback
+import com.qxwz.sdk.core.RtcmSDKManager
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
@@ -119,7 +124,7 @@
import kotlin.math.atan2
class MainActivity : SerialPortActivity(), SensorEventListener,
- Handler.Callback {
+ Handler.Callback, IRtcmSDKCallback {
private val kTag = "MainActivity"
private val context = this
@@ -135,6 +140,13 @@
private val rotationMatrix = FloatArray(9)//旋转矩阵缓存
private val valueArray = FloatArray(3)//方位角数值
private var clickTime: Long = 0
+
+ /***千寻配置*****start*/
+ private var isStart = false
+ private val GGA = "\$GPGGA,000001,3112.518576,N,12127.901251,E,1,8,1,0,M,-32,M,3,0*4B"
+
+ /***千寻配置****start*/
+
private var markers = ArrayList()
private var clusterOverlay: ClusterOverlay? = null
private var isFreeTask = false
@@ -285,11 +297,11 @@
}).build().show()
} else {
lifecycleScope.launch(Dispatchers.Main) {
- val labels = withContext(Dispatchers.IO) {
+ val markers = withContext(Dispatchers.IO) {
DataBaseManager.get.queryMarkerByState("0")
}
//如果有需要补全的标识器,Popup右侧会有小圆点提示
- if (labels.isNotEmpty()) {
+ if (markers.isNotEmpty()) {
samplePopupWindow.setShowPosition(4)
}
val x =
@@ -303,11 +315,15 @@
SamplePopupWindow.OnPopupWindowClickListener {
override fun onPopupItemClicked(position: Int) {
when (position) {
- 0 -> updateLabels()
+ 0 -> updateMarkers()
1 -> downloadTask()
2 -> navigatePageTo()
3 -> uploadEvent()
4 -> completionMarker()
+ 5 -> {
+ "尽情期待".show(context)
+// navigatePageTo()
+ }
}
}
})
@@ -586,11 +602,11 @@
//显示标识器详细信息
if (!detailDialog.isShowing) {
- val labelBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
- if (labelBean == null) {
+ val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull()
+ if (markerBean == null) {
"无法查询到此ID【${markerId}】的信息".show(context)
} else {
- detailDialog.setMarker(labelBean)
+ detailDialog.setMarker(markerBean)
detailDialog.show()
}
}
@@ -833,7 +849,7 @@
}
//更新标识器数据
- private fun updateLabels() {
+ private fun updateMarkers() {
AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?")
.setNegativeButton("取消").setPositiveButton("确定")
.setOnDialogButtonClickListener(object :
@@ -872,7 +888,7 @@
private fun uploadEvent() {
val taskId = SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String
- if (taskId.isBlank()) {
+ if (taskId == "") {
"已完成全部巡检".show(this)
return
}
@@ -990,12 +1006,66 @@
//注册磁场传感器监听
val magnetic = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)
sensorManager.registerListener(this, magnetic, SensorManager.SENSOR_DELAY_NORMAL)
+
+ //千寻(application access key and application access secret)
+// val ack = SaveKeyValues.getValue(LocaleConstant.ACK, "") as String
+// val acs = SaveKeyValues.getValue(LocaleConstant.ACS, "") as String
+// val deviceId = Settings.System.getString(contentResolver, Settings.Secure.ANDROID_ID)
+// val accountInfo = AccountInfo.builder()
+// .setKeyType(KeyType.QXWZ_SDK_KEY_TYPE_AK).setKey(ack).setSecret(acs)
+// .setDeviceId(deviceId).setDeviceType(android.os.Build.BOARD)
+// .build()
+// val config = SDKConfig.builder()
+// .setAccountInfo(accountInfo).setRtcmSDKCallback(this).build()
+// RtcmSDKManager.getInstance().init(config)
+// RtcmSDKManager.getInstance().auth()
+ }
+
+ override fun onData(type: Int, bytes: ByteArray) {
+ Log.d(kTag, "rtcm data received, data length is ${bytes.size}")
+ }
+
+ override fun onStatus(status: Int) {
+ Log.d(kTag, "status changed to $status")
+ }
+
+ override fun onAuth(code: Int, caps: MutableList?) {
+ if (code == Constants.QXWZ_SDK_STAT_AUTH_SUCC) {
+ Log.d(kTag, "onAuth: successfully")
+ caps?.forEach {
+ Log.d(kTag, "capInfo: $it")
+ }
+
+ lifecycleScope.launch(Dispatchers.IO) {
+ RtcmSDKManager.getInstance().start(Constants.QXWZ_SDK_CAP_ID_NOSR)
+ }
+ } else {
+ Log.d(kTag, "onAuth: failed, code is $code")
+ }
+ }
+
+ override fun onStart(code: Int, capId: Int) {
+ if (code == Constants.QXWZ_SDK_STAT_CAP_START_SUCC) {
+ Log.d(kTag, "onStart: successfully")
+ isStart = true
+ lifecycleScope.launch(Dispatchers.IO) {
+ while (isStart) {
+ RtcmSDKManager.getInstance().sendGga(GGA)
+ delay(100)
+ }
+ }
+ } else {
+ Log.d(kTag, "onStart: failed, code is $code")
+ }
}
override fun onPause() {
super.onPause()
binding.mapView.onPause()
sensorManager.unregisterListener(this)
+ //千寻
+ isStart = false
+ RtcmSDKManager.getInstance().stop(Constants.QXWZ_SDK_CAP_ID_NOSR)
}
override fun onSaveInstanceState(outState: Bundle) {
@@ -1010,6 +1080,7 @@
locationHub.stopLocation()
//降低串口电位
gpioManager.setGpioLow("18")
+ RtcmSDKManager.getInstance().cleanup()
}
/**安装标识器对话框******************************************************************************/
diff --git a/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt b/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
index d0da098..6dd4cfb 100644
--- a/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/UploadEventActivity.kt
@@ -1,11 +1,13 @@
package com.casic.detector.view
+import android.app.ActionBar.LayoutParams
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.Gravity
import android.view.View
+import android.widget.LinearLayout
import androidx.lifecycle.ViewModelProvider
import com.amap.api.location.AMapLocation
import com.casic.detector.adapter.EditableImageAdapter
@@ -71,7 +73,7 @@
window.setGravity(Gravity.CENTER)
val params = window.attributes
params.width = ((getScreenWidth() * 0.9).toInt())
- params.height = ((getScreenHeight() * 0.8).toInt())
+ params.height = LinearLayout.LayoutParams.WRAP_CONTENT
window.attributes = params
taskViewModel = ViewModelProvider(this)[TaskViewModel::class.java]
diff --git a/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt b/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt
index 5fd6585..a8c8511 100644
--- a/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt
+++ b/app/src/main/java/com/casic/detector/widgets/SamplePopupWindow.kt
@@ -21,7 +21,7 @@
}
init {
- width = ((context.getScreenWidth() * 0.35).toInt())
+ width = ((context.getScreenWidth() * 0.4).toInt())
height = ViewGroup.LayoutParams.WRAP_CONTENT
isOutsideTouchable = true
isFocusable = true
diff --git a/app/src/main/res/layout/activity_config_rtk_service.xml b/app/src/main/res/layout/activity_config_rtk_service.xml
new file mode 100644
index 0000000..b6dab48
--- /dev/null
+++ b/app/src/main/res/layout/activity_config_rtk_service.xml
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file