-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBitFrameDecoder.h
40 lines (32 loc) · 1.31 KB
/
BitFrameDecoder.h
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
38
39
40
// -*- Mode: ObjC -*-
//
// Copyright (C) 2011, Brad Howes. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BitStreamFrameDetectorObserver.h"
#import "BitFrameDecoderObserver.h"
/** The BitFrameDecoder accepts a string of bit values ("1" and "0") from a BitStreamFrameDetector and decodes the
payload values, emitting them to a registered observer via the BitFrameDecoderObserver protocol.
*/
@interface BitFrameDecoder : NSObject <BitStreamFrameDetectorObserver> {
@private
NSInteger buttonState;
NSInteger frequency;
NSObject<BitFrameDecoderObserver>* observer;
}
@property (nonatomic, assign, readonly) NSInteger buttonState;
@property (nonatomic, assign, readonly) NSInteger frequency;
@property (nonatomic, retain) NSObject<BitFrameDecoderObserver>* observer;
/** Tranlate a string containing 10 '0' and '1' characters into an equivalent integer value, treating the first and last
bits as start and stop bits (ignoring them). The ordering of the bits is LSB->MSB.
\param bits a string of length 10 containgin '0' and '1' characters
\result integer value in the range [-128 - 127).
*/
+ (NSInteger)integerFromBits:(NSString*)bits;
/** Factory method to create an initialize a new BitFrameDecoder object.
*/
+ (id)create;
/** Initialize a new BitFrameDecoder object.
*/
- (id)init;
@end