You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
948 B

  1. #include "XNetSDKTest.h"
  2. #include "ModifyPassword.h"
  3. USE_NS_NETSDK_CFG
  4. int TestModifyPassword()
  5. {
  6. printf("%s\r\n", __FUNCTION__);
  7. int nRet = 0;
  8. char c = 0;
  9. while((c = getchar()) != 'q')
  10. {
  11. switch(c)
  12. {
  13. case 's':
  14. {
  15. char oldPsw[6] = "10111";
  16. signed char oldEncryptPsw[6] = {0};
  17. XSDK_EncryptPassword(oldPsw, oldEncryptPsw, 6);
  18. printf("oldEncryptPassWord = %s\n", oldEncryptPsw);
  19. char newPsw[5] = "1011";
  20. signed char newEncryptPsw[5] = {0};
  21. XSDK_EncryptPassword(newPsw, newEncryptPsw, 5);
  22. printf("newEncryptPassWord = %s\n", newEncryptPsw);
  23. SXSDK_MODIFY_PSW cfg;
  24. strcpy(cfg.Password, (const char *)oldEncryptPsw);
  25. strcpy(cfg.NewPassword, (const char *)newEncryptPsw);
  26. strcpy(cfg.sUserName, "admin");
  27. nRet = XSDK_DevModifyIPConfig(g_hDevice, (const char *)&cfg, sizeof(SXSDK_MODIFY_PSW), 12, 5000);
  28. }
  29. break;
  30. }
  31. }
  32. return 0;
  33. }