HttpClient.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2021-11-03 14:08:44
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-10-09 09:14:16
  8. */
  9. #pragma once
  10. #include <iostream>
  11. #include <time.h>
  12. #include <ctime>
  13. #include "Util/logger.h"
  14. #include "Util/NoticeCenter.h"
  15. #include "Poller/EventPoller.h"
  16. #include "Util/SqlPool.h"
  17. #include "Network/TcpClient.h"
  18. #include "Poller/Timer.h"
  19. #include "TCPClient.h"
  20. #include "inifile.h"
  21. #include "Notices.h"
  22. #include "md5.h"
  23. #include "NettyHttpResultMsg.h"
  24. #include "NettyHttpToken.h"
  25. #include "NettyHttpNull.h"
  26. #include "NettyHttpCarInfo.h"
  27. #include "NettyHttpPeakValleyConfig.h"
  28. #include "NettyHttpCrowdingDegreeConfig.h"
  29. #include "NettyHttpDeviceConfig.h"
  30. using namespace std;
  31. namespace MIVA
  32. {
  33. class HttpClient
  34. {
  35. private:
  36. // 用户名
  37. std::string account;
  38. std::string pwd = "sunwin20211102";
  39. // 固定16位私钥
  40. std::string privateKey = "mwWAH2eUAAHodlRt";
  41. // authToken
  42. std::string authToken = "";
  43. // refreshToken
  44. std::string refreshToken = "";
  45. public:
  46. HttpClient();
  47. ~HttpClient();
  48. /**
  49. * @description: 初始化
  50. * @param {string} account
  51. * @param {string} url
  52. * @param {int} port
  53. * @return {*}
  54. */
  55. int32_t Init(std::string account,std::string url, int port);
  56. /**
  57. * @description: 创建对象
  58. * @param {*}
  59. * @return {*}
  60. */
  61. static std::shared_ptr<HttpClient> CreateNew();
  62. /**
  63. * @description: 登录
  64. * @param {*}
  65. * @return {*}
  66. */
  67. int32_t LoginNetty();
  68. /**
  69. * @description: 获取用户数据
  70. * @param {*}
  71. * @return {*}
  72. */
  73. int32_t GetUserData();
  74. /**
  75. * @description: 获取峰谷配置列表
  76. * @param {*}
  77. * @return {*}
  78. */
  79. int32_t GetPeakValleyConfig();
  80. /**
  81. * @description: 获取拥挤配置
  82. * @param {*}
  83. * @return {*}
  84. */
  85. int32_t GetCrowdingDegreeConfig();
  86. /**
  87. * @description: 获取摄像头设置
  88. * @param {*}
  89. * @return {*}
  90. */
  91. int32_t GetVideoConfig();
  92. /**
  93. * @description: 获取系统设置
  94. * @param {*}
  95. * @return {*}
  96. */
  97. int32_t GetSystemConfig();
  98. /**
  99. * @description: 获取时间
  100. * @param {char} *ctime
  101. * @return {*}
  102. */
  103. static void getDataTime(char *ctime);
  104. /**
  105. * @description: 判断是否获取到Token
  106. * @param {*}
  107. * @return {*}
  108. */
  109. bool alive();
  110. };
  111. } // namespace name