Wrapper of GKSession for openframeworks on iOS
Objective-C C++
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
src
.gitignore
LICENSE
README.md

README.md

#ofxiGKSession (iOS)

Wrapper of GKSession for openframeworks on iOS

How to use

  1. Add GameKit.framework to your project
  2. Add ofxiGKSession & ofxObjective-C++Utility to your project and include ofxiGKSession.h
  3. Create subclass of ofxiGKSessionDataReceiver and implement receiveData method

Dependencies

ofxObjective-C++Utility [https://github.com/2bbb/ofxObjective-C--Utility]

API

ofxiGKSession

  • 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

ofxiGKSessionDataReceiver (Interface about receive data)

  • void receiveData(const ofBuffer &buffer)

this method is call when receive data.

ofxiGKSession (Interface about managing the connection)

  • 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

Update history

2013/08/10 ver 0.01 beta release

License

MIT License.

Author

  • ISHII 2bit [bufferRenaiss co., ltd.]
  • ishii[at]buffer-renaiss.com

At the last

Please create new issue, if there is a problem. And please throw pull request, if you have a cool idea!!