#include "XNetSDKTest.h"
#include "TestFuns.h"
#include <time.h>

void OnDevSnap(int nResult, const char *pData, int nDataLen, int nSeq)
{
	printf("%s->Result[%d]\r\n", __FUNCTION__, nResult);
	if (nResult >= 0)
	{
		static int s_index = 0;
		char szFile[256] = {0};
		sprintf(szFile, "%d_%d.jpg", s_index++, (int)time(NULL));
		ToFile(szFile, pData, nDataLen);
	}
}

int TestDevSnap()
{
	printf("%s\r\n", __FUNCTION__);
	char c = 'a';
	printf("q-->To exit.\r\n", __FUNCTION__);
	while((c = getchar()) != 'q')
	{
		switch(c)
		{
		case 'g':
			{
				XSDK_DevSnap(g_hDevice, 0, "", 0);
			}
			break;
		}
	}
	return 0;
}