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