lipengwei
2020-04-09 5034eefb65f57edb5ddb554a644a33de14b5c7fc
commit | author | age
ea8e18 1 //
L 2 // MQTTCFSocketDecoder.h
3 // MQTTClient.framework
4 // 
5 // Copyright © 2013-2016, Christoph Krey
6 //
7
8 #import <Foundation/Foundation.h>
9
10 typedef NS_ENUM(NSInteger, MQTTCFSocketDecoderState) {
11     MQTTCFSocketDecoderStateInitializing,
12     MQTTCFSocketDecoderStateReady,
13     MQTTCFSocketDecoderStateError
14 };
15
16 @class MQTTCFSocketDecoder;
17
18 @protocol MQTTCFSocketDecoderDelegate <NSObject>
19 - (void)decoder:(MQTTCFSocketDecoder *)sender didReceiveMessage:(NSData *)data;
20 - (void)decoderDidOpen:(MQTTCFSocketDecoder *)sender;
21 - (void)decoder:(MQTTCFSocketDecoder *)sender didFailWithError:(NSError *)error;
22 - (void)decoderdidClose:(MQTTCFSocketDecoder *)sender;
23
24 @end
25
26 @interface MQTTCFSocketDecoder : NSObject <NSStreamDelegate>
27 @property (nonatomic) MQTTCFSocketDecoderState state;
28 @property (strong, nonatomic) NSError *error;
29 @property (strong, nonatomic) NSInputStream *stream;
30 @property (strong, nonatomic) NSRunLoop *runLoop;
31 @property (strong, nonatomic) NSString *runLoopMode;
32 @property (weak, nonatomic ) id<MQTTCFSocketDecoderDelegate> delegate;
33
34 - (void)open;
35 - (void)close;
36
37 @end
38
39