Skip to content

Commit

Permalink
remove the editor plugin file and handle the error on connect case
Browse files Browse the repository at this point in the history
  • Loading branch information
goatchurchprime committed Nov 8, 2024
1 parent 4dd8ef0 commit 39fdc7a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions addons/mqtt/mqtt.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 0 additions & 7 deletions addons/mqtt/plugin.cfg

This file was deleted.

6 changes: 3 additions & 3 deletions mqttexample.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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))


6 changes: 2 additions & 4 deletions mqttexample.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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://"
Expand Down Expand Up @@ -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 = "<none>"
popup/item_0/id = 0

[node name="unsubscribe" type="Button" parent="VBox/HBoxSubscriptions"]
layout_mode = 2
Expand Down
6 changes: 1 addition & 5 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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")

0 comments on commit 39fdc7a

Please sign in to comment.