diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml index 52d1201..53167a7 100644 --- a/.github/workflows/build-on-push.yml +++ b/.github/workflows/build-on-push.yml @@ -21,7 +21,7 @@ jobs: path: demo/godot-mqtt - - name: Create Godot Hand Pose Detector + - name: Create Godot MQTT run: | mkdir plugin mkdir plugin/godot-mqtt @@ -38,7 +38,7 @@ jobs: path: plugin - - name: Create Godot Hand Pose Detector demo artifact + - name: Create Godot MQTT demo artifact uses: actions/upload-artifact@v4 with: name: godot-mqtt_demo diff --git a/addons/mqtt/mqtt.gd b/addons/mqtt/mqtt.gd index b032444..1c01bb4 100644 --- a/addons/mqtt/mqtt.gd +++ b/addons/mqtt/mqtt.gd @@ -264,7 +264,7 @@ func connect_to_broker(brokerurl): assert (brokerconnectmode == BCM_NOCONNECTION) var brokermatch = regexbrokerurl.search(brokerurl) if brokermatch == null: - print("ERROR: unrecognized brokerurl pattern: ", brokerurl, " must be tcp,ssh,ws, or wss://") + printerr("ERROR: unrecognized brokerurl pattern: ", brokerurl, " must be tcp,ssh,ws, or wss://") return cleanupsockets(false) var brokercomponents = brokermatch.strings var brokerprotocol = brokercomponents[1] @@ -285,7 +285,7 @@ func connect_to_broker(brokerurl): print("Connecting to websocketurl: ", websocketurl) var E = websocket.connect_to_url(websocketurl) if E != 0: - print("ERROR: websocketclient.connect_to_url Err: ", E) + printerr("ERROR: websocketclient.connect_to_url Err: ", E) return cleanupsockets(false) print("Websocket get_requested_url ", websocket.get_requested_url()) brokerconnectmode = BCM_WAITING_WEBSOCKET_CONNECTION @@ -296,7 +296,7 @@ func connect_to_broker(brokerurl): print("Connecting to %s:%s" % [brokerserver, brokerport]) var E = socket.connect_to_host(brokerserver, brokerport) if E != 0: - print("ERROR: socketclient.connect_to_url Err: ", E) + printerr("ERROR: socketclient.connect_to_url Err: ", E) return cleanupsockets(false) if isssl: brokerconnectmode = BCM_WAITING_SSL_SOCKET_CONNECTION diff --git a/addons/mqtt/plugin.cfg b/addons/mqtt/plugin.cfg deleted file mode 100644 index 180e833..0000000 --- a/addons/mqtt/plugin.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[plugin] - -name="MQTT" -description="MQTT client in GDScript" -author="Julian Todd" -version="1.0" -script="mqtt.gd" diff --git a/mqttexample.gd b/mqttexample.gd index 010af35..c7cd3ae 100644 --- a/mqttexample.gd +++ b/mqttexample.gd @@ -30,7 +30,9 @@ func _on_button_connect_toggled(button_pressed): $VBox/HBoxBrokerControl/status.text = "connecting..." var brokerurl = $VBox/HBoxBroker/brokeraddress.text var protocol = $VBox/HBoxBroker/brokerprotocol.get_item_text($VBox/HBoxBroker/brokerprotocol.selected) - $MQTT.connect_to_broker("%s%s:%s" % [protocol, brokerurl, $VBox/HBoxBroker/brokerport.text]) + var retval = $MQTT.connect_to_broker("%s%s:%s" % [protocol, brokerurl, $VBox/HBoxBroker/brokerport.text]) + if not retval: + $VBox/HBoxBrokerControl/status.text = "error." else: #$VBox/HBoxBrokerControl/status.text = "disconnecting..." @@ -110,5 +112,3 @@ func _on_unsubscribe_pressed(): $VBox/HBoxSubscriptions/unsubscribe.disabled = (seloptbutt.item_count == 0) if seloptbutt.item_count != 0: seloptbutt.select(min(sel, seloptbutt.item_count - 1)) - - diff --git a/mqttexample.tscn b/mqttexample.tscn index c867530..ebebc9c 100644 --- a/mqttexample.tscn +++ b/mqttexample.tscn @@ -111,10 +111,9 @@ text = "Protocol: " [node name="brokerprotocol" type="OptionButton" parent="VBox/HBoxBroker"] layout_mode = 2 -item_count = 4 selected = 0 +item_count = 4 popup/item_0/text = "tcp://" -popup/item_0/id = 0 popup/item_1/text = "ssl://" popup/item_1/id = 1 popup/item_2/text = "ws://" @@ -192,10 +191,9 @@ layout_mode = 2 size_flags_horizontal = 10 tooltip_text = "Subscribed topics " -item_count = 1 selected = 0 +item_count = 1 popup/item_0/text = "" -popup/item_0/id = 0 [node name="unsubscribe" type="Button" parent="VBox/HBoxSubscriptions"] layout_mode = 2 diff --git a/project.godot b/project.godot index 0ea48c8..09ffbf9 100644 --- a/project.godot +++ b/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="Godot-mqtt" run/main_scene="res://mqttexample.tscn" -config/features=PackedStringArray("4.2", "Forward Plus") +config/features=PackedStringArray("4.3", "Forward Plus") config/icon="res://icon.png" [audio] @@ -23,7 +23,3 @@ buses/default_bus_layout="" window/size/viewport_width=900 window/size/viewport_height=520 - -[editor_plugins] - -enabled=PackedStringArray("res://addons/mqtt/plugin.cfg")