Skip to content

Instantly share code, notes, and snippets.

@conorliv
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conorliv/ab3f83869f926e07520e to your computer and use it in GitHub Desktop.
Save conorliv/ab3f83869f926e07520e to your computer and use it in GitHub Desktop.
Drafting surface-level interface for Library/Quizshow communication
public interface LibraryFacace {
/**
* Simply opens a socket on a pre-determined port
* and listens to any messages it receives. It expects that
* the messages it receives are from instances of the Buzzer App
* and derives an IP address from them. The library stores this
* list of derived IP addresses and uses them to send out messages
* to all registered devices for the rest of the game session.
**/
public startIpRegistration();
/**
* Close socket that was opened by startIpRegistration().
**/
public stopIpRegistration();
/**
* At this point the Quizshow's IP address
* should be displayed on the screen for QuizShow
* participants to type into their devices.
*
*
* This method sends out a message to the
* Buzzer App instances it does so using the list of
* IP addresses it derived from the packets that were
* sent to it during the register IP activity.
* Then it opens a socket on the quizshow's
* device that listens for registration messages
* from the Buzzer App instances.
*
**/
public void startRegistration();
/**
* Send a message to all registered devices that
* the team registration period is over.
**/
public void endRegistration();
/**
* Allows the quizshow to retrieve from the library
* a list of Player objects. Player objects simply
* aggregate data about a player. I.e. their team
* name and team color to use for visual display purposes
* on the quizshow's interface.
**/
public ArrayList<Player> getPlayerInfo();
/**
* Sends a message that the Buzzer App is listening for
* to activate the big red button on the GamePlay activity.
**/
public void startQuestion();
/**
* Sends a message that the Buzzer App is listening for
* to de-activate the big red button on the GamePlay activity.
**/
public void endQuestion();
/**
* Closes sockets that were opened during GamePlay.
*
* Can also contain other essential teardown operations.
**/
public void endGame();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment