-
Notifications
You must be signed in to change notification settings - Fork 0
/
BumpClient.h
56 lines (41 loc) · 1.76 KB
/
BumpClient.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// BumpClient.h
//
// Created by Thomas Greany on 10/21/11.
// Copyright 2011 Bump Technologies, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef unsigned long long BumpChannelID;
typedef enum {
BUMP_EVENT_BUMP = 0,
BUMP_EVENT_NO_MATCH = 1,
} bump_event;
typedef void (^BumpEventBlock)(bump_event event);
typedef void (^BumpMatchBlock)(BumpChannelID channelID);
typedef void (^BumpChannelConfirmedBlock)(BumpChannelID channelID);
typedef void (^BumpConnectionStateChangedBlock)(BOOL connectedToBumpServer);
typedef void (^BumpDataReceivedBlock)(BumpChannelID channel, NSData *data);
@interface BumpClient : NSObject {}
+ (BumpClient *) sharedClient;
- (void) connect; // the first call to sharedClient calls this already
- (void) disconnect;
// required configuration
+ (void) configureWithAPIKey : (NSString *) key andUserID : (NSString *) userName;
- (void) setMatchBlock : (BumpMatchBlock) matchBlock;
- (void) setChannelConfirmedBlock : (BumpChannelConfirmedBlock) confirmedBlock;
// channel methods
- (void) confirmMatch : (BOOL) confirmed onChannel : (BumpChannelID) channel;
- (void) sendData : (NSData *) data toChannel : (BumpChannelID) channel;
- (NSString *) userIDForChannel : (BumpChannelID) channelID;
// optional blocks
- (void) setConnectionStateChangedBlock : (BumpConnectionStateChangedBlock) connectionBlock;
- (void) setBumpEventBlock : (BumpEventBlock) bumpEventBlock;
- (void) setDataReceivedBlock : (BumpDataReceivedBlock) dataReceivedBlock;
// turn bumping on/off; defaults to YES.
@property (nonatomic) BOOL bumpable;
// specify dispatch queue that callback blocks should placed on.
// if unset, the main queue is used.
- (void) setCallbackQueue : (dispatch_queue_t) callbackQueue;
// bump simulation
- (void) simulateBump;
@end