123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- /*
- * @Description:
- * @Version: 1.0
- * @Autor: lishengyin
- * @Date: 2021-11-03 14:08:44
- * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
- * @LastEditTime: 2022-07-10 18:05:12
- */
- #pragma once
- #include <iostream>
- #include <time.h>
- #include <ctime>
- #include "Util/logger.h"
- #include "Util/NoticeCenter.h"
- #include "Util/SqlPool.h"
- #include "Network/TcpClient.h"
- #include "Poller/Timer.h"
- #include "inifile.h"
- #include "Notices.h"
- #include "md5.h"
- #include "NettyHttpResultMsg.h"
- #include "NettyHttpToken.h"
- #include "NettyHttpNull.h"
- #include "NettyHttpCarInfo.h"
- #include "NettyHttpPeakValleyConfig.h"
- #include "NettyHttpCrowdingDegreeConfig.h"
- #include "NettyHttpDeviceConfig.h"
- #include "uuid.hpp"
- using namespace std;
- using namespace utility;
- namespace gsd_ds
- {
- class HttpClient
- {
- private:
- // 用户名
- std::string account;
- std::string pwd = "sunwin20211102";
- // 固定16位私钥
- std::string privateKey = "mwWAH2eUAAHodlRt";
- // authToken
- std::string authToken = "";
- // refreshToken
- std::string refreshToken = "";
-
- public:
- HttpClient();
- ~HttpClient();
- using Ptr = std::shared_ptr<HttpClient>;
- /**
- * @description: 初始化
- * @param {string} account
- * @param {string} url
- * @param {int} port
- * @return {*}
- */
- int32_t Init(std::string account,std::string url, int port);
- /**
- * @description: 创建对象
- * @param {*}
- * @return {*}
- */
- static std::shared_ptr<HttpClient> CreateNew();
- /**
- * @description: 发送Post请求
- * @param {*}
- * @return {*}
- */
- int8_t Post_Bird(std::string& json);
- /**
- * @description: 获取时间
- * @param {char} *ctime
- * @return {*}
- */
- static void getDataTime(char *ctime);
- /**
- * @description: 判断是否获取到Token
- * @param {*}
- * @return {*}
- */
- bool alive();
- /**
- * @description: 控制设备
- * @param {*}
- * @return {*}
- */
- int8_t ControlDev(std::string commandCode);
-
- };
- } // namespace name
|