LargeScreen/main_perspectiveinfo.gd
shurongsen b8d780b2a2 3d
接口添加
2025-01-03 14:02:17 +08:00

31 lines
852 B
GDScript

extends Panel
func _ready() -> void:
Websocket.connected_to_server.connect(connected_to_server)
Websocket.message_received.connect(message_received)
func connected_to_server():
pass
func message_received(data:Dictionary):
if data.is_empty():return
if !data.has("topic"):return
match data.topic:
"/hmi_input/app/cloud_control_platform/vehicle_info":
if (data.msg.seatbelt == 0):
%SeatBeltTexture.texture = preload("res://res/icon/icon_safebelt_yes.png")
pass
else:
%SeatBeltTexture.texture = preload("res://res/icon/icon_safebelt_no.png")
pass
%Speed.text = str(data.msg.spd)
pass
func vehicle_info():#所有车辆信息
var send_data = {
"op": "subscribe",
"topic": "/hmi_input/app/cloud_control_platform/vehicle_info",
"type": "pixmoving_hmi_msgs/msg/VehicleInfo"
}
Websocket.send_msg(str(send_data))