#include "XNetSDKTest.h"
#include "ModifyPassword.h"

USE_NS_NETSDK_CFG

int TestModifyPassword()
{
	printf("%s\r\n", __FUNCTION__);

	int nRet = 0;
	char c = 0;
	while((c = getchar()) != 'q')
	{
		switch(c)
		{
		case 's':
			{
				char oldPsw[6] = "10111";
				signed char oldEncryptPsw[6] = {0};
				XSDK_EncryptPassword(oldPsw, oldEncryptPsw, 6);
				printf("oldEncryptPassWord = %s\n", oldEncryptPsw);

				char newPsw[5] = "1011";
				signed char newEncryptPsw[5] = {0};
				XSDK_EncryptPassword(newPsw, newEncryptPsw, 5);
				printf("newEncryptPassWord = %s\n", newEncryptPsw);

				SXSDK_MODIFY_PSW cfg;
				strcpy(cfg.Password, (const char *)oldEncryptPsw);
				strcpy(cfg.NewPassword, (const char *)newEncryptPsw);
				strcpy(cfg.sUserName, "admin");

				nRet = XSDK_DevModifyIPConfig(g_hDevice, (const char *)&cfg, sizeof(SXSDK_MODIFY_PSW), 12, 5000);			
			}
			break;
		}	
	}

	return 0;
}


