Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MQTT protocol, fully integrated now.
- Loading branch information
Showing
4 changed files
with
24 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
module ActionIntegration | ||
# Handles the MQTT communication protocol | ||
module MQTT | ||
def connect(*args, **kwargs) | ||
@mqtt_client = MQTT::Client.connect(*args, **kwargs) | ||
end | ||
module Protocols | ||
# Handles the MQTT communication protocol | ||
module MQTT | ||
def connect(*args, **kwargs, &block) | ||
@mqtt_client = ::MQTT::Client.connect(*args, **kwargs, &block) | ||
end | ||
|
||
def publish(topic, payload, retain = false) | ||
@mqtt_client.publish(topic, payload, retain) | ||
end | ||
def publish(topic, payload, retain = false) | ||
@mqtt_client.publish(topic, payload, retain) | ||
end | ||
|
||
def subscribe(*topics) | ||
@mqtt_client.subscribe(*topics) | ||
end | ||
def subscribe(*topics) | ||
@mqtt_client.subscribe(*topics) | ||
end | ||
|
||
def get(topic = nil, &block) | ||
@mqtt_client.get(topic, &block) | ||
def get(topic = nil, &block) | ||
@mqtt_client.get(topic, &block) | ||
end | ||
end | ||
end | ||
end |