62 lines
1.3 KiB
Objective-C
Executable File
62 lines
1.3 KiB
Objective-C
Executable File
//
|
|
// ManagerMqtt.h
|
|
// SoundRiver
|
|
//
|
|
// Created by apple on 2020/3/19.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "MQTTClient.h"
|
|
#import "MQTTSessionManager.h"
|
|
#import <CommonCrypto/CommonHMAC.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
@protocol MQTTClientModelDelegate <NSObject>
|
|
@optional
|
|
- (void)MQTTClientModel_handleMessage:(NSData *)data onTopic:(NSString *)topic retained:(BOOL)retained;
|
|
- (void)socketManager:(NSString *)socketManager receivedMessage:(NSDictionary *)message topic:(NSString *)topic;
|
|
|
|
@end
|
|
|
|
|
|
@interface QXManagerMqtt : NSObject
|
|
@property (nonatomic, assign) BOOL isDiscontent;
|
|
@property (nonatomic, weak) id <MQTTClientModelDelegate> delegate;
|
|
|
|
@property (nonatomic,strong,nullable) MQTTSessionManager *mySessionManager;
|
|
|
|
+ (instancetype)sharedInstance;
|
|
|
|
|
|
- (void)bindWithUserName:(NSString *)username password:(NSString *)password cliendId:(NSString *)cliendId isSSL:(BOOL)isSSL;
|
|
|
|
- (void)disconnect;
|
|
|
|
- (void)reConnect;
|
|
|
|
/**
|
|
订阅主题
|
|
|
|
@param topic 主题
|
|
*/
|
|
typedef void (^SubscribeTopicHandler)(NSString *topic, BOOL success);
|
|
|
|
- (void)subscribeTopic:(NSString *)topic;
|
|
|
|
/**
|
|
取消订阅
|
|
|
|
@param topic 主题
|
|
*/
|
|
- (void)unsubscribeTopic:(NSString *)topic;
|
|
|
|
/**
|
|
发布消息
|
|
*/
|
|
- (void)sendDataToTopic:(NSString *)topic dict:(NSDictionary *)dict;
|
|
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|