-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMultiMagic.h
91 lines (58 loc) · 2.21 KB
/
MultiMagic.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@import MultipeerConnectivity;
#import "MMData.h"
#import "MMResource.h"
#import "MMState.h"
#import "MMStream.h"
@interface MultiMagic : NSObject <MCSessionDelegate>
/**
Shared manager instance. You can connect to up to 8 peers at a time per session
*/
+ (instancetype)manager;
/**
Your device identifier that will be visible to others
*/
@property (nonatomic, readonly) MCPeerID *peerID;
/**
The current session if there is one
*/
@property (nonatomic, readonly) MCSession *session;
/**
The browser that controls connecting to other peers
*/
@property (nonatomic, readonly) MCBrowserViewController *browser;
/**
The advertiser for handling your visibility to other peers
*/
@property (nonatomic, readonly) MCAdvertiserAssistant *advertiser;
/**
Start a multipeer session
@param displayName your personal identifier that will appear to others
@param visible determines your visibility to other potential peers
*/
-(void)startSessionWithName:(NSString *)displayName visible:(BOOL)visible;
/**
Set to deterimine visibility to other peers
@param shouldAdvertise is NO if the device should be invisible
*/
-(void)advertiseSelf:(BOOL)shouldAdvertise;
/**
This will get called when peers are connected or disconnected
*/
@property (nonatomic, copy) void (^onSessionDidChangeState)(MMState *sessionState);
/**
This will get called whenever data is received from another peer. You receive an MMData instance which holds the message.
*/
@property (nonatomic, copy) void (^onSessionDidReceiveData)(MMData *data);
/**
This will get called when a nearby peer opens a stream to your device. The MMStream object you receive contains an NSInputStream.
*/
@property (nonatomic, copy) void (^onSessionDidReceiveStream)(MMStream *stream);
/**
Indicates that you have begun receiving a resource from another peer. This instance of MMResource holds an NSProgress object.
*/
@property (nonatomic, copy) void (^onSessionDidStartReceivingResource)(MMResource *resource);
/**
Indicates that the stream you have been receiving just finished. It contains an NSURL object pointing to the brand new local file stored on your device.
*/
@property (nonatomic, copy) void (^onSessionDidFinishReceivingResource)(MMResource *resource);
@end