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.

63 lines
1.4 KiB

  1. #include "XNetSDKTest.h"
  2. #include "SystemInfo.h"
  3. #include "SystemFunction.h"
  4. USE_NS_NETSDK_CFG
  5. int TestDevConfig()
  6. {
  7. printf("%s\r\n", __FUNCTION__);
  8. char c = 0;
  9. while((c = getchar()) != 'q')
  10. {
  11. switch(c)
  12. {
  13. case 'a':
  14. {
  15. // 获取设备能力级
  16. XSDK_DevGetSysConfig(g_hDevice, JK_SystemFunction, 1234, 4000, JK_SystemFunction_MsgId);
  17. }
  18. break;
  19. case 'b':
  20. {
  21. }
  22. break;
  23. case 'c':
  24. {
  25. // 获取设备基本信息(版本信息等)
  26. XSDK_DevGetSysConfig(g_hDevice, JK_SystemInfo, 123, 4000, JK_SystemInfo_MsgId);
  27. }
  28. break;
  29. case 'd':
  30. {
  31. }
  32. break;
  33. }
  34. }
  35. return 0;
  36. }
  37. void OnDevConfig(int nMsgId, int nResult, const char *szCfgName, const char *szResult, int nResultLen, int nSeq)
  38. {
  39. if (nResult < 0)
  40. {
  41. printf("OnDevConfig:[MsgId:%d; Result:%d]\r\n", nMsgId, nResult);
  42. return;
  43. }
  44. if((ESXSDK_DEV_GET_SYS_CONFIG == nMsgId ||ESXSDK_DEV_GET_CHN_CONFIG == nMsgId) && szCfgName && szResult && nResultLen > 0)
  45. {
  46. if (strcmp(szCfgName, JK_SystemInfo) == 0)
  47. {
  48. SystemInfo cfg;
  49. cfg.Parse(szResult);
  50. printf("SystemInfo:[SerialNo:%s; BuildTime:%s; ]\r\n", cfg.SerialNo.Value(), cfg.BuildTime.Value());
  51. }
  52. else if (strcmp(szCfgName, JK_SystemFunction) == 0)
  53. {
  54. SystemFunction cfg;
  55. cfg.Parse(szResult);
  56. printf("SystemFunction:[CombineStream:%d; ]\r\n", cfg.mEncodeFunction.CombineStream.Value());
  57. }
  58. }
  59. }