
#ifndef _Game_H_
#define _Game_H_

#include "pub.h"

#include "PublicSDKMotion.h"
#include "RunGame.h"
#include "DanceGame.h"
#include "Tricycle.h"
#include "H5_Game.h"
#include "Interaction.h"
#include "FootStep.h"
#include "FingerGuessing.h"
#include "Aerobics.h"
#include "Kongfu.h"
#include "SportFunction.h"
#include "BuildHouse.h"
#include "CutCake.h"

#include "StepVel.h"
#include "TestGame.h"

#include "online_motion.h"


#include <fstream>
#include <time.h>
#include <sstream>

#if defined(_WIN32)
#if defined( SDK_EXPORTS)
#define SDK_EXPORT __declspec(dllexport)
#else
#define SDK_EXPORT __declspec(dllimport)
#endif
#else
#define SDK_EXPORT
#endif


class SDK_EXPORT Game
{
		public:
			Game(int gametype);

			void GameProcess(int gameTime, int* right_pos_data, int* right_att_data, int* right_acc_data, int right_zupt, int right_front_mag, int right_back_mag,
				int* left_pos_data, int* left_att_data, int* left_acc_data, int left_zupt, int left_front_mag, int left_back_mag,
				int jump, int down, int rssi);

			void GameProcessBuf(uint8_t* buf, int len);

			void getGameResult(int* matrix);

			void getFootAtt(int* left_att, int* right_att);

			string getGameDataStr();

			int getStepStatus(int left_or_right);
			int getStepFreq(int left_or_right);
			int getStepCount(int left_or_right);

			float getGamePos(int left_or_right, int index);

			string getVersion();

			int getInteractionCMD();

			int getGameStepVel();

			void setGameDataStr();

			int getMotionCount(int motion_type);

			bool setShoesDataBuff(int &gameTime, int* right_pos_data, int* right_att_data, int* right_acc_data, int &right_zupt, int& right_front_mag, int& right_back_mag,
				int* left_pos_data, int* left_att_data, int* left_acc_data, int& left_zupt, int& left_front_mag, int& left_back_mag,
				int& jump, int& down, int& rssi);

		private:

			int GameType;

			int leftStepRate;
			int rightStepRate;
			
			int leftRate;
			int rightRate;

			int resultMatrix[RESULT_LEN];

			float leftRotate[4];
			
			float rightRotate[4];

			fstream foot_data_file;


			int InteractionCMD;

			int right_pos_data[3];
			int right_att_data[3];

			int left_pos_data[3];
			int left_att_data[3];

			int left_acc_data[3];
			int right_acc_data[3];

			int left_gyr_data[3];
			int right_gyr_data[3];

			int girl_shoes;

			int s_zupt;
			int h_zupt;

			int down;
			int jump;

			int rssi;

			int posTimeStamp;
			int attTimeStamp;

			uint32_t gameTime = 0;
			int lastTimeStamp = -1;

			uint16_t right_front_mag;
			uint16_t right_back_mag;

			uint16_t left_front_mag;
			uint16_t left_back_mag;


			string data_str;

			int shoes_down;

			PublicSDKMotion *game;

			FootStep leftFootStep;
			FootStep rightFootStep;
			StepVel  stepVel;

		    Interaction interaction;

			int shoes_data_buff_size;

			int setShoesDataBuff_count;

			online_motion extract_motion;

};

#endif