新增了PQDIF补招线程,导入了新的lib库
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "client2.h"
|
||||
|
||||
#include "cloudfront/code/interface.h"
|
||||
#include "pqdif_thread_processor.h"
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
@@ -35,7 +36,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
extern std::atomic<int> INITFLAG;//̨<>˵ȳ<CBB5>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD>־
|
||||
//extern void cleanup_args(ThreadArgs* args);
|
||||
//extern void cleanup_args(ThreadArgs* args);00:B7:8D:A8:00:D6 00:B7:8D:00:A9:03
|
||||
|
||||
void init_daemon(void)
|
||||
{
|
||||
@@ -66,53 +67,9 @@ void init_daemon(void)
|
||||
thread_info_t thread_info[THREAD_CONNECTIONS]; // <20>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER; // ȫ<>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
extern SafeMessageQueue message_queue;
|
||||
// <20><><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>װ<EFBFBD><EFBFBD>
|
||||
std::vector<DeviceInfo> generate_test_devices(int count) {
|
||||
std::vector<DeviceInfo> devices;
|
||||
|
||||
for (int i = 1; i <= count; ++i) {
|
||||
// <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::string dev_id = "D" + std::to_string(1000 + i).substr(1); // D001, D002, ..., D100
|
||||
std::string dev_name = "Device " + std::to_string(i);
|
||||
|
||||
// <20><><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>
|
||||
std::vector<PointInfo> points = {
|
||||
{
|
||||
"P" + dev_id.substr(1) + "01", // <20><><EFBFBD><EFBFBD>ID<49><44> P00101
|
||||
"Voltage " + dev_name,
|
||||
dev_id,
|
||||
1,
|
||||
0.0, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹֵ
|
||||
0.0,
|
||||
100.0,
|
||||
80.0
|
||||
},
|
||||
{
|
||||
"P" + dev_id.substr(1) + "02", // <20><><EFBFBD><EFBFBD>ID<49><44> P00102
|
||||
"Current " + dev_name,
|
||||
dev_id,
|
||||
2,
|
||||
0.0, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
0.0,
|
||||
20.0,
|
||||
15.0
|
||||
}
|
||||
};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>
|
||||
devices.push_back({
|
||||
dev_id,
|
||||
dev_name,
|
||||
(i % 2 == 0) ? "Model-X" : "Model-Y", // <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD>
|
||||
"00-B7-8D-A8-00-D6", // <20><><EFBFBD><EFBFBD>MAC<41><43>ַ
|
||||
1, // ״̬ (1=<3D><><EFBFBD><EFBFBD>)
|
||||
points
|
||||
});
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
bool PQD_FLAG = false;//pqd<71>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ <20>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD>߳<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD>
|
||||
|
||||
//̨<>˴<EFBFBD>ӡ
|
||||
void PrintDevices(const std::vector<DeviceInfo>& devices) {
|
||||
std::cout << "==== Devices List (" << devices.size() << ") ====\n";
|
||||
for (const auto& dev : devices) {
|
||||
@@ -139,7 +96,7 @@ void PrintDevices(const std::vector<DeviceInfo>& devices) {
|
||||
}
|
||||
}
|
||||
|
||||
/* <20>̹߳<DFB3><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>*/
|
||||
/* <20>̹߳<DFB3><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>*/
|
||||
/* <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>̺߳<DFB3><CCBA><EFBFBD>*/
|
||||
void* client_manager_thread(void* arg) {
|
||||
int index = *(int*)arg;
|
||||
@@ -171,9 +128,6 @@ void* client_manager_thread(void* arg) {
|
||||
// }
|
||||
//};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>100<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>
|
||||
//std::vector<DeviceInfo> test_devices = generate_test_devices(100);
|
||||
|
||||
//lnk<6E><6B>̨<EFBFBD>˶<EFBFBD>ȡ<EFBFBD>豸
|
||||
std::vector<DeviceInfo> devices = GenerateDeviceInfoFromLedger(terminal_devlist);//lnk<6E><6B><EFBFBD><EFBFBD>
|
||||
|
||||
@@ -192,7 +146,7 @@ void* client_manager_thread(void* arg) {
|
||||
pthread_mutex_unlock(&thread_info[index].lock);
|
||||
return NULL;
|
||||
}
|
||||
/* <20>̹߳<DFB3><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>*/
|
||||
/* <20>̹߳<DFB3><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>*/
|
||||
/* <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>̺߳<DFB3><CCBA><EFBFBD> */
|
||||
void* message_processor_thread(void* arg) {
|
||||
int index = *(int*)arg;
|
||||
@@ -230,6 +184,39 @@ void* message_processor_thread(void* arg) {
|
||||
pthread_mutex_unlock(&thread_info[index].lock);
|
||||
return NULL;
|
||||
}
|
||||
/* <20>̹߳<DFB3><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3<><33><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>*/
|
||||
/* PQDIF<49><46><EFBFBD><EFBFBD><EFBFBD>̺߳<DFB3><CCBA><EFBFBD>*/
|
||||
void* pqd_thread(void* arg)
|
||||
{
|
||||
int index = *(int*)arg;
|
||||
free(arg);
|
||||
|
||||
pthread_mutex_lock(&thread_info[index].lock);
|
||||
printf("PQDIF Thread %d started\n", index);
|
||||
thread_info[index].state = THREAD_RUNNING;
|
||||
pthread_mutex_unlock(&thread_info[index].lock);
|
||||
|
||||
try
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> PQDIF ɨ<><C9A8><EFBFBD>߳<EFBFBD>
|
||||
RunPqdifScanLoop();
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
printf("PQDIF Thread %d exception: %s\n", index, ex.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
printf("PQDIF Thread %d exception: unknown\n", index);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&thread_info[index].lock);
|
||||
thread_info[index].state = THREAD_STOPPED;
|
||||
printf("PQDIF Thread %d stopped\n", index);
|
||||
pthread_mutex_unlock(&thread_info[index].lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* <20>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
void restart_thread(int index) {
|
||||
|
||||
@@ -270,7 +257,7 @@ void restart_thread(int index) {
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
}
|
||||
} else if (index == 1) {
|
||||
} else if (index == 1 && !PQD_FLAG) {
|
||||
// <20>ͻ<EFBFBD><CDBB>˹<EFBFBD><CBB9><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
int* new_index = (int*)malloc(sizeof(int));
|
||||
if (!new_index) {
|
||||
@@ -282,15 +269,14 @@ void restart_thread(int index) {
|
||||
}
|
||||
*new_index = index;
|
||||
|
||||
if (pthread_create(&thread_info[index].tid, NULL,
|
||||
client_manager_thread, new_index) != 0) {
|
||||
if (pthread_create(&thread_info[index].tid, NULL,client_manager_thread, new_index) != 0) {
|
||||
pthread_mutex_lock(&global_lock);
|
||||
printf("Failed to restart client manager thread %d\n", index);
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
free(new_index); // ʧ<>ܲ<EFBFBD><DCB2>Լ<EFBFBD> free<65><65><EFBFBD>ɹ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>߳<EFBFBD><DFB3><EFBFBD> free
|
||||
}
|
||||
} else if (index == 2) {
|
||||
} else if (index == 2 && !PQD_FLAG) {
|
||||
// <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
int* new_index = (int*)malloc(sizeof(int));
|
||||
if (!new_index) {
|
||||
@@ -302,61 +288,36 @@ void restart_thread(int index) {
|
||||
}
|
||||
*new_index = index;
|
||||
|
||||
if (pthread_create(&thread_info[index].tid, NULL,
|
||||
message_processor_thread, new_index) != 0) {
|
||||
if (pthread_create(&thread_info[index].tid, NULL,message_processor_thread, new_index) != 0) {
|
||||
pthread_mutex_lock(&global_lock);
|
||||
printf("Failed to restart message processor thread %d\n", index);
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
free(new_index);
|
||||
}
|
||||
} else if(index == 3 && PQD_FLAG){
|
||||
//PQDIF<49><46><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD> <20><><EFBFBD><EFBFBD><E0B9A4><EFBFBD>̲߳<DFB3><CCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int* new_index = (int*)malloc(sizeof(int));
|
||||
if (!new_index) {
|
||||
pthread_mutex_lock(&global_lock);
|
||||
printf("Failed to malloc for message processor thread %d\n", index);
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
return;
|
||||
}
|
||||
*new_index = index;
|
||||
|
||||
if (pthread_create(&thread_info[index].tid, NULL, pqd_thread, new_index) != 0) {
|
||||
pthread_mutex_lock(&global_lock);
|
||||
printf("Failed to restart message processor thread %d\n", index);
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
free(new_index);
|
||||
}
|
||||
|
||||
} else {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
}
|
||||
|
||||
/*// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
int* new_index = (int*)malloc(sizeof(int));
|
||||
*new_index = index;
|
||||
|
||||
if (index == 1) {
|
||||
// <20>ͻ<EFBFBD><CDBB>˹<EFBFBD><CBB9><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
if (pthread_create(&thread_info[index].tid, NULL, client_manager_thread, new_index) != 0) {
|
||||
pthread_mutex_lock(&global_lock);
|
||||
printf("Failed to restart client manager thread %d\n", index);
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
free(new_index);
|
||||
}
|
||||
}
|
||||
else if (index == 2) {
|
||||
// <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
if (pthread_create(&thread_info[index].tid, NULL, message_processor_thread, new_index) != 0) {
|
||||
pthread_mutex_lock(&global_lock);
|
||||
printf("Failed to restart message processor thread %d\n", index);
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
free(new_index);
|
||||
}
|
||||
}
|
||||
else if (index == 0) {
|
||||
// <20>ӿڣ<D3BF>mq
|
||||
//char* argv[] = { (char*)new_index };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̺Ų<CCBA><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// ThreadArgs* args = new ThreadArgs{1, argv};
|
||||
if (pthread_create(&thread_info[index].tid, NULL, cloudfrontthread, new_index) != 0) {
|
||||
pthread_mutex_lock(&global_lock);
|
||||
printf("Failed to restart message processor thread %d\n", index);
|
||||
thread_info[index].state = THREAD_CRASHED;
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
//delete args; // <20><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6>ͷ<EFBFBD>
|
||||
free(new_index);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>ʵ<EFBFBD><CAB5>Ӧ<EFBFBD><D3A6><EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
/* <20>̴߳<DFB3><CCB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
@@ -364,16 +325,6 @@ int is_thread_alive(pthread_t tid) {
|
||||
return pthread_tryjoin_np(tid, NULL) == EBUSY; // EBUSY<53><59>ʾ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
//lnk<6E><6B><EFBFBD><EFBFBD>
|
||||
/*ThreadArgs* make_thread_args_from_strs(const std::vector<std::string>& args_vec) {
|
||||
char** argv = new char*[args_vec.size() + 1]; // <20><>һ<EFBFBD><D2BB> nullptr <20><>β
|
||||
for (size_t i = 0; i < args_vec.size(); ++i) {
|
||||
argv[i] = strdup(args_vec[i].c_str()); // strdup <20><> malloc <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
argv[args_vec.size()] = nullptr;
|
||||
return new ThreadArgs{static_cast<int>(args_vec.size()), argv};
|
||||
}*/
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
int main(int argc ,char** argv) {//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD>
|
||||
if(!parse_param(argc,argv)){
|
||||
@@ -407,29 +358,26 @@ int main(int argc ,char** argv) {//
|
||||
int* index = (int*)malloc(sizeof(int));
|
||||
*index = i;
|
||||
|
||||
if (i == 1) {
|
||||
if (i == 1 && !PQD_FLAG) {
|
||||
// <20>ͻ<EFBFBD><CDBB>˹<EFBFBD><CBB9><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
if (pthread_create(&thread_info[i].tid, NULL, client_manager_thread, index) != 0) {
|
||||
if (pthread_create(&thread_info[i].tid, NULL, client_manager_thread, index) != 0 ) {
|
||||
printf("Failed to create client manager thread %d\n", i);
|
||||
free(index);
|
||||
}
|
||||
}
|
||||
else if (i == 2) {
|
||||
else if (i == 2 && !PQD_FLAG) {
|
||||
// <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
if (pthread_create(&thread_info[i].tid, NULL, message_processor_thread, index) != 0) {
|
||||
if (pthread_create(&thread_info[i].tid, NULL, message_processor_thread, index) != 0 ) {
|
||||
printf("Failed to create message processor thread %d\n", i);
|
||||
free(index);
|
||||
}
|
||||
}
|
||||
else if (i == 3){
|
||||
/*//<2F>ӿں<D3BF>mq
|
||||
char* argv[] = { (char*)index };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̺Ų<CCBA><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ThreadArgs* args = new ThreadArgs{1, argv};
|
||||
if (pthread_create(&thread_info[i].tid, NULL, cloudfrontthread, args) != 0) {
|
||||
printf("Failed to create message processor thread %d\n", i);
|
||||
delete args; // <20><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6>ͷ<EFBFBD>
|
||||
else if (i == 3 && PQD_FLAG){
|
||||
//PQDIF<49><46><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><E0B9A4><EFBFBD>߳<EFBFBD>ֹͣ
|
||||
if (pthread_create(&thread_info[i].tid, NULL, pqd_thread, index) != 0) {
|
||||
printf("Failed to create pqd_thread %d\n", i);
|
||||
free(index);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
@@ -465,59 +413,12 @@ int main(int argc ,char** argv) {//
|
||||
}
|
||||
}
|
||||
|
||||
/*// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<PointInfo> points2 = {
|
||||
{"P101", "Generator Output", "D002",1 ,1, 1, 1, 1,"0.38k",0}
|
||||
};
|
||||
//00B78DA800D6 00-B7-8D-01-79-06 00-B7-8D-A8-00-D6
|
||||
// <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>б<EFBFBD>
|
||||
std::vector<DeviceInfo> devices = {
|
||||
{
|
||||
"D002", "Backup Device", "Model-Y", "00-B7-8D-A8-00-D6",
|
||||
1, points2,true
|
||||
}
|
||||
};*/
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//std::vector<PointInfo> points1 = {
|
||||
// {"P001", "Main Voltage", "D001",1 ,1, 1, 1, 1,"0.38k",0},
|
||||
// {"P002", "Backup Voltage", "D001",2 ,1, 1, 1, 1,"0.38k",0}
|
||||
//};
|
||||
//std::vector<PointInfo> points2 = {
|
||||
// {"P003", "Main Voltage", "D002",1 ,1, 1, 1, 1,"0.38k",0},
|
||||
// {"P004", "Backup Voltage", "D002",2 ,1, 1, 1, 1,"0.38k",0}
|
||||
//};
|
||||
////00B78DA800D6 00-B7-8D-01-79-06 00-B7-8D-A8-00-D6 00-B7-8D-01-71-09 00-B7-8D-01-88-7f
|
||||
//// <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD>б<EFBFBD>
|
||||
//std::vector<DeviceInfo> devices = {
|
||||
// {
|
||||
// "D001", "Primary Device", "Model-X", "00-B7-8D-01-88-7f",
|
||||
// 1, points1,true
|
||||
// },
|
||||
// {
|
||||
// "D002", "Primary Device1", "Model-X1", "00-B7-8D-01-71-09",
|
||||
// 1, points2,true
|
||||
// }
|
||||
//};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>socket<65><74><EFBFBD><EFBFBD>״̬
|
||||
static int queue_monitor = 0;
|
||||
static bool flag = false;
|
||||
//static int count = 3;
|
||||
if (++queue_monitor >= 60) { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>豸
|
||||
if (++queue_monitor >= 60) {
|
||||
printf("Message queue size: %zu\n", message_queue.size());
|
||||
queue_monitor = 0;
|
||||
/*if (flag) {
|
||||
flag = false;
|
||||
for (const auto& device : devices) {
|
||||
ClientManager::instance().add_device(device);
|
||||
}
|
||||
}
|
||||
else {
|
||||
flag = true;
|
||||
ClientManager::instance().remove_device("D001");
|
||||
ClientManager::instance().remove_device("D002");
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user