Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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