-
Notifications
You must be signed in to change notification settings - Fork 0
/
NetworkManager.h
48 lines (32 loc) · 1.11 KB
/
NetworkManager.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
//
// NetworkManager.h
// NekoLogic
//
// Created by Cory on 10/08/22.
// Copyright 2010 Cory R. Leach. All rights reserved.
//
//
#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>
#import "Network.h"
//Note: Byte Order is Assumed to be the same between devices!
@interface NetworkManager : NSObject {
GKSession* session;
NSMutableDictionary* handlers;
NSMutableDictionary* registeredObjects;
NSUInteger sendUpdateCounter;
NSUInteger recieveUpdateCounter;
}
@property (nonatomic,retain) GKSession* session;
@property (nonatomic,readonly) GKSessionMode sessionMode;
@property (nonatomic,readonly) BOOL isServer;
@property (nonatomic,readonly) BOOL isClient;
@property (nonatomic,readonly) BOOL isPeer;
@property (nonatomic,readonly) BOOL isConnected;
+ (NetworkManager*) sharedInstance;
- (void) registerMessageHandler:(id<NetworkHandler>)hander withId:(NetworkHandlerID)handlerId;
- (id) handlerWithId:(NetworkHandlerID)handlerId;
- (NSString*) myID;
- (NSArray*) peers;
- (void) receiveData:(NSData *)data fromPeer:(NSString *)peer inSession:(GKSession *)aSession context:(void *)context;
@end