brightnessinfo.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _BRIGHTNESSINFO_H_
  2. #define _BRIGHTNESSINFO_H_
  3. #include "IHttpFunc.h"
  4. #include "json/json.h"
  5. #include "SpBase.h"
  6. #ifndef RVC_UPDATE_CAMERABRIGHNESS_HTTP_API
  7. #define RVC_UPDATE_CAMERABRIGHNESS_HTTP_API "/api/unify/config/alter/exposure"
  8. #endif // !RVC_UPDATE_CAMERABRIGHNESS_HTTP_API
  9. #ifndef RVC_HTTPTIMEOUT
  10. #define RVC_HTTPTIMEOUT 20
  11. #endif // !RVC_HTTPTIMEOUT
  12. #define REFLECTION(var) #var
  13. typedef struct brightness_item_s {
  14. std::string module;
  15. std::string name;
  16. std::string value;
  17. }brightness_item_t;
  18. //brightness_info_t
  19. typedef struct brightness_info_s {
  20. CSimpleStringA strServerURL;
  21. CSimpleStringA strAPI;
  22. CSimpleStringA strTerminalNo;
  23. CSimpleStringA strAppVersion;
  24. CSimpleStringA strBranchNo;
  25. vector<brightness_item_t*> vBrightnessList;
  26. }brightness_info_t;
  27. struct BrightnessInfoHTTPReq : CHTTPReq {
  28. std::string m_reqContent;
  29. virtual string ToJson() {
  30. return m_reqContent;
  31. }
  32. };
  33. struct BrightnessInfoHTTPRet : CHTTPRet {
  34. std::string m_request;
  35. bool m_success;
  36. std::string m_code;
  37. std::string m_message;
  38. std::string m_returnCode;
  39. std::string m_errorMsg;
  40. bool m_data;
  41. virtual bool Parse(string strData) {
  42. Json::Value root;
  43. Json::Reader reader;
  44. if (reader.parse(strData, root, false)) {
  45. m_success = root[REFLECTION(success)].asBool();
  46. m_code = root[REFLECTION(code)].asString();
  47. m_message = root[REFLECTION(message)].asString();
  48. m_returnCode = root[REFLECTION(return_code)].asString();
  49. m_errorMsg = root[REFLECTION(error_msg)].asString();
  50. m_data = root[REFLECTION(data)].asBool();
  51. }
  52. else {
  53. m_success = false;
  54. }
  55. return m_success;
  56. }
  57. };
  58. int post_camera_brightness_info_list(unsigned int& uposttime, CSimpleStringA& errormsg, brightness_info_t* pinfo, int itimeout, bool bprintdbg);
  59. #endif