Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
p x
SuZhouAvp
Commits
a99826e3
"app/src/git@tydicdata.com:pengxiao/suzhouavp.git" did not exist on "374a24ad60fd5f274c9e53fc56f92a3aec583342"
Commit
a99826e3
authored
Sep 18, 2025
by
p x
Browse files
整理代码,测试车辆位姿和感知物以及v2x
parent
e09a56b8
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
app/build.gradle.kts
View file @
a99826e3
...
...
@@ -18,6 +18,11 @@ android {
versionCode
=
1
versionName
=
"1.0"
ndk
{
// abiFilters.addAll(listOf("x86_64", "arm64-v8a"))
abiFilters
.
addAll
(
listOf
(
"arm64-v8a"
))
}
testInstrumentationRunner
=
"androidx.test.runner.AndroidJUnitRunner"
}
...
...
app/src/main/AndroidManifest.xml
View file @
a99826e3
...
...
@@ -63,11 +63,11 @@
android:screenOrientation=
"landscape"
android:theme=
"@style/Theme.SuZhouAvp"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<!--
<intent-filter>
-->
<!--
<action android:name="android.intent.action.MAIN" />
-->
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
<!--
<category android:name="android.intent.category.LAUNCHER" />
-->
<!--
</intent-filter>
-->
</activity>
...
...
@@ -81,17 +81,17 @@
android:resizeableActivity=
"false"
android:screenOrientation=
"fullUser"
/>
<!--
<activity
-->
<!--
android:name=".ui.BootActivity"
-->
<!--
android:exported="true"
-->
<!--
android:screenOrientation="landscape"
-->
<!--
android:theme="@style/SplashTheme">
-->
<!--
<intent-filter>
-->
<!--
<action android:name="android.intent.action.MAIN" />
-->
<activity
android:name=
".ui.BootActivity"
android:exported=
"true"
android:screenOrientation=
"landscape"
android:theme=
"@style/SplashTheme"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<!--
<category android:name="android.intent.category.LAUNCHER" />
-->
<!--
</intent-filter>
-->
<!--
</activity>
-->
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
...
...
app/src/main/assets/mock/PerTarget.txt
View file @
a99826e3
This diff is collapsed.
Click to expand it.
app/src/main/assets/mock/PerTarget_15.txt
View file @
a99826e3
This diff is collapsed.
Click to expand it.
app/src/main/java/com/sd/cavphmi/ui/BootActivity.kt
View file @
a99826e3
...
...
@@ -34,30 +34,17 @@ class BootActivity : BaseActivity<ActivityBootBinding, MyBaseViewModel>() {
return
BR
.
vm
}
// private var latLngInfo: LatLngInfo? = null
override
fun
initView
()
{
// tcpUpVM.owner=this
// tcpUpVM.upWork()
// viewModel.testWork()
requestPers
()
}
// fun getLatLngInfo() {
// latLngInfo = intent.getParcelableExtra<LatLngInfo>(MyContants.LAT_LNG_INFO)
//// var lat = intent.getDoubleExtra("LAT", 0.0)
//// var lng = intent.getDoubleExtra("LNG", 0.0)
// println("---------智慧 boot lng = ${latLngInfo?.lng} lat = ${latLngInfo?.lat}")
//// println("---------智慧 直接传 lat = $lat lng = $lng")
// }
private
fun
starMain
()
{
// requestPers()
binding
.
imageView
.
postDelayed
({
var
jump
=
Intent
(
this
,
Ma
inActivity
::
class
.
java
)
//
binding.imageView.postDelayed({
var
jump
=
Intent
(
this
,
Log
inActivity
::
class
.
java
)
startActivity
(
jump
)
finish
()
},
10
)
//
}, 10
0
)
}
...
...
@@ -79,7 +66,7 @@ class BootActivity : BaseActivity<ActivityBootBinding, MyBaseViewModel>() {
.
onExplainRequestReason
{
scope
,
deniedList
->
scope
.
showRequestReasonDialog
(
deniedList
,
"A
das
需要同意以下授权才能正常使用"
,
"A
VP
需要同意以下授权才能正常使用"
,
"好的"
,
"取消"
)
...
...
app/src/main/java/com/sd/cavphmi/ui/fragment/CarPanelFragment.kt
View file @
a99826e3
package
com.sd.cavphmi.ui.fragment
import
android.util.Log
import
androidx.fragment.app.activityViewModels
import
androidx.lifecycle.ViewModelProvider
import
com.sd.cavphmi.BR
import
com.sd.cavphmi.R
import
com.sd.cavphmi.base.BaseFragment
import
com.sd.cavphmi.base.MyBaseViewModel
import
com.sd.cavphmi.databinding.FragmentCarPanelBinding
import
com.sd.cavphmi.highmap.HighMapApi
import
com.sd.cavphmi.viewmodels.CarPanelVM
import
com.sd.cavphmi.viewmodels.MainVm
import
dagger.hilt.android.AndroidEntryPoint
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
//private const val ARG_PARAM1 = "param1"
//private const val ARG_PARAM2 = "param2"
/**
* 车仪表
*/
@AndroidEntryPoint
class
CarPanelFragment
:
BaseFragment
<
FragmentCarPanelBinding
,
CarPanelVM
>()
{
//
// private var param1: String? = null
// private var param2: String? = null
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// arguments?.let {
// param1 = it.getString(ARG_PARAM1)
// param2 = it.getString(ARG_PARAM2)
// }
// }
class
CarPanelFragment
:
BaseFragment
<
FragmentCarPanelBinding
,
MyBaseViewModel
>()
{
override
fun
getStatuBarColor
():
Int
{
return
-
1
...
...
@@ -46,8 +29,8 @@ class CarPanelFragment : BaseFragment<FragmentCarPanelBinding, CarPanelVM>() {
return
R
.
layout
.
fragment_car_panel
}
override
fun
initViewModel
():
CarPanelVM
{
return
ViewModelProvider
(
this
).
get
(
CarPanelVM
::
class
.
java
)
override
fun
initViewModel
():
MyBaseViewModel
{
return
ViewModelProvider
(
this
).
get
(
MyBaseViewModel
::
class
.
java
)
}
override
fun
initVariableId
():
Int
{
...
...
@@ -55,97 +38,26 @@ class CarPanelFragment : BaseFragment<FragmentCarPanelBinding, CarPanelVM>() {
}
private
val
mainVm
:
MainVm
by
activityViewModels
()
private
var
currentNumber
=
0
// 初始数字
private
val
carPanelVM
:
CarPanelVM
by
activityViewModels
()
override
fun
initView
()
{
binding
.
cpBean
=
viewModel
.
carPanelBean
// //驾驶模式
// if(viewModel.carPanelBean.driveMode=="1"){
// binding.tvDrivemode.text="自动驾驶"
// }else{
// binding.tvDrivemode.text="人工驾驶"
// }
//车灯
/* if (viewModel.carPanelBean.lights == 0) {
binding.ivLeftLight.setImageResource(R.drawable.trun_left_grey)
binding.ivRightLight.setImageResource(R.drawable.trun_left_grey)
} else if (viewModel.carPanelBean.lights == 1) {
binding.ivLeftLight.setImageResource(R.drawable.trun_left_blue)
binding.ivRightLight.setImageResource(R.drawable.trun_left_grey)
} else {
binding.ivLeftLight.setImageResource(R.drawable.trun_left_grey)
binding.ivRightLight.setImageResource(R.drawable.trun_right_blue)
}
//档位
if (viewModel.carPanelBean.gear == 0) {
binding.tvP.setTextColor(Color.BLUE)
binding.tvR.setTextColor(resources.getColor(R.color.text_grey))
binding.tvN.setTextColor(resources.getColor(R.color.text_grey))
binding.tvD.setTextColor(resources.getColor(R.color.text_grey))
} else if (viewModel.carPanelBean.gear == 1) {
binding.tvP.setTextColor(resources.getColor(R.color.text_grey))
binding.tvR.setTextColor(Color.BLUE)
binding.tvN.setTextColor(resources.getColor(R.color.text_grey))
binding.tvD.setTextColor(resources.getColor(R.color.text_grey))
} else if (viewModel.carPanelBean.gear == 2) {
binding.tvP.setTextColor(resources.getColor(R.color.text_grey))
binding.tvR.setTextColor(resources.getColor(R.color.text_grey))
binding.tvN.setTextColor(resources.getColor(R.color.text_grey))
binding.tvD.setTextColor(Color.BLUE)
} else if (viewModel.carPanelBean.gear == 3) {
binding.tvP.setTextColor(resources.getColor(R.color.text_grey))
binding.tvR.setTextColor(resources.getColor(R.color.text_grey))
binding.tvN.setTextColor(Color.BLUE)
binding.tvD.setTextColor(resources.getColor(R.color.text_grey))
}
// 启动协程定时切换
lifecycleScope.launch {
while (true) {
if (currentNumber > 100) {
return@launch
}
binding.tvSoc.text = "${currentNumber}%"
binding.proSoc.progress = currentNumber
delay(1000) // 等待10秒
currentNumber++
println("-----" + currentNumber)
}
}*/
binding
.
cpBean
=
carPanelVM
.
carPanelBean
}
override
fun
initListener
()
{
mainVm
.
carVehicle
.
observe
(
this
)
{
viewModel
.
setCarPanelBean
(
it
)
for
(
item
in
it
){
Log
.
e
(
"Car"
,
"------车辆位姿数据----$item"
)
HighMapApi
.
setCarPosition
(
item
.
heading
,
item
.
latitude
,
item
.
longitude
,
item
.
elevation
.
toDouble
())
// HighMapApi.setCarPosition(item.heading,item.latitude,item.longitude,20.80189)
}
carPanelVM
.
setCarPanelBean
(
it
)
}
}
override
fun
getToData
()
{
}
companion
object
{
// lateinit var cp: CarPanelFragment
// @JvmStatic
// fun newInstance(param1: String, param2: String) =
// CarPanel().apply {
// arguments = Bundle().apply {
// putString(ARG_PARAM1, param1)
// putString(ARG_PARAM2, param2)
// }
// }
@JvmStatic
fun
newInstance
()
=
CarPanelFragment
()
}
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/utils/MyContants.kt
View file @
a99826e3
...
...
@@ -5,7 +5,7 @@ object MyContants {
//测试环境
// var HOST = "https://itg-dev.cu-sc.com:19443/"
//开发环境切勿动
var
HOST
=
"https://itg-yz.cu-sc.com:13443"
var
HOST
=
"https://itg-yz.cu-sc.com:13443"
//智网生产环境地址用于拼接3dtile.json
var
HOST_HTTP_3
=
"https://itg-yz.cu-sc.com:13443"
// /***测试环境socket token***/
...
...
@@ -20,7 +20,7 @@ object MyContants {
// private val reType = "51world"
//跟踪车辆的ID 15(模拟) skywell.1ggvlp16.car10 skywell.1ggvlp16.car8
//
智网测试、开发地址
//
用来拼接websocket
var
BASE_HOST
=
if
(
IS_DEBUG
)
"172.24.124.130:19443"
else
"itg-yz.cu-sc.com:19443"
...
...
app/src/main/java/com/sd/cavphmi/viewmodels/MainVm.kt
View file @
a99826e3
...
...
@@ -194,7 +194,7 @@ class MainVm @Inject constructor(
override
fun
onMsg
(
str
:
String
)
{
viewModelScope
.
launch
{
//下载到sd卡下面的DownLoad文件夹下面
FileIoUtils
.
writeToFile
(
str
,
"CarVehicle.txt"
)
//
FileIoUtils.writeToFile(str, "CarVehicle.txt")
var
carBean
=
gson
.
fromJson
(
str
,
CarVehicle
::
class
.
java
)
// carVehicle.postValue(carBean)
//更新主车位置
...
...
@@ -225,7 +225,7 @@ class MainVm @Inject constructor(
feelTargetWSClient
.
onDataCb
=
object
:
FeelTargetWSClient
.
OnDataCb
{
override
fun
onMsg
(
str
:
String
)
{
viewModelScope
.
launch
{
FileIoUtils
.
writeToFile
(
str
,
"PerTarget.txt"
)
//
FileIoUtils.writeToFile(str, "PerTarget.txt")
var
bean
=
gson
.
fromJson
(
str
,
PerceptionBean
::
class
.
java
)
targetPre
.
postValue
(
bean
)
}
...
...
@@ -254,7 +254,7 @@ class MainVm @Inject constructor(
v2xWSClient
.
onDataCb
=
object
:
V2xWSClient
.
OnDataCb
{
override
fun
onMsg
(
str
:
String
)
{
viewModelScope
.
launch
{
FileIoUtils
.
writeToFile
(
str
,
"onStartV2x.txt"
)
//
FileIoUtils.writeToFile(str, "onStartV2x.txt")
var
bean
=
gson
.
fromJson
(
str
,
V2xStartBean
::
class
.
java
)
v2xStartBean
.
postValue
(
bean
)
}
...
...
app/src/main/res/layout/activity_boot.xml
View file @
a99826e3
...
...
@@ -15,13 +15,14 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.BootActivity"
android:background=
"@
null
"
>
android:background=
"@
drawable/login_bg
"
>
<ImageView
android:id=
"@+id/imageView"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:scaleType=
"centerInside"
android:src=
"@mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
app/src/main/res/layout/activity_login.xml
View file @
a99826e3
...
...
@@ -8,143 +8,143 @@
android:orientation=
"vertical"
tools:context=
".ui.LoginActivity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
android:background=
"@color/white"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"登录"
android:textColor=
"#3D3D3D"
android:textSize=
"16sp"
/>
</RelativeLayout>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"30dp"
android:src=
"@mipmap/ic_launcher"
/>
<LinearLayout
android:layout_width=
"220dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"25dp"
android:background=
"@drawable/rect_white_20"
android:gravity=
"center_vertical"
android:paddingHorizontal=
"10dp"
android:paddingVertical=
"5dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/smartphone_line"
/>
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<EditText
android:id=
"@+id/et_account"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:background=
"@null"
android:hint=
"请输入账号"
android:maxLines=
"1"
android:text=
"18501971666"
android:textColor=
"@color/text_black"
android:textSize=
"10sp"
/>
android:layout_height=
"?attr/actionBarSize"
android:background=
"@color/white"
>
</LinearLayout>
<LinearLayout
android:layout_width=
"
220dp
"
android:layout_height=
"wrap_content"
android:layout_
gravity=
"center_horizontal
"
android:
layout_marginTop=
"25dp
"
android:
background=
"@drawable/rect_white_20
"
android:
gravity=
"center_vertical"
android:paddingHorizontal=
"10dp"
android:paddingVertical=
"5dp"
>
<TextView
android:layout_width=
"
wrap_content
"
android:layout_height=
"wrap_content"
android:layout_
centerInParent=
"true
"
android:
text=
"登录
"
android:
textColor=
"#3D3D3D
"
android:
textSize=
"16sp"
/>
</RelativeLayout
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/et_pwd"
/>
<EditText
android:id=
"@+id/et_pwd"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:background=
"@null"
android:hint=
"请输入密码"
android:inputType=
"textPassword"
android:maxLines=
"1"
android:text=
"vUO2dStZDhbd*88FfT84"
android:textColor=
"@color/text_black"
android:textSize=
"10sp"
/>
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/bt_login"
android:layout_width=
"220dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"40dp"
android:text=
"登录"
android:textColor=
"@color/white"
android:textSize=
"15sp"
/>
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"30dp"
android:src=
"@mipmap/ic_launcher"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/bt_vehinfo"
android:layout_width=
"wrap_content"
<LinearLayout
android:layout_width=
"220dp"
android:layout_height=
"wrap_content"
android:text=
"获取车辆信息"
android:visibility=
"visible"
/>
<Button
android:id=
"@+id/bt_spaceinfo"
android:layout_width=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"25dp"
android:background=
"@drawable/rect_white_20"
android:gravity=
"center_vertical"
android:paddingHorizontal=
"10dp"
android:paddingVertical=
"5dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/smartphone_line"
/>
<EditText
android:id=
"@+id/et_account"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:background=
"@null"
android:hint=
"请输入账号"
android:maxLines=
"1"
android:text=
"18501971666"
android:textColor=
"@color/text_black"
android:textSize=
"10sp"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"220dp"
android:layout_height=
"wrap_content"
android:text=
"车位占用情况"
android:visibility=
"visible"
/>
<Button
android:id=
"@+id/bt_avpstatu"
android:layout_width=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"25dp"
android:background=
"@drawable/rect_white_20"
android:gravity=
"center_vertical"
android:paddingHorizontal=
"10dp"
android:paddingVertical=
"5dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/et_pwd"
/>
<EditText
android:id=
"@+id/et_pwd"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:background=
"@null"
android:hint=
"请输入密码"
android:inputType=
"textPassword"
android:maxLines=
"1"
android:text=
"vUO2dStZDhbd*88FfT84"
android:textColor=
"@color/text_black"
android:textSize=
"10sp"
/>
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/bt_login"
android:layout_width=
"220dp"
android:layout_height=
"wrap_content"
android:text=
"获取AVP状态信息"
android:visibility=
"visible"
/>
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"40dp"
android:text=
"登录"
android:textColor=
"@color/white"
android:textSize=
"15sp"
/>
<Button
android:id=
"@+id/bt_main"
android:layout_width=
"wrap_content"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"直接到首页"
/>
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/bt_vehinfo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"获取车辆信息"
android:visibility=
"visible"
/>
<Button
android:id=
"@+id/bt_spaceinfo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"车位占用情况"
android:visibility=
"visible"
/>
<Button
android:id=
"@+id/bt_avpstatu"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"获取AVP状态信息"
android:visibility=
"visible"
/>
<Button
android:id=
"@+id/bt_main"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"直接到首页"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
app/src/main/res/layout/fragment_car_panel.xml
View file @
a99826e3
...
...
@@ -5,9 +5,9 @@
<data>
<variable
name=
"vm"
type=
"com.sd.cavphmi.viewmodels.CarPanelVM"
/>
<!--
<variable
-->
<!--
name="vm"
-->
<!--
type="com.sd.cavphmi.viewmodels.CarPanelVM" />
-->
<variable
name=
"cpBean"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment