Added example exercises
This commit is contained in:
@@ -10,7 +10,7 @@ import java.util.Objects;
|
||||
|
||||
public abstract class AbstractExercise implements IWebSocketHandler {
|
||||
|
||||
private EMuscleGroup muscleGroup;
|
||||
private EMuscleGroup[] muscleGroups;
|
||||
private EExerciseType exerciseType;
|
||||
private GesturePath path;
|
||||
|
||||
@@ -22,12 +22,12 @@ public abstract class AbstractExercise implements IWebSocketHandler {
|
||||
/**
|
||||
* Constructor for the AbstractExercise class.
|
||||
*
|
||||
* @param muscleGroup The muscle group of the exercise.
|
||||
* @param muscleGroups The muscle group of the exercise.
|
||||
* @param exerciseType The type of exercise.
|
||||
* @param path The path of the exercise.
|
||||
*/
|
||||
public AbstractExercise(EMuscleGroup muscleGroup, EExerciseType exerciseType, GesturePath path) {
|
||||
this.muscleGroup = muscleGroup;
|
||||
public AbstractExercise(EMuscleGroup[] muscleGroups, EExerciseType exerciseType, GesturePath path) {
|
||||
this.muscleGroups = muscleGroups;
|
||||
this.exerciseType = exerciseType;
|
||||
this.path = path;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public abstract class AbstractExercise implements IWebSocketHandler {
|
||||
* Start the exercise.
|
||||
* This method starts a WebSocket server
|
||||
*/
|
||||
public void startExercise() {
|
||||
public final void startExercise() {
|
||||
|
||||
// Ensure no other exercise is active.
|
||||
if (currentExercise != null && currentExercise != this) {
|
||||
@@ -81,6 +81,8 @@ public abstract class AbstractExercise implements IWebSocketHandler {
|
||||
webSocket.stop();
|
||||
webSocket = null;
|
||||
}
|
||||
currentExercise = null;
|
||||
this.onStopExercise();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +93,7 @@ public abstract class AbstractExercise implements IWebSocketHandler {
|
||||
/**
|
||||
* Method for stopping this exercise.
|
||||
*/
|
||||
public abstract void stopExercise();
|
||||
public abstract void onStopExercise();
|
||||
|
||||
/**
|
||||
* Check if the current exercise is the current activity.
|
||||
@@ -103,8 +105,8 @@ public abstract class AbstractExercise implements IWebSocketHandler {
|
||||
/**
|
||||
* Get the muscle group of the exercise.
|
||||
*/
|
||||
public EMuscleGroup getMuscleGroup() {
|
||||
return muscleGroup;
|
||||
public EMuscleGroup[] getMuscleGroup() {
|
||||
return muscleGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,21 @@
|
||||
package com.example.fitbot.exercise;
|
||||
|
||||
public enum EMuscleGroup {
|
||||
// TODO: Implement
|
||||
// TODO: Implement
|
||||
|
||||
TORSO(0),
|
||||
ARMS(1),
|
||||
LEGS(2),
|
||||
BALANCE(3);
|
||||
|
||||
int muscleGroupIdentifier;
|
||||
|
||||
EMuscleGroup(int identifier) {
|
||||
this.muscleGroupIdentifier = identifier;
|
||||
}
|
||||
|
||||
public int getIdentifier() {
|
||||
return this.muscleGroupIdentifier;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,45 @@
|
||||
package com.example.fitbot.exercise.exercises;
|
||||
|
||||
import com.example.fitbot.exercise.AbstractExercise;
|
||||
import com.example.fitbot.exercise.EExerciseType;
|
||||
import com.example.fitbot.exercise.EMuscleGroup;
|
||||
import com.example.fitbot.exercise.FitnessManager;
|
||||
import com.example.fitbot.util.server.WebSocket;
|
||||
|
||||
import java.net.Socket;
|
||||
|
||||
public class BicepCurlExercise extends AbstractExercise {
|
||||
|
||||
private static final String UNIQUE_ID = "bicep_curl";
|
||||
|
||||
/**
|
||||
* Constructor for the BicepCurlExercise class.
|
||||
*/
|
||||
public BicepCurlExercise() {
|
||||
super(
|
||||
new EMuscleGroup[] { EMuscleGroup.ARMS },
|
||||
EExerciseType.POWER,
|
||||
FitnessManager.acquirePath(UNIQUE_ID)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActivityFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopExercise() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(WebSocket.Message message, WebSocket.MessageReply replier) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Socket socket, String error) {
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user