#ofxiGKSession (iOS)
Wrapper of GKSession for openframeworks on iOS
- Add GameKit.framework to your project
- Add ofxiGKSession & ofxObjective-C++Utility to your project and include ofxiGKSession.h
- Create subclass of ofxiGKSessionDataReceiver and implement receiveData method
ofxObjective-C++Utility [https://github.com/2bbb/ofxObjective-C--Utility]
- void setup(string sessionID = "ofxiGKSession", string displayName = "")
sessionID is using for detect service group. and if displayName is empty string "", then displayName be device name.
- void setDataReceiver(ofxiGKSessionDataReceiver *receiver);
receiver is a instance of the subclass inherited ofxiGKSessionDataReceiver. ofxiGKSessionDataReceiver is implementd the method that process received data.
- void setManager(ofxiGKSessionManager *manager)
manager is a instance of the subclass inherited ofxiGKSessionManager. ofxiGKSessionManager manages connection while devices.
- void startServer(ofxiGKSessionMode sessionMode = OFXI_GKSESSION_MODE_PEER)
start the bluetooth service. sessionMode is select from OFXI_GKSESSION_MODE_SERVER, OFXI_GKSESSION_MODE_CLIENT or OFXI_GKSESSION_MODE_PEER.
- void setSendDataMode(ofxiGKSessionSendDataMode mode)
TODO
- void setAvailable();
- void setUnavailable();
TODO
- void connectToPeerID(string &peerID)
- void disconnectPeerFromAllPeers(string &peerID)
- void disconnectFromAllPeers()
- void acceptConnection(string peerID)
- void denyConnection(string peerID)
TODO
- void sendData(const string &str)
- void sendData(const ofBuffer &buffer)
- void sendData(const string &str, const vector &peers)
- void sendData(const ofBuffer &buffer, const vector &peers)
send datas.
- const ofxiGKSessionMode getSessionMode() const;
- const string getDisplayName() const;
- const string getDisplayName(string peer) const;
- const string getSessionID() const;
- vector getConnectedPeers();
- vector getAvailablePeers();
TODO
- void receiveData(const ofBuffer &buffer)
this method is call when receive data.
- virtual void connectionWithPeerFailed(string peerID, string errorDescription)
- virtual void fail(string errorDescription)
- virtual void receiveConnectionRequest(string peerID)
TODO
- virtual void peerAvailable(string peerID)
- virtual void peerConnecting(string peerID)
- virtual void peerConnected(string peerID)
- virtual void peerDisconnected(string peerID)
- virtual void peerUnavailable(string peerID)
TODO
MIT License.
- ISHII 2bit [bufferRenaiss co., ltd.]
- ishii[at]buffer-renaiss.com
Please create new issue, if there is a problem. And please throw pull request, if you have a cool idea!!