Class: AwsIotDevice::MqttShadowClient::ShadowClient
- Inherits:
-
Object
- Object
- AwsIotDevice::MqttShadowClient::ShadowClient
- Defined in:
- lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb
Instance Attribute Summary collapse
-
#action_manager ⇒ Object
Returns the value of attribute action_manager.
Instance Method Summary collapse
- #configure_credentials(ca_file, key, cert) ⇒ Object
- #configure_endpoint(host, port) ⇒ Object
- #connect ⇒ Object
- #create_shadow_handler_with_name(shadow_name, is_persistent_subscribe = false) ⇒ Object
- #delete_shadow(callback = nil, timeout = 5) ⇒ Object
- #disconnect ⇒ Object
- #get_shadow(callback = nil, timeout = 5) ⇒ Object
-
#initialize ⇒ ShadowClient
constructor
A new instance of ShadowClient.
- #register_delta_callback(callback) ⇒ Object
- #remove_shadow_delta_callback ⇒ Object
- #topic_manager ⇒ Object
- #update_shadow(payload, callback = nil, timeout = 5) ⇒ Object
Constructor Details
#initialize ⇒ ShadowClient
Returns a new instance of ShadowClient.
10 11 12 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 10 def initialize @mqtt_client = MqttManager.new end |
Instance Attribute Details
#action_manager ⇒ Object
Returns the value of attribute action_manager.
8 9 10 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 8 def action_manager @action_manager end |
Instance Method Details
#configure_credentials(ca_file, key, cert) ⇒ Object
55 56 57 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 55 def configure_credentials(ca_file, key, cert) @mqtt_client.config_ssl_context(ca_file, key, cert) end |
#configure_endpoint(host, port) ⇒ Object
51 52 53 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 51 def configure_endpoint(host,port) @mqtt_client.config_endpoint(host,port) end |
#connect ⇒ Object
14 15 16 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 14 def connect @mqtt_client.connect end |
#create_shadow_handler_with_name(shadow_name, is_persistent_subscribe = false) ⇒ Object
22 23 24 25 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 22 def create_shadow_handler_with_name(shadow_name, is_persistent_subscribe=false) topic_manager @action_manager = ShadowActionManager.new(shadow_name, @topic_manager, is_persistent_subscribe) end |
#delete_shadow(callback = nil, timeout = 5) ⇒ Object
35 36 37 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 35 def delete_shadow(callback=nil, timeout=5) @action_manager.shadow_delete(callback, timeout) end |
#disconnect ⇒ Object
47 48 49 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 47 def disconnect @mqtt_client.disconnect end |
#get_shadow(callback = nil, timeout = 5) ⇒ Object
27 28 29 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 27 def get_shadow(callback=nil, timeout=5) @action_manager.shadow_get(callback, timeout) end |
#register_delta_callback(callback) ⇒ Object
39 40 41 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 39 def register_delta_callback(callback) @action_manager.register_shadow_delta_callback(callback) end |
#remove_shadow_delta_callback ⇒ Object
43 44 45 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 43 def remove_shadow_delta_callback @action_manager.remove_shadow_delta_callback end |
#topic_manager ⇒ Object
18 19 20 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 18 def topic_manager @topic_manager = ShadowTopicManager.new(@mqtt_client) end |
#update_shadow(payload, callback = nil, timeout = 5) ⇒ Object
31 32 33 |
# File 'lib/aws_iot_device/mqtt_shadow_client/shadow_client.rb', line 31 def update_shadow(payload, callback=nil, timeout=5) @action_manager.shadow_update(payload, callback, timeout) end |