25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.9 KiB

  1. #include "XNetSDKTest.h"
  2. #include "XNetSDKSyn.h"
  3. #include "SystemInfo.h"
  4. #include "SystemFunction.h"
  5. USE_NS_NETSDK_CFG
  6. int TestDevSystemConfig()
  7. {
  8. printf("%s\r\n", __FUNCTION__);
  9. char c = 0;
  10. while((c = getchar()) != 'q')
  11. {
  12. switch(c)
  13. {
  14. /////////获取设备支持的功能/////////
  15. case 'a':
  16. {
  17. // [异步]获取设备能力级
  18. // XSDK_DevGetSysConfig(g_hDevice, JK_SystemFunction, 1234, 4000, JK_SystemFunction_MsgId);
  19. // [同步]获取设备能力级
  20. char szOutBuffer[40960] = {0};
  21. int nInOutSize = sizeof(szOutBuffer);
  22. int nResult = XSDK_DevGetSysConfigSyn(g_hDevice, JK_SystemFunction, szOutBuffer, &nInOutSize, 4000, JK_SystemFunction_MsgId);
  23. if(nResult >= 0)
  24. {
  25. printf("Get Success String[%s]\r\n", szOutBuffer);
  26. SystemFunction cfg;
  27. cfg.Parse(szOutBuffer);
  28. printf("AlarmFunction.AlarmConfig = %d\r\n", cfg.mAlarmFunction.AlarmConfig.Value());
  29. }
  30. else
  31. {
  32. printf("Get Fail String[%s], nResult = %d\r\n", szOutBuffer, nResult);
  33. }
  34. }
  35. break;
  36. case 'b':
  37. {
  38. // [异步]获取设备基本信息(版本信息等)
  39. //XSDK_DevGetSysConfig(g_hDevice, JK_SystemInfo, 123, 4000, JK_SystemInfo_MsgId);
  40. // [同步]获取设备基本信息(版本信息等)
  41. char szOutBuffer[40960] = {0};
  42. int nInOutSize = sizeof(szOutBuffer);
  43. int nResult = XSDK_DevGetSysConfigSyn(g_hDevice, JK_SystemInfo, szOutBuffer, &nInOutSize, 4000, JK_SystemInfo_MsgId);
  44. if(nResult >= 0)
  45. {
  46. printf("Get Success String[%s]\r\n", szOutBuffer);
  47. SystemInfo cfg;
  48. cfg.Parse(szOutBuffer);
  49. const char * SoftWareVersion = cfg.SoftWareVersion.ToString();
  50. printf("SoftWareVersion = %s\r\n", SoftWareVersion);
  51. }
  52. else
  53. {
  54. printf("Get Fail String[%s], nResult = %d\r\n", szOutBuffer, nResult);
  55. }
  56. }
  57. break;
  58. }
  59. }
  60. return 0;
  61. }