⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 privatemaskinfo.c

📁 一个在Linux下开发的IP摄像头的驱动程序及控制软件
💻 C
字号:
/*
 * This sample code is written by block mode. If you want to use nonblock mode,
 * please reference the HttpOperation_NonBlock sample.
 *
 */

#include "Utility.h"

int main(int argc, char* argv[])
{
	SCODE scRet = S_OK;
	HANDLE hServerMgr = NULL;
	HANDLE hDevice = NULL;
	TCHAR szModelName[MAX_PATH] = {0};
	TSERVER_INFO tServerInfo;

	// PrivateMaskInfo parameter
	int i = 0;
	DWORD dwCamNumber = 1; // Index of camera, starting from 1.
	TSRVCTRL_PRIVATEMASK_INFO tPMInfo;
	char szInputBuf[MAX_PATH] = {0};

	// example Get PrivateMaskInfo input: -I192.168.0.1 -H80 -Uroot -Proot -T30000 -R
	// example Set PrivateMaskInfo input: -I192.168.0.1 -H80 -Uroot -Proot -T30000
	if (ParseInputArgument(argc, argv, &tServerInfo, eSrvMgrPrivateMaskInfo) != S_OK)
	{
		return 0;
	}

	// 1. Initialization
	scRet = ServerManagerInitBlock(&hServerMgr, &hDevice, szModelName, tServerInfo);
	if (S_OK != scRet)
	{
		printf("ServerManagerInitBlock failed...\n");
		return 0;
	}

	// 2. PrivateMaskInfo sample
	if (tServerInfo.bRead)
	{
		// Get PrivateMaskInfo
		scRet = ServerManager_GetPrivateMaskInfoBlock(hDevice, dwCamNumber, &tPMInfo);
		if (S_OK == scRet)
		{
			if (tPMInfo.bWindowEnabled)
			{
				printf("PrivateMaskInfo: Name = %s, X = %d, Y = %d, W = %d, H = %d\n",
						tPMInfo.szName, tPMInfo.nX, tPMInfo.nY, tPMInfo.nW, tPMInfo.nH);
			}
		}
	}
	else
	{
		while (1)
		{
			printf("\n\nPlease press Enter directly to end this program.\n\n");

			// check the input command
			printf("Type the settings in sequence:\n\"Name, X, Y, Width, Height\"\n");
			if (fgets(szInputBuf, MAX_PATH, stdin) == NULL)
			{
				printf("Incorrect input!\n\n");
				continue;
			}
			if (strlen(szInputBuf) > 0 && szInputBuf[strlen(szInputBuf) - 1] == '\n')
			{
				szInputBuf[strlen(szInputBuf) - 1] = 0;
			}
			if (szInputBuf[0] == 0)
			{
				break; // end the rpogram
			}
			i = sscanf(szInputBuf,"%s %d %d %d %d", tPMInfo.szName, &tPMInfo.nX, &tPMInfo.nY, &tPMInfo.nW, &tPMInfo.nH);
			if (i != 5)
			{
				printf("Incorrect Format\n\n");
				continue;
			}

			// Set PrivateMaskInfo
			scRet = ServerManager_SetPrivateMaskInfoBlock(hDevice, dwCamNumber, &tPMInfo, FALSE);
		}
	}


	if (S_OK == scRet)
	{
		printf("Get PrivateMaskInfo success\n");
	}
	else
	{
		printf("Get PrivateMaskInfo failed: %X\n", scRet);
	}

	// 3. Release all resource
	ServerManagerRelease(&hServerMgr, &hDevice);

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -