LargeScreen/main_perspectiveinfo.gd

31 lines
852 B
GDScript3
Raw Normal View History

2025-01-02 02:25:42 +08:00
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:
2025-01-03 14:02:17 +08:00
"/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)
2025-01-02 02:25:42 +08:00
pass
2025-01-03 14:02:17 +08:00
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))