-
Notifications
You must be signed in to change notification settings - Fork 3
/
BKSession.h
63 lines (56 loc) · 1.65 KB
/
BKSession.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
57
58
59
60
61
62
63
//
// BKSession.h
// BonjourKit
//
// Created by Takayoshi Sato on 2009/07/27.
// Copyright 2009 Takayoshi Sato. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BKServer.h"
#import "BKAlertView.h"
typedef enum {
BKSessionModeServer,
BKSessionModeClient,
BKSessionModePeer,
} BKSessionMode;
@class BKSession;
@protocol BKSessionDelegate
- (void)sessionDidEnabled:(BKSession *)session;
- (void)session:(BKSession *)session didReceiveData:(NSData *)aData;
- (void)sessionDidCanceled:(BKSession *)session;
- (void)sessionDidOpenStream:(BKSession *)session;
@end
@interface BKSession : NSObject <BKServerDelegate, BKBrowserViewControllerDelegate, UIAlertViewDelegate> {
BKSessionMode mode;
NSString* sessionID;
BKServer* server;
BOOL available;
BOOL enabled;
NSThread* serverThread;
NSThread* inStreamThread;
NSThread* outStreamThread;
NSThread* receiveThread;
NSRunLoop* inStreamRunLoop;
NSRunLoop* outStreamRunLoop;
BKAlertView* alert;
NSInputStream* inStream;
NSOutputStream* outStream;
BOOL inReady;
BOOL outReady;
NSString* name;
id<BKSessionDelegate> delegate;
NSMutableData* receiveBuffer;
}
@property(readonly) NSString *sessionID;
@property(readonly) BKSessionMode mode;
@property(getter=isEnabled) BOOL enabled;
@property(getter=isAvailable) BOOL available;
@property(retain, nonatomic) id<BKSessionDelegate> delegate;
- (id)initWithSessionID:(NSString *)aSessionID displayName:(NSString *)aName sessionMode:(BKSessionMode)aMode;
- (void)startServerThread;
- (void)openStreams;
- (void)showPicker;
- (void)destroyPicker;
- (void)showAlertWithMessage:(NSString *)message retryButton:(BOOL)aBool;
- (void)sendData:(NSData *)aData;
@end