- Main Page
- Related Pages
- Classes
- Files

- File List

# /Users/cem/Works/INFSmartFoxiPhoneLibrary/INFSmartFoxiPhoneLibrary/Classes/INFSmartFoxiPhoneClient.h

    00001 //
    00002 //  INFSmartFoxiPhoneClient.h
    00003 //  OkeyiPhoneClient
    00004 //
    00005 //  Created by Cem Uzunlar | infosfer.com on 11/21/08.
    00006 //  Copyright 2008 Infosfer Game and Visualizaiton Technologies Ltd.. All rights reserved.
    00007 //
    00008 #import <Foundation/Foundation.h>
    00009 #import <sys/socket.h>
    00010 #import <netinet/in.h>
    00011 #import <CFNetwork/CFNetwork.h>
    00012 #import <mach/mach_time.h>
    00013
    00014 #import "NSStreamAddition.h"
    00015 #import "NSObjectAddition.h"
    00016 #import "INFSendBuffer.h"
    00017 #import "INFSmartFoxISFSEvents.h"
    00018
    00019 @class INFSmartFoxSysHandler, INFSmartFoxExtHandler, INFSmartFoxRoom, INFSmartFoxBuddy, INFSmartFoxRoomCreateParams;
    00020
    00021 extern NSInteger INFSMARTFOXCLIENT_EOM;
    00022 extern NSString *INFSMARTFOXCLIENT_MSG_XML;
    00023 extern NSString *INFSMARTFOXCLIENT_MSG_JSON;
    00024
    00033 extern NSString *INFSMARTFOXCLIENT_MODMSG_TO_USER;
    00034
    00043 extern NSString *INFSMARTFOXCLIENT_MODMSG_TO_ROOM;
    00044
    00053 extern NSString *INFSMARTFOXCLIENT_MODMSG_TO_ZONE;
    00054
    00063 extern NSString *INFSMARTFOXCLIENT_XTMSG_TYPE_XML;
    00064
    00073 extern NSString *INFSMARTFOXCLIENT_XTMSG_TYPE_STR;
    00074
    00083 extern NSString *INFSMARTFOXCLIENT_XTMSG_TYPE_JSON;
    00084
    00095 extern NSString *INFSMARTFOXCLIENT_CONNECTION_MODE_DISCONNECTED;
    00096
    00107 extern NSString *INFSMARTFOXCLIENT_CONNECTION_MODE_SOCKET;
    00108
    00119 extern NSString *INFSMARTFOXCLIENT_CONNECTION_MODE_HTTP;
    00120
    00130 @interface INFSmartFoxiPhoneClient : NSObject {
    00131 @private
    00132         NSInputStream *_inStream;
    00133         NSOutputStream *_outStream;
    00134
    00135         NSLock *_receiveLock;
    00136         NSMutableData *_receiveBuffer;
    00137
    00138         NSLock *_sendLock;
    00139         NSMutableArray *_sendBuffers;
    00140         INFSendBuffer *_lastSendBuffer;
    00141         BOOL _noDataSent;
    00142
    00143         id <INFSmartFoxISFSEvents>_delegate;
    00144 @private
    00145         NSString *_MSG_STR;
    00146
    00147         NSInteger _MIN_POLL_SPEED;
    00148         NSInteger _DEFAULT_POLL_SPEED;
    00149         NSInteger _MAX_POLL_SPEED;
    00150         NSString *_HTTP_POLL_REQUEST;
    00151         // -------------------------------------------------------
    00152         // Properties
    00153         // -------------------------------------------------------
    00154 @private
    00155         NSMutableDictionary *_roomList;
    00156         BOOL _connected;
    00157         uint64_t _benchStartTime;
    00158     mach_timebase_info_data_t _mach_timebase_info_data;
    00159
    00160         NSInteger _majVersion;
    00161         NSInteger _minVersion;
    00162         NSInteger _subVersion;
    00163
    00164         NSMutableDictionary *_messageHandlers;
    00165
    00166         BOOL _autoConnectOnConfigSuccess;
    00167
    00168 @public
    00176         NSString *_ipAddress;
    00177
    00186         NSInteger _port;
    00187
    00195         NSString *_defaultZone;
    00196
    00197         //--- BlueBox settings (start) ---------------------------------------------------------------------
    00198
    00199 @private
    00200         BOOL _isHttpMode;                                                               // connection mode
    00201         NSInteger _httpPollSpeed;                                       // bbox poll speed
    00202         //private var httpConnection:HttpConnection;
    00203
    00204 @public
    00215         NSString *_blueBoxIpAddress;
    00216
    00227         NSInteger _blueBoxPort;
    00228
    00239         BOOL _smartConnect;
    00240
    00241         //--- BlueBox settings (end) ---------------------------------------------------------------------
    00242
    00288         NSMutableDictionary *_buddyList;
    00289
    00311         NSMutableDictionary *_myBuddyVars;
    00312
    00346         BOOL _debug;
    00347
    00364         NSInteger _myUserId;
    00365
    00382         NSString *_myUserName;
    00383
    00406         NSInteger _playerId;
    00407
    00423         BOOL _amIModerator;
    00424
    00440         NSInteger _activeRoomId;
    00441
    00447         BOOL _changingRoom;
    00448
    00464         NSInteger _httpPort;
    00465
    00466 }
    00467
    00486 @property (assign) NSString *rawProtocolSeparator;
    00487
    00498 @property (assign) BOOL isConnected;
    00499
    00521 @property (assign) NSInteger httpPollSpeed;
    00522
    00523 @property (readonly) id<INFSmartFoxISFSEvents> delegate;
    00524
    00525 @property (assign) BOOL amIModerator;
    00526 @property (assign) NSInteger myUserId;
    00527 @property (assign) NSInteger playerId;
    00528 @property (retain) NSString *myUserName;
    00529 @property (assign) NSInteger activeRoomId;
    00530 @property (assign) BOOL changingRoom;
    00531 @property (readonly) mach_timebase_info_data_t mach_timebase_info_data;
    00532 @property (readonly) NSMutableDictionary *myBuddyVars;
    00533 @property (readonly) NSMutableDictionary *buddyList;
    00534
    00535 + (id)iPhoneClient:(BOOL)debug delegate:(id <INFSmartFoxISFSEvents>)delegate;
    00536
    00547 - (id)initWithParams:(BOOL)debug delegate:(id <INFSmartFoxISFSEvents>)delegate;
    00548
    00549 - (void)debugMessage:(NSString *)message;
    00550
    00618 - (void)loadConfig:(NSString *)configFile autoConnect:(BOOL)autoConnect;
    00619
    00646 - (NSString *)getConnectionMode;
    00647
    00672 - (void)connect:(NSString *)ipAdr  port:(NSInteger)port;
    00673
    00689 - (void)disconnect;
    00690
    00728 - (void)addBuddy:(NSString *)buddyName;
    00729
    00749 - (void)autoJoin;
    00750
    00770 - (void)clearBuddyList;
    00771
    00823 - (void)createRoom:(INFSmartFoxRoomCreateParams *)roomObj roomId:(NSInteger)roomId;
    00824
    00847 - (NSMutableDictionary *)getAllRooms;
    00848
    00878 - (INFSmartFoxBuddy *)getBuddyByName:(NSString *)buddyName;
    00879
    00909 - (INFSmartFoxBuddy *)getBuddyById:(NSInteger)id;
    00910
    00937 - (void)getBuddyRoom:(INFSmartFoxBuddy *)buddy;
    00938
    00959 - (INFSmartFoxRoom *)getRoom:(NSInteger)roomId;
    00960
    00981 - (INFSmartFoxRoom *)getRoomByName:(NSString *)roomName;
    00982
    01013 - (void)getRoomList;
    01014
    01031 - (INFSmartFoxRoom *)getActiveRoom;
    01032
    01056 - (void)getRandomKey;
    01057
    01074 - (NSString *)getUploadPath;
    01075
    01088 - (NSString *)getVersion;
    01089
    01126 - (void)joinRoom:(id)newRoom pword:(NSString *)pword isSpectator:(BOOL)isSpectator dontLeave:(BOOL)dontLeave oldRoom:(NSInteger)oldRoom;
    01127
    01146 - (void)leaveRoom:(NSInteger)roomId;
    01147
    01184 - (void)loadBuddyList;
    01185
    01222 - (void)login:(NSString *)zone name:(NSString *)name pass:(NSString *)pass;
    01223
    01249 - (void)logout;
    01250
    01280 - (void)removeBuddy:(NSString *)buddyName;
    01281
    01318 - (void)roundTripBench;
    01319
    01364 - (void)sendBuddyPermissionResponse:(BOOL)allowBuddy targetBuddy:(NSString *)targetBuddy;
    01365
    01392 - (void)sendPublicMessage:(NSString *)message roomId:(NSInteger)roomId;
    01393
    01421 - (void)sendPrivateMessage:(NSString *)message recipientId:(NSInteger)recipientId roomId:(NSInteger)roomId;
    01422
    01448 - (void)sendModeratorMessage:(NSString *)message type:(NSString *)type id:(NSInteger)id;
    01449
    01484 - (void)sendObject:(NSDictionary *)obj roomId:(NSInteger)roomId;
    01485
    01511 - (void)sendObjectToGroup:(NSMutableDictionary *)obj userList:(NSArray *)userList roomId:(NSInteger)roomId;
    01512
    01548 - (void)sendXtMessage:(NSString *)xtName cmd:(NSString *)cmd paramObj:(NSDictionary *)paramObj type:(NSString *)type roomId:(NSInteger)roomId;
    01549
    01568 - (void)setBuddyBlockStatus:(NSString *)buddyName status:(BOOL)status;
    01569
    01607 - (void)setBuddyVariables:(NSDictionary *)varList;
    01608
    01702 - (void)setRoomVariables:(NSArray *)varList roomId:(NSInteger)roomId setOwnership:(BOOL)setOwnership;
    01703
    01731 - (void)setUserVariables:(NSDictionary *)varObj roomId:(NSInteger)roomId;
    01732
    01763 - (void)switchSpectator:(NSInteger)roomId;
    01764
    01765 - (void)__logout;
    01766 - (void)sendString:(NSString *)strMessage;
    01767 - (NSInteger)getBenchStartTime;
    01768 - (void)clearRoomList;
    01769
    01770 @end