lipengwei
2020-05-06 d8c7af0ebe241beb9270ba597a8d2dd9ca3275e9
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