Tuya iOS Smart Life App SDK 5.15.0
ThingSmartMQTTChannel Class Reference

#import <ThingSmartMQTTChannel.h>

Inheritance diagram for ThingSmartMQTTChannel:

Instance Methods

(void) - startConnectToHostWithMqttConfig:
 
(void) - close
 
(ThingSmartMqttConnectState) - connectState
 
(void) - subscribeToTopic:devInfo:success:failure:
 
(void) - unsubscribeToTopic:success:failure:
 
(UInt16) - publishMessage:topic:success:failure:
 
(void) - publishMessageWithMessageModel:topic:success:failure:
 
(void) - addDelegate:
 
(void) - removeDelegate:
 
(BOOL) - hasSubscribedTopic:
 
(void) - startConnectToHostWithMqttConfig:
 
(void) - close
 
(ThingSmartMqttConnectState) - connectState
 
(void) - subscribeToTopic:devInfo:success:failure:
 
(void) - unsubscribeToTopic:success:failure:
 
(UInt16) - publishMessage:topic:success:failure:
 
(void) - publishMessageWithMessageModel:topic:success:failure:
 
(void) - addDelegate:
 
(void) - removeDelegate:
 
(BOOL) - hasSubscribedTopic:
 

Class Methods

(instancetype) + sharedInstance
 
(instancetype) + sharedInstance
 

Properties

BOOL quicEnabled
 
id< ThingSmartMQTTSubscribeCorrectProtocoldeviceCorrector
 
BOOL backgroundEnabled
 

Detailed Description

Definition at line 101 of file ThingSmartMQTTChannel.h.

Method Documentation

◆ addDelegate: [1/2]

- (void) addDelegate: (id< ThingSmartMQTTChannelDelegate >)  delegate

Adds an MQTT channel delegate.

Parameters
delegateDelegate

◆ addDelegate: [2/2]

- (void) addDelegate: (id< ThingSmartMQTTChannelDelegate >)  delegate

Adds an MQTT channel delegate.

Parameters
delegateDelegate

◆ close [1/2]

- (void) close

Disconnects from the MQTT host.

◆ close [2/2]

- (void) close

Disconnects from the MQTT host.

◆ connectState [1/2]

- (ThingSmartMqttConnectState) connectState

The MQTT connection state.

◆ connectState [2/2]

- (ThingSmartMqttConnectState) connectState

The MQTT connection state.

◆ hasSubscribedTopic: [1/2]

- (BOOL) hasSubscribedTopic: (NSString *)  topic

Whether MQTT channel has subscribed to a topic.

Parameters
topictopic

◆ hasSubscribedTopic: [2/2]

- (BOOL) hasSubscribedTopic: (NSString *)  topic

Whether MQTT channel has subscribed to a topic.

Parameters
topictopic

◆ publishMessage:topic:success:failure: [1/2]

- (UInt16) publishMessage: (NSData *)  data
topic: (NSString *)  topic
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Publishes the MQTT data.

Parameters
dataThe data.
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.
Returns
The message identifier of the published message. A value of zero is returned at the QoS level 0. A message identifier is returned at the QoS level 1 or 2.

◆ publishMessage:topic:success:failure: [2/2]

- (UInt16) publishMessage: (NSData *)  data
topic: (NSString *)  topic
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Publishes the MQTT data.

Parameters
dataThe data.
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.
Returns
The message identifier of the published message. A value of zero is returned at the QoS level 0. A message identifier is returned at the QoS level 1 or 2.

◆ publishMessageWithMessageModel:topic:success:failure: [1/2]

- (void) publishMessageWithMessageModel: (ThingSmartPublishMessageModel *)  messageModel
topic: (NSString *)  topic
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Publishes MQTT data.

Parameters
messageModelThe message model.
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.

◆ publishMessageWithMessageModel:topic:success:failure: [2/2]

- (void) publishMessageWithMessageModel: (ThingSmartPublishMessageModel *)  messageModel
topic: (NSString *)  topic
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Publishes MQTT data.

Parameters
messageModelThe message model.
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.

◆ removeDelegate: [1/2]

- (void) removeDelegate: (id< ThingSmartMQTTChannelDelegate >)  delegate

Removes an MQTT channel delegate.

Parameters
delegateThe delegate.

◆ removeDelegate: [2/2]

- (void) removeDelegate: (id< ThingSmartMQTTChannelDelegate >)  delegate

Removes an MQTT channel delegate.

Parameters
delegateThe delegate.

◆ sharedInstance [1/2]

+ (instancetype) sharedInstance

◆ sharedInstance [2/2]

+ (instancetype) sharedInstance

◆ startConnectToHostWithMqttConfig: [1/2]

- (void) startConnectToHostWithMqttConfig: (ThingSmartMQTTConfigModel *)  mqttConfig

Connects to the MQTT host.

Parameters
mqttConfigThe configuration of the MQTT connection.

◆ startConnectToHostWithMqttConfig: [2/2]

- (void) startConnectToHostWithMqttConfig: (ThingSmartMQTTConfigModel *)  mqttConfig

Connects to the MQTT host.

Parameters
mqttConfigThe configuration of the MQTT connection.

◆ subscribeToTopic:devInfo:success:failure: [1/2]

- (void) subscribeToTopic: (NSString *)  topic
devInfo: (nullable NSDictionary *)  devInfo
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Subscribes to a topic.

Parameters
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.

◆ subscribeToTopic:devInfo:success:failure: [2/2]

- (void) subscribeToTopic: (NSString *)  topic
devInfo: (nullable NSDictionary *)  devInfo
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Subscribes to a topic.

Parameters
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.

◆ unsubscribeToTopic:success:failure: [1/2]

- (void) unsubscribeToTopic: (NSString *)  topic
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Unsubscribes from a topic.

Parameters
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.

◆ unsubscribeToTopic:success:failure: [2/2]

- (void) unsubscribeToTopic: (NSString *)  topic
success: (nullable ThingSuccessHandler success
failure: (nullable ThingFailureError failure 

Unsubscribes from a topic.

Parameters
topicThe topic.
successCalled when the task is finished.
failureCalled when the task is interrupted by an error.

Property Documentation

◆ backgroundEnabled

- (BOOL) backgroundEnabled
readwritenonatomicassign

Special reconnect enable while App’s state is Background Active. Default is NO.

Definition at line 109 of file ThingSmartMQTTChannel.h.

◆ deviceCorrector

- (id< ThingSmartMQTTSubscribeCorrectProtocol >) deviceCorrector
readwritenonatomicstrong

Definition at line 105 of file ThingSmartMQTTChannel.h.

◆ quicEnabled

- (BOOL) quicEnabled
readwritenonatomicassign

Definition at line 103 of file ThingSmartMQTTChannel.h.


The documentation for this class was generated from the following files: