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
C-AVP2.0
Commits
15cd729f
Commit
15cd729f
authored
Jan 05, 2026
by
p x
Browse files
补充注释
parent
a61e1f9c
Changes
5
Show whitespace changes
Inline
Side-by-side
app/build.gradle.kts
View file @
15cd729f
...
@@ -92,7 +92,7 @@ dependencies {
...
@@ -92,7 +92,7 @@ dependencies {
testImplementation
(
libs
.
junit
)
testImplementation
(
libs
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
//腾讯key-value存储方案
implementation
(
"com.tencent:mmkv:2.2.4"
)
implementation
(
"com.tencent:mmkv:2.2.4"
)
implementation
(
"io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.7"
)
implementation
(
"io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.7"
)
implementation
(
"com.jakewharton.rxbinding4:rxbinding:4.0.0"
)
implementation
(
"com.jakewharton.rxbinding4:rxbinding:4.0.0"
)
...
...
app/src/main/java/com/sd/cavphmi/highmap/TileJsonBean.kt
View file @
15cd729f
...
@@ -48,11 +48,13 @@ class TileJsonBean {
...
@@ -48,11 +48,13 @@ class TileJsonBean {
"/data/avp/04jianzhu/tileset.json"
"/data/avp/04jianzhu/tileset.json"
)
)
// var tiles3d = listOf(
//公司服务器的
// "/data/adas/LanePolygon/tileset.json",
/* var host = "http://192.168.58.65:9001"
// "/data/adas/RoadSection/tileset.json",
var tiles3d = listOf(
// "/data/adas/Yizhuang_Unicom_ground1018/tileset.json"
"/data/01road/tileset.json",
// )
"/data/02shebei/tileset.json",
"/data/04jianzhu/tileset.json"
)*/
//方本地的
//方本地的
/* var host = "http://192.168.60.164:5003"
/* var host = "http://192.168.60.164:5003"
...
...
app/src/main/java/com/sd/cavphmi/repositorys/AvpDataRepo.kt
View file @
15cd729f
...
@@ -23,7 +23,7 @@ class AvpDataRepo @Inject constructor(
...
@@ -23,7 +23,7 @@ class AvpDataRepo @Inject constructor(
// private var simpleSSEClient = SimpleSSEClient.instance
// private var simpleSSEClient = SimpleSSEClient.instance
private
var
sseManager2
=
SseManager
.
instance
private
var
sseManager2
=
SseManager
.
instance
// 初始化多连接管理器
(全局单例更佳,可通过依赖注入)
// 初始化多连接管理器
private
val
sseManager
=
SseMultiConnectionManager
.
instance
private
val
sseManager
=
SseMultiConnectionManager
.
instance
// 连接 ID 定义(唯一标识每个连接)
// 连接 ID 定义(唯一标识每个连接)
...
@@ -133,7 +133,11 @@ class AvpDataRepo @Inject constructor(
...
@@ -133,7 +133,11 @@ class AvpDataRepo @Inject constructor(
sseManager2.connect(url, body)*/
sseManager2.connect(url, body)*/
}
}
/**获取车辆位姿****/
/**获取车辆位姿
* @param url
* @param body
* @param sseCallback 接口回调
*/
fun
getCarPose
(
url
:
String
,
body
:
RequestBody
,
sseCallback
:
SseCallback
)
{
fun
getCarPose
(
url
:
String
,
body
:
RequestBody
,
sseCallback
:
SseCallback
)
{
sseManager
.
startConnection
(
CONN_ID_CAR
,
url
,
body
,
sseCallback
)
sseManager
.
startConnection
(
CONN_ID_CAR
,
url
,
body
,
sseCallback
)
}
}
...
...
app/src/main/java/com/sd/cavphmi/ui/MainActivity.kt
View file @
15cd729f
...
@@ -295,6 +295,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MyBaseViewModel>() {
...
@@ -295,6 +295,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MyBaseViewModel>() {
lifecycleScope
.
launch
{
lifecycleScope
.
launch
{
repeatOnLifecycle
(
Lifecycle
.
State
.
STARTED
)
{
repeatOnLifecycle
(
Lifecycle
.
State
.
STARTED
)
{
mainVm
.
subVehicle
().
collect
{
car
->
mainVm
.
subVehicle
().
collect
{
car
->
//更新车辆位置
showVehicle
(
car
)
showVehicle
(
car
)
}
}
}
}
...
@@ -305,7 +306,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MyBaseViewModel>() {
...
@@ -305,7 +306,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MyBaseViewModel>() {
}*/
}*/
}
}
/
/显示车辆位姿UI
/
**更新车辆位置*/
private
fun
showVehicle
(
car
:
CarVehicle
)
{
private
fun
showVehicle
(
car
:
CarVehicle
)
{
if
(
car
.
vehiclePos
==
null
||
car
.
vehiclePos
?.
getOrNull
(
2
)
==
null
)
{
if
(
car
.
vehiclePos
==
null
||
car
.
vehiclePos
?.
getOrNull
(
2
)
==
null
)
{
//隐藏小车
//隐藏小车
...
...
app/src/main/java/com/sd/cavphmi/ui/fragment/DistantTipFragment.kt
View file @
15cd729f
...
@@ -40,7 +40,6 @@ class DistantTipFragment : Fragment() {
...
@@ -40,7 +40,6 @@ class DistantTipFragment : Fragment() {
}
}
}
}
override
fun
onCreateView
(
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
):
View
?
{
...
@@ -59,16 +58,18 @@ class DistantTipFragment : Fragment() {
...
@@ -59,16 +58,18 @@ class DistantTipFragment : Fragment() {
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
super
.
onViewCreated
(
view
,
savedInstanceState
)
//观察AVP状态
// mainVm.avpStatu.observe(viewLifecycleOwner) {
// mainVm.avpStatu.observe(viewLifecycleOwner) {
// showTip(it)
// showTip(it)
// }
// }
//观察AVP状态和车辆位姿
lifecycleScope
.
launch
{
lifecycleScope
.
launch
{
repeatOnLifecycle
(
Lifecycle
.
State
.
STARTED
)
{
repeatOnLifecycle
(
Lifecycle
.
State
.
STARTED
)
{
mainVm
.
carAndAvp
.
collect
{
carAndAvp
->
mainVm
.
carAndAvp
.
collect
{
carAndAvp
->
if
(
carAndAvp
.
carVehicle
==
null
||
carAndAvp
.
avpStatuBean
==
null
)
{
if
(
carAndAvp
.
carVehicle
==
null
||
carAndAvp
.
avpStatuBean
==
null
)
{
return
@collect
return
@collect
}
}
//显示提示文字
showTip
(
carAndAvp
.
avpStatuBean
!!
,
carAndAvp
.
carVehicle
!!
)
showTip
(
carAndAvp
.
avpStatuBean
!!
,
carAndAvp
.
carVehicle
!!
)
}
}
}
}
...
...
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