hank
2018-08-30 f610fb2d23edd059b6bb5d0685b41fd72e9d868f
commit | author | age
2370e0 1 //
H 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