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

📄 systeminfo.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;

	// SystemInfo parameters
	DWORD dwDataSize = MAX_PATH;
	char szDataBuf[MAX_PATH] = {0};

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

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

	// 2. SystemInfo sample
	if (tServerInfo.bRead)
	{
		// Get SystemInfo from local buffer
		scRet = ServerManager_GetValueByName(hDevice, tServerInfo.tSystemInfo.szSystemItem, szDataBuf, &dwDataSize);
		if (S_OK == scRet)
		{
			printf("Get SystemInfo success.\n %s = %s \n", tServerInfo.tSystemInfo.szSystemItem, szDataBuf);
		}
		else
		{
			printf("Get SystemInfo failed: %X\n", scRet);
		}
	}
	else
	{
		// Set SystemInfo to local buffer
		scRet = ServerManager_SetValueByName(hDevice, tServerInfo.tSystemInfo.szSystemItem, tServerInfo.tSystemInfo.szItemContent, TRUE);
		if (S_OK == scRet)
		{
			printf("Set SystemInfo to local buffer success.\n");

			// Upload the local configuration to remote server
			scRet = ServerManager_UpdateRemoteConfigBlock(hDevice);
			if (S_OK == scRet)
			{
				printf("Upload the local configuration to remote server success.\n");
			}
			else
			{
				printf("ServerManager_UpdateRemoteConfigBlock failed: %X\n", scRet);
			}
		}
		else
		{
			printf("Set SystemInfo failed: %X\n", scRet);
		}
	}

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

	return 0;
}

⌨️ 快捷键说明

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