#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include <math.h>
//#include "vrpn_Tracker.h"

//#define WIFIBOT_TRACE_ON
//#define WIACLIENT_TRACE_ON
#define USE_WIACLIENT
#define USE_WIFIBOT

#include <pthread.h>

#ifdef USE_WIACLIENT
	#include "WIAClient_info.h"
#endif

#ifdef USE_WIFIBOT
    #include "Wifibot_info.h"
#endif

#include <WIAClientSM_info.h>
#include <WifibotSM_info.h>


#ifdef TESTFUNCDLL_EXPORT
#define TESTFUNCDLL_API __declspec(dllexport) 
#else
#define TESTFUNCDLL_API __declspec(dllimport) 
#endif

extern "C" {
#include <SMCore.h>
	TESTFUNCDLL_API int attach_wiaclient_sm();
    TESTFUNCDLL_API int create_wiaclient_sm();
	TESTFUNCDLL_API int copy_wiaclient_data_to_sm(WIAClientLibObjects *wiaclient_data);
	TESTFUNCDLL_API int attach_wifibot_sm();
    TESTFUNCDLL_API int create_wifibot_sm();
	TESTFUNCDLL_API int copy_wifibot_data_to_sm(WifibotLibObjects *wiaclient_data);
	TESTFUNCDLL_API void reset_wiaclient_connected();
	TESTFUNCDLL_API void set_wiaclient_connected();
	TESTFUNCDLL_API bool is_wiaclient_connected();
	TESTFUNCDLL_API int get_jpeg_length();
	TESTFUNCDLL_API BYTE * get_jpeg_data();
	TESTFUNCDLL_API void copy_jpeg_data( void *cpy_data);
	TESTFUNCDLL_API long get_wifibot_frame_id();
	TESTFUNCDLL_API int get_wifibot_frame_sec( double *sec);
	TESTFUNCDLL_API long get_wiaclient_frame_id();
	TESTFUNCDLL_API int get_wiaclient_frame_sec( double *sec);
	TESTFUNCDLL_API void set_wifibot_connected();
	TESTFUNCDLL_API bool is_wifibot_connected();
	TESTFUNCDLL_API int get_wifibot_speedFrontLeft();
	TESTFUNCDLL_API int get_wifibot_speedFrontRight();
	TESTFUNCDLL_API int get_wifibot_speedRearLeft();
	TESTFUNCDLL_API int get_wifibot_speedRearRight();
	TESTFUNCDLL_API int get_wifibot_irLeft();
	TESTFUNCDLL_API int get_wifibot_irRight();
	TESTFUNCDLL_API int get_wifibot_irLeft2();
	TESTFUNCDLL_API int get_wifibot_irRight2();
	TESTFUNCDLL_API long get_wifibot_odometryLeft();
	TESTFUNCDLL_API long get_wifibot_odometryRight();
	TESTFUNCDLL_API int get_wifibot_left_speed();
	TESTFUNCDLL_API int get_wifibot_right_speed();
	TESTFUNCDLL_API void set_wifibot_speed(int newLeftSpeed, int newRightSpeed);
}