Compare commits

...

3 Commits

@ -0,0 +1,4 @@
 | FileName | Status | FileSize | TotalTime(sec) | Upload(sec) | Submit(sec) | SignWait(sec) | Retry Count |
|---------------------------|--------|----------|----------------|-------------|-------------|---------------|-------------|
| onnxruntime.dll | Pass | 7.99MB | 73.78 | 1.01 | 0.46 | 72.3 | 0 |
| time_providers_shared.dll | Pass | 11.5KB | 53.29 | 0.51 | 0.34 | 51.81 | 0 |

@ -0,0 +1 @@
b353e0b41d588605958b03f9a223d10a2fbeb514

@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,21 @@
# Privacy
## Data Collection
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
***
### Private Builds
No data collection is performed when using your private builds built from source code.
### Official Builds
ONNX Runtime does not maintain any independent telemetry collection mechanisms outside of what is provided by the platforms it supports. However, where applicable, ONNX Runtime will take advantage of platform-supported telemetry systems to collect trace events with the goal of improving product quality.
Currently telemetry is only implemented for Windows builds and is turned **ON** by default in the official builds distributed in their respective package management repositories ([see here](../README.md#binaries)). This may be expanded to cover other platforms in the future. Data collection is implemented via 'Platform Telemetry' per vendor platform providers (see [telemetry.h](../onnxruntime/core/platform/telemetry.h)).
#### Technical Details
The Windows provider uses the [TraceLogging](https://docs.microsoft.com/en-us/windows/win32/tracelogging/trace-logging-about) API for its implementation. This enables ONNX Runtime trace events to be collected by the operating system, and based on user consent, this data may be periodically sent to Microsoft servers following GDPR and privacy regulations for anonymity and data access controls.
Windows ML and onnxruntime C APIs allow Trace Logging to be turned on/off (see [API pages](../README.md#api-documentation) for details).
For information on how to enable and disable telemetry, see [C API: Telemetry](./C_API.md#telemetry).
There are equivalent APIs in the C#, Python, and Java language bindings as well.

@ -0,0 +1,52 @@
<p align="center"><img width="50%" src="docs/images/ONNX_Runtime_logo_dark.png" /></p>
**ONNX Runtime is a cross-platform inference and training machine-learning accelerator**.
**ONNX Runtime inference** can enable faster customer experiences and lower costs, supporting models from deep learning frameworks such as PyTorch and TensorFlow/Keras as well as classical machine learning libraries such as scikit-learn, LightGBM, XGBoost, etc. ONNX Runtime is compatible with different hardware, drivers, and operating systems, and provides optimal performance by leveraging hardware accelerators where applicable alongside graph optimizations and transforms. [Learn more &rarr;](https://www.onnxruntime.ai/docs/#onnx-runtime-for-inferencing)
**ONNX Runtime training** can accelerate the model training time on multi-node NVIDIA GPUs for transformer models with a one-line addition for existing PyTorch training scripts. [Learn more &rarr;](https://www.onnxruntime.ai/docs/#onnx-runtime-for-training)
## Get Started
**General Information**: [onnxruntime.ai](https://onnxruntime.ai)
**Usage documention and tutorials**: [onnxruntime.ai/docs](https://onnxruntime.ai/docs)
**Companion sample repositories**:
- ONNX Runtime Inferencing: [microsoft/onnxruntime-inference-examples](https://github.com/microsoft/onnxruntime-inference-examples)
- ONNX Runtime Training: [microsoft/onnxruntime-training-examples](https://github.com/microsoft/onnxruntime-training-examples)
## Build Pipeline Status
|System|CPU|GPU|EPs|
|---|---|---|---|
|Windows|[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Windows%20CPU%20CI%20Pipeline?label=Windows+CPU)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=9)|[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Windows%20GPU%20CI%20Pipeline?label=Windows+GPU)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=10)|[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Windows%20GPU%20TensorRT%20CI%20Pipeline?label=Windows+GPU+TensorRT)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=47)|
|Linux|[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Linux%20CPU%20CI%20Pipeline?label=Linux+CPU)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=11)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Linux%20CPU%20Minimal%20Build%20E2E%20CI%20Pipeline?label=Linux+CPU+Minimal+Build)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=64)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Linux%20CPU%20x64%20NoContribops%20CI%20Pipeline?label=Linux+CPU+x64+No+Contrib+Ops)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=110)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/centos7_cpu?label=Linux+CentOS7)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=78)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/orttraining-linux-ci-pipeline?label=Linux+CPU+Training)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=86)|[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Linux%20GPU%20CI%20Pipeline?label=Linux+GPU)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=12)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Linux%20GPU%20TensorRT%20CI%20Pipeline?label=Linux+GPU+TensorRT)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=45)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/orttraining-distributed?label=Distributed+Training)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=140)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/orttraining-linux-gpu-ci-pipeline?label=Linux+GPU+Training)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=84)|[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Linux%20OpenVINO%20CI%20Pipeline?label=Linux+OpenVINO)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=55)|
|Mac|[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/MacOS%20CI%20Pipeline?label=MacOS+CPU)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=13)<br>[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/MacOS%20NoContribops%20CI%20Pipeline?label=MacOS+NoContribops)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=65)|||
|Android|||[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Android%20CI%20Pipeline?label=Android)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=53)|
|iOS|||[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/iOS%20CI%20Pipeline?label=iOS)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=134)|
|WebAssembly|||[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Windows%20WebAssembly%20CI%20Pipeline?label=WASM)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=161)|
## Data/Telemetry
Windows distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the [privacy statement](docs/Privacy.md) for more details.
## Contributions and Feedback
We welcome contributions! Please see the [contribution guidelines](CONTRIBUTING.md).
For feature requests or bug reports, please file a [GitHub Issue](https://github.com/Microsoft/onnxruntime/issues).
For general discussion or questions, please use [GitHub Discussions](https://github.com/microsoft/onnxruntime/discussions).
## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## License
This project is licensed under the [MIT License](LICENSE).

File diff suppressed because it is too large Load Diff

@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "onnxruntime_c_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \param use_arena zero: false. non-zero: true.
*/
ORT_EXPORT
ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CPU, _In_ OrtSessionOptions* options, int use_arena)
ORT_ALL_ARGS_NONNULL;
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
/*
* This file defines RunOptions Config Keys and format of the Config Values.
*
* The Naming Convention for a RunOptions Config Key,
* "[Area][.[SubArea1].[SubArea2]...].[Keyname]"
* Such as "ep.cuda.use_arena"
* The Config Key cannot be empty
* The maximum length of the Config Key is 128
*
* The string format of a RunOptions Config Value is defined individually for each Config.
* The maximum length of the Config Value is 1024
*/
// Key for enabling shrinkages of user listed device memory arenas.
// Expects a list of semi-colon separated key value pairs separated by colon in the following format:
// "device_0:device_id_0;device_1:device_id_1"
// No white-spaces allowed in the provided list string.
// Currently, the only supported devices are : "cpu", "gpu" (case sensitive).
// If "cpu" is included in the list, DisableCpuMemArena() API must not be called (i.e.) arena for cpu should be enabled.
// Example usage: "cpu:0;gpu:0" (or) "gpu:0"
// By default, the value for this key is empty (i.e.) no memory arenas are shrunk
static const char* const kOrtRunOptionsConfigEnableMemoryArenaShrinkage = "memory.enable_memory_arena_shrinkage";

@ -0,0 +1,144 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
/*
* This file defines SessionOptions Config Keys and format of the Config Values.
*
* The Naming Convention for a SessionOptions Config Key,
* "[Area][.[SubArea1].[SubArea2]...].[Keyname]"
* Such as "ep.cuda.use_arena"
* The Config Key cannot be empty
* The maximum length of the Config Key is 128
*
* The string format of a SessionOptions Config Value is defined individually for each Config.
* The maximum length of the Config Value is 1024
*/
// Key for disable PrePacking,
// If the config value is set to "1" then the prepacking is disabled, otherwise prepacking is enabled (default value)
static const char* const kOrtSessionOptionsConfigDisablePrepacking = "session.disable_prepacking";
// A value of "1" means allocators registered in the env will be used. "0" means the allocators created in the session
// will be used. Use this to override the usage of env allocators on a per session level.
static const char* const kOrtSessionOptionsConfigUseEnvAllocators = "session.use_env_allocators";
// Set to 'ORT' (case sensitive) to load an ORT format model.
// If unset, model type will default to ONNX unless inferred from filename ('.ort' == ORT format) or bytes to be ORT
static const char* const kOrtSessionOptionsConfigLoadModelFormat = "session.load_model_format";
// Set to 'ORT' (case sensitive) to save optimized model in ORT format when SessionOptions.optimized_model_path is set.
// If unset, format will default to ONNX unless optimized_model_filepath ends in '.ort'.
static const char* const kOrtSessionOptionsConfigSaveModelFormat = "session.save_model_format";
// If a value is "1", flush-to-zero and denormal-as-zero are applied. The default is "0".
// When multiple sessions are created, a main thread doesn't override changes from succeeding session options,
// but threads in session thread pools follow option changes.
// When ORT runs with OpenMP, the same rule is applied, i.e. the first session option to flush-to-zero and
// denormal-as-zero is only applied to global OpenMP thread pool, which doesn't support per-session thread pool.
// Note that an alternative way not using this option at runtime is to train and export a model without denormals
// and that's recommended because turning this option on may hurt model accuracy.
static const char* const kOrtSessionOptionsConfigSetDenormalAsZero = "session.set_denormal_as_zero";
// It controls to run quantization model in QDQ (QuantizelinearDeQuantizelinear) format or not.
// "0": enable. ORT does fusion logic for QDQ format.
// "1": disable. ORT doesn't do fusion logic for QDQ format.
// Its default value is "0"
static const char* const kOrtSessionOptionsDisableQuantQDQ = "session.disable_quant_qdq";
// If set to "1", enables the removal of QuantizeLinear/DequantizeLinear node pairs once all QDQ handling has been
// completed. e.g. If after all QDQ handling has completed and we have -> FloatOp -> Q -> DQ -> FloatOp -> the
// Q -> DQ could potentially be removed. This will provide a performance benefit by avoiding going from float to
// 8-bit and back to float, but could impact accuracy. The impact on accuracy will be model specific and depend on
// other factors like whether the model was created using Quantization Aware Training or Post Training Quantization.
// As such, it's best to test to determine if enabling this works well for your scenario.
// The default value is "0"
// Available since version 1.11.
static const char* const kOrtSessionOptionsEnableQuantQDQCleanup = "session.enable_quant_qdq_cleanup";
// Enable or disable gelu approximation in graph optimization. "0": disable; "1": enable. The default is "0".
// GeluApproximation has side effects which may change the inference results. It is disabled by default due to this.
static const char* const kOrtSessionOptionsEnableGeluApproximation = "optimization.enable_gelu_approximation";
// Enable or disable using device allocator for allocating initialized tensor memory. "1": enable; "0": disable. The default is "0".
// Using device allocators means the memory allocation is made using malloc/new.
static const char* const kOrtSessionOptionsUseDeviceAllocatorForInitializers = "session.use_device_allocator_for_initializers";
// Configure whether to allow the inter_op/intra_op threads spinning a number of times before blocking
// "0": thread will block if found no job to run
// "1": default, thread will spin a number of times before blocking
static const char* const kOrtSessionOptionsConfigAllowInterOpSpinning = "session.inter_op.allow_spinning";
static const char* const kOrtSessionOptionsConfigAllowIntraOpSpinning = "session.intra_op.allow_spinning";
// Key for using model bytes directly for ORT format
// If a session is created using an input byte array contains the ORT format model data,
// By default we will copy the model bytes at the time of session creation to ensure the model bytes
// buffer is valid.
// Setting this option to "1" will disable copy the model bytes, and use the model bytes directly. The caller
// has to guarantee that the model bytes are valid until the ORT session using the model bytes is destroyed.
static const char* const kOrtSessionOptionsConfigUseORTModelBytesDirectly = "session.use_ort_model_bytes_directly";
/// <summary>
/// Key for using the ORT format model flatbuffer bytes directly for initializers.
/// This avoids copying the bytes and reduces peak memory usage during model loading and initialization.
/// Requires `session.use_ort_model_bytes_directly` to be true.
/// If set, the flatbuffer bytes provided when creating the InferenceSession MUST remain valid for the entire
/// duration of the InferenceSession.
/// </summary>
static const char* const kOrtSessionOptionsConfigUseORTModelBytesForInitializers =
"session.use_ort_model_bytes_for_initializers";
// This should only be specified when exporting an ORT format model for use on a different platform.
// If the ORT format model will be used on ARM platforms set to "1". For other platforms set to "0"
// Available since version 1.11.
static const char* const kOrtSessionOptionsQDQIsInt8Allowed = "session.qdqisint8allowed";
// x64 SSE4.1/AVX2/AVX512(with no VNNI) has overflow problem with quantizied matrix multiplication with U8S8.
// To avoid this we need to use slower U8U8 matrix multiplication instead. This option, if
// turned on, use slower U8U8 matrix multiplications. Only effective with AVX2 or AVX512
// platforms.
static const char* const kOrtSessionOptionsAvx2PrecisionMode = "session.x64quantprecision";
// Specifies how minimal build graph optimizations are handled in a full build.
// These optimizations are at the extended level or higher.
// Possible values and their effects are:
// "save": Save runtime optimizations when saving an ORT format model.
// "apply": Only apply optimizations available in a minimal build.
// ""/<unspecified>: Apply optimizations available in a full build.
// Available since version 1.11.
static const char* const kOrtSessionOptionsConfigMinimalBuildOptimizations =
"optimization.minimal_build_optimizations";
// Note: The options specific to an EP should be specified prior to appending that EP to the session options object in
// order for them to take effect.
// Specifies a list of stop op types. Nodes of a type in the stop op types and nodes downstream from them will not be
// run by the NNAPI EP.
// The value should be a ","-delimited list of op types. For example, "Add,Sub".
// If not specified, the default set of stop ops is used. To specify an empty stop ops types list and disable stop op
// exclusion, set the value to "".
static const char* const kOrtSessionOptionsConfigNnapiEpPartitioningStopOps = "ep.nnapi.partitioning_stop_ops";
// Enabling dynamic block-sizing for multithreading.
// With a positive value, thread pool will split a task of N iterations to blocks of size starting from:
// N / (num_of_threads * dynamic_block_base)
// As execution progresses, the size will decrease according to the diminishing residual of N,
// meaning the task will be distributed in smaller granularity for better parallelism.
// For some models, it helps to reduce the variance of E2E inference latency and boost performance.
// The feature will not function by default, specify any positive integer, e.g. "4", to enable it.
// Available since version 1.11.
static const char* const kOrtSessionOptionsConfigDynamicBlockBase = "session.dynamic_block_base";
// This option allows to decrease CPU usage between infrequent
// requests and forces any TP threads spinning stop immediately when the last of
// concurrent Run() call returns.
// Spinning is restarted on the next Run() call.
// Applies only to internal thread-pools
static const char* const kOrtSessionOptionsConfigForceSpinningStop = "session.force_spinning_stop";
// "1": all inconsistencies encountered during shape and type inference
// will result in failures.
// "0": in some cases warnings will be logged but processing will continue. The default.
// May be useful to expose bugs in models.
static const char* const kOrtSessionOptionsConfigStrictShapeTypeInference = "session.strict_shape_type_inference";

@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include <string>
#include <unordered_map>
#include <vector>
namespace onnxruntime {
// data types for execution provider options
using ProviderOptions = std::unordered_map<std::string, std::string>;
using ProviderOptionsVector = std::vector<ProviderOptions>;
using ProviderOptionsMap = std::unordered_map<std::string, ProviderOptions>;
} // namespace onnxruntime

@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "onnxruntime_c_api.h"
#ifdef __cplusplus
extern "C" {
#endif
ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Tensorrt, _In_ OrtSessionOptions* options, int device_id);
#ifdef __cplusplus
}
#endif

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <QDialog> #include <QDialog>
class CLog : public QObject class CLog : public QObject
{ {
Q_OBJECT Q_OBJECT

@ -3,13 +3,25 @@
#include <WS2tcpip.h> #include <WS2tcpip.h>
#include <stdio.h> #include <stdio.h>
#include <qtcpsocket.h> #include <qtcpsocket.h>
#include <PLCDevice.h>
#pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "ws2_32.lib")
extern PLCDevice* m_PLCTCPDevice;
extern PLCDevice* m_PLCDevice;
void threadSendTCP::init(SyncQueue<_TCPSendInfo>* p_TCP_Info_queue, std::string ip_, int port_) { void threadSendTCP::init(SyncQueue<_TCPSendInfo>* p_TCP_Info_queue, std::string ip_, int port_) {
ip = QString::fromStdString(ip_); ip = QString::fromStdString(ip_);
port = port_; port = port_;
qDebug() << "tcp ip:" << ip << "| tcp port:" << port; qDebug() << "tcp ip:" << ip << "| tcp port:" << port;
Local_TCP_Info_queue = p_TCP_Info_queue; Local_TCP_Info_queue = p_TCP_Info_queue;
#ifdef __TCPServer
tcpServer = new QTcpServer(this);
tcpServer->listen(QHostAddress::Any, port);// Equivalent to QHostAddress("127.0.0.1").
connect(tcpServer,SIGNAL(newConnection()),this,SLOT(onNewConnection()));
connect(mySocket, SIGNAL(connected()), this, SLOT(onClientConnected()));
connect(mySocket, SIGNAL(disconnected()), this, SLOT(onClientDisconnected()));
#endif
} }
void threadSendTCP::start_work() void threadSendTCP::start_work()
{ {
@ -19,42 +31,195 @@ void threadSendTCP::start_work()
void threadSendTCP::stop() void threadSendTCP::stop()
{ {
#ifdef __TCPServer
if (tcpServer->isListening())
tcpServer->close();
if(tcpServer) delete tcpServer;
#endif
#ifdef __TCPClient
mySocket->deleteLater();
if (mySocket) delete mySocket;
#endif
isLoop = false; isLoop = false;
// wait(); // wait();
delete mySocket;
} }
#ifdef __TCPClient
bool threadSendTCP::connectTCP() { bool threadSendTCP::connectTCP() {
mySocket = new QTcpSocket(); mySocket = new QTcpSocket();
// 取消已有的连接 // 取消已有的连接
mySocket->abort(); mySocket->abort();
// 连接服务器 // 连接服务器
mySocket->connectToHost(ip, port); mySocket->connectToHost(ip, port);
if (!mySocket->waitForConnected(30000)) { if (!mySocket->waitForConnected(100)) {
qDebug() << "connect failed!"; qDebug() << "connect failed!";
return false; return false;
} }
qDebug() << "connect successfully!"; qDebug() << "connect successfully!";
return true; return true;
} }
#endif
void threadSendTCP::run() void threadSendTCP::run()
{ {
try {
#ifdef __TCPClient
if (!connectTCP()) if (!connectTCP())
{
qDebug() << "TCP connect error!"; qDebug() << "TCP connect error!";
}
#endif
while (isLoop) { while (isLoop) {
_TCPSendInfo TCPSendInfo; _TCPSendInfo TCPSendInfo;
Local_TCP_Info_queue->take(TCPSendInfo); Local_TCP_Info_queue->take(TCPSendInfo);
num++; num++;
sendData(&TCPSendInfo, num); sendData(&TCPSendInfo, num);
#ifdef __TCPServer
if (ClientStatus == QAbstractSocket::ConnectedState)
{
sendData(&TCPSendInfo, num);
}
#endif
#ifdef __TCPClient
sendData(&TCPSendInfo, num);
#endif
//mySocket->write("Hello! here is tcp client!\n"); //mySocket->write("Hello! here is tcp client!\n");
//mySocket->flush(); //mySocket->flush();
} }
}
catch (const std::exception& e) {
// 注意std::exception通常不捕获由运行时错误引发的异常
// 但这里是为了演示catch块的结构
std::cerr << __FUNCTION__<<"捕获到异常: " << e.what() << std::endl;
}
catch (...) {
// 使用省略号(...)可以捕获所有类型的异常,这是一种通用的捕获方式
std::cerr << "捕获到未知类型的异常" << std::endl;
}
} }
void threadSendTCP::sendData(_TCPSendInfo* TCPSendInfo, int Num) { void threadSendTCP::sendData(_TCPSendInfo* TCPSendInfo, int Num) {
std::string fileName = TCPSendInfo->pics_name + ", " + QString::number(Num).toStdString();
std::string fileName = TCPSendInfo->pics_name;
QDateTime ts_start = QDateTime::currentDateTime();
#if defined(__TCPServer) || defined(__TCPClient)
mySocket->write(fileName.c_str()); mySocket->write(fileName.c_str());
char temp = num % 10;
mySocket->write((char*)&temp, sizeof(char));
mySocket->write("\n"); mySocket->write("\n");
mySocket->flush(); mySocket->flush();
#endif
#if defined(__ModebusServer) || defined(__ModebusClient)
std::vector<int> asciiVals = stringToAscii(fileName);
//mySocket->write(fileName.c_str());
/*int temp = num % 2;
if (temp == 1)
{
m_PLCDevice->write_bit_2_plc(10006, 1);
}
else
{
m_PLCDevice->write_bit_2_plc(10006, 0);
}*/
//mySocket->write((char*)&temp,sizeof(char));
//mySocket->write("\n");
//mySocket->flush();
//
//遍历发送
int val_[32] = {};
uint8_t high[17] = {};
uint8_t low[17] = {};
uint16_t val[17] = {};
int h = 0;
int l = 0;
for (int i = 0; i < asciiVals.size(); i++)
{
if (i % 2 == 0)
{
high[h] = asciiVals[i];
h++;
}
else
{
low[l] = asciiVals[i];
l++;
}
}
#endif
#ifdef __ModebusServer
//m_PLCTCPDevice->write_2_plc(40000, 70, (uint16_t*)&val_);//小盒
m_PLCTCPDevice->write_2_plc(40070, 70, (uint16_t*)&val_);//条盒
#endif
#ifdef __ModebusClient
for (int i = 0; i < sizeof(val) / sizeof(short); i++)
{
val[i] = (static_cast<uint16_t>(high[i]) << 8) | low[i];//组合高低字节
m_PLCTCPDevice->mapping->tab_registers[i] = val[i];
}
/*uint16_t da, dat, data, data_, data__;
da = m_PLCTCPDevice->mapping->tab_registers[13];
dat = m_PLCTCPDevice->mapping->tab_registers[14];
data = m_PLCTCPDevice->mapping->tab_registers[15];
data_ = m_PLCTCPDevice->mapping->tab_registers[16];
data__ = m_PLCTCPDevice->mapping->tab_registers[17];
uint8_t da8[2], dat8[2], data8[2], data8_[2], data8__[2];
Ui16ToUin8_P(da, da8);
Ui16ToUin8_P(dat, dat8);
Ui16ToUin8_P(data, data8);
Ui16ToUin8_P(data_, data8_);
Ui16ToUin8_P(data__, data8__);
string str[8];
str[0] = std::to_string(data8[0]);
str[1] = std::to_string(data8[1]);
str[2] = std::to_string(data8_[0]);
str[3] = std::to_string(data8__[0]);
str[4] = std::to_string(dat8[0]);
str[7] = std::to_string(da8[1]);
cout << "tcp_send_times:" << num << endl;
cout << "data:" << str[7] << str[4] << "." << str[0] << str[1] << str[2] << "_" << str[3] << endl;*/
#endif
}
//字符串转ASCII
std::vector<int> threadSendTCP::stringToAscii(const std::string& str)
{
std::vector<int> asciiValues;
for (char c : str) {
asciiValues.push_back(static_cast<int>(c));
}
return asciiValues;
}
#ifdef __TCPServer
void threadSendTCP::onNewConnection()
{
mySocket = tcpServer->nextPendingConnection(); //创建socket
qDebug() << "NewConnectionConnected";
ClientStatus = QAbstractSocket::ConnectedState;
}
void threadSendTCP::onClientConnected()
{
qDebug() << "ClientConnected";
}
void threadSendTCP::onClientDisconnected()
{
ClientStatus = QAbstractSocket::UnconnectedState;
qDebug() << "ClientDisconnected";
mySocket->deleteLater();
} }
#endif

@ -1,16 +1,20 @@
#pragma once #pragma once
#include "common.h"
#include <QWidget>
#include <QDebug> #include <QDebug>
#include <QDateTime> #include <QDateTime>
#include <iostream> #include <iostream>
#include <QThread> #include <QThread>
#include <qtcpsocket.h> #include <qtcpsocket.h>
#include "common.h"
#include "SyncQueue.h" #include "SyncQueue.h"
#include <QTcpServer>
class _TCPSendInfo class _TCPSendInfo
{ {
public: public:
std::string pics_name; std::string pics_name;
std::string result;
std::string num;
_TCPSendInfo() _TCPSendInfo()
{ {
@ -38,8 +42,9 @@ public:
wait(); wait();
} }
void stop(); void stop();
#ifdef __TCPClient
bool connectTCP(); bool connectTCP();
#endif
protected: protected:
void run(); void run();
@ -47,9 +52,21 @@ public:
void init(SyncQueue<_TCPSendInfo>* p_TCP_Info_queue, std::string ip_, int port_); void init(SyncQueue<_TCPSendInfo>* p_TCP_Info_queue, std::string ip_, int port_);
void start_work(); void start_work();
void sendData(_TCPSendInfo* TCPSendInfo, int Num); void sendData(_TCPSendInfo* TCPSendInfo, int Num);
std::vector<int> stringToAscii(const std::string& str);
#ifdef __TCPServer
private slots:
void onNewConnection();
void onClientConnected();
void onClientDisconnected();
#endif
public: public:
SyncQueue<_TCPSendInfo>* Local_TCP_Info_queue; SyncQueue<_TCPSendInfo>* Local_TCP_Info_queue;
std::atomic_bool isLoop = { 0 }; std::atomic_bool isLoop = { 0 };
QTcpSocket* mySocket; #if defined(__TCPServer) || defined(__TCPClient)
QTcpSocket* mySocket = NULL;
#endif
#ifdef __TCPServer
QTcpServer *tcpServer = NULL;
QAbstractSocket::SocketState ClientStatus;
#endif
}; };

@ -144,7 +144,7 @@ Cigarette::Cigarette(QWidget* parent)
connect(hThread, &QThread::finished, clogWorkThread, &CLog::deleteLater); connect(hThread, &QThread::finished, clogWorkThread, &CLog::deleteLater);
connect(this, &Cigarette::sengMsgToClog, clogWorkThread, &CLog::recMegFromCigarette); connect(this, &Cigarette::sengMsgToClog, clogWorkThread, &CLog::recMegFromCigarette);
hThread->start(); hThread->start();
emit sengMsgToClog("Application Start."); LOG("Application Start.")
#endif #endif
g_save_queue = new SyncQueue<std::pair<std::string, cv::Mat>>(Queue_Size); g_save_queue = new SyncQueue<std::pair<std::string, cv::Mat>>(Queue_Size);
g_save_queue->name = "save queue"; g_save_queue->name = "save queue";
@ -577,7 +577,7 @@ Cigarette::Cigarette(QWidget* parent)
Cigarette::~Cigarette() Cigarette::~Cigarette()
{ {
emit sengMsgToClog("Application exited."); LOG("Application exited.")
Exit(); Exit();
//exit(-1); //exit(-1);
} }
@ -648,12 +648,12 @@ void Cigarette::start_work()
//开始按钮 //开始按钮
void Cigarette::on_btn_start_released() void Cigarette::on_btn_start_released()
{ {
emit sengMsgToClog("Start to work."); LOG("Start to work.")
if (!g_admin_mode) if (!g_admin_mode)
{ {
if (!g_op_mode) if (!g_op_mode)
{ {
emit sengMsgToClog("Start to login in."); LOG("Start to login in.")
dialogin = new Dialogin(this); dialogin = new Dialogin(this);
connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp())); connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp()));
dialogin->setModal(true); dialogin->setModal(true);
@ -765,12 +765,12 @@ void Cigarette::Exit()
//停止工作按钮 //停止工作按钮
void Cigarette::on_btn_pause_released() void Cigarette::on_btn_pause_released()
{ {
emit sengMsgToClog("Pause the application."); LOG("Pause the application.")
if (!g_admin_mode) if (!g_admin_mode)
{ {
if (!g_op_mode) if (!g_op_mode)
{ {
emit sengMsgToClog("Start to login in."); LOG("Start to login in.")
dialogin = new Dialogin(this); dialogin = new Dialogin(this);
connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp())); connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp()));
dialogin->setModal(true); dialogin->setModal(true);
@ -792,7 +792,7 @@ void Cigarette::on_btn_lock_released()
{ {
if (!g_admin_mode) if (!g_admin_mode)
{ {
emit sengMsgToClog("Unlock the application."); LOG("Unlock the application.")
dialog_setup_passwd = new DialogSetupPasswd(this); dialog_setup_passwd = new DialogSetupPasswd(this);
connect(dialog_setup_passwd, SIGNAL(enter_admin()), this, SLOT(OnAdmin())); connect(dialog_setup_passwd, SIGNAL(enter_admin()), this, SLOT(OnAdmin()));
dialog_setup_passwd->setModal(true); dialog_setup_passwd->setModal(true);
@ -801,7 +801,7 @@ void Cigarette::on_btn_lock_released()
} }
else else
{ {
emit sengMsgToClog("Lock the application."); LOG("Lock the application.")
g_admin_mode = false; g_admin_mode = false;
g_op_mode = false; g_op_mode = false;
ui.label_12->setText(QStringLiteral("登录用户:")); ui.label_12->setText(QStringLiteral("登录用户:"));
@ -824,7 +824,7 @@ void Cigarette::on_btn_lock_released()
//设置按钮 //设置按钮
void Cigarette::on_btn_setup_released() void Cigarette::on_btn_setup_released()
{ {
emit sengMsgToClog("Start to set the application."); LOG("Start to set the application.")
if (g_admin_mode) if (g_admin_mode)
{ {
dialog_setup = new DialogSetup(this); dialog_setup = new DialogSetup(this);
@ -909,7 +909,7 @@ void Cigarette::TestImgs()
//管理员登陆 //管理员登陆
void Cigarette::OnAdmin() void Cigarette::OnAdmin()
{ {
emit sengMsgToClog("Administrator is login in."); LOG("Administrator is login in.")
g_admin_mode = true; g_admin_mode = true;
ui.label_12->setText(QStringLiteral("登录用户:")); ui.label_12->setText(QStringLiteral("登录用户:"));
ui.label_role->setText(QStringLiteral("管理员")); ui.label_role->setText(QStringLiteral("管理员"));
@ -928,7 +928,7 @@ void Cigarette::OnAdmin()
//操作员登陆 //操作员登陆
void Cigarette::OnOp() void Cigarette::OnOp()
{ {
emit sengMsgToClog("Operator is login in."); LOG("Operator is login in.")
g_op_mode = true; g_op_mode = true;
g_op_time = OP_TIME; g_op_time = OP_TIME;
ui.label_role->setText(QStringLiteral("操作员")); ui.label_role->setText(QStringLiteral("操作员"));
@ -937,7 +937,7 @@ void Cigarette::OnOp()
//退出前执行 //退出前执行
void Cigarette::OnExit() void Cigarette::OnExit()
{ {
emit sengMsgToClog("Close the Application."); LOG("Close the Application.")
Exit(); Exit();
exit(-1); exit(-1);
} }
@ -978,7 +978,7 @@ void Cigarette::sendLatestData() {
void Cigarette::OnRotateReleasedHub(int Num)//旋转按钮 void Cigarette::OnRotateReleasedHub(int Num)//旋转按钮
{ {
QString str = "Start to rotate picture " + QString::number(90 * ((rotationAngle[Num] + 1) % 4)) + " degrees of camera " + QString::number(Num) + "."; QString str = "Start to rotate picture " + QString::number(90 * ((rotationAngle[Num] + 1) % 4)) + " degrees of camera " + QString::number(Num) + ".";
emit sengMsgToClog(str); LOG(str)
if (isNeedRotate[Num] == true) if (isNeedRotate[Num] == true)
{ {
rotationAngle[Num] = (rotationAngle[Num] + 1) % 4; rotationAngle[Num] = (rotationAngle[Num] + 1) % 4;
@ -995,7 +995,7 @@ void Cigarette::OnToolButtonCamReleasedHub(int Num)
{ {
if (!SingleCamInfo[Num].IsOpen) if (!SingleCamInfo[Num].IsOpen)
{ {
emit sengMsgToClog("Start open camera " + QString::number(Num) + "."); LOG("Start open camera " + QString::number(Num) + ".")
if (ControlCamOpenOrClose(Num, OPEN)) if (ControlCamOpenOrClose(Num, OPEN))
{ {
cam_work_mat[Num]->setStyleSheet(tr("background-color: rgb(0, 170, 0);"));//相机工作提示 cam_work_mat[Num]->setStyleSheet(tr("background-color: rgb(0, 170, 0);"));//相机工作提示
@ -1007,7 +1007,7 @@ void Cigarette::OnToolButtonCamReleasedHub(int Num)
} }
else else
{ {
emit sengMsgToClog("Start close camera " + QString::number(Num) + "."); LOG("Start close camera " + QString::number(Num) + ".")
if (ControlCamOpenOrClose(Num, CLOSE)) if (ControlCamOpenOrClose(Num, CLOSE))
{ {
cam_work_mat[Num]->setStyleSheet(tr("background-color: rgb(255, 255, 0);")); cam_work_mat[Num]->setStyleSheet(tr("background-color: rgb(255, 255, 0);"));
@ -1019,12 +1019,12 @@ void Cigarette::OnToolButtonCamReleasedHub(int Num)
} }
else else
{ {
emit sengMsgToClog("Close or open camera " + QString::number(Num) + " fail, there is no camera in potision 0."); LOG("Close or open camera " + QString::number(Num) + " fail, there is no camera in potision 0.")
QMessageBox::information(NULL, QStringLiteral("操作失败"), QStringLiteral("该机位没有检测到相机"), QMessageBox::Ok); QMessageBox::information(NULL, QStringLiteral("操作失败"), QStringLiteral("该机位没有检测到相机"), QMessageBox::Ok);
} }
} }
else { else {
emit sengMsgToClog("Close or open camera " + QString::number(Num) + " fail, because of authorization check fail."); LOG("Close or open camera " + QString::number(Num) + " fail, because of authorization check fail.")
QMessageBox::information(NULL, QStringLiteral("权限检查"), QStringLiteral("请先点击解锁按钮,进入管理员模式"), QMessageBox::Ok); QMessageBox::information(NULL, QStringLiteral("权限检查"), QStringLiteral("请先点击解锁按钮,进入管理员模式"), QMessageBox::Ok);
} }
} }
@ -1147,7 +1147,7 @@ void Cigarette::OnDBClickHub(int Num_Cnt)
std::lock_guard<std::mutex> locker(g_display_label_conf[Num].lock); std::lock_guard<std::mutex> locker(g_display_label_conf[Num].lock);
if (g_display_label_conf[Num].g_max[Cnt]) if (g_display_label_conf[Num].g_max[Cnt])
{ /// 全屏状态下 双击取消全屏 { /// 全屏状态下 双击取消全屏
emit sengMsgToClog("Cancel the picture of camera " + QString::number(Num) + " to full screen."); LOG("Cancel the picture of camera " + QString::number(Num) + " to full screen.")
g_display_label_conf[Num].g_max[Cnt] = false; g_display_label_conf[Num].g_max[Cnt] = false;
display_lable_mat[Num][Cnt]->setGeometry( display_lable_mat[Num][Cnt]->setGeometry(
display_lable_info[Num][Cnt].x, display_lable_info[Num][Cnt].x,
@ -1172,7 +1172,7 @@ void Cigarette::OnDBClickHub(int Num_Cnt)
} }
else else
{ // 双击全屏 { // 双击全屏
emit sengMsgToClog("Set the picture of camera " + QString::number(Num) + " to full screen."); LOG("Set the picture of camera " + QString::number(Num) + " to full screen.")
g_display_label_conf[Num].g_max[Cnt] = true; g_display_label_conf[Num].g_max[Cnt] = true;
display_lable_mat[Num][Cnt]->setGeometry(0, 0, 1280, 800); display_lable_mat[Num][Cnt]->setGeometry(0, 0, 1280, 800);
@ -1293,7 +1293,7 @@ void Cigarette::OnTPClickHub(int Num_Cnt)
//双击NG //双击NG
void Cigarette::OnDBClickNGHub(int Num) void Cigarette::OnDBClickNGHub(int Num)
{ {
emit sengMsgToClog("Double click NG."); LOG("Double click NG.")
QDateTime now_ts = QDateTime::currentDateTime(); QDateTime now_ts = QDateTime::currentDateTime();
std::ostringstream ostr; std::ostringstream ostr;
QString file_path = g_conf_path.save_pics_path; QString file_path = g_conf_path.save_pics_path;
@ -1416,7 +1416,7 @@ void Cigarette::on_checkBox_unkick_clicked(bool checked)
{ {
if (!g_op_mode) if (!g_op_mode)
{ {
emit sengMsgToClog("Start to login in."); LOG("Start to login in.")
dialogin = new Dialogin(this); dialogin = new Dialogin(this);
connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp())); connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp()));
dialogin->setModal(true); dialogin->setModal(true);
@ -1434,7 +1434,7 @@ void Cigarette::on_checkBox_unkick_clicked(bool checked)
if (m_PLCDevice->g_plc_ok) { if (m_PLCDevice->g_plc_ok) {
if (checked) if (checked)
{ {
emit sengMsgToClog("Enter unkick mode."); LOG("Enter unkick mode.")
int ret = m_PLCDevice->write_bit_2_plc(g_modbus_conf.no_kick, 1); int ret = m_PLCDevice->write_bit_2_plc(g_modbus_conf.no_kick, 1);
#ifdef __UDPSend #ifdef __UDPSend
sThread.sendData("UnKickOk", g_sys_conf.FeedbackPort); sThread.sendData("UnKickOk", g_sys_conf.FeedbackPort);
@ -1442,7 +1442,7 @@ void Cigarette::on_checkBox_unkick_clicked(bool checked)
} }
else else
{ {
emit sengMsgToClog("Exit unkick mode."); LOG("Exit unkick mode.")
int ret = m_PLCDevice->write_bit_2_plc(g_modbus_conf.no_kick, 0); int ret = m_PLCDevice->write_bit_2_plc(g_modbus_conf.no_kick, 0);
#ifdef __UDPSend #ifdef __UDPSend
sThread.sendData("KickOk", g_sys_conf.FeedbackPort); sThread.sendData("KickOk", g_sys_conf.FeedbackPort);
@ -1452,7 +1452,7 @@ void Cigarette::on_checkBox_unkick_clicked(bool checked)
} }
else { else {
ui.checkBox_unkick->setChecked(false); ui.checkBox_unkick->setChecked(false);
emit sengMsgToClog("Enter or exit unkick mode fail."); LOG("Enter or exit unkick mode fail.")
#ifdef __UDPSend #ifdef __UDPSend
sThread.sendData("UnKickFail", g_sys_conf.FeedbackPort); sThread.sendData("UnKickFail", g_sys_conf.FeedbackPort);
#endif #endif
@ -1477,7 +1477,7 @@ void Cigarette::on_checkBox_debug_clicked(bool checked)
} }
else else
{ {
emit sengMsgToClog("Enter debug mode."); LOG("Enter debug mode.")
EnableDebugMode(); EnableDebugMode();
ui.checkBox_debug->setChecked(true); ui.checkBox_debug->setChecked(true);
#ifdef __UDPSend #ifdef __UDPSend
@ -1487,7 +1487,7 @@ void Cigarette::on_checkBox_debug_clicked(bool checked)
} }
else //关闭相机调试 else //关闭相机调试
{ {
emit sengMsgToClog("Exit debug mode."); LOG("Exit debug mode.")
DisableDebugMode(); DisableDebugMode();
//on_pushButton_clear_released(); //换班 //on_pushButton_clear_released(); //换班
ui.checkBox_debug->setChecked(false); ui.checkBox_debug->setChecked(false);
@ -1526,7 +1526,7 @@ void Cigarette::on_pushButton_wintab_clicked(bool checked) {
//打开PLC配置对话框 //打开PLC配置对话框
void Cigarette::on_toolButton_plc_released() void Cigarette::on_toolButton_plc_released()
{ {
emit sengMsgToClog("Open PLC setting."); LOG("Open PLC setting.")
if (m_PLCDevice->g_plc_ok) if (m_PLCDevice->g_plc_ok)
{ {
if (g_admin_mode) if (g_admin_mode)
@ -1911,7 +1911,7 @@ void Cigarette::on_pushButton_reset_released()///复位按钮
} }
void Cigarette::OnCancelAlarm() //双击消警 void Cigarette::OnCancelAlarm() //双击消警
{ {
emit sengMsgToClog("Cancel alarm mode."); LOG("Cancel alarm mode.")
if (!g_admin_mode) if (!g_admin_mode)
{ {
if (!g_op_mode) if (!g_op_mode)
@ -1951,12 +1951,12 @@ void Cigarette::OnCancelAlarm() //双击消警
} }
void Cigarette::on_toolButton_alarm_released() void Cigarette::on_toolButton_alarm_released()
{ {
emit sengMsgToClog("Open alarm dialog."); LOG("Open alarm dialog.")
if (!g_admin_mode) if (!g_admin_mode)
{ {
if (!g_op_mode) if (!g_op_mode)
{ {
emit sengMsgToClog("Start to login in."); LOG("Start to login in.")
dialogin = new Dialogin(this); dialogin = new Dialogin(this);
connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp())); connect(dialogin, SIGNAL(enter_op()), this, SLOT(OnOp()));
dialogin->setModal(true); dialogin->setModal(true);
@ -1973,9 +1973,10 @@ void Cigarette::on_toolButton_alarm_released()
} }
void Cigarette::on_pushButton_clear_released()//换班 void Cigarette::on_pushButton_clear_released()//换班
{ {
emit sengMsgToClog("Change shift."); LOG("Change shift.")
#ifdef __ExportData
emit sendMsgToExportData(); emit sendMsgToExportData();
#endif
if (!g_admin_mode) if (!g_admin_mode)
{ {
if (!g_op_mode) if (!g_op_mode)
@ -3841,7 +3842,7 @@ void Cigarette::recMsgFromUdp(QString data)
} }
else if (data == "CLEARNIMAGE") else if (data == "CLEARNIMAGE")
{ {
emit sengMsgToClog("Clean images."); LOG("Clean images.")
#ifdef CLEAR_THREAD #ifdef CLEAR_THREAD
CleanThreadStart(); CleanThreadStart();
#endif #endif

@ -227,7 +227,9 @@ private:
#endif #endif
public slots: public slots:
#ifdef CLEAR_THREAD
void CleanThreadStartAuto(); void CleanThreadStartAuto();
#endif
#ifdef __UDPSend #ifdef __UDPSend
void recMsgFromUdp(QString data); void recMsgFromUdp(QString data);
#endif #endif
@ -238,7 +240,9 @@ signals:
#ifdef LOG_RECORD #ifdef LOG_RECORD
void sengMsgToClog(QString); void sengMsgToClog(QString);
#endif #endif
#ifdef __ExportData
void sendMsgToExportData(); void sendMsgToExportData();
#endif
}; };
#endif // CIGARETTE_H #endif // CIGARETTE_H

@ -7,9 +7,20 @@
//#define __DEBUG //debug信息输出功能 //#define __DEBUG //debug信息输出功能
#define LOG_RECORD //log日志功能 #define LOG_RECORD //log日志功能
#ifdef LOG_RECORD
#define LOG(x) emit sengMsgToClog(x);
#else
#define LOG(x)
#endif
#define CLEAR_THREAD //定时清理线程 #define CLEAR_THREAD //定时清理线程
//#define __UDPSend //网络发送功能 //#define __UDPSend //网络发送功能
//#define __TCPSend // TCP发送 //#define __TCPSend // TCP发送
#if defined (__TCPSend)
//#define __TCPServer // TCP服务器
#define __TCPClient // TCP客户端
//#define __ModebusServer // 建立modbus主机
//#define __ModebusClient // 建立modbus从机
#endif
//#define __MQTTSend // MQTT发送 //#define __MQTTSend // MQTT发送
#define BASLER_SUPPORT #define BASLER_SUPPORT
#if defined (BASLER_SUPPORT) #if defined (BASLER_SUPPORT)

Loading…
Cancel
Save