Files
featherVoice/QXLive/Config/QXManagerMqtt.h

62 lines
1.3 KiB
C
Raw Normal View History

2025-08-08 10:49:36 +08:00
//
// 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