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.

62 rivejä
1.6 KiB

  1. #include "XNetSDKTest.h"
  2. void OnDevFindFile(int nResult, SXSDKQueryRecordRes *pFiles, int nCount, int nSeq)
  3. {
  4. if (nResult <= 0)
  5. {
  6. printf("ESXSDK_DEV_FIND_FILE[%d]\r\n", nResult);
  7. return;
  8. }
  9. SXSDKQueryRecordRes *pFile = NULL;
  10. for (int i = 0; i < nCount; i++)
  11. {
  12. pFile = &pFiles[i];
  13. printf("File[%d][%s~%s][%d][%s][%s]\r\n", i, pFile->sBeginTime, pFile->sEndTime, pFile->nFileLength, pFile->sFileType, pFile->sFileSubType);
  14. printf("FileName[%d][%s]\r\n", i, pFile->sFileName);
  15. if(i == 0)
  16. {
  17. bFindFile = true;
  18. strcpy(info.sBeginTime, pFile->sBeginTime);
  19. strcpy(info.sEndTime, pFile->sEndTime);
  20. strcpy(info.sFileName, pFile->sFileName);
  21. }
  22. }
  23. }
  24. int TestDevFindFile()
  25. {
  26. printf("%s\r\n", __FUNCTION__);
  27. int nSeq = 0;
  28. char c = 0;
  29. printf("q-->To exit.\r\n", __FUNCTION__);
  30. while((c = getchar()) != 'q')
  31. {
  32. switch(c)
  33. {
  34. case 's':
  35. {
  36. SXSDKQueryRecordReq param = {0};
  37. strcpy(param.sFileType, EMFileType_jpg);
  38. strcpy(param.sFileSubType, EMFileSubType_ALL);
  39. param.nChannel = 0;
  40. param.nStreamType = 0;
  41. #if 1
  42. time_t tNow = time(NULL);
  43. struct tm tmNow = *localtime(&tNow);
  44. sprintf(param.sBeginTime, "%04d-%02d-%02d 00:00:00", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday);
  45. sprintf(param.sEndTime, "%04d-%02d-%02d 23:59:59", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday);
  46. #else
  47. strcpy(param.sBeginTime, "2018-08-04 00:00:00");
  48. strcpy(param.sEndTime, "2018-08-04 23:59:59");
  49. #endif
  50. //注意函数一次最多返回64条
  51. XSDK_DevFindFile(g_hDevice, &param, 4000, nSeq++);
  52. }
  53. break;
  54. }
  55. }
  56. return 0;
  57. }