#pragma once
#include <iostream>
#include <afxdisp.h>
#include <windows.h>
#include <afxsock.h>            
#include <comdef.h> 
using namespace std;

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS


static const int SOCKET_CONNECT_OUTTIME=5000;
static const int SOCKET_CREATE_ERROR=-1;
static const int SOCKET_CONNECT_SUCCESS=1;
static const int SOCKET_CONNECT_ERROR=-2;
static const int SOCKET_ERROR_CHANNEL_TYPE=-3;

class iMaticSocket
{
public:
	iMaticSocket(void);
	~iMaticSocket(void);
public:
	CSocket *m_socket;

	boolean isChannel8Connect;
	boolean isChannel16Connect;
	boolean debugState;

	//Will print error code if it is true;
	void IsDebugState(boolean debugState);

	int ConnectSocket(int imatic_type);
	void SendCommand();
private:
	boolean SendChannel8Command(int led_number,int led_state);
	boolean SendChannel16Command(int led_number,int led_state);
};



