
#include "PublicSDKMotion.h"


struct sport_data_struct
{
	float pos_x;
	float pos_y;
	float pos_z;

	float acc_x;
	float acc_y;
	float acc_z;

	int front_press;
	int back_press;

	int jump;
	int zupt;

	float max_z;
	float min_z;

	float max_pos_z;

	int not_on_floor;

	int time_stamp;
};

struct single_jump_data_struct
{
	int jump_tag;
	int jump_high;
	int jump_length;

	int start_time_stamp;
};

struct dual_jump_data_struct
{
	int live_time;

	single_jump_data_struct  left_jump_data;
	single_jump_data_struct  right_jump_data;
};

struct double_press_struct
{
	int front_press;
	int back_press;

	int up_flag;
	int get_flag;
};

struct jump_data_struct
{
	float max_pos_z;
	float max_pos_xy;
};

struct long_jump_data_struct
{
	int step_length;
	int start_time;
	int end_time;
};



class SportFunction : public PublicSDKMotion
{
public:
	SportFunction();

	void setData(deque<sport_data_struct>& shoes_data_vector, float pos_x, float pos_y, float pos_z,
		float acc_x, float acc_y, float acc_z, int front_press, int back_press,
		int jump, int zupt, int times_stamp);

	void checkShoesData(deque<sport_data_struct>& shoes_data_vector);

	int checkRopeSkip(deque<sport_data_struct>& left_shoes_data_vector, deque<sport_data_struct>& right_shoes_data_vector);

	void getJumpHighLength(dual_jump_data_struct& dual_jump_data, deque<sport_data_struct>& shoes_data_vector, int left_or_right);

	void processJumpHighLength(dual_jump_data_struct& dual_jump_data, int rssi);

	void processStepData(deque<sport_data_struct>& shoes_data_vector, int left_or_right);

	float getJumpLength(deque<sport_data_struct>& shoes_data_vector);


	virtual void Process(int time_stamp, int* right_pos, int* right_att, int* right_acc, int right_zupt, int right_front_press, int right_back_press,
		int* left_pos, int* left_att, int* left_acc, int left_zupt, int left_front_press, int left_back_press,
		int jump, int down, int rssi);

private:
	deque<sport_data_struct> left_shoes_data_vector;
	deque<sport_data_struct> right_shoes_data_vector;

	dual_jump_data_struct dual_jump_data;

	single_jump_data_struct left_jump_data;
	single_jump_data_struct right_jump_data;

	int left_step;
	int right_step;

	int left_step_length;
	int right_step_length;

	int step_length;

	int jump_count;
	int last_jump_count;

	int jump_high;
	int jump_length;

};