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

📄 systeminfogetset.c

📁 一个在Linux下开发的IP摄像头的驱动程序及控制软件
💻 C
字号:
#include "Utility.h"


/*!
***************************************************************************
 * \brief
 *	get server's settings

 * \param tServerInfo
	[in] server info
 * \param iEntry 
	[in] entry of server to get
 * \param pszSection 
	[out] section name of index iEntry 
 * \param pszEntry 
	[out] key of the section
 * \param pszContent 
	[out] key value 

 * \return 
 * \retval S_OK get server settings successfully
**************************************************************************/
SCODE GetSystemSettings(TSERVER_INFO tServerInfo, int iEntry, char* pszSection, char* pszEntry, char* pszContent)
{
	char lpszModelName[64]; 
	HANDLE hServerUtl;
	HANDLE hDevice;

	SCODE scRet;
	
	scRet = ServerUtlInit(&hServerUtl, &hDevice, lpszModelName, tServerInfo);
	if (scRet != S_OK)
		return scRet;
	
	scRet = ServerUtl_GetSysInfoSecEntry(hDevice, (ESYSTEM_INFO_ID) iEntry, pszSection, pszEntry);
	if (scRet != S_OK)
	{
		//printf("\nServer does not support such property!\n\n");
		ServerUtlRelease(&hServerUtl, &hDevice);
		return scRet;
	}

	scRet = ServerUtl_GetSysInfoByID(hDevice, pszContent, (ESYSTEM_INFO_ID) iEntry, -1);
	if (scRet != S_OK)
	{
		//printf("ServerUtl_GetSysInfoByID fail\n");
		ServerUtlRelease(&hServerUtl, &hDevice);
		return scRet;
	} 
	ServerUtlRelease(&hServerUtl, &hDevice);
	return S_OK;
}

/*!
***************************************************************************
 * \brief
 *	set server's settings

 * \param tServerInfo
	[in] server info
 * \param iEntry 
	[in] entry of server to set
 * \param szInputBuf 
	[in] string to set the index iEntry

 * \return 
 * \retval S_OK set server settings successfully
**************************************************************************/
SCODE SetSystemSettings(TSERVER_INFO tServerInfo, int iEntry, char *szInputBuf)
{
	char lpszModelName[64];
	char szSection[256], szEntry[256];
	char szContent[256];
	SCODE scRet = 0;
	HANDLE hServerUtl;
	HANDLE hDevice;

	scRet = ServerUtlInit(&hServerUtl, &hDevice, lpszModelName, tServerInfo);
	if (scRet != S_OK)
		return scRet;

	scRet = ServerUtl_GetSysInfoSecEntry(hDevice, (ESYSTEM_INFO_ID) iEntry, szSection, szEntry);
	if (scRet != S_OK)
	{
		//printf("\nServer does not support such property!\n\n");
		ServerUtlRelease(&hServerUtl, &hDevice);
		return scRet;
	}

	scRet = ServerUtl_GetSysInfoByID(hDevice, szContent, (ESYSTEM_INFO_ID) iEntry, -1);
	if (scRet != S_OK)
	{
		//printf("ServerUtl_GetSysInfoByID fail\n");
		ServerUtlRelease(&hServerUtl, &hDevice);
		return scRet;
	} 

	scRet = ServerUtl_SetSysInfo(hDevice, szInputBuf, szSection, szEntry, -1);
	if (scRet != S_OK)
	{
		//printf("set entry vlaue fail\n");
		ServerUtlRelease(&hServerUtl, &hDevice);
		return scRet;
	} 	
	
	//update the remote config. 
	scRet = ServerUtl_UpdateRemoteConfig(hDevice, false);		
	if (scRet != S_OK)
	{
		//printf("update remote config fail\n");
		ServerUtlRelease(&hServerUtl, &hDevice);
		return scRet;
	}
	 	
	ServerUtlRelease(&hServerUtl, &hDevice);
	return 0;
}

⌨️ 快捷键说明

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