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
d381cdf5
Commit
d381cdf5
authored
Sep 28, 2025
by
p x
Browse files
删除无用类,增加2个HTTP接口
parent
4faa9691
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
app/src/main/assets/mock/PerTarget_15.txt
View file @
d381cdf5
This diff is collapsed.
Click to expand it.
app/src/main/java/com/sd/cavphmi/bean/AvpStatuBean.kt
View file @
d381cdf5
...
...
@@ -3,20 +3,196 @@ package com.sd.cavphmi.bean
/**
* Avp 状态信息
* {"code":1,"msg":"操作成功","result":[{"vehicleId":1694264612474306561,"vehiclePlate":"苏EAVP001","businessType":"NIL","businessTypeCode":0,"businessStatus":"NIL","businessStatusCode":0,"lines":null},{"vehicleId":1826545465602543618,"vehiclePlate":"皖BDJ1106","businessType":"NIL","businessTypeCode":0,"businessStatus":"NIL","businessStatusCode":0,"lines":null}],"success":true}
*
*
*
*/
data class
AvpStatuBean
(
val
code
:
Int
,
val
msg
:
String
,
val
result
:
List
<
AResult
>,
val
success
:
Boolean
data class
AvpStatuBean
(
val
businessType
:
String
,
val
drivenDecision
:
DrivenDecision
,
// val exceptionCode: Any,
// val exceptionMessage: Any,
val
haulingNo
:
String
,
// val haulingStageState: String,
val
space
:
Space
,
val
spaceId
:
String
,
val
vehicleContext
:
VehicleContext
,
val
vin
:
String
)
data class
AResult
(
val
businessStatus
:
String
,
val
businessStatusCode
:
Int
,
val
businessType
:
String
,
val
businessTypeCode
:
Int
,
val
lines
:
Any
,
val
vehicleId
:
Long
,
val
vehiclePlate
:
String
data class
DrivenDecision
(
val
endPoint
:
EndPoint
,
val
progress
:
Any
,
val
routing
:
Any
,
val
startPoint
:
StartPoint
,
val
trajectory
:
Trajectory
// 全局路径
)
data class
Space
(
val
centerLatitude
:
Double
,
// 车位中心的纬度 02坐标系
val
centerLongitude
:
Double
,
// 车位中心的经度 02坐标系
val
code
:
String
,
// 目标车位编号
// val createdAt: Long,
// val elevation: Any,
val
entranceLatitude
:
Double
,
//目标车位倒车点的纬度 02坐标系
val
entranceLongitude
:
Double
,
// 目标车位倒车点的经度 02坐标系
val
id
:
Int
,
// 目标车位id
// val line: Any,
val
name
:
String
,
// val occupySource: Any,
// val occupyTime: Any,
val
placeId
:
Int
,
val
spaceType
:
String
,
val
state
:
String
,
// val surface: Any,
// val updatedAt: Long
)
data class
VehicleContext
(
val
online
:
Boolean
,
// val perceptionContext: Any,
// val vehicleBasic: VehicleBasic,
// val vehicleBusinessType: Any,
val
vehicleDynamic
:
VehicleDynamic
,
val
vin
:
String
)
data class
EndPoint
(
val
acceleration
:
Double
,
val
altitude
:
Double
,
val
area
:
Any
,
val
curvature
:
Double
,
val
curvatureRate
:
Double
,
val
heading
:
Double
,
val
id
:
String
,
val
latitude
:
Double
,
val
longitude
:
Double
,
val
longitudinalAcce
:
Any
,
val
longitudinalDis
:
Any
,
val
longitudinalSpeed
:
Any
,
val
targetSpeed
:
Double
,
val
timestamp
:
Double
,
val
transverseAcce
:
Any
,
val
transverseDis
:
Any
,
val
transverseSpeed
:
Any
,
val
verticalAcce
:
Any
)
data class
StartPoint
(
val
acceleration
:
Double
,
val
altitude
:
Double
,
val
area
:
Any
,
val
curvature
:
Double
,
val
curvatureRate
:
Double
,
val
heading
:
Double
,
val
id
:
String
,
val
latitude
:
Double
,
val
longitude
:
Double
,
val
longitudinalAcce
:
Any
,
val
longitudinalDis
:
Any
,
val
longitudinalSpeed
:
Any
,
val
targetSpeed
:
Double
,
val
timestamp
:
Double
,
val
transverseAcce
:
Any
,
val
transverseDis
:
Any
,
val
transverseSpeed
:
Any
,
val
verticalAcce
:
Any
)
data class
Trajectory
(
val
arrived
:
Boolean
,
val
endPoint
:
EndPointX
,
val
length
:
Double
,
// val pathArray: Any,
val
pathLine
:
String
,
val
points
:
List
<
APoint
>,
// 全局路径 02坐标系
val
startPoint
:
StartPointX
,
val
time
:
Int
)
data class
EndPointX
(
val
acceleration
:
Double
,
val
altitude
:
Double
,
val
area
:
Any
,
val
curvature
:
Double
,
val
curvatureRate
:
Double
,
val
heading
:
Double
,
val
id
:
Any
,
val
latitude
:
Double
,
val
longitude
:
Double
,
val
longitudinalAcce
:
Any
,
val
longitudinalDis
:
Any
,
val
longitudinalSpeed
:
Any
,
val
targetSpeed
:
Double
,
val
timestamp
:
Double
,
val
transverseAcce
:
Any
,
val
transverseDis
:
Any
,
val
transverseSpeed
:
Any
,
val
verticalAcce
:
Any
)
data class
APoint
(
val
acceleration
:
Double
,
val
altitude
:
Double
,
val
area
:
Any
,
val
curvature
:
Double
,
val
curvatureRate
:
Double
,
val
heading
:
Double
,
val
id
:
Any
,
val
latitude
:
Double
,
// 全局路径的经度 02坐标系
val
longitude
:
Double
,
// 全局路径的纬度 02坐标系
val
longitudinalAcce
:
Any
,
val
longitudinalDis
:
Any
,
val
longitudinalSpeed
:
Any
,
val
targetSpeed
:
Double
,
val
timestamp
:
Double
,
val
transverseAcce
:
Any
,
val
transverseDis
:
Any
,
val
transverseSpeed
:
Any
,
val
verticalAcce
:
Any
)
data class
StartPointX
(
val
acceleration
:
Double
,
val
altitude
:
Double
,
val
area
:
Any
,
val
curvature
:
Double
,
val
curvatureRate
:
Double
,
val
heading
:
Double
,
val
id
:
Any
,
val
latitude
:
Double
,
val
longitude
:
Double
,
val
longitudinalAcce
:
Any
,
val
longitudinalDis
:
Any
,
val
longitudinalSpeed
:
Any
,
val
targetSpeed
:
Double
,
val
timestamp
:
Double
,
val
transverseAcce
:
Any
,
val
transverseDis
:
Any
,
val
transverseSpeed
:
Any
,
val
verticalAcce
:
Any
)
data class
VehicleBasic
(
val
deviceId
:
String
,
val
id
:
Int
,
val
maxSpeed
:
Any
,
val
minTurnRadius
:
Any
,
val
vehicleLength
:
Any
,
val
vehicleWidth
:
Any
)
data class
VehicleDynamic
(
val
accSpeed
:
Double
,
val
doorStatus
:
String
,
val
drivingMode
:
String
,
val
elevation
:
Double
,
val
gearType
:
String
,
// 档位类型
val
heading
:
Double
,
val
latitude
:
Double
,
val
light
:
Any
,
val
longitude
:
Double
,
val
power
:
Any
,
val
speed
:
Double
,
val
wiper
:
Any
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/BindCarBean.kt
0 → 100644
View file @
d381cdf5
package
com.sd.cavphmi.bean
/**可绑定车辆
* [{
* // 车辆唯一标识
* "id": 123456789012345,
* // 车辆VIN
* "vin": "LSVCC2CB8BM123456",
* // 车牌号
* "plateNumber": "鄂A12345",
* // 车辆的唯一编码
* "vehicleCode": "VC2024000123",
* }]
* */
//class BindCarBean : ArrayList<BindCarBeanItem>()
data class
BindCarItem
(
val
id
:
Long
,
val
plateNumber
:
String
,
val
vehicleCode
:
String
,
val
vin
:
String
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/PreDelay.kt
deleted
100644 → 0
View file @
4faa9691
package
com.sd.cavphmi.bean
/***感知延时**/
data class
PreDelay
(
val
id
:
String
,
val
level
:
Int
,
val
objects
:
List
<
PObject
>,
val
reportTime
:
Long
,
val
startTime
:
Long
,
val
type
:
Int
,
val
typeName
:
String
)
data class
PObject
(
val
elevation
:
Double
,
val
id
:
String
,
val
latitude
:
Double
,
val
longitude
:
Double
,
val
name
:
String
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/TrafficLightBean.kt
deleted
100644 → 0
View file @
4faa9691
package
com.sd.cavphmi.bean
/****交通信号灯****/
data class
TrafficLightBean
(
val
signalgroup
:
List
<
Signalgroup
>,
val
timestamp
:
String
)
data class
Signalgroup
(
val
idtype
:
Any
,
val
junctionid
:
String
,
val
phase
:
List
<
Phase
>
)
data class
Phase
(
val
color
:
String
,
val
countDown
:
Int
,
val
lightmodelid
:
List
<
Lightmodelid
>,
val
phaseid
:
String
,
val
turnlanesid
:
List
<
Turnlanesid
>
)
data class
Lightmodelid
(
val
id
:
String
,
val
phase
:
Int
)
data class
Turnlanesid
(
val
id
:
Int
,
val
lane_type
:
String
,
val
text
:
Any
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/TrafficPerBean.kt
deleted
100644 → 0
View file @
4faa9691
package
com.sd.cavphmi.bean
/****交通感知事件****/
data class
TrafficPerBean
(
val
accessTime
:
Any
,
val
description
:
Any
,
val
endTime
:
Any
,
val
id
:
String
,
val
imagesUrl
:
Any
,
val
level
:
Int
,
val
location
:
List
<
TLocation
>,
val
mqttTime
:
Any
,
val
name
:
String
,
val
ptcIds
:
List
<
String
>,
val
reportTime
:
Any
,
val
startTime
:
Any
,
val
type
:
String
,
val
videosUrl
:
Any
)
data class
TLocation
(
val
elevation
:
Any
,
val
latitude
:
Double
,
val
longitude
:
Double
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/highmap/CarNavPath.kt
View file @
d381cdf5
package
com.sd.cavphmi.highmap
/**
*全局路径绘制
(蓝色)
*全局路径绘制
*/
data class
CarNavPath
(
val
lines
:
List
<
AllLine
>
)
class
CarNavPath
{
var
lines
:
List
<
AllLine
>?
=
null
var
through
=
"8e959e"
//通过路的颜色颜色HEX RRGGBB
var
notthrough
=
"2868D8"
//未通过路的颜色颜色HEX RRGGBB
var
drawpassed
=
true
//绘制通过路
var
showdistance
=
45
//显示路径的距离,超过这个范围的路径点不绘制
//注意,目前的是否通过是程序根据点的顺序判断距离车最近的点为当前点,后面的未通过,前面的点为已通过
}
class
AllLine
{
// val evel: Int,
constructor
()
constructor
(
lat
:
Double
,
lon
:
Double
){
this
.
lat
=
lat
this
.
lon
=
lon
}
class
AllLine
{
// val evel: Int,
constructor
()
var
lat
:
Double
=
0.0
var
lon
:
Double
=
0.0
}
\ No newline at end of file
constructor
(
lat
:
Double
,
lon
:
Double
)
{
this
.
lat
=
lat
this
.
lon
=
lon
}
var
lat
:
Double
=
0.0
var
lon
:
Double
=
0.0
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/highmap/HighMapApi.kt
View file @
d381cdf5
...
...
@@ -62,10 +62,27 @@ object HighMapApi {
/**
* 车辆行驶全局路径绘制 - 蓝色渐变引导线
* @param lines 全局路径
* @param through = "8e959e" 通过路的颜色颜色HEX RRGGBB
* @param notthrough = "2868D8" 未通过路的颜色颜色HEX RRGGBB
* @param drawpassed = true 绘制通过路
* @param showdistance = 45 显示路径的距离,超过这个范围的路径点不绘制
*/
fun
setCarNavPath
(
lines
:
List
<
AllLine
>)
{
var
carNavPath
=
CarNavPath
(
lines
)
UnityPlayer
.
UnitySendMessage
(
MODELNAME
,
"SetCarNavPath"
,
gson
.
toJson
(
carNavPath
))
fun
setCarNavPath
(
lines
:
List
<
AllLine
>,
notthrough
:
String
=
"2868D8"
,
through
:
String
=
"8e959e"
,
drawpassed
:
Boolean
=
true
,
showdistance
:
Int
=
45
)
{
var
carNavPath
=
CarNavPath
().
apply
{
this
.
lines
=
lines
this
.
notthrough
=
notthrough
this
.
through
=
through
this
.
drawpassed
=
drawpassed
this
.
showdistance
=
showdistance
}
// UnityPlayer.UnitySendMessage(MODELNAME, "SetCarNavPath", gson.toJson(carNavPath))
UnityPlayer
.
UnitySendMessage
(
MODELNAME
,
"SetCarAvpNavPath"
,
gson
.
toJson
(
carNavPath
))
}
/**
...
...
@@ -104,13 +121,12 @@ object HighMapApi {
}
/**
* 选中车位的动效(四周流光效果加一个P的弹跳)
* @param spaceCode 车位编号
* 目前测试ID范围:B001~B075
*/
fun
parkRoundLight
(
spaceCode
:
String
){
fun
parkRoundLight
(
spaceCode
:
String
)
{
var
parkRoundLight
=
ParkRoundLight
().
apply
{
this
.
spaceCode
=
spaceCode
}
...
...
app/src/main/java/com/sd/cavphmi/net/httpmothod/ClientRetrofitMethod.kt
View file @
d381cdf5
...
...
@@ -2,6 +2,7 @@ package com.sd.cavphmi.net.httpmothod
import
com.sd.cavphmi.bean.AvpStatuBean
import
com.sd.cavphmi.bean.BindCarItem
import
com.sd.cavphmi.bean.LoginSuccBean
import
com.sd.cavphmi.bean.ParkLinePlan
import
com.sd.cavphmi.bean.SpaceInfoBean
...
...
@@ -32,9 +33,13 @@ interface ClientRetrofitMethod {
/**车位占用情况***/
@POST
(
"api/avpweb/v1/avp/overview/listSpaceInfoByCondition"
)
suspend
fun
getSpaceInfo
(
@Body
body
:
RequestBody
):
SpaceInfoBean
/**获取已绑定车辆列表***/
@POST
(
"hmi/v1/queryVehicleList "
)
suspend
fun
getBindCar
(
@Body
body
:
RequestBody
):
List
<
BindCarItem
>
/**车位占用情况***/
@POST
(
"api/avpweb/v1/avp/overview/listAvpStatus"
)
/**AVP状态***/
// @POST("api/avpweb/v1/avp/overview/listAvpStatus")
@POST
(
"hmi/monitor/v1/taskStatus"
)
suspend
fun
getAvpStatus
(
@Body
body
:
RequestBody
):
AvpStatuBean
...
...
app/src/main/java/com/sd/cavphmi/repositorys/AvpDataRepo.kt
View file @
d381cdf5
package
com.sd.cavphmi.repositorys
import
com.sd.cavphmi.bean.AvpStatuBean
import
com.sd.cavphmi.bean.BindCarItem
import
com.sd.cavphmi.bean.SpaceInfoBean
import
com.sd.cavphmi.bean.VehDetailBean
import
com.sd.cavphmi.net.MyResult
...
...
@@ -40,6 +41,21 @@ class AvpDataRepo @Inject constructor(private var clientRetrofitMethod: ClientRe
var
bean
=
clientRetrofitMethod
.
getSpaceInfo
(
body
)
return
MyResult
.
Success
(
bean
)
}
catch
(
e
:
HttpException
)
{
// println("e.message = ${e.message}")
return
MyResult
.
Error
(
e
.
code
(),
e
.
message
()
?:
"error"
)
}
catch
(
e
:
Exception
)
{
return
MyResult
.
Error
(
MyContants
.
HTTP_ERROR
,
e
.
message
?:
"error"
)
}
}
/**
* 获取可绑车辆
*/
suspend
fun
getBindCar
():
MyResult
<
List
<
BindCarItem
>>
{
try
{
var
body
=
RequestBodyUtil
.
toRequestBody
(
mapOf
())
var
bean
=
clientRetrofitMethod
.
getBindCar
(
body
)
return
MyResult
.
Success
(
bean
)
}
catch
(
e
:
HttpException
)
{
// println("e.message = ${e.message}")
return
MyResult
.
Error
(
e
.
code
(),
e
.
message
()
?:
"error"
)
}
catch
(
e
:
Exception
)
{
...
...
@@ -63,6 +79,7 @@ class AvpDataRepo @Inject constructor(private var clientRetrofitMethod: ClientRe
}
/**登录***/
suspend
fun
login
(
user
:
String
,
pwd
:
String
,
verifyCode
:
Int
):
MyResult
<
String
>
{
// if (id.isNullOrEmpty()) {
// return MyResult.Error(MyContants.HTTP_ERROR, "error")
...
...
app/src/main/java/com/sd/cavphmi/ui/BootActivity.kt
View file @
d381cdf5
...
...
@@ -34,17 +34,16 @@ class BootActivity : BaseActivity<ActivityBootBinding, MyBaseViewModel>() {
return
BR
.
vm
}
override
fun
initView
()
{
requestPers
()
}
private
fun
starMain
()
{
// requestPers()
// binding.imageView.postDelayed({
var
jump
=
Intent
(
this
,
LoginActivity
::
class
.
java
)
startActivity
(
jump
)
finish
()
// }, 100)
//到登录页面
private
fun
starLogin
()
{
var
jump
=
Intent
(
this
,
LoginActivity
::
class
.
java
)
startActivity
(
jump
)
finish
()
}
...
...
@@ -55,10 +54,10 @@ class BootActivity : BaseActivity<ActivityBootBinding, MyBaseViewModel>() {
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
,
Manifest
.
permission
.
READ_PHONE_STATE
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
){
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
)
{
pers
.
add
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
pers
.
add
(
Manifest
.
permission
.
MANAGE_EXTERNAL_STORAGE
)
}
else
{
}
else
{
pers
.
add
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
}
PermissionX
.
init
(
this
)
...
...
@@ -77,7 +76,7 @@ class BootActivity : BaseActivity<ActivityBootBinding, MyBaseViewModel>() {
.
request
{
allGranted
,
grantedList
,
deniedList
->
if
(
allGranted
)
{
// ToastHelper.showShort(this, "All permissions are granted")
star
Ma
in
()
star
Log
in
()
}
else
{
ToastHelper
.
showShort
(
this
,
"权限被拒"
)
binding
.
root
.
postDelayed
({
...
...
app/src/main/java/com/sd/cavphmi/ui/LoginActivity.kt
View file @
d381cdf5
...
...
@@ -54,6 +54,9 @@ class LoginActivity : AppCompatActivity() {
binding
.
btAvpstatu
.
setOnClickListener
{
mainVm
.
getAvpStatus
()
}
binding
.
btGetbindcar
.
setOnClickListener
{
mainVm
.
getBindCar
()
}
//直接到首页
binding
.
btMain
.
setOnClickListener
{
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
))
...
...
app/src/main/java/com/sd/cavphmi/viewmodels/MainVm.kt
View file @
d381cdf5
...
...
@@ -7,6 +7,7 @@ import androidx.lifecycle.viewModelScope
import
com.google.gson.Gson
import
com.sd.cavphmi.base.MyBaseViewModel
import
com.sd.cavphmi.bean.AvpStatuBean
import
com.sd.cavphmi.bean.BindCarItem
import
com.sd.cavphmi.bean.CarVehicle
import
com.sd.cavphmi.bean.PerceptionBean
import
com.sd.cavphmi.bean.SpaceInfoBean
...
...
@@ -55,13 +56,6 @@ class MainVm @Inject constructor(
//socket 管理
private
var
sockets
=
listOf
(
vecLocWSClient
,
feelTargetWSClient
,
v2xWSClient
)
//感知延时
// private var preDelayWSClient: PreDelayWSClient? = null
//交通感知事件
// private var trafficPreWSClient: TrafficPreWSClient? = null
//交通信号灯
// private var trafficLightWSClient: TrafficLightWSClient? = null
...
...
@@ -92,6 +86,8 @@ class MainVm @Inject constructor(
var
avpStatu
=
MutableLiveData
<
AvpStatuBean
>()
//车位占用情况
var
spaceInfo
=
MutableLiveData
<
SpaceInfoBean
>()
//获取已绑定车辆列表
var
bindCars
=
MutableLiveData
<
List
<
BindCarItem
>>()
//交通感知
// var trafficPerBean = MutableLiveData<TrafficPerBean>()
...
...
@@ -99,11 +95,6 @@ class MainVm @Inject constructor(
//交通信号灯
// var trafficLightBean = MutableLiveData<TrafficLightBean>()
// 订单详情
// private var orderTimer = Timer()
// fun startWS() {
// val httpHeaders = mutableMapOf<String, String>()
// httpHeaders.put("Cookie", "username=nemo")
...
...
@@ -179,6 +170,24 @@ class MainVm @Inject constructor(
return
avpStatu
}
//HTTP获取已绑定车辆列表
fun
getBindCar
()
:
LiveData
<
AvpStatuBean
>{
viewModelScope
.
launch
{
var
result
=
avpDataRepo
.
getBindCar
()
when
(
result
)
{
is
MyResult
.
Success
<
List
<
BindCarItem
>>
->
{
var
str
=
gson
.
toJson
(
result
)
FileIoUtils
.
writeToFile
(
str
,
"bind_car.txt"
)
bindCars
.
postValue
(
result
.
data
)
}
else
->
{
}
}
}
return
avpStatu
}
/**
* 联网车辆位姿数据
...
...
app/src/main/java/com/sd/cavphmi/websockets/PreDelayWSClient.kt
deleted
100644 → 0
View file @
4faa9691
package
com.sd.cavphmi.websockets
import
org.java_websocket.client.WebSocketClient
import
org.java_websocket.drafts.Draft
import
org.java_websocket.handshake.ServerHandshake
import
java.net.URI
import
java.nio.ByteBuffer
/*****感知延时**/
class
PreDelayWSClient
:
WebSocketClient
{
private
val
TAG
=
"-----PreDelayWSClient"
constructor
(
serverUri
:
URI
)
:
super
(
serverUri
)
constructor
(
serverUri
:
URI
?,
protocolDraft
:
Draft
?)
:
super
(
serverUri
,
protocolDraft
)
constructor
(
serverUri
:
URI
?,
httpHeaders
:
MutableMap
<
String
,
String
>?)
:
super
(
serverUri
,
httpHeaders
)
override
fun
onOpen
(
handshakedata
:
ServerHandshake
?)
{
// send("Hello, it is me. Mario :)")
// System.out.println(TAG + "new connection opened")
}
override
fun
onMessage
(
message
:
String
?)
{
// println(TAG + " : " + message)
if
(
message
.
isNullOrEmpty
())
return
onDataCb
?.
onMsg
(
message
)
// onSocketCb?.onMessage(message)
}
override
fun
onMessage
(
bytes
:
ByteBuffer
?)
{
// System.out.println(TAG + " received ByteBuffer")
}
override
fun
onClose
(
code
:
Int
,
reason
:
String
?,
remote
:
Boolean
)
{
// System.out.println(TAG + " closed with exit code " + code + " additional info: " + reason);
}
override
fun
onError
(
ex
:
Exception
?)
{
// System.err.println(TAG + "an error occurred:" + ex)
}
var
onDataCb
:
OnDataCb
?
=
null
interface
OnDataCb
{
fun
onMsg
(
str
:
String
)
}
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/websockets/TrafficLightWSClient.kt
deleted
100644 → 0
View file @
4faa9691
package
com.sd.cavphmi.websockets
import
org.java_websocket.client.WebSocketClient
import
org.java_websocket.drafts.Draft
import
org.java_websocket.handshake.ServerHandshake
import
java.net.URI
import
java.nio.ByteBuffer
/**
*交通信号灯
* **/
class
TrafficLightWSClient
:
WebSocketClient
{
private
val
TAG
=
"-----TrafficLightWSClient"
constructor
(
serverUri
:
URI
)
:
super
(
serverUri
)
constructor
(
serverUri
:
URI
?,
protocolDraft
:
Draft
?)
:
super
(
serverUri
,
protocolDraft
)
constructor
(
serverUri
:
URI
?,
httpHeaders
:
MutableMap
<
String
,
String
>?)
:
super
(
serverUri
,
httpHeaders
)
override
fun
onOpen
(
handshakedata
:
ServerHandshake
?)
{
// send("Hello, it is me. Mario :)")
// System.out.println(TAG + " new connection opened")
}
override
fun
onMessage
(
message
:
String
?)
{
// println(TAG + " : " + message)
if
(
message
.
isNullOrEmpty
())
return
onDataCb
?.
onMsg
(
message
)
// onSocketCb?.onMessage(message)
}
override
fun
onMessage
(
bytes
:
ByteBuffer
?)
{
// System.out.println(TAG + " received ByteBuffer")
}
override
fun
onClose
(
code
:
Int
,
reason
:
String
?,
remote
:
Boolean
)
{
// System.out.println(TAG + " closed with exit code " + code + " additional info: " + reason);
}
override
fun
onError
(
ex
:
Exception
?)
{
// System.err.println(TAG + "an error occurred:" + ex)
}
var
onDataCb
:
OnDataCb
?
=
null
interface
OnDataCb
{
fun
onMsg
(
str
:
String
)
}
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/websockets/TrafficPreWSClient.kt
deleted
100644 → 0
View file @
4faa9691
package
com.sd.cavphmi.websockets
import
org.java_websocket.client.WebSocketClient
import
org.java_websocket.drafts.Draft
import
org.java_websocket.handshake.ServerHandshake
import
java.net.URI
import
java.nio.ByteBuffer
/**
*交通(感知)事件
* **/
class
TrafficPreWSClient
:
WebSocketClient
{
private
val
TAG
=
"-----TrafficPreWSClient"
constructor
(
serverUri
:
URI
)
:
super
(
serverUri
)
constructor
(
serverUri
:
URI
?,
protocolDraft
:
Draft
?)
:
super
(
serverUri
,
protocolDraft
)
constructor
(
serverUri
:
URI
?,
httpHeaders
:
MutableMap
<
String
,
String
>?)
:
super
(
serverUri
,
httpHeaders
)
override
fun
onOpen
(
handshakedata
:
ServerHandshake
?)
{
// send("Hello, it is me. Mario :)")
// System.out.println(TAG + " new connection opened")
}
override
fun
onMessage
(
message
:
String
?)
{
// println(TAG + " : " + message)
if
(
message
.
isNullOrEmpty
())
return
onDataCb
?.
onMsg
(
message
)
// onSocketCb?.onMessage(message)
}
override
fun
onMessage
(
bytes
:
ByteBuffer
?)
{
// System.out.println(TAG + " received ByteBuffer")
}
override
fun
onClose
(
code
:
Int
,
reason
:
String
?,
remote
:
Boolean
)
{
// System.out.println(TAG + " closed with exit code " + code + " additional info: " + reason);
}
override
fun
onError
(
ex
:
Exception
?)
{
// System.err.println(TAG + "an error occurred:" + ex)
}
var
onDataCb
:
OnDataCb
?
=
null
interface
OnDataCb
{
fun
onMsg
(
str
:
String
)
}
}
\ No newline at end of file
app/src/main/res/layout/activity_login.xml
View file @
d381cdf5
...
...
@@ -133,7 +133,13 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"获取AVP状态信息"
android:visibility=
"visible"
/>
/>
<Button
android:id=
"@+id/bt_getbindcar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"获取可绑车辆列表"
/>
<Button
android:id=
"@+id/bt_main"
...
...
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