recordinfo.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef _RECORDINFO_H_
  2. #define _RECORDINFO_H_
  3. #include "IHttpFunc.h"
  4. #include "json/json.h"
  5. #include "SpBase.h"
  6. #ifndef RVC_MAX_JSON_LENGTH
  7. #define RVC_MAX_JSON_LENGTH 512
  8. #endif // !RVC_MAX_JSON_LENGTH
  9. #ifndef RVC_MAX_RECORDITEM_JSON_LENGTH
  10. #define RVC_MAX_RECORDITEM_JSON_LENGTH 260
  11. #endif // !RVC_MAX_RECORDITEM_JSON_LENGTH
  12. #ifndef RVC_UPLOAD_VIDEORECORDING_HTTP_API
  13. #define RVC_UPLOAD_VIDEORECORDING_HTTP_API "/api/upload/video_recording"
  14. #endif // !RVC_UPLOAD_VIDEORECORDING_HTTP_API
  15. #ifndef RVC_UPLOAD_VIDEORECORDING_HTTP_ADDR
  16. #define RVC_UPLOAD_VIDEORECORDING_HTTP_ADDR "https://uploadservice.paas.cmbchina.cn"
  17. #endif // !RVC_UPLOAD_VIDEORECORDING_HTTP_ADDR
  18. #ifndef RVC_HTTPTIMEOUT
  19. #define RVC_HTTPTIMEOUT 10
  20. #endif // !RVC_HTTPTIMEOUT
  21. #define REFLECTION(var) #var
  22. //业务状态(0 - 失败,1 - 成功,2 - 取消,3 - 中断)
  23. enum eRvcBusinessStatus {
  24. eFailed,
  25. eSuccess,
  26. eCancel,
  27. eInterrupt
  28. };
  29. typedef struct record_item_s {
  30. std::string file_name;
  31. std::string file_path;
  32. int file_length;
  33. }record_item_t;
  34. //video_record_info_t
  35. typedef struct video_record_info_s {
  36. CSimpleStringA strServerURL;
  37. CSimpleStringA strAPI;
  38. CSimpleStringA strTerminalNo;
  39. CSimpleStringA strAppVersion;
  40. CSimpleStringA strRecordEndTime;
  41. CSimpleStringA strRecordID;
  42. int iBusinessStatus;
  43. vector<record_item_t> vRecordList;
  44. }video_record_info_t;
  45. struct RecordInfoHTTPReq : CHTTPReq {
  46. std::string m_reqContent;
  47. virtual string ToJson() {
  48. return m_reqContent;
  49. }
  50. };
  51. struct RecordInfoHTTPRet : CHTTPRet {
  52. std::string m_request;
  53. bool m_success;
  54. std::string m_code;
  55. std::string m_message;
  56. std::string m_returnCode;
  57. std::string m_errorMsg;
  58. bool m_data;
  59. virtual bool Parse(string strData) {
  60. Json::Value root;
  61. Json::Reader reader;
  62. if (reader.parse(strData, root, false)) {
  63. m_success = root[REFLECTION(success)].asBool();
  64. m_code = root[REFLECTION(code)].asString();
  65. m_message = root[REFLECTION(message)].asString();
  66. m_returnCode = root[REFLECTION(returnCode)].asString();
  67. m_errorMsg = root[REFLECTION(errorMsg)].asString();
  68. m_data = root[REFLECTION(data)].asBool();
  69. }
  70. else {
  71. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("reader parse failed!");
  72. m_success = false;
  73. }
  74. return m_success;
  75. }
  76. };
  77. int post_video_recordinfo_list(unsigned int& uposttime, CSimpleStringA& errormsg, video_record_info_t* pinfo, int itimeout, bool bprintdbg);
  78. #endif