
/*
history:
  17-09-2004 - Add SendFile function
  27-08-2004 - Add Connect4,SendData4 function
  16-08-2004 - Add SendReactToCore function
  12-03-2004
*/

#define LPCTSTR const char*
#define LPTSTR char*
#define BOOL int
#define DWORD unsigned long

#if defined IIDK_EXPORTS
	#define IIDK_API	__declspec( dllexport )
#else
    #pragma comment(lib, "iidk.lib")
	#define IIDK_API 	__declspec( dllimport )
#endif


typedef void (__stdcall iidk_user_data_func)(int nIdent,byte *pBuffer,DWORD dwSize,unsigned long user_param);
typedef void (__stdcall iidk_frame_callback_func)(byte *pImage,int nWidth,int nHeight,unsigned long user_param);
typedef void (__stdcall iidk_callback_func)(const char* msg,const char* slave_id,unsigned long user_param);
typedef void (__stdcall iidk_old_func)(const char* msg) ;

extern "C" 
{
	IIDK_API	 BOOL __stdcall	Connect(LPCTSTR ip, LPCTSTR port, LPCTSTR id, iidk_old_func* func);
	IIDK_API	 BOOL __stdcall Connect2(LPCTSTR ip, LPCTSTR port, LPCTSTR id);

/*
Connect3

asynchronous/synchronous connect mode

async_connect=0  - synchronous connect mode   - return true,if connected
async_connect=-1 - asynchronous connect mode  - always return FALSE,connect_attempts if connected  - generete event CONNECTED
async_connect= any other value - begin with synchronous mode,next if failed asynchronous connect mode (see async_connect = -1)
*/

	IIDK_API	 BOOL __stdcall	Connect3(LPCTSTR ip, LPCTSTR port, LPCTSTR id, iidk_callback_func* lpfunc,DWORD user_param,int async_connect,DWORD connect_attempts);

/*
Connect4
iidk_frame_callback_func* lpframe_func			- callback for videoframe
iidk_user_data_func*      iidk_user_data_func   - callback for data,sended with SendData4
*/
	IIDK_API BOOL __stdcall Connect4(LPCTSTR ip, LPCTSTR port, LPCTSTR id, 
									iidk_callback_func* lpfunc,
									iidk_frame_callback_func* lpframe_func,
									iidk_user_data_func*      iidk_user_data_func,
		DWORD user_param,int async_connect,DWORD connect_attempts);

/*
SendData4 - send user defined data
nIndent - unique identificator
pBuffer - data
dwSize - size of data
*/
	IIDK_API BOOL __stdcall SendData4(LPCTSTR id, int nIdent,BYTE *pBuffer,DWORD dwSize);

// Send file to core
	IIDK_API BOOL __stdcall SendFile(LPCTSTR id, LPCTSTR file_from, LPCTSTR file_to);


	IIDK_API	 BOOL __stdcall SendMsg(LPCTSTR id, LPCTSTR msg);
	IIDK_API	 BOOL __stdcall GetMsg(LPTSTR msg, DWORD& cb);
	IIDK_API	 void __stdcall Disconnect(LPCTSTR id);
	IIDK_API	 BOOL __stdcall SendReactToCore(LPCTSTR id, LPCTSTR msg);
/*
IsConnected
return TRUE if connected
else FALSE
*/
	IIDK_API BOOL __stdcall IsConnected(LPCTSTR id);

}
