mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
新增http、mqtt运行库,实现mqtt功能, 新增spdlog
This commit is contained in:
54
src/main.cpp
54
src/main.cpp
@@ -19,45 +19,27 @@
|
||||
#include "pv/PvUser.h"
|
||||
|
||||
#include "rlsocket.h"
|
||||
#include "protocol/HttpEntity.h"
|
||||
#include "common/Spdlogger.h"
|
||||
|
||||
enum EAA
|
||||
{
|
||||
A = 1,
|
||||
B = 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define wsa rlwsa
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
EAA aa = EAA(100);
|
||||
std::cout << aa;
|
||||
|
||||
std::thread([]() {
|
||||
while (1) {
|
||||
HttpEntity http;
|
||||
http.listen("0.0.0.0", 19800);
|
||||
}
|
||||
}).detach();
|
||||
|
||||
|
||||
|
||||
// 设置控制台输出为 UTF-8 编码
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
// 设置控制台输入为 UTF-8 编码(如果需要输入中文)
|
||||
SetConsoleCP(CP_UTF8);
|
||||
|
||||
{
|
||||
|
||||
NJsonNode jsonroot;
|
||||
NJson::parse(R"({"name": "Alice", "age": 25, "data":[["1","1","1"],["1","1","1"],["1","1","1"]]})", jsonroot);
|
||||
std::cout << (jsonroot.is_null() ? "ERROR" : "OK") << std::endl;
|
||||
|
||||
std::vector<std::vector<std::string>> v1;
|
||||
NJson::read<std::vector<std::vector<std::string>>>(jsonroot, "data", v1);
|
||||
|
||||
std::vector<std::vector<std::string>> vec = {
|
||||
{"1", "1", "1", "1", "1", "1", "1", "1"},
|
||||
{"1", "1", "1", "1", "1", "1", "1", "1"},
|
||||
{"1", "1", "1", "1", "1", "1", "1", "1"},
|
||||
{"1", "1", "1", "1", "1", "1", "1", "1"},
|
||||
{"1", "1", "1", "1", "1", "1", "1", "1"}
|
||||
@@ -70,14 +52,23 @@ int main(int argc, char** argv)
|
||||
jsonroot1["price_off_peak"] = 0.53;
|
||||
jsonroot1["periods"] = vec;
|
||||
|
||||
std::cout << jsonroot1.dump();
|
||||
std::cout << jsonroot1.dump() << std::endl;
|
||||
}
|
||||
|
||||
std::map<int, bool> mapT;
|
||||
bool ff = mapT[1];
|
||||
// 设置控制台输出为 UTF-8 编码
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
// 设置控制台输入为 UTF-8 编码(如果需要输入中文)
|
||||
SetConsoleCP(CP_UTF8);
|
||||
|
||||
rlwsa();
|
||||
rlSocket socket("127.0.0.1", 19801, 1);
|
||||
Spdlogger::init(spdlog::level::debug, "");
|
||||
spdlog::info("[main] start ... ====================================================================================================");
|
||||
spdlog::info("spd info");
|
||||
spdlog::debug("spd debug");
|
||||
spdlog::error("spd error");
|
||||
|
||||
|
||||
//rlwsa();
|
||||
//rlSocket socket("127.0.0.1", 19801, 1);
|
||||
//int ret = socket.connect();
|
||||
//std::string s1 = "helloworld";
|
||||
//socket.write(s1.c_str(), s1.size());
|
||||
@@ -91,7 +82,6 @@ int main(int argc, char** argv)
|
||||
// std::cout << "===>>> " << std::string(buf.begin(), buf.end());
|
||||
// }
|
||||
//}
|
||||
std::cout << "===>>> main start ... " << std::endl;
|
||||
|
||||
////std::cout << Snowflake::instance().getId() << std::endl;
|
||||
//for (int i = 0; i<=10; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user