HttpClient.h 3.0 KB

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