/*! 
* 
* Copyright(c) 2010 Apogee Instruments, Inc. 
* \class WinEthernetIO 
* \brief windows ethernet io 
* 
*/ 


#ifndef WINETHERNETIO_INCLUDE_H__ 
#define WINETHERNETIO_INCLUDE_H__ 

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers

#include <windows.h>
#include <wininet.h>

#include <string>
#include <vector>

#include "IEthernetIO.h"

class WinEthernetIO: public IEthernetIO
{
    public:
        WinEthernetIO();
        virtual ~WinEthernetIO();
        
        void HttpGet( const std::string & Url,
            std::string & data);

        void HttpGet( const std::string & Url, 
            std::vector<unsigned short> & data,
            int numBytesExpected);

    private:
        HINTERNET m_hSession;

        void FetchService( const std::string & Url, 
            HINTERNET * service );

        void ReadData( HINTERNET * service, 
            void * data, DWORD BytesAvailable) ;

};

#endif 
