添加项目文件。
This commit is contained in:
433
Plugin/Driver/CEXMemFileQueue.cpp
Normal file
433
Plugin/Driver/CEXMemFileQueue.cpp
Normal file
@@ -0,0 +1,433 @@
|
||||
#include "stdafx.h"
|
||||
#include "CEXMemFileQueue.h"
|
||||
#include <sys/timeb.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <windows.h>
|
||||
#include <algorithm>
|
||||
#include <codecvt>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>YYYYMMDDhhmmssSSS
|
||||
std::string formatTimeAsString(int lIndexEx)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime(&st);
|
||||
std::ostringstream oss;
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
oss << std::setw(4) << std::setfill('0') << (st.wYear % 10000);
|
||||
// <20>·ݺ<C2B7><DDBA><EFBFBD><EFBFBD><EFBFBD>
|
||||
oss << std::setw(2) << std::setfill('0') << st.wMonth;
|
||||
oss << std::setw(2) << std::setfill('0') << st.wDay;
|
||||
// Сʱ<D0A1><CAB1><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>
|
||||
oss << std::setw(2) << std::setfill('0') << st.wHour;
|
||||
oss << std::setw(2) << std::setfill('0') << st.wMinute;
|
||||
oss << std::setw(2) << std::setfill('0') << st.wSecond;
|
||||
//__timeb64 tb;
|
||||
//_ftime64_s(&tb); // <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0>䣬<EFBFBD><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//oss << std::setw(3) << std::setfill('0') << tb.millitm; // <20><><EFBFBD>룬<EFBFBD><EBA3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰ<EFBFBD>油<EFBFBD><E6B2B9>
|
||||
oss << std::setw(6) << std::setfill('0') << lIndexEx; // <20><>ֹ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
//<2F><>ȡһ<C8A1><D2BB>ָ<EFBFBD><D6B8>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lType<70><65>ʾ<EFBFBD><CABE>ȡ<EFBFBD><C8A1><EFBFBD>ͣ<EFBFBD>1<EFBFBD><31><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>2<EFBFBD><32><EFBFBD>ļ<EFBFBD><C4BC>У<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>
|
||||
static void traverse_directory_ansi(const char* directory_path, std::vector<std::string>& files, int lType)
|
||||
{
|
||||
char search_path[MAX_PATH];
|
||||
strcpy_s(search_path, directory_path);
|
||||
strcat_s(search_path, "\\*");
|
||||
|
||||
WIN32_FIND_DATAA find_data;
|
||||
HANDLE hFind = FindFirstFileA(search_path, &find_data);
|
||||
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
std::cerr << "Failed to open directory: " << directory_path << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (strcmp(find_data.cFileName, ".") == 0 || strcmp(find_data.cFileName, "..") == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
char full_path[MAX_PATH];
|
||||
strcpy_s(full_path, directory_path);
|
||||
strcat_s(full_path, "\\");
|
||||
strcat_s(full_path, find_data.cFileName);
|
||||
|
||||
if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
//<2F>ݲ<EFBFBD>֧<EFBFBD>ֵݹ<D6B5><DDB9><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
if (1 != lType) files.push_back(find_data.cFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (2 != lType) files.push_back(find_data.cFileName);
|
||||
}
|
||||
} while (FindNextFileA(hFind, &find_data) != 0);
|
||||
|
||||
FindClose(hFind);
|
||||
|
||||
// <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::sort(files.begin(), files.end());
|
||||
}
|
||||
|
||||
CEXMemFileQueue::CEXMemFileQueue(std::string strDataDir)
|
||||
{
|
||||
m_strBaseDir = strDataDir;
|
||||
m_pWriteFileItem = NULL;
|
||||
m_pReadFileItem = NULL;
|
||||
m_lReadIndex = 0;
|
||||
m_lItemCount = 0;
|
||||
InitializeCriticalSection(&m_cs);
|
||||
|
||||
SYSTEMTIME stTime;
|
||||
GetLocalTime(&stTime);
|
||||
ChangeDataDate(stTime);
|
||||
}
|
||||
|
||||
CEXMemFileQueue::~CEXMemFileQueue()
|
||||
{
|
||||
for (int i = 0; i < (int)m_vecFile.size(); i++)
|
||||
{
|
||||
delete m_vecFile[i];
|
||||
}
|
||||
m_vecFile.clear();
|
||||
}
|
||||
|
||||
|
||||
int CEXMemFileQueue::GetItemCount()
|
||||
{
|
||||
return m_lItemCount;
|
||||
}
|
||||
|
||||
int CEXMemFileQueue::GetAutoSn()
|
||||
{
|
||||
ThreadLock stLock(&m_cs);
|
||||
m_lAutoSn++;
|
||||
return m_lAutoSn;
|
||||
}
|
||||
|
||||
int CEXMemFileQueue::ReadItem(void* pData, int lIndex /* = -1 */)
|
||||
{
|
||||
ThreadLock stLock(&m_cs);
|
||||
if (lIndex > m_lItemCount)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lIndex >= 0)
|
||||
{
|
||||
m_lReadIndex = lIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lReadIndex++;
|
||||
}
|
||||
|
||||
if (m_lReadIndex >= m_lItemCount)
|
||||
{
|
||||
return -1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
if (NULL == m_pReadFileItem || m_lReadIndex < m_pReadFileItem->lBeindIndex || m_lReadIndex > m_pReadFileItem->lEndIndex)
|
||||
{
|
||||
m_pReadFileItem = NULL;
|
||||
//<2F><><EFBFBD><EFBFBD>Ѱ<EFBFBD><D1B0>
|
||||
for (int i = 0; i < (int)m_vecFile.size(); i++)
|
||||
{
|
||||
if (m_lReadIndex >= m_vecFile[i]->lBeindIndex && m_lReadIndex <= m_vecFile[i]->lEndIndex)
|
||||
{
|
||||
m_pReadFileItem = m_vecFile[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == m_pReadFileItem)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(pData, (char*)m_pReadFileItem->pBuf + DATA_FIRST_LINE_SIZE + DATA_LINE_SIZE *(m_lReadIndex- m_pReadFileItem->lBeindIndex), DATA_LINE_SIZE);
|
||||
|
||||
return m_lReadIndex;
|
||||
}
|
||||
|
||||
void CEXMemFileQueue::FlushWriteFile()
|
||||
{
|
||||
ThreadLock stLock(&m_cs);
|
||||
if (NULL != m_pWriteFileItem)
|
||||
{
|
||||
char acFirstLine[DATA_FIRST_LINE_SIZE+1] = { 0 };
|
||||
sprintf_s(acFirstLine, "%-15d\n", m_pWriteFileItem->lFileSize);
|
||||
memcpy((char*)m_pWriteFileItem->pBuf, acFirstLine, DATA_FIRST_LINE_SIZE);
|
||||
|
||||
FlushViewOfFile(m_pWriteFileItem->pBuf, m_pWriteFileItem->lFileSize);
|
||||
}
|
||||
}
|
||||
|
||||
int CEXMemFileQueue::WriteItem(void* pData)
|
||||
{
|
||||
ThreadLock stLock(&m_cs);
|
||||
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
SYSTEMTIME stDate;
|
||||
GetLocalTime(&stDate);
|
||||
if (stDate.wYear != m_stDataDate.wYear || stDate.wMonth != m_stDataDate.wMonth || stDate.wDay != m_stDataDate.wDay)
|
||||
{
|
||||
AutoCleanData(5);
|
||||
ChangeDataDate(stDate);
|
||||
}
|
||||
if (m_pWriteFileItem == NULL || m_pWriteFileItem->lFileSize + DATA_LINE_SIZE > DATA_FILE_SIZE)
|
||||
{
|
||||
if (m_pWriteFileItem != NULL)
|
||||
{
|
||||
m_pWriteFileItem->lEndIndex = m_lItemCount-1;
|
||||
FlushWriteFile();
|
||||
}
|
||||
m_pWriteFileItem = new CEX_QUEUE_FILE_ITEM;
|
||||
m_pWriteFileItem->lBeindIndex = m_lItemCount;
|
||||
|
||||
m_pWriteFileItem->strFileName = m_strDataDir + "\\" + formatTimeAsString((int)m_vecFile.size()) + ".txt";;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>д<EFBFBD><EFBFBD><CDB9><EFBFBD>
|
||||
m_pWriteFileItem->hFile = CreateFileA(
|
||||
m_pWriteFileItem->strFileName.c_str(),
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
nullptr,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr
|
||||
);
|
||||
|
||||
if (m_pWriteFileItem->hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
TRACE("CreateFile failed\r\n");
|
||||
delete m_pWriteFileItem;
|
||||
m_pWriteFileItem = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>------<2D><>һ<EFBFBD>й̶<D0B9>ռ<EFBFBD><D5BC>16<31>ֽڼ<D6BD>¼<EFBFBD>ļ<EFBFBD>ʵ<EFBFBD>ʴ<EFBFBD>С
|
||||
m_pWriteFileItem->hMapFile = CreateFileMappingA(m_pWriteFileItem->hFile,nullptr,PAGE_READWRITE, 0,DATA_FILE_SIZE+16,nullptr);
|
||||
if (m_pWriteFileItem->hMapFile == nullptr)
|
||||
{
|
||||
TRACE("CreateFileMapping failed\r\n");
|
||||
delete m_pWriteFileItem;
|
||||
m_pWriteFileItem = NULL;
|
||||
return -2;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>䵽<EFBFBD><E4B5BD><EFBFBD>̵ĵ<CCB5>ַ<EFBFBD>ռ<EFBFBD>
|
||||
m_pWriteFileItem->pBuf = MapViewOfFile( m_pWriteFileItem->hMapFile,FILE_MAP_ALL_ACCESS,0, 0,DATA_FILE_SIZE+16);
|
||||
if (m_pWriteFileItem->pBuf == nullptr)
|
||||
{
|
||||
TRACE("MapViewOfFile failed\r\n");
|
||||
delete m_pWriteFileItem;
|
||||
m_pWriteFileItem = NULL;
|
||||
return -3;
|
||||
}
|
||||
FlushWriteFile();//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ȱ<EFBFBD><C8B1><EFBFBD>һ<EFBFBD>£<EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD>ͷ
|
||||
m_vecFile.push_back(m_pWriteFileItem);
|
||||
}
|
||||
|
||||
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
memcpy((char*)m_pWriteFileItem->pBuf + m_pWriteFileItem->lFileSize, pData, DATA_LINE_SIZE);
|
||||
m_pWriteFileItem->lFileSize += DATA_LINE_SIZE;
|
||||
m_pWriteFileItem->lEndIndex = m_lItemCount;
|
||||
m_lItemCount++;
|
||||
|
||||
//ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
||||
char acFirstLine[DATA_FIRST_LINE_SIZE + 1] = { 0 };
|
||||
sprintf_s(acFirstLine, "%-15d\n", m_pWriteFileItem->lFileSize);
|
||||
memcpy((char*)m_pWriteFileItem->pBuf, acFirstLine, DATA_FIRST_LINE_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//<2F>л<EFBFBD><D0BB><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||||
void CEXMemFileQueue::ChangeDataDate(SYSTEMTIME stDate)
|
||||
{
|
||||
ThreadLock stLock(&m_cs);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>
|
||||
FlushWriteFile();
|
||||
m_pReadFileItem = NULL;
|
||||
m_pWriteFileItem = NULL;
|
||||
for (int i = 0; i < (int)m_vecFile.size(); i++)
|
||||
{
|
||||
delete m_vecFile[i];
|
||||
}
|
||||
m_vecFile.clear();
|
||||
m_lItemCount = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
||||
m_stDataDate = stDate;
|
||||
char acDate[32] = { 0 };
|
||||
sprintf_s(acDate, "%04d-%02d-%02d", m_stDataDate.wYear, m_stDataDate.wMonth, m_stDataDate.wDay);
|
||||
m_strDataDir = m_strBaseDir + "\\" + acDate;
|
||||
CreateDirectory(m_strDataDir.c_str(), NULL);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>У<EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<std::string> files;
|
||||
traverse_directory_ansi(m_strDataDir.c_str(), files, 1);
|
||||
for (int i = 0; i < (int)files.size(); i++)
|
||||
{
|
||||
CEX_QUEUE_FILE_ITEM* pTempItem = new CEX_QUEUE_FILE_ITEM;
|
||||
pTempItem->lBeindIndex = m_lItemCount;
|
||||
|
||||
pTempItem->strFileName = m_strDataDir + "\\" + files[i];
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>д<EFBFBD><EFBFBD><CDB9><EFBFBD>
|
||||
pTempItem->hFile = CreateFileA(
|
||||
pTempItem->strFileName.c_str(),
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
nullptr,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr
|
||||
);
|
||||
|
||||
if (pTempItem->hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
TRACE("CreateFile failed\r\n");
|
||||
delete pTempItem;
|
||||
pTempItem = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>------<2D><>һ<EFBFBD>й̶<D0B9>ռ<EFBFBD><D5BC>16<31>ֽڼ<D6BD>¼<EFBFBD>ļ<EFBFBD>ʵ<EFBFBD>ʴ<EFBFBD>С
|
||||
pTempItem->hMapFile = CreateFileMappingA(pTempItem->hFile, nullptr, PAGE_READWRITE, 0, DATA_FILE_SIZE + 16, nullptr);
|
||||
if (pTempItem->hMapFile == nullptr)
|
||||
{
|
||||
TRACE("CreateFileMapping failed\r\n");
|
||||
delete pTempItem;
|
||||
pTempItem = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>䵽<EFBFBD><E4B5BD><EFBFBD>̵ĵ<CCB5>ַ<EFBFBD>ռ<EFBFBD>
|
||||
pTempItem->pBuf = MapViewOfFile(pTempItem->hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, DATA_FILE_SIZE + 16);
|
||||
if (pTempItem->pBuf == nullptr)
|
||||
{
|
||||
TRACE("MapViewOfFile failed\r\n");
|
||||
delete pTempItem;
|
||||
pTempItem = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
pTempItem->lFileSize = atoi((char*)pTempItem->pBuf);
|
||||
m_lItemCount += (pTempItem->lFileSize - DATA_FIRST_LINE_SIZE) / DATA_LINE_SIZE;
|
||||
pTempItem->lEndIndex = m_lItemCount - 1;
|
||||
|
||||
|
||||
m_vecFile.push_back(pTempItem);
|
||||
}
|
||||
m_lAutoSn = m_lItemCount;
|
||||
if (m_vecFile.size() > 0)
|
||||
{
|
||||
m_pWriteFileItem = m_vecFile[m_vecFile.size() - 1];
|
||||
}
|
||||
}
|
||||
|
||||
static bool isValidDateFormat(const std::string& date)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD>ʽ %04d-%02d-%02d
|
||||
std::regex datePattern(R"((\d{4})\-(\d{2})-(\d{2}))");
|
||||
//std::regex datePattern(R"(\d{4}-\d{2}-\d{2})");
|
||||
std::smatch match;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
if (std::regex_match(date, match, datePattern))
|
||||
{
|
||||
// <20><>ȡ<EFBFBD>ꡢ<EFBFBD>¡<EFBFBD><C2A1><EFBFBD>
|
||||
int year = std::stoi(match[1].str());
|
||||
int month = std::stoi(match[2].str());
|
||||
int day = std::stoi(match[3].str());
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>Ч<EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD>磺<EFBFBD>·<EFBFBD><C2B7><EFBFBD>1<EFBFBD><31>12֮<32>䣬<EFBFBD><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>31֮<31><D6AE><EFBFBD>ȣ<EFBFBD>
|
||||
if (month < 1 || month > 12 || day < 1 || day > 31)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool DeleteDirectory(const std::string& dirPath)
|
||||
{
|
||||
WIN32_FIND_DATA findFileData;
|
||||
std::string searchPath = dirPath + _T("\\*");
|
||||
HANDLE hFind = FindFirstFile(searchPath.c_str(), &findFileData);
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
std::string filePath;
|
||||
if (strcmp(findFileData.cFileName, _T(".")) == 0 || strcmp(findFileData.cFileName, _T("..")) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filePath = dirPath + _T("\\") + findFileData.cFileName;
|
||||
if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
if (!DeleteDirectory(filePath))
|
||||
{
|
||||
FindClose(hFind);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DeleteFile(filePath.c_str()))
|
||||
{
|
||||
FindClose(hFind);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} while (FindNextFile(hFind, &findFileData) != 0);
|
||||
|
||||
FindClose(hFind);
|
||||
return RemoveDirectory(dirPath.c_str()) != 0;
|
||||
}
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
std::vector<std::string> CEXMemFileQueue::GetDataList()
|
||||
{
|
||||
std::vector<std::string> vecDir;
|
||||
traverse_directory_ansi(m_strBaseDir.c_str(), vecDir, 2);
|
||||
|
||||
std::vector<std::string> vecDate;
|
||||
//<2F><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>
|
||||
for (int i = 0; i < (int)vecDir.size(); i++)
|
||||
{
|
||||
if (isValidDateFormat(vecDir[i].c_str()))
|
||||
{
|
||||
vecDate.push_back(vecDir[i].c_str());
|
||||
}
|
||||
}
|
||||
return vecDate;
|
||||
}
|
||||
|
||||
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD>ݣ<EFBFBD>lRecvDayΪ<79><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CEXMemFileQueue::AutoCleanData(int lRecvDay)
|
||||
{
|
||||
ThreadLock stLock(&m_cs);
|
||||
std::vector<std::string> vecDate = GetDataList();
|
||||
for (int i = 0; i < ((int)vecDate.size()) - 5; i++)
|
||||
{
|
||||
DeleteDirectory(m_strBaseDir + "\\" + vecDate[i]);
|
||||
}
|
||||
}
|
||||
120
Plugin/Driver/CEXMemFileQueue.h
Normal file
120
Plugin/Driver/CEXMemFileQueue.h
Normal file
@@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define DATA_FIRST_LINE_SIZE (16) //<2F><>һ<EFBFBD>м<EFBFBD>¼<EFBFBD><C2BC>ǰ<EFBFBD>ļ<EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// char acSeq[10];
|
||||
// char acTime[12];
|
||||
// unsigned char cIndex; // 0<><30>1
|
||||
// unsigned char acTxRx; // 0:send, 1:recv
|
||||
// char acID[10];
|
||||
// unsigned char acFrame;//0:data, 1:remote
|
||||
// unsigned char acType; //0:standard, 1:extend
|
||||
// unsigned char cDlc;
|
||||
// char acData[32];
|
||||
|
||||
|
||||
|
||||
#define DATA_FILE_SIZE (89*10000) //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
|
||||
class CEX_QUEUE_FILE_ITEM
|
||||
{
|
||||
public:
|
||||
CEX_QUEUE_FILE_ITEM()
|
||||
{
|
||||
lFileSize = DATA_FIRST_LINE_SIZE;
|
||||
lBeindIndex = 0;
|
||||
lEndIndex = 0;
|
||||
hFile = INVALID_HANDLE_VALUE;
|
||||
hMapFile = NULL;
|
||||
pBuf = NULL;
|
||||
}
|
||||
~CEX_QUEUE_FILE_ITEM()
|
||||
{
|
||||
if (NULL != pBuf)
|
||||
{
|
||||
FlushViewOfFile(pBuf, lFileSize);
|
||||
UnmapViewOfFile(pBuf);
|
||||
}
|
||||
if (NULL != hMapFile)
|
||||
{
|
||||
CloseHandle(hMapFile);
|
||||
}
|
||||
if (INVALID_HANDLE_VALUE != hFile)
|
||||
{
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
}
|
||||
std::string strFileName;
|
||||
HANDLE hFile;//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
HANDLE hMapFile;//<2F>ļ<EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void* pBuf;//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lFileSize;//<2F><>ǰ<EFBFBD>ļ<EFBFBD><C4BC>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>е<EFBFBD>ժҪ<D5AA><D2AA>Ϣ<EFBFBD><CFA2><EFBFBD>ļ<EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ȣ<EFBFBD>
|
||||
int lBeindIndex;//<2F><>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lEndIndex;//<2F><>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
class CEXMemFileQueue
|
||||
{
|
||||
class ThreadLock {
|
||||
public:
|
||||
// <20><><EFBFBD>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||||
ThreadLock(CRITICAL_SECTION* cs)
|
||||
{
|
||||
m_cs = cs;
|
||||
EnterCriticalSection(m_cs);
|
||||
}
|
||||
~ThreadLock()
|
||||
{
|
||||
LeaveCriticalSection(m_cs);
|
||||
}
|
||||
private:
|
||||
CRITICAL_SECTION* m_cs; // <20>ٽ<EFBFBD><D9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
public:
|
||||
CEXMemFileQueue(std::string strDataDir);
|
||||
~CEXMemFileQueue();
|
||||
|
||||
//<2F><>ȡһ<C8A1><D2BB><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ȹ̶<C8B9>ΪDATA_LINE_SIZE
|
||||
int ReadItem(void* pData, int lIndex = -1);
|
||||
//д<><D0B4>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ȹ̶<C8B9>λDATA_LINE_SIZE
|
||||
int WriteItem(void* pData);
|
||||
//ǿ<><C7BF>ˢ<EFBFBD><CBA2><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
void FlushWriteFile();
|
||||
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int GetItemCount();
|
||||
|
||||
int GetAutoSn();
|
||||
|
||||
//<2F>л<EFBFBD><D0BB><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||||
void ChangeDataDate(SYSTEMTIME stDate);
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
std::vector<std::string> GetDataList();
|
||||
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD>ݣ<EFBFBD>lRecvDayΪ<79><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void AutoCleanData(int lRecvDay);
|
||||
|
||||
private:
|
||||
|
||||
//<2F><><EFBFBD>ݷ<EFBFBD><DDB7>ļ<EFBFBD><C4BC>洢
|
||||
std::vector<CEX_QUEUE_FILE_ITEM*> m_vecFile;
|
||||
|
||||
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ڵ<EFBFBD>
|
||||
CEX_QUEUE_FILE_ITEM* m_pWriteFileItem;
|
||||
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ļ<EFBFBD><C4BC>ڵ<EFBFBD>
|
||||
CEX_QUEUE_FILE_ITEM* m_pReadFileItem;
|
||||
|
||||
int m_lReadIndex;//<2F><>ǰ<EFBFBD><C7B0>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
|
||||
int m_lItemCount;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
std::string m_strBaseDir;//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
std::string m_strDataDir;//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
|
||||
CRITICAL_SECTION m_cs;
|
||||
|
||||
int m_lAutoSn;
|
||||
|
||||
SYSTEMTIME m_stDataDate;
|
||||
};
|
||||
|
||||
315
Plugin/Driver/CEXVirtualListCtrl.cpp
Normal file
315
Plugin/Driver/CEXVirtualListCtrl.cpp
Normal file
@@ -0,0 +1,315 @@
|
||||
// CEXVirtualListDlg.cpp: 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "PluginDriver.h"
|
||||
#include "CEXVirtualListCtrl.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
//控件ID只需要在当前窗口中唯一,这里随便写一个就好
|
||||
#define ID_VIRTUAL_LIST_CTRL (1987)
|
||||
|
||||
IMPLEMENT_DYNAMIC(CEXVirtualListCtrl, CListCtrl)
|
||||
|
||||
CEXVirtualListCtrl::CEXVirtualListCtrl()
|
||||
{
|
||||
m_pQueueData = NULL;
|
||||
m_lOldCount = 0;
|
||||
}
|
||||
|
||||
CEXVirtualListCtrl::~CEXVirtualListCtrl()
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CEXVirtualListCtrl, CListCtrl)
|
||||
ON_NOTIFY_REFLECT(LVN_GETDISPINFO, &CEXVirtualListCtrl::OnLvnGetdispinfo)
|
||||
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, &CEXVirtualListCtrl::OnNMCustomdraw)
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
void CEXVirtualListCtrl::Initialize()
|
||||
{
|
||||
SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_OWNERDATA); // 确保设置了虚拟大小样式
|
||||
SetItemCountEx((int)0);
|
||||
|
||||
// 添加列(这里假设列是固定的,可以在构造函数中或这里添加)
|
||||
InsertColumn(0, _T("ID"), LVCFMT_LEFT, 80);
|
||||
InsertColumn(1, _T("Value1"), LVCFMT_LEFT, 120);
|
||||
InsertColumn(2, _T("Value2"), LVCFMT_LEFT, 100);
|
||||
}
|
||||
*/
|
||||
|
||||
void CEXVirtualListCtrl::SetData(CEXMemFileQueue* pQueue)
|
||||
{
|
||||
m_pQueueData = pQueue;
|
||||
SetItemCountEx((int)m_pQueueData->GetItemCount());
|
||||
}
|
||||
|
||||
std::string getSubString(const char* input, int index) {
|
||||
std::vector<std::string> substrings;
|
||||
std::stringstream ss(input);
|
||||
std::string item;
|
||||
|
||||
// 使用逗号作为分隔符分割字符串
|
||||
while (std::getline(ss, item, ',')) {
|
||||
substrings.push_back(item);
|
||||
}
|
||||
|
||||
// 检查索引是否有效
|
||||
if (index < 0 || index >= substrings.size()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 返回对应的子串
|
||||
return substrings[index];
|
||||
}
|
||||
|
||||
void CEXVirtualListCtrl::OnLvnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NMLVDISPINFO* pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
|
||||
LV_ITEM* pItem = &(pDispInfo)->item;
|
||||
|
||||
if (pItem->iItem >= 0 && pItem->iItem < static_cast<int>(m_pQueueData->GetItemCount()))
|
||||
{
|
||||
char acTemp[DATA_LINE_SIZE + 1] = { 0 };
|
||||
int lIndex = m_pQueueData->ReadItem(acTemp, pItem->iItem); //pItem->iItem为行序号,即数据索引
|
||||
|
||||
if (pItem->mask & LVIF_TEXT)
|
||||
{
|
||||
CString str;
|
||||
int lTempValue = 0;
|
||||
switch (pItem->iSubItem) //pItem->iSubItem为列编号,可以逐单元格设置内容;
|
||||
{
|
||||
case 0://acSeq[10];
|
||||
str= getSubString(acTemp, 0).c_str();
|
||||
break;
|
||||
case 1://acTime[12];
|
||||
str = getSubString(acTemp, 1).c_str();
|
||||
break;
|
||||
case 2://cIndex; // 0或1
|
||||
str = getSubString(acTemp, 2).c_str();
|
||||
break;
|
||||
case 3://acTxRx; // 0:send, 1:recv
|
||||
lTempValue = atoi(getSubString(acTemp, 3).c_str());
|
||||
str = lTempValue == 0 ? "send" : lTempValue == 1 ? "recv" : "-";
|
||||
break;
|
||||
case 4://acID[10];
|
||||
str = getSubString(acTemp, 4).c_str();
|
||||
break;
|
||||
case 5://acFrame;//0:data, 1:remote
|
||||
lTempValue = atoi(getSubString(acTemp, 5).c_str());
|
||||
str = lTempValue == 0 ? "data" : lTempValue == 1 ? "remote" : "-";
|
||||
break;
|
||||
case 6:////0:standard, 1:extend
|
||||
lTempValue = atoi(getSubString(acTemp, 6).c_str());
|
||||
str = lTempValue == 0 ? "standard" : lTempValue == 1 ? "extend" : "-";
|
||||
break;
|
||||
case 7://cDlc;
|
||||
str = getSubString(acTemp, 7).c_str();
|
||||
break;
|
||||
case 8://acData[32];
|
||||
str = getSubString(acTemp, 8).c_str();
|
||||
break;
|
||||
|
||||
}
|
||||
lstrcpy(pItem->pszText, str);
|
||||
}
|
||||
}
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
void CEXVirtualListCtrl::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
LPNMLVCUSTOMDRAW pLVCD = reinterpret_cast<LPNMLVCUSTOMDRAW>(pNMHDR);
|
||||
*pResult = CDRF_DODEFAULT;
|
||||
|
||||
switch (pLVCD->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
*pResult = CDRF_NOTIFYITEMDRAW;
|
||||
break;
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
// 获取当前项和子项的索引
|
||||
int nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);
|
||||
|
||||
char acTemp[DATA_LINE_SIZE + 1] = { 0 };
|
||||
m_pQueueData->ReadItem(acTemp, nItem);
|
||||
int lId = atoi(acTemp);//测试数据每条数据的最前面是10进制的ID,所以这里直接使用atoi了
|
||||
|
||||
// 根据需要修改颜色
|
||||
if (lId % 10 == 0) // 根据需要设定行颜色
|
||||
{
|
||||
pLVCD->clrText = RGB(255, 0, 0); // 红色文本
|
||||
pLVCD->clrTextBk = RGB(200, 200, 255); // 浅蓝色背景
|
||||
|
||||
//*pResult = CDRF_NEWFONT | CDRF_SKIPDEFAULT;
|
||||
*pResult = CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
BOOL CEXVirtualListCtrl::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
//return TRUE; //避免闪烁
|
||||
return CListCtrl::OnEraseBkgnd(pDC);
|
||||
}
|
||||
|
||||
#define TIMER_REFRESH_LIST_ID (18989)
|
||||
void CEXVirtualListCtrl::StartAutoRefresh(int lMSecond)
|
||||
{
|
||||
SetTimer(TIMER_REFRESH_LIST_ID, lMSecond, NULL);
|
||||
}
|
||||
void CEXVirtualListCtrl::StopAutoRefresh()
|
||||
{
|
||||
KillTimer(TIMER_REFRESH_LIST_ID);
|
||||
}
|
||||
void CEXVirtualListCtrl::RefreshShow()
|
||||
{
|
||||
int lItemCount = m_pQueueData->GetItemCount();
|
||||
if (m_lOldCount == lItemCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetItemCountEx(lItemCount, LVSICF_NOINVALIDATEALL | LVSICF_NOSCROLL);
|
||||
EnsureVisible(lItemCount - 1, FALSE);
|
||||
|
||||
m_lOldCount = lItemCount;
|
||||
}
|
||||
|
||||
void CEXVirtualListCtrl::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
|
||||
if (TIMER_REFRESH_LIST_ID == nIDEvent)
|
||||
{
|
||||
if (NULL != m_pQueueData)
|
||||
{
|
||||
RefreshShow();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//自定义定时器,无需调用基类OnTimer,否则定时器会被强制结束
|
||||
CListCtrl::OnTimer(nIDEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// CEXVirtualListDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CEXVirtualListDlg, CDialogEx)
|
||||
|
||||
CEXVirtualListDlg::CEXVirtualListDlg(CWnd* pParent /*=nullptr*/)
|
||||
: CDialogEx(IDD_CEXVirtualListDlg, pParent)
|
||||
{
|
||||
m_pstVirtualList = new CEXVirtualListCtrl();
|
||||
}
|
||||
|
||||
CEXVirtualListDlg::~CEXVirtualListDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CEXVirtualListDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
//DDX_Control(pDX, ID_VIRTUAL_LIST_CTRL, *m_pstVirtualList);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CEXVirtualListDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDOK, &CEXVirtualListDlg::OnBnClickedOk)
|
||||
ON_BN_CLICKED(IDCANCEL, &CEXVirtualListDlg::OnBnClickedCancel)
|
||||
ON_WM_SIZE()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CEXVirtualListDlg 消息处理程序
|
||||
|
||||
|
||||
void CEXVirtualListDlg::OnBnClickedOk()
|
||||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
//CDialogEx::OnOK();
|
||||
//屏蔽按下回车导致列表隐藏
|
||||
}
|
||||
|
||||
|
||||
void CEXVirtualListDlg::OnBnClickedCancel()
|
||||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
//CDialogEx::OnCancel();
|
||||
//屏蔽按下ESC导致列表隐藏
|
||||
}
|
||||
|
||||
|
||||
void CEXVirtualListDlg::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CDialogEx::OnSize(nType, cx, cy);
|
||||
|
||||
// TODO: 在此处添加消息处理程序代码
|
||||
if (NULL != m_pstVirtualList && NULL != m_pstVirtualList->m_hWnd)
|
||||
{
|
||||
m_pstVirtualList->MoveWindow(0, 0, cx, cy);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CEXVirtualListDlg::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
if (!m_pstVirtualList->Create(WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_OWNERDATA | LVS_EX_DOUBLEBUFFER, CRect(0, 0, 0, 0), this, ID_VIRTUAL_LIST_CTRL)) {
|
||||
TRACE0("Failed to create MyVirtualListCtrl\n");
|
||||
delete m_pstVirtualList;
|
||||
m_pstVirtualList = nullptr;
|
||||
return FALSE; // 返回 FALSE 以使框架知道未成功初始化
|
||||
}
|
||||
|
||||
// 设置控件的扩展样式和其他属性:整行选中、
|
||||
m_pstVirtualList->SetExtendedStyle(LVS_EX_GRIDLINES | LVS_REPORT/*LVS_EX_VIRTUALSIZE*/);
|
||||
|
||||
m_pstVirtualList->Initialize();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void CEXVirtualListDlg::SetData(CEXMemFileQueue* pQueue)
|
||||
{
|
||||
m_pstVirtualList->SetData(pQueue);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BOOL CEXVirtualListCtrl::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// TODO: 在此添加专用代码和/或调用基类
|
||||
|
||||
|
||||
return CListCtrl::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
|
||||
BOOL CEXVirtualListCtrl::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
|
||||
{
|
||||
// TODO: 在此添加专用代码和/或调用基类
|
||||
|
||||
BOOL bRet = CListCtrl::Create(dwStyle, rect, pParentWnd, nID);
|
||||
SetExtendedStyle(LVS_EX_GRIDLINES | LVS_REPORT/*LVS_EX_VIRTUALSIZE*/);
|
||||
SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_OWNERDATA); // 确保设置了虚拟大小样式
|
||||
SetItemCountEx((int)0);
|
||||
return bRet;
|
||||
}
|
||||
75
Plugin/Driver/CEXVirtualListCtrl.h
Normal file
75
Plugin/Driver/CEXVirtualListCtrl.h
Normal file
@@ -0,0 +1,75 @@
|
||||
#pragma once
|
||||
|
||||
#include <afxwin.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "CEXMemFileQueue.h"
|
||||
|
||||
struct MyListItem {
|
||||
int id;
|
||||
CString name;
|
||||
CString date;
|
||||
};
|
||||
|
||||
class CEXVirtualListCtrl : public CListCtrl {
|
||||
DECLARE_DYNAMIC(CEXVirtualListCtrl)
|
||||
|
||||
public:
|
||||
CEXVirtualListCtrl();
|
||||
virtual ~CEXVirtualListCtrl();
|
||||
|
||||
//void Initialize();
|
||||
void SetData(CEXMemFileQueue* pQueue);
|
||||
|
||||
void StartAutoRefresh(int lMSecond);
|
||||
void StopAutoRefresh();
|
||||
void RefreshShow();
|
||||
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
afx_msg void OnLvnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
|
||||
private:
|
||||
CEXMemFileQueue* m_pQueueData;
|
||||
int m_lOldCount;
|
||||
public:
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
};
|
||||
|
||||
|
||||
// CEXVirtualListDlg 对话框
|
||||
|
||||
class CEXVirtualListDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CEXVirtualListDlg)
|
||||
|
||||
public:
|
||||
CEXVirtualListDlg(CWnd* pParent = nullptr); // 标准构造函数
|
||||
virtual ~CEXVirtualListDlg();
|
||||
|
||||
//给虚拟列表关联数据
|
||||
void SetData(CEXMemFileQueue* pQueue);
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_CEXVirtualListDlg };
|
||||
#endif
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
afx_msg void OnBnClickedOk();
|
||||
afx_msg void OnBnClickedCancel();
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
|
||||
private:
|
||||
CEXVirtualListCtrl* m_pstVirtualList;
|
||||
};
|
||||
137
Plugin/Driver/ColoredListCtrl.cpp
Normal file
137
Plugin/Driver/ColoredListCtrl.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
// ColoredListCtrl.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ColoredListCtrl.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColoredListCtrl
|
||||
CColoredListCtrl::CColoredListCtrl()
|
||||
{
|
||||
m_colRow1 = RGB(200,200,250);
|
||||
m_colRow2 = RGB(230,247,247);
|
||||
|
||||
// m_colRow1 = RGB(240,247,249);
|
||||
// m_colRow2 = RGB(229,232,239);
|
||||
}
|
||||
|
||||
CColoredListCtrl::~CColoredListCtrl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CColoredListCtrl, CListCtrl)
|
||||
//{{AFX_MSG_MAP(CColoredListCtrl)
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColoredListCtrl message handlers
|
||||
|
||||
void CColoredListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
*pResult = 0;
|
||||
|
||||
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
|
||||
int iRow = lplvcd->nmcd.dwItemSpec;
|
||||
|
||||
switch(lplvcd->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT :
|
||||
{
|
||||
*pResult = CDRF_NOTIFYITEMDRAW;
|
||||
return;
|
||||
}
|
||||
|
||||
// Modify item text and or background
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
lplvcd->clrText = RGB(0,0,0);
|
||||
// If you want the sub items the same as the item,
|
||||
// set *pResult to CDRF_NEWFONT
|
||||
if(ItemColorFlag[iRow]){
|
||||
lplvcd->clrTextBk = m_colRow2;
|
||||
}
|
||||
else{
|
||||
lplvcd->clrTextBk = m_colRow1;
|
||||
}
|
||||
|
||||
*pResult =CDRF_NOTIFYSUBITEMDRAW;
|
||||
return;
|
||||
}
|
||||
|
||||
// Modify sub item text and/or background
|
||||
case CDDS_SUBITEM | CDDS_PREPAINT | CDDS_ITEM:
|
||||
{
|
||||
/* //if(*(ItemColorFlag+nextrow)){
|
||||
if(ItemColorFlag[iRow]){
|
||||
lplvcd->clrTextBk = m_colRow2;
|
||||
}
|
||||
else{
|
||||
lplvcd->clrTextBk = m_colRow1;
|
||||
}
|
||||
*/
|
||||
*pResult = CDRF_DODEFAULT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
void CCoolList::OnCustomDraw(NMHDR *pNMHDR, LRESULT *pResult){//<2F><><EFBFBD>Ͱ<EFBFBD>ȫת<C8AB><D7AA>
|
||||
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
|
||||
*pResult = 0;//ָ<><D6B8><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
if(CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
|
||||
{*pResult = CDRF_NOTIFYITEMDRAW;}
|
||||
else if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
|
||||
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(pLVCD->nmcd.dwItemSpec % 2)
|
||||
pLVCD->clrTextBk = RGB(255, 255, 128);//ż<><C5BC><EFBFBD><EFBFBD>
|
||||
else
|
||||
pLVCD->clrTextBk = RGB(128, 255, 255);//<2F><><EFBFBD><EFBFBD>*pResult = CDRF_DODEFAULT;}}
|
||||
);//<2F><><EFBFBD><EFBFBD>
|
||||
*pResult = CDRF_DODEFAULT;}}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
BOOL CColoredListCtrl::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
|
||||
//return TRUE;
|
||||
|
||||
CRect rect;
|
||||
CColoredListCtrl::GetClientRect(rect);
|
||||
|
||||
|
||||
// POINT mypoint;
|
||||
|
||||
// CBrush brush0(m_colRow1);
|
||||
CBrush brush1(m_colRow2);
|
||||
|
||||
|
||||
|
||||
int chunk_height=GetCountPerPage();
|
||||
pDC->FillRect(&rect,&brush1);
|
||||
/*
|
||||
for (int i=0;i<=chunk_height;i++)
|
||||
{
|
||||
GetItemPosition(i,&mypoint);
|
||||
rect.top=mypoint.y ;
|
||||
GetItemPosition(i+1,&mypoint);
|
||||
rect.bottom =mypoint.y;
|
||||
pDC->FillRect(&rect,i %2 ? &brush1 : &brush0);
|
||||
}*/
|
||||
|
||||
// brush0.DeleteObject();
|
||||
brush1.DeleteObject();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
51
Plugin/Driver/ColoredListCtrl.h
Normal file
51
Plugin/Driver/ColoredListCtrl.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#if !defined(AFX_COLOREDLISTCTRL_H__86FEBE8E_F6FA_429F_B740_76F1769C81C6__INCLUDED_)
|
||||
#define AFX_COLOREDLISTCTRL_H__86FEBE8E_F6FA_429F_B740_76F1769C81C6__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// ColoredListCtrl.h : header file
|
||||
//
|
||||
extern unsigned long int nextrow;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CColoredListCtrl window
|
||||
|
||||
class CColoredListCtrl : public CListCtrl
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CColoredListCtrl();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
COLORREF m_colRow1;
|
||||
COLORREF m_colRow2;
|
||||
|
||||
// Operations
|
||||
public:
|
||||
unsigned char ItemColorFlag[60000];
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CColoredListCtrl)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CColoredListCtrl();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CColoredListCtrl)
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
//}}AFX_MSG
|
||||
afx_msg void CColoredListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_COLOREDLISTCTRL_H__86FEBE8E_F6FA_429F_B740_76F1769C81C6__INCLUDED_)
|
||||
302
Plugin/Driver/CommDataDef.h
Normal file
302
Plugin/Driver/CommDataDef.h
Normal file
@@ -0,0 +1,302 @@
|
||||
|
||||
#pragma once
|
||||
#pragma pack (1)
|
||||
|
||||
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
#define WM_THREAD_RECV WM_USER + 1000
|
||||
#define WM_SERTHREAD_RECV WM_USER + 2000
|
||||
|
||||
#define WP_WPARA_RECV 1001
|
||||
#define WP_WPARA_CLOSE 1002 //socket<65>ر<EFBFBD>
|
||||
#define WP_WPARA_THREAD_QUIT 1005 //<2F>̹߳ر<CCB9>
|
||||
|
||||
#define WP_WPARA_SERVER_RECV 2001
|
||||
#define WP_WPARA_SERVER_CLOSE 2002 //socket<65>ر<EFBFBD>
|
||||
#define WP_WPARA_SERTHREAD_QUIT 2005 //<2F>̹߳ر<CCB9>
|
||||
|
||||
//<2F>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD>
|
||||
#define DUSTDEV_REGNUM 14 //<2F>ɼ<EFBFBD><C9BC>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD>
|
||||
|
||||
//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef struct __dustDevPara{
|
||||
double fDCVolt;
|
||||
double fDCCurr;
|
||||
double fPSVolt;
|
||||
double fPSCurr;
|
||||
WORD wPsFreq;
|
||||
double fEnvTempr;
|
||||
double fEnvHumity;
|
||||
double fDcIgbtTemp;
|
||||
double fPulseIgbtTemp;
|
||||
__dustDevPara(){
|
||||
fDCVolt =0.0;
|
||||
fDCCurr =0.0;
|
||||
fPSVolt =0.0;
|
||||
fPSCurr =0.0;
|
||||
wPsFreq =0;
|
||||
fEnvTempr =0.0;
|
||||
fEnvHumity =0.0;
|
||||
fDcIgbtTemp =0.0;
|
||||
fPulseIgbtTemp =0.0;
|
||||
}
|
||||
}ST_DUSTDEV_WOORKPARA;
|
||||
|
||||
//Modbus<75><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>ֵ
|
||||
typedef enum __enumFuncCode{
|
||||
EN_MODBUS_READ_SINGLECOIL =0x01, //<2F><><EFBFBD><EFBFBD>Ȧ
|
||||
EN_MODBUS_READ_PERSISREG =0x03, //<2F><><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
EN_MODBUS_WRITE_SINGLECOIL =0x05, //д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ
|
||||
EN_MODBUS_WRITE_SINGLEREG =0x06, //д<><D0B4><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
EN_MODBUS_WRITE_MULTIREG =0x10,
|
||||
|
||||
EN_MODBUS_READ_SINGLECOIL_RSPERR =0x81,
|
||||
EN_MODBUS_READ_PERSISREG_RSPERR =0x83,
|
||||
EN_MODBUS_WRITE_SINGLECOIL_RSPERR =0x85,
|
||||
EN_MODBUS_WRITE_SINGLEREG_RSPERR =0x86,
|
||||
EN_MODBUS_WRITE_MULTIREG_RSPERR =0x90
|
||||
}EN_NUM_MODBUS_FUNCCODE;
|
||||
|
||||
//<2F>Ĵ<EFBFBD><C4B4><EFBFBD>ö<EFBFBD><C3B6>ֵ(*10<31><30>ʾ<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>ֵΪʵ<CEAA><CAB5>ֵ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>)
|
||||
typedef enum __enumRegAddr{
|
||||
EN_REGADDR_DCVOLTH =0x0000, //ֱ<><D6B1><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
|
||||
EN_REGADDR_DCVOLTL =0x0001, //ֱ<><D6B1><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
|
||||
EN_REGADDR_DCCURR =0x0002, //ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *10.0
|
||||
EN_REGADDR_PULSEVOLTH =0x0003, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
|
||||
EN_REGADDR_PULSEVOLTL =0x0004, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
|
||||
EN_REGADDR_PULSECURR =0x0005, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *10.0
|
||||
EN_REGADDR_PULSEFREQ =0x0006, //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5> *10.0
|
||||
EN_REGADDR_ENVTEMP =0x0007, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> *10.0
|
||||
EN_REGADDR_ENVHUMITY =0x0008, //<2F><><EFBFBD><EFBFBD>ʪ<EFBFBD><CAAA> *10.0
|
||||
EN_REGADDR_SUPPLYVOLT =0x0009, //<2F>е<EFBFBD><D0B5><EFBFBD>ѹ *10.0
|
||||
EN_REGADDR_SUPPLYCURR =0x000A, //<2F>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD> *10.0
|
||||
EN_REGADDR_ACTODCVOLT =0x000B, //ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD>ѹ *10.0
|
||||
EN_REGADDR_DCIGBTTEMP =0x000C, //ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IGBT<42><54><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> *10.0
|
||||
EN_REGADDR_PULSEIGBTTEMP=0x000D //<2F><><EFBFBD>岿<EFBFBD><E5B2BF>IGBT<42><54><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> *10.0
|
||||
}EN_NUM_REGADDR;
|
||||
|
||||
//MBAP<41><50><EFBFBD><EFBFBD>ͷ
|
||||
typedef struct __modbusMbapHeader{
|
||||
WORD wTransFlag;
|
||||
WORD wProtocolFlag;
|
||||
WORD wLen;
|
||||
BYTE bUnitFlag;
|
||||
__modbusMbapHeader(){
|
||||
wTransFlag =0;
|
||||
wProtocolFlag =0;
|
||||
wLen =0;
|
||||
bUnitFlag =0;
|
||||
}
|
||||
}ST_MODBUS_MBAP_HEADER;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ/<2F><><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---Cient<6E><74>
|
||||
typedef struct __clientRqtReadFrame{
|
||||
ST_MODBUS_MBAP_HEADER stMbapHeader;
|
||||
BYTE bFuncConde;
|
||||
WORD wStartAddr;
|
||||
WORD wRegNum;
|
||||
__clientRqtReadFrame()
|
||||
{
|
||||
bFuncConde =0x0;
|
||||
wStartAddr =0;
|
||||
wRegNum =0;
|
||||
}
|
||||
}ST_MODBUS_CLIENT_RQTREAD_FRAME;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD>---Cient<6E><74>
|
||||
typedef struct __clientRqtWrtCoilFrame{
|
||||
ST_MODBUS_MBAP_HEADER stMbapHeader;
|
||||
BYTE bFuncConde;
|
||||
WORD wAddr;
|
||||
WORD wOutVal;
|
||||
__clientRqtWrtCoilFrame()
|
||||
{
|
||||
bFuncConde =0x05;
|
||||
wAddr =0;
|
||||
wOutVal =0;
|
||||
}
|
||||
}ST_MODBUS_CLIENT_RQTWRTCOIL_FRAME;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef struct __serverRqtWrtRegFrame{
|
||||
ST_MODBUS_MBAP_HEADER stMbapHeader;
|
||||
BYTE bFuncConde;
|
||||
WORD wAddr;
|
||||
WORD wOutVal;
|
||||
__serverRqtWrtRegFrame()
|
||||
{
|
||||
bFuncConde =0x06;
|
||||
wAddr =0;
|
||||
wOutVal =0;
|
||||
}
|
||||
}ST_MODBUS_SERVER_RQTWRTREG_FRAME;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---Cient<6E><74>
|
||||
typedef struct __clientRqtWrtMultiRegFrame{
|
||||
ST_MODBUS_MBAP_HEADER stMbapHeader;
|
||||
BYTE bFuncConde;
|
||||
WORD wStartAddr;
|
||||
WORD wRegNum;
|
||||
BYTE bLen;
|
||||
BYTE bRegVal[255];
|
||||
__clientRqtWrtMultiRegFrame()
|
||||
{
|
||||
bFuncConde =0x10;
|
||||
wStartAddr =0;
|
||||
wRegNum =0;
|
||||
bLen =0;
|
||||
memset(bRegVal,0,255);
|
||||
}
|
||||
}ST_MODBUS_CLIENT_RQTWRTMULTIREG_FRAME;
|
||||
|
||||
//<2F><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ּĴ<D6BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--Server <20><>
|
||||
typedef struct __serveRspReadFrame{
|
||||
ST_MODBUS_MBAP_HEADER stMbapHeader;
|
||||
BYTE bFuncConde;
|
||||
BYTE bLen;
|
||||
BYTE bRtnData[255];
|
||||
}ST_MODBUS_SERVER_RSPREAD_FRAME;
|
||||
|
||||
//<2F><>Ӧд<D3A6><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ּĴ<D6BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--Server <20><>
|
||||
typedef struct __serveRspWrtFrame{
|
||||
ST_MODBUS_MBAP_HEADER stMbapHeader;
|
||||
BYTE bFuncConde;
|
||||
WORD wStartAddr;
|
||||
WORD wRegNum;
|
||||
}ST_MODBUS_SERVER_RSPWRT_FRAME;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ֡
|
||||
typedef struct __serverRspErrFrame{
|
||||
ST_MODBUS_MBAP_HEADER stMbapHeader;
|
||||
BYTE bFuncConde;
|
||||
BYTE bErrCode;
|
||||
}ST_MODBUS_SERVER_RSPERR_FRAME;
|
||||
|
||||
////===========================================================================================================
|
||||
//------------<2D><><EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>PCͨ<43><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>
|
||||
typedef enum __enumpcCommFuncCode{
|
||||
EN_PCCOMM_TRANSDATA =0x51, //HMI--->PC
|
||||
EN_PCCOMM_WORKPARASET =0x52, //PC---->HMI
|
||||
EN_PCCOMM_SAMPLEPARASET =0x53, //PC---->HMI
|
||||
EN_PCCOMM_DEVSTARTSTOP =0x54, //PC---->HMI
|
||||
EN_PCCOMM_HISTORYDATARQT =0x55, //PC---->HMI
|
||||
|
||||
EN_PCCOMM_TRANSDATA_RSP =0x61, //PC---->HMI
|
||||
EN_PCCOMM_WORKPARASET_RSP =0x62, //HMI--->PC
|
||||
EN_PCCOMM_SAMPLEPARASET_RSP =0x63, //HMI--->PC
|
||||
EN_PCCOMM_DEVSTARTSTOP_RSP =0x64 //HMI--->PC
|
||||
|
||||
}EN_NUM_PCCOMM_FUNCCODE;
|
||||
|
||||
|
||||
//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9>
|
||||
typedef struct __devSampleData{
|
||||
int iDevID;
|
||||
DWORD dwIPAddr;
|
||||
WORD wPulseFreq;
|
||||
float fDcVolt;
|
||||
float fDcCurr;
|
||||
float fPulseVolt;
|
||||
float fPulseCurr;
|
||||
float fEnvTemprature;
|
||||
float fEnvHumidity;
|
||||
float fSupplyVolt;
|
||||
float fSupplyCurr;
|
||||
float fRectiferDC;
|
||||
float fDcIgbtTemp;
|
||||
float fPsIgbtTemp;
|
||||
BYTE bSampleTime[6];
|
||||
__devSampleData(){
|
||||
iDevID =0;
|
||||
dwIPAddr =0;
|
||||
wPulseFreq =0;
|
||||
fDcVolt =0;
|
||||
fDcCurr =0;
|
||||
fPulseVolt =0;
|
||||
fPulseCurr =0;
|
||||
fEnvHumidity=0;
|
||||
fEnvTemprature =0;
|
||||
fSupplyVolt =0;
|
||||
fSupplyCurr =0;
|
||||
fRectiferDC =0;
|
||||
fDcIgbtTemp =0;
|
||||
fPsIgbtTemp =0;
|
||||
memset(bSampleTime,0,6);
|
||||
}
|
||||
}ST_DEVSAMPLE_DATA;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef struct __devWorkParaFromPC{
|
||||
int iDevID;
|
||||
DWORD dwIPAddr;
|
||||
WORD wPulseFreq;
|
||||
float fDcVolt;
|
||||
float fDcCurr;
|
||||
float fPulseVolt;
|
||||
float fPulseCurr;
|
||||
char szDevName[32];
|
||||
char szDevIPAddr[32];
|
||||
__devWorkParaFromPC(){
|
||||
iDevID =0;
|
||||
dwIPAddr =0;
|
||||
wPulseFreq =0;
|
||||
fDcVolt =0;
|
||||
fDcCurr =0;
|
||||
fPulseVolt =0;
|
||||
fPulseCurr =0;
|
||||
szDevName[0] ='\0';
|
||||
szDevIPAddr[0] ='\0';
|
||||
}
|
||||
__devWorkParaFromPC& operator=(const __devWorkParaFromPC &rhs)
|
||||
{
|
||||
this->iDevID = rhs.iDevID;
|
||||
this->dwIPAddr = rhs.dwIPAddr;
|
||||
this->wPulseFreq= rhs.wPulseFreq;
|
||||
this->fDcVolt = rhs.fDcVolt;
|
||||
this->fDcCurr = rhs.fDcCurr;
|
||||
this->fPulseVolt= rhs.fPulseVolt;
|
||||
this->fPulseCurr= rhs.fPulseCurr;
|
||||
strcpy(this->szDevName,rhs.szDevName);
|
||||
strcpy(this->szDevIPAddr,rhs.szDevIPAddr);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
}ST_DEVWORKPARA_FROMPC,*PST_DEVWORKPARA_FROMPC;
|
||||
|
||||
//<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef struct __devSampleParaFromPC{
|
||||
WORD wSampleIntver;
|
||||
BYTE bIsSavePcOnline;
|
||||
__devSampleParaFromPC(){
|
||||
wSampleIntver =0;
|
||||
bIsSavePcOnline =0;
|
||||
}
|
||||
}ST_SAMPLEPARA_FROMPC;
|
||||
|
||||
//<2F>豸<EFBFBD><E8B1B8>ͣ
|
||||
typedef struct __devStartStopFromPC{
|
||||
int iDevID;
|
||||
DWORD dwIPAddr;
|
||||
BYTE bIsStart;
|
||||
__devStartStopFromPC(){
|
||||
iDevID =0;
|
||||
dwIPAddr =0;
|
||||
bIsStart =0;
|
||||
}
|
||||
}ST_DEVSTARTSTOP_FROMPC;
|
||||
|
||||
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef struct __historyRqtFromPC{
|
||||
int iDevID;
|
||||
DWORD dwIPAddr;
|
||||
BYTE bStartTime[6];
|
||||
BYTE bStopTime[6];
|
||||
__historyRqtFromPC(){
|
||||
iDevID =0;
|
||||
dwIPAddr =0;
|
||||
memset(bStartTime,0,6);
|
||||
memset(bStopTime,0,6);
|
||||
}
|
||||
}ST_HISTORYRQT_FROMPC;
|
||||
|
||||
#pragma pack ()
|
||||
BIN
Plugin/Driver/Driver.rc
Normal file
BIN
Plugin/Driver/Driver.rc
Normal file
Binary file not shown.
245
Plugin/Driver/Driver.vcxproj
Normal file
245
Plugin/Driver/Driver.vcxproj
Normal file
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8BBB60C1-510D-47BC-8FD2-E14E9EA3A156}</ProjectGuid>
|
||||
<RootNamespace>VcsClient</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>E:\work\tank_svn\shiyu\project\fan\warehouse\code\cpp\vcs-client\Inc\json\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\curl\inc;..\modbus;$(SolutionDir)3rdparty\can\inc;$(SolutionDir)3rdparty\sqlite;$(SolutionDir)3rdparty\whttp-server-core;$(SolutionDir)3rdparty\openssl\inc;$(SolutionDir)3rdparty\pthread\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>libcurl.lib;ControlCAN.lib;libcrypto.lib;libssl.lib;pthreadVC2.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)3rdparty\curl\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)3rdparty\modbus\lib;$(SolutionDir)3rdparty\can\lib;$(SolutionDir)3rdparty\pthread\lib\x64;$(SolutionDir)3rdparty\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\curl\inc;..\modbus;$(SolutionDir)3rdparty\can\inc;$(SolutionDir)3rdparty\sqlite;$(SolutionDir)3rdparty\whttp-server-core;$(SolutionDir)3rdparty\pthread\inc;$(SolutionDir)3rdparty\openssl\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)3rdparty\curl\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)3rdparty\modbus\lib;$(SolutionDir)3rdparty\can\lib;$(SolutionDir)3rdparty\pthread\lib\x64;$(SolutionDir)3rdparty\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libcurl.lib;ControlCAN.lib;libcrypto.lib;libssl.lib;pthreadVC2.lib</AdditionalDependencies>
|
||||
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\3rdparty\whttp-server-core\LockQueue.hpp" />
|
||||
<ClInclude Include="..\..\3rdparty\whttp-server-core\unistd.h" />
|
||||
<ClInclude Include="CEXMemFileQueue.h" />
|
||||
<ClInclude Include="CEXVirtualListCtrl.h" />
|
||||
<ClInclude Include="ColoredListCtrl.h" />
|
||||
<ClInclude Include="DriverMainDlg.h" />
|
||||
<ClInclude Include="Map.h" />
|
||||
<ClInclude Include="PluginDriver.h" />
|
||||
<ClInclude Include="PositionView.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_reader.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_value.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_writer.cpp" />
|
||||
<ClCompile Include="CEXMemFileQueue.cpp" />
|
||||
<ClCompile Include="CEXVirtualListCtrl.cpp" />
|
||||
<ClCompile Include="ColoredListCtrl.cpp" />
|
||||
<ClCompile Include="DriverMainDlg.cpp" />
|
||||
<ClCompile Include="PluginDriver.cpp" />
|
||||
<ClCompile Include="PositionView.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Driver.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\Driver.rc2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\Driver.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
52
Plugin/Driver/Driver.vcxproj.filters
Normal file
52
Plugin/Driver/Driver.vcxproj.filters
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="ColoredListCtrl.cpp" />
|
||||
<ClCompile Include="CEXMemFileQueue.cpp" />
|
||||
<ClCompile Include="CEXVirtualListCtrl.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_reader.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_value.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_writer.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PluginDriver.cpp" />
|
||||
<ClCompile Include="DriverMainDlg.cpp" />
|
||||
<ClCompile Include="PositionView.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="ColoredListCtrl.h" />
|
||||
<ClInclude Include="CEXMemFileQueue.h" />
|
||||
<ClInclude Include="CEXVirtualListCtrl.h" />
|
||||
<ClInclude Include="Map.h" />
|
||||
<ClInclude Include="..\..\3rdparty\whttp-server-core\LockQueue.hpp" />
|
||||
<ClInclude Include="..\..\3rdparty\whttp-server-core\unistd.h" />
|
||||
<ClInclude Include="PluginDriver.h" />
|
||||
<ClInclude Include="DriverMainDlg.h" />
|
||||
<ClInclude Include="PositionView.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Driver.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\Driver.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\Driver.rc2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="json">
|
||||
<UniqueIdentifier>{263f81d2-2eb0-4ed0-aef7-dc7f1cd0dad3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
1060
Plugin/Driver/DriverMainDlg.cpp
Normal file
1060
Plugin/Driver/DriverMainDlg.cpp
Normal file
File diff suppressed because it is too large
Load Diff
159
Plugin/Driver/DriverMainDlg.h
Normal file
159
Plugin/Driver/DriverMainDlg.h
Normal file
@@ -0,0 +1,159 @@
|
||||
#pragma once
|
||||
|
||||
#include "CEXVirtualListCtrl.h"
|
||||
#include "ControlCAN.h"
|
||||
#include "PositionView.h"
|
||||
#include "afxwin.h"
|
||||
// CCanDeviceDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
|
||||
|
||||
typedef struct ST_DRIVER_CONTROL {
|
||||
int Drive_Speed; //<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
||||
int Diversion_Position; //ת<><D7AA><EFBFBD>Ƕ<EFBFBD>
|
||||
int Zero_Angle; //ת<><D7AA><EFBFBD><EFBFBD><EFBFBD>Ƚǣ<C8BD><C7A3><EFBFBD><EFBFBD>ݻ<EFBFBD>е<EFBFBD>ṹ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD>Ƕȣ<C7B6>
|
||||
int MIX_Angle_R; //<2F>ֶ<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD>Ƕ<EFBFBD>
|
||||
int MAN_Angle_L; //<2F>ֶ<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>Сת<D0A1><D7AA><EFBFBD>Ƕ<EFBFBD>
|
||||
int AutoMAX_Angle; //<2F>Զ<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD>Ƕ<EFBFBD>
|
||||
int AutoMIN_Angle; //<2F>Զ<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD>Ƕ<EFBFBD>
|
||||
float SPEEDPAR; //<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>ϵ<EFBFBD><CFB5>
|
||||
|
||||
ST_DRIVER_CONTROL()
|
||||
{
|
||||
Drive_Speed = 0;
|
||||
Zero_Angle = 1320000; //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2108000 504000
|
||||
MIX_Angle_R = 504000; // Zero_Angle + 850000;
|
||||
MAN_Angle_L = 2108000; // Zero_Angle - 850000;
|
||||
AutoMIN_Angle = Zero_Angle - 700000;
|
||||
AutoMAX_Angle = Zero_Angle + 700000;
|
||||
Diversion_Position = Zero_Angle;
|
||||
SPEEDPAR = 1;
|
||||
}
|
||||
|
||||
} ST_DRIVER_CONTROL;
|
||||
|
||||
typedef struct ST_SENSOR_DATA {
|
||||
short FMagnetism_Offset; //ǰ<><C7B0><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t FMagnetism_Valid; //ǰ<><C7B0><EFBFBD><EFBFBD>1<EFBFBD><31>Ч 0<><30>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
||||
uint8_t FMagnetism_ALLTrue; //16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B5BD>
|
||||
short BMagnetism_Offset; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t BMagnetism_Valid; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>Ч 0<><30>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
||||
uint8_t BMagnetism_ALLTrue; //16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t RFID_Point; //RFID<49><44>ǩλ<C7A9><CEBB>
|
||||
uint8_t Battery_SOC; //<2F><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>
|
||||
|
||||
float *Mile_info; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
ST_SENSOR_DATA() //Ĭ<>Ϲ<EFBFBD><CFB9>캯<EFBFBD><ECBAAF>
|
||||
{
|
||||
FMagnetism_Offset = 0;
|
||||
FMagnetism_Valid = 0;
|
||||
FMagnetism_ALLTrue = 0;
|
||||
BMagnetism_Offset = 0;
|
||||
BMagnetism_Valid = 0;
|
||||
BMagnetism_ALLTrue = 0;
|
||||
RFID_Point = 0;
|
||||
Battery_SOC = 0;
|
||||
}
|
||||
|
||||
} ST_SENSOR_DATA;
|
||||
|
||||
|
||||
class CDriverMainDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CDriverMainDlg)
|
||||
|
||||
public:
|
||||
CDriverMainDlg(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CDriverMainDlg();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_DEV_CAN_DLG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
afx_msg void OnCheckCanrxEn();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
int m_nSendFrameFormatIdx0;
|
||||
int m_nSendFrameTypeIdx0;
|
||||
int m_nSendFrameFormatIdx1;
|
||||
int m_nSendFrameTypeIdx1;
|
||||
int m_nSendCanIndex;
|
||||
int m_nRecvCanIndex;
|
||||
int m_nDevType;
|
||||
public:
|
||||
CString m_iniPath;
|
||||
int m_DevType;
|
||||
int m_DevIndex;
|
||||
BOOL m_bOpenCan;
|
||||
BOOL m_bCanRxEn;
|
||||
BOOL m_bAutoRefresh;
|
||||
BOOL m_bAutoSend;
|
||||
BOOL m_bAutoSend2;
|
||||
CString m_strSendID;
|
||||
|
||||
|
||||
CString m_strSendData;
|
||||
BOOL m_StopSendFlag;
|
||||
BOOL m_StopSendFlag2;
|
||||
|
||||
void Drive_enable(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||
void Drive_disable(); //ʧ<><CAA7>
|
||||
|
||||
int Auto_Stop();
|
||||
int Auto_Forward(float speedpar);
|
||||
int Auto_Backward(float speedpar);
|
||||
int Auto_EStop();
|
||||
void UpdatePositionView();
|
||||
void UpdateVehiclePosition(int nPosition);
|
||||
void ReadConfigFromIni();
|
||||
void InitVirtualList();
|
||||
BOOL OpenCanDevice();
|
||||
void UpdateCanStatue(BOOL bStatue);
|
||||
void ProcessPipeMsg(int lMsgId, char* pData, int lLen);
|
||||
void SendCanData(int nDevIdx, int nCanIdx, int nFrameType, int nFrameFormat, UINT32 acFrameId, char acFrameData[8]);
|
||||
int Str2Hex(CString str);
|
||||
int HexChar(char c);
|
||||
//CPluginMainDialog *m_pMainWnd;
|
||||
virtual BOOL OnInitDialog();
|
||||
static UINT ReceiveCanThread(LPVOID v);
|
||||
static UINT SendCanThread(LPVOID v);
|
||||
static UINT SendCanThread2(LPVOID v);
|
||||
void WriteVirtualList(CString strFrameId, CString strFrameData, int nTxRx = 0, int nCanIdx = 0, int nFrameType = 0, int nFrameFormat = 0);
|
||||
|
||||
public:
|
||||
CEXVirtualListCtrl *m_pstVirtualList;
|
||||
afx_msg void OnBnClickedBtnSendMan();
|
||||
afx_msg void OnBnClickedAutoSend();
|
||||
|
||||
CEXMemFileQueue* m_pQueue;
|
||||
CString m_strDataDir;
|
||||
|
||||
volatile int m_nAgvAction;
|
||||
int m_nAgvReturnState;
|
||||
|
||||
afx_msg void OnBnClickedCheckAutoRefreshShow();
|
||||
afx_msg void OnBnClickedBtnSendMan2();
|
||||
afx_msg void OnBnClickedAutoSend2();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
|
||||
ST_DRIVER_CONTROL m_stDrvierControl;
|
||||
ST_SENSOR_DATA m_stSensorData;
|
||||
|
||||
void AnalysiseCanData(int nCanIndex, VCI_CAN_OBJ objCan);
|
||||
void CalculateAutoCanParam();
|
||||
void SendCanControlData(float Vel, float Ang);
|
||||
void GetRoadwayInfo(int nReqPosId);
|
||||
|
||||
afx_msg void OnBnClickedButtonAgvstop();
|
||||
afx_msg void OnBnClickedButtonAgvestop();
|
||||
afx_msg void OnBnClickedButtonAgvforward();
|
||||
afx_msg void OnBnClickedButtonAgvbackward();
|
||||
CPositionView m_PositionView;
|
||||
CStatic Mil_info;
|
||||
CStatic TAG;
|
||||
};
|
||||
23
Plugin/Driver/Map.h
Normal file
23
Plugin/Driver/Map.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "Map.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
POS_UNLOAD = 1, //AGVж<56><D0B6><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
POS_UNLOAD_SLOW_DOWN = 2, //ж<><D0B6><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD>
|
||||
POS_CLOSE_SHOP_ROLLER_DOOR = 3, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>
|
||||
POS_OPEN_SHOP_ROLLER_DOOR = 4, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>
|
||||
POS_MANHOLE_COVER_1 = 5, //<2F><><EFBFBD><EFBFBD>#1
|
||||
POS_MANHOLE_COVER_2 = 6, //<2F><><EFBFBD><EFBFBD>#2
|
||||
//POS_BOLLARD_SLOW_DOWN_1 = 6, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD>#1
|
||||
POS_BOLLARD_STOP_1 = 7, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>#1
|
||||
POS_MANHOLE_COVER_3 = 8, //<2F><><EFBFBD><EFBFBD>#3
|
||||
POS_MANHOLE_COVER_4 = 9, //<2F><><EFBFBD><EFBFBD>#4
|
||||
//POS_BOLLARD_SLOW_DOWN_2 = 10, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD>#2
|
||||
POS_BOLLARD_STOP_2 = 10, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>#2
|
||||
POS_MANHOLE_COVER_5 = 11, //<2F><><EFBFBD><EFBFBD>#5
|
||||
POS_MANHOLE_COVER_6 = 12, //<2F><><EFBFBD><EFBFBD>#6
|
||||
POS_LOAD_SLOW_DOWN = 13, //װ<><D7B0><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD>
|
||||
POS_LOAD = 14, //װ<><D7B0><EFBFBD><EFBFBD>
|
||||
}ENUM_LOCATION_MAP; //<2F><>ͼ<EFBFBD><CDBC>λ
|
||||
164
Plugin/Driver/PluginDriver.cpp
Normal file
164
Plugin/Driver/PluginDriver.cpp
Normal file
@@ -0,0 +1,164 @@
|
||||
|
||||
// Vcs-Client.cpp : <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "PluginDriver.h"
|
||||
#include "DriverMainDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
CCEXPipeClientBase* g_pstPipeClient = CCEXPipeClientBase::CreateObj();
|
||||
// CVcsClientApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPluginDriver, CWinApp)
|
||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CPluginDriver::CPluginDriver()
|
||||
{
|
||||
// ֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||
|
||||
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> InitInstance <20><>
|
||||
}
|
||||
|
||||
|
||||
// Ψһ<CEA8><D2BB>һ<EFBFBD><D2BB> CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CPluginDriver theApp;
|
||||
HANDLE hmutex;
|
||||
|
||||
// CVcsClientApp <20><>ʼ<EFBFBD><CABC>
|
||||
|
||||
|
||||
BOOL CPluginDriver::InitInstance()
|
||||
{
|
||||
|
||||
hmutex = CreateMutexA(nullptr, FALSE, "agv-plugin-driver");
|
||||
int err = GetLastError();
|
||||
if (err == ERROR_ALREADY_EXISTS) {
|
||||
CloseHandle(hmutex);
|
||||
hmutex = nullptr;
|
||||
//AfxMessageBox("<22><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CHAR dir[1000] = { 0 };
|
||||
int filelen = GetModuleFileName(NULL, dir, 1000);
|
||||
//WriteLog(dir);
|
||||
int i = filelen;
|
||||
while (dir[i] != '\\')i--;
|
||||
dir[i] = '\0';
|
||||
m_strModulePath = dir;
|
||||
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows XP <20>ϵ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD>嵥ָ<E5B5A5><D6B8>Ҫ
|
||||
// ʹ<><CAB9> ComCtl32.dll <20>汾 6 <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ӻ<EFBFBD><D3BB><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
//<2F><><EFBFBD><EFBFBD>Ҫ InitCommonControlsEx()<29><> <20><><EFBFBD><EFBFBD><F2A3ACBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
|
||||
INITCOMMONCONTROLSEX InitCtrls;
|
||||
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC>ࡣ
|
||||
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||
InitCommonControlsEx(&InitCtrls);
|
||||
|
||||
CWinApp::InitInstance();
|
||||
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20>κ<EFBFBD> shell <20><><EFBFBD><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> shell <20>б<EFBFBD><D0B1><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>
|
||||
CShellManager *pShellManager = new CShellManager;
|
||||
|
||||
// <20><><EFBFBD>Windows Native<76><65><EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||
|
||||
// <20><><EFBFBD><D7BC>ʼ<EFBFBD><CABC>
|
||||
// <20><><EFBFBD><EFBFBD>δʹ<CEB4><CAB9><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ܲ<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>С
|
||||
// <20><><EFBFBD>տ<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD>õ<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// TODO: Ӧ<>ʵ<EFBFBD><CAB5>ĸ<DEB8><C4B8>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>֯<EFBFBD><D6AF>
|
||||
SetRegistryKey(_T("Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵı<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
|
||||
|
||||
|
||||
CDriverMainDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// <20><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
}
|
||||
else if (nResponse == -1)
|
||||
{
|
||||
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20>Ի<EFBFBD><D4BB><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>\n");
|
||||
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS<47><53>\n");
|
||||
}
|
||||
|
||||
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>洴<EFBFBD><E6B4B4><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (pShellManager != NULL)
|
||||
{
|
||||
delete pShellManager;
|
||||
}
|
||||
|
||||
#ifndef _AFXDLL
|
||||
ControlBarCleanUp();
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD>ѹرգ<D8B1><D5A3><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD> FALSE <20>Ա<EFBFBD><D4B1>˳<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>á<EFBFBD>
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
CString CPluginDriver::SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param)
|
||||
{
|
||||
LogOutToFile("DRIVER::SendMsg2Platform Begin");
|
||||
|
||||
Json::Value root;
|
||||
root["sender"] = "DRIVER"; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,SwingArm
|
||||
root["receiver"] = strReceiver.GetBuffer();
|
||||
|
||||
/******************************************************
|
||||
nMsgTypeʹ<65><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CREATE_TASK_RET = 2, //WCS->WMS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
EXECUTE_TASK_RET = 4, //WCS->WMS ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
DEVICE_STATE_REPORT = 5, //WCS->WMS <20>豸״̬<D7B4>ϱ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
DEVICE_CONFIG_REQ = 6, //WCS->WMS <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*******************************************************/
|
||||
|
||||
root["type"] = nMsgType;
|
||||
root["params"] = param;
|
||||
|
||||
Json::FastWriter writer;
|
||||
string strJson = writer.write(root);
|
||||
|
||||
g_pstPipeClient->SendeMsg(WCS_2_WMS_DATA, (char*)strJson.c_str(), strJson.length());
|
||||
|
||||
LogOutToFile("DRIVER::SendMsg2Platform End");
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
61
Plugin/Driver/PluginDriver.h
Normal file
61
Plugin/Driver/PluginDriver.h
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
// Vcs-Client.h : PROJECT_NAME Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error "<22>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>stdafx.h<><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PCH <20>ļ<EFBFBD>"
|
||||
#endif
|
||||
|
||||
#include "resource.h" // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include "CCEXPipeLib.h"
|
||||
#define WM_MSG_ROBOT_TO_MAIN WM_USER+2000
|
||||
|
||||
|
||||
// CVcsClientApp:
|
||||
// <20>йش<D0B9><D8B4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Vcs-Client.cpp
|
||||
//
|
||||
#define MAX_GUIDE_LABEL 50
|
||||
class CPluginDriver : public CWinApp
|
||||
{
|
||||
public:
|
||||
CPluginDriver();
|
||||
|
||||
// <20><>д
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
public:
|
||||
void ReadConfigFromIni();
|
||||
|
||||
|
||||
public:
|
||||
CString m_strModulePath;
|
||||
|
||||
ST_CAN_DEVICE m_stCanDevice;
|
||||
|
||||
|
||||
ST_GUIDE_LABEL m_GuideLabels[MAX_GUIDE_LABEL];
|
||||
int m_nLabelCount;
|
||||
int m_nRoadwayId;
|
||||
int m_nRoadwayLen;
|
||||
CString m_strRoadwayName;
|
||||
|
||||
int m_nX;
|
||||
int m_nY;
|
||||
float m_fAngle;
|
||||
int m_nTag;
|
||||
|
||||
float m_fVelCal;
|
||||
float m_fAngCal;
|
||||
|
||||
|
||||
// ʵ<><CAB5>
|
||||
CString SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param = NULL);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CPluginDriver theApp;
|
||||
extern CCEXPipeClientBase* g_pstPipeClient;
|
||||
87
Plugin/Driver/PositionView.cpp
Normal file
87
Plugin/Driver/PositionView.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
// PositionView.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "PositionView.h"
|
||||
#include "PluginDriver.h"
|
||||
|
||||
// CPositionView
|
||||
|
||||
IMPLEMENT_DYNAMIC(CPositionView, CStatic)
|
||||
|
||||
CPositionView::CPositionView()
|
||||
{
|
||||
m_nLabelCount = 0;
|
||||
//m_nPosition = 6000;
|
||||
m_nChannelLen = 12000;
|
||||
}
|
||||
|
||||
CPositionView::~CPositionView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPositionView, CStatic)
|
||||
ON_WM_PAINT()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
void CPositionView::Update()
|
||||
{
|
||||
m_nLabelCount = theApp.m_nLabelCount;
|
||||
m_nChannelLen = theApp.m_nRoadwayLen;
|
||||
}
|
||||
|
||||
|
||||
// CPositionView <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CPositionView::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this);
|
||||
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
|
||||
int nWidth = rect.Width();
|
||||
int nPosCnt = m_nLabelCount;
|
||||
//dc.Rectangle(0, 0, nWidth, 60); // 10cm<63><6D><EFBFBD>Ŀ̶ȳ<CCB6>
|
||||
|
||||
|
||||
CFont font;
|
||||
font.CreatePointFont(60, "Arial");
|
||||
|
||||
|
||||
for (int i = 0; i < nPosCnt; i++)
|
||||
{
|
||||
int nLabelPos = nWidth * theApp.m_GuideLabels[i].nOffset *1.0 / m_nChannelLen;
|
||||
|
||||
dc.MoveTo(nLabelPos, 15); // λ<>ÿ̶<C3BF>
|
||||
dc.LineTo(nLabelPos, 0);
|
||||
|
||||
|
||||
CString str;
|
||||
str.Format(_T("%d"), theApp.m_GuideLabels[i].nIndex);
|
||||
dc.TextOut(nLabelPos - 10, -25, str);
|
||||
|
||||
CFont* pOldFont = dc.SelectObject(&font);
|
||||
str.Format(_T("%d"), theApp.m_GuideLabels[i].nTag);
|
||||
dc.TextOut(nLabelPos - 10, 15, str);
|
||||
dc.SelectObject(pOldFont);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
str.Format(_T("%d"), theApp.m_GuideLabels[i].nOffset);
|
||||
dc.TextOut(nLabelPos - 10, 35, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dc.MoveTo(nWidth, 15);
|
||||
dc.LineTo(nWidth, 0);
|
||||
|
||||
int nAgvPos = m_nPosition * nWidth *1.0 / m_nChannelLen; //AGV<47><56><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
|
||||
CBrush brushRed(RGB(255, 0, 0));
|
||||
CBrush* pOldBrush = dc.SelectObject(&brushRed);
|
||||
dc.Ellipse(nAgvPos - 6, 10 - 6, nAgvPos + 6, 10 + 6);
|
||||
dc.SelectObject(pOldBrush);
|
||||
}
|
||||
25
Plugin/Driver/PositionView.h
Normal file
25
Plugin/Driver/PositionView.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CPositionView
|
||||
|
||||
class CPositionView : public CStatic
|
||||
{
|
||||
DECLARE_DYNAMIC(CPositionView)
|
||||
|
||||
public:
|
||||
CPositionView();
|
||||
virtual ~CPositionView();
|
||||
afx_msg void OnPaint();
|
||||
void Update();
|
||||
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
int m_nLabelCount; //ͨ<><CDA8><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>
|
||||
int m_nPosition; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>λ<EFBFBD><CEBB>
|
||||
int m_nChannelLen; //ͨ<><CDA8><EFBFBD><EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>
|
||||
};
|
||||
|
||||
|
||||
67
Plugin/Driver/ReadMe.txt
Normal file
67
Plugin/Driver/ReadMe.txt
Normal file
@@ -0,0 +1,67 @@
|
||||
================================================================================
|
||||
MICROSOFT 基础类库 : Vcs-Client 项目概述
|
||||
===============================================================================
|
||||
|
||||
应用程序向导已为您创建了此 Vcs-Client 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
|
||||
|
||||
本文件概要介绍组成 Vcs-Client 应用程序的每个文件的内容。
|
||||
|
||||
Vcs-Client.vcxproj
|
||||
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
|
||||
|
||||
Vcs-Client.vcxproj.filters
|
||||
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
|
||||
|
||||
Vcs-Client.h
|
||||
这是应用程序的主头文件。
|
||||
其中包括其他项目特定的标头(包括 Resource.h),并声明 CVcsClientApp 应用程序类。
|
||||
|
||||
Vcs-Client.cpp
|
||||
这是包含应用程序类 CVcsClientApp 的主应用程序源文件。
|
||||
|
||||
Vcs-Client.rc
|
||||
这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
|
||||
|
||||
res\Vcs-Client.ico
|
||||
这是用作应用程序图标的图标文件。此图标包括在主资源文件 Vcs-Client.rc 中。
|
||||
|
||||
res\VcsClient.rc2
|
||||
此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
应用程序向导创建一个对话框类:
|
||||
|
||||
Vcs-ClientDlg.h、Vcs-ClientDlg.cpp - 对话框
|
||||
这些文件包含 CVcsClientDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 Vcs-Client.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
其他功能:
|
||||
|
||||
ActiveX 控件
|
||||
该应用程序包含对使用 ActiveX 控件的支持。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
其他标准文件:
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
这些文件用于生成名为 Vcs-Client.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
|
||||
|
||||
Resource.h
|
||||
这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
|
||||
|
||||
Vcs-Client.manifest
|
||||
Windows XP 使用应用程序清单文件来描述特定版本的并行程序集的应用程序依赖项。加载程序使用这些信息来从程序集缓存中加载相应的程序集,并保护其不被应用程序访问。应用程序清单可能会包含在内,以作为与应用程序可执行文件安装在同一文件夹中的外部 .manifest 文件进行重新分发,它还可能以资源的形式包含在可执行文件中。
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
其他注释:
|
||||
|
||||
应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
|
||||
|
||||
如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
|
||||
有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BIN
Plugin/Driver/res/Driver.ico
Normal file
BIN
Plugin/Driver/res/Driver.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
Plugin/Driver/res/Driver.rc2
Normal file
BIN
Plugin/Driver/res/Driver.rc2
Normal file
Binary file not shown.
BIN
Plugin/Driver/resource.h
Normal file
BIN
Plugin/Driver/resource.h
Normal file
Binary file not shown.
188
Plugin/Driver/stdafx.cpp
Normal file
188
Plugin/Driver/stdafx.cpp
Normal file
@@ -0,0 +1,188 @@
|
||||
|
||||
// stdafx.cpp : ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Դ<EFBFBD>ļ<EFBFBD>
|
||||
// Vcs-Client.pch <20><><EFBFBD><EFBFBD>ΪԤ<CEAA><D4A4><EFBFBD><EFBFBD>ͷ
|
||||
// stdafx.obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
#define MIN_XYZ_VALUE (-999999)
|
||||
float* g_xys = new float[3000 * 3000 * 2];
|
||||
int g_xyz_flag = 0;
|
||||
|
||||
|
||||
#define Q_R 1500
|
||||
#define X0 1500
|
||||
#define Y0 1500
|
||||
|
||||
inline float abs_m(float lf)
|
||||
{
|
||||
if (lf < 0) lf *= -1;
|
||||
return lf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
CString g_strSavePath = "";
|
||||
CString g_strCurTime = "";
|
||||
|
||||
void LogOutToFile(const char* fmt, ...)
|
||||
{
|
||||
static CRITICAL_SECTION stCritical;
|
||||
static BOOL bInit = FALSE;
|
||||
static CString strLogPath;
|
||||
if (FALSE == bInit)
|
||||
{
|
||||
bInit = TRUE;
|
||||
GetModuleFileName(NULL, strLogPath.GetBuffer(2048), 2047);
|
||||
strLogPath.ReleaseBuffer();
|
||||
strLogPath = strLogPath.Left(strLogPath.ReverseFind('\\'));
|
||||
strLogPath += "\\log\\runtime.log";
|
||||
|
||||
InitializeCriticalSection(&stCritical);
|
||||
}
|
||||
|
||||
EnterCriticalSection(&stCritical);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
char pBuffer[800] = "";
|
||||
if (vsnprintf_s(pBuffer, 796, _TRUNCATE, fmt, ap) > 0)
|
||||
{
|
||||
|
||||
if (strlen(pBuffer) == 0 || pBuffer[strlen(pBuffer) - 1] != '\n')
|
||||
{
|
||||
pBuffer[strlen(pBuffer) + 1] = '\0';//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊԭ<CEAA><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>з<EFBFBD>
|
||||
pBuffer[strlen(pBuffer)] = '\n';
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
TRACE("%s\n", pBuffer);
|
||||
|
||||
FILE* pFile = NULL;
|
||||
fopen_s(&pFile, strLogPath.GetBuffer(), "ab+");
|
||||
if (NULL != pFile)
|
||||
{
|
||||
char acTime[32] = { 0 };
|
||||
SYSTEMTIME stTime;
|
||||
GetLocalTime(&stTime);
|
||||
sprintf_s(acTime, 32, "[%02d-%02d %02d:%02d:%02d.%03d] ", stTime.wMonth, stTime.wDay, stTime.wHour, stTime.wMinute, stTime.wSecond, stTime.wMilliseconds);
|
||||
|
||||
fwrite(acTime, 1, strlen(acTime), pFile);
|
||||
fwrite(pBuffer, 1, strlen(pBuffer), pFile);
|
||||
fwrite("\r\n", 1, strlen("\r\n"), pFile);
|
||||
fclose(pFile);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&stCritical);
|
||||
}
|
||||
|
||||
int g_nMsgIdx = 998;
|
||||
|
||||
string _UnicodeToUtf8(CString Unicodestr)
|
||||
{
|
||||
wchar_t* unicode = Unicodestr.AllocSysString();
|
||||
int len;
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, unicode, -1, NULL, 0, NULL, NULL);
|
||||
char *szUtf8 = (char*)malloc(len + 1);
|
||||
memset(szUtf8, 0, len + 1);
|
||||
WideCharToMultiByte(CP_UTF8, 0, unicode, -1, szUtf8, len, NULL, NULL);
|
||||
string result = szUtf8;
|
||||
free(szUtf8);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// UTF8<46><38><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>(MultiByte)<29><>ת
|
||||
CString UTF8AndMB_Convert(const CString &strSource, UINT nSourceCodePage, UINT nTargetCodePage)
|
||||
{
|
||||
int nSourceLen = strSource.GetLength();
|
||||
int nWideBufLen = MultiByteToWideChar(nSourceCodePage, 0, strSource, -1, NULL, 0);
|
||||
|
||||
wchar_t* pWideBuf = new wchar_t[nWideBufLen + 1];
|
||||
memset(pWideBuf, 0, (nWideBufLen + 1) * sizeof(wchar_t));
|
||||
|
||||
MultiByteToWideChar(nSourceCodePage, 0, strSource, -1, (LPWSTR)pWideBuf, nWideBufLen);
|
||||
|
||||
char* pMultiBuf = NULL;
|
||||
int nMiltiBufLen = WideCharToMultiByte(nTargetCodePage, 0, (LPWSTR)pWideBuf, -1, (char *)pMultiBuf, 0, NULL, NULL);
|
||||
|
||||
pMultiBuf = new char[nMiltiBufLen + 1];
|
||||
memset(pMultiBuf, 0, nMiltiBufLen + 1);
|
||||
|
||||
WideCharToMultiByte(nTargetCodePage, 0, (LPWSTR)pWideBuf, -1, (char *)pMultiBuf, nMiltiBufLen, NULL, NULL);
|
||||
|
||||
CStringA strTarget(pMultiBuf);
|
||||
|
||||
delete[] pWideBuf;
|
||||
delete[] pMultiBuf;
|
||||
|
||||
return strTarget;
|
||||
}
|
||||
|
||||
CStringA UTF8ToMB(const CStringA& utf8Str)
|
||||
{
|
||||
if (IsTextUTF8(utf8Str, utf8Str.GetLength()))
|
||||
{
|
||||
return UTF8AndMB_Convert(utf8Str, CP_UTF8, CP_ACP);
|
||||
}
|
||||
return utf8Str;
|
||||
}
|
||||
|
||||
|
||||
bool IsTextUTF8(const char* str, ULONGLONG length)
|
||||
{
|
||||
DWORD nBytes = 0;//UFT8<54><38><EFBFBD><EFBFBD>1-6<><36><EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD>,ASCII<49><49>һ<EFBFBD><D2BB><EFBFBD>ֽ<EFBFBD>
|
||||
UCHAR chr;
|
||||
bool bAllAscii = true; //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII, ˵<><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF-8
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
chr = *(str + i);
|
||||
if ((chr & 0x80) != 0) // <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ASCII<49><49><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,˵<><CBB5><EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD>UTF-8,ASCII<49><49>7λ<37><CEBB><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֽڴ<D6BD>,<2C><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ0,o0xxxxxxx
|
||||
bAllAscii = false;
|
||||
if (nBytes == 0) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII<49><49>,Ӧ<><D3A6><EFBFBD>Ƕ<EFBFBD><C7B6>ֽڷ<D6BD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
{
|
||||
if (chr >= 0x80)
|
||||
{
|
||||
if (chr >= 0xFC && chr <= 0xFD)
|
||||
nBytes = 6;
|
||||
else if (chr >= 0xF8)
|
||||
nBytes = 5;
|
||||
else if (chr >= 0xF0)
|
||||
nBytes = 4;
|
||||
else if (chr >= 0xE0)
|
||||
nBytes = 3;
|
||||
else if (chr >= 0xC0)
|
||||
nBytes = 2;
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
nBytes--;
|
||||
}
|
||||
}
|
||||
else //<2F><><EFBFBD>ֽڷ<D6BD><DAB7>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>ֽ<EFBFBD>,ӦΪ 10xxxxxx
|
||||
{
|
||||
if ((chr & 0xC0) != 0x80)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
nBytes--;
|
||||
}
|
||||
}
|
||||
|
||||
if (nBytes > 0) //Υ<><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bAllAscii) //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII, ˵<><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF-8
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
177
Plugin/Driver/stdafx.h
Normal file
177
Plugin/Driver/stdafx.h
Normal file
@@ -0,0 +1,177 @@
|
||||
|
||||
// stdafx.h : <20><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
// <20><><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>
|
||||
// <20>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // <20><> Windows ͷ<><CDB7><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString <20><><EFBFBD>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
|
||||
// <20>ر<EFBFBD> MFC <20><>ijЩ<C4B3><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7>ĺ<EFBFBD><C4BA>Եľ<D4B5><C4BE><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
||||
#include <afxext.h> // MFC <20><>չ
|
||||
|
||||
|
||||
#include <afxdisp.h> // MFC <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC <20><> Internet Explorer 4 <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD><D6A7>
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC <20><> Windows <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD><D6A7>
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include<afxsock.h>
|
||||
#include "json.h"
|
||||
#include <queue>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define WM_NETMESSAGE (WM_USER+9981)
|
||||
#define NET_CONNECT_OK 0
|
||||
#define NET_DISCONNECT 1
|
||||
#define NET_DATA_MSG 2
|
||||
#define CAN_DISCONNECT 3
|
||||
#define PLC_DISCONNECT 4
|
||||
#define APP_DATA_MSG 5
|
||||
|
||||
|
||||
#include <afxcontrolbars.h> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳؼ<CDBF><D8BC><EFBFBD><EFBFBD><EFBFBD> MFC ֧<><D6A7>
|
||||
#include "../Protocol.h"
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined _M_IX86
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_X64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#else
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
extern CString g_strSavePath;
|
||||
extern CString g_strCurTime;
|
||||
extern int g_nMsgIdx;
|
||||
void LogOutToFile(const char* fmt, ...);
|
||||
string _UnicodeToUtf8(CString Unicodestr);
|
||||
|
||||
|
||||
CString UTF8AndMB_Convert(const CString &strSource, UINT nSourceCodePage, UINT nTargetCodePage); // UTF8<46><38><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>(MultiByte)<29><>ת
|
||||
CString UTF8ToMB(const CString& utf8Str);
|
||||
bool IsTextUTF8(const char* str, ULONGLONG length);
|
||||
|
||||
|
||||
typedef struct ST_THREAD_PARAM
|
||||
{
|
||||
void * pParent;
|
||||
//int nIdx;
|
||||
}
|
||||
ST_THREAD_PARAM;
|
||||
|
||||
typedef struct ST_CAN_DEVICE
|
||||
{
|
||||
int nSendFrameFormat;
|
||||
int nSendFrameType;
|
||||
int nCanIndex;
|
||||
int nDevType;
|
||||
}
|
||||
ST_CAN_DEVICE;
|
||||
|
||||
typedef struct ST_GUIDE_LABEL
|
||||
{
|
||||
int nIndex;
|
||||
int nTag;
|
||||
int nOffset;
|
||||
}
|
||||
ST_GUIDE_LABEL;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NET_WR_MSG_RET = 0,
|
||||
NET_RD_MSG_RET = 1
|
||||
}NET_MSG_TYPE_ENUM;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MANUAL_MODE = 0, //<2F>ֶ<EFBFBD>ģʽ<C4A3><CABD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>
|
||||
AUTO_MODE = 1, //<2F>Զ<EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD> PDA<44><41><EFBFBD>ƣ<EFBFBD>PAD<41><44><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>Ƶ<EFBFBD>բ <20><><EFBFBD><EFBFBD> β<><CEB2>װ<EFBFBD><D7B0>
|
||||
DEBUG_MODE = 2, //PDA<44><41><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>е<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD>
|
||||
|
||||
}AGV_RUN_MODE_ENUM;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RE_NORMAL_RUN = 0, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
RE_UNUSUAL_STOP = 1, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>쳣ͣ<ECB3A3><CDA3>
|
||||
RE_POINT_STOP = 2, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>(<28>յ<EFBFBD>)
|
||||
RE_A_STOP = 3, //<2F>Զ<EFBFBD>ͣ<EFBFBD><CDA3>
|
||||
RE_E_STOP = 4, //<2F><><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>
|
||||
}AGV_RUN_RESTATE_ENUM; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
A_STOP = 0, //<2F>Զ<EFBFBD>ͣ<EFBFBD><CDA3>
|
||||
FORWARD = 1, //<2F><>ǰ<EFBFBD><C7B0>ʻ
|
||||
BACKWARD = 2, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʻ
|
||||
E_STOP = 3, //<2F><><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>
|
||||
INVALID_ACTION = 4, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Чָ<D0A7>ά<EEA3AC>ֵ<EFBFBD>ǰͣ<C7B0><CDA3><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>״̬
|
||||
}AGV_ACTION_ENUM;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOG_ERROR = 0,
|
||||
LOG_INFO = 1
|
||||
}LOG_TYPE_ENUM;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SEND_MSG = 0,
|
||||
RECV_MSG = 1
|
||||
}CAN_MSG_ENUM;
|
||||
|
||||
typedef struct NET_PACKET
|
||||
{
|
||||
char* pData;
|
||||
int lLen;
|
||||
int nDevId;
|
||||
NET_MSG_TYPE_ENUM enType;
|
||||
}*pNET_PACKET;
|
||||
|
||||
|
||||
#define DATA_LINE_SIZE (11+13+4+4+11+4+4+4+33) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ֽ<EFBFBD><D6BD><EFBFBD>89
|
||||
|
||||
typedef struct ST_CAN_MESSAGE
|
||||
{
|
||||
char acSeq[10];
|
||||
char acTime[12];
|
||||
unsigned char cIndex; // 0<><30>1
|
||||
unsigned char acTxRx; // 0:send, 1:recv
|
||||
char acID[10];
|
||||
unsigned char acFrame;//0:data, 1:remote
|
||||
unsigned char acType; //0:standard, 1:extend
|
||||
unsigned char cDlc;
|
||||
char acData[32];
|
||||
|
||||
}ST_CAN_MESSAGE;
|
||||
|
||||
|
||||
|
||||
typedef struct APP_NET_PACKET
|
||||
{
|
||||
int lFuncLen;
|
||||
int lParamLen;
|
||||
char *pFuncData;
|
||||
char *pParamData;
|
||||
|
||||
}*pNET_APP_PACKET;
|
||||
8
Plugin/Driver/targetver.h
Normal file
8
Plugin/Driver/targetver.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> SDKDDKVer.h <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE> Windows ƽ̨<C6BD><CCA8>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ҪΪ<D2AA><CEAA>ǰ<EFBFBD><C7B0> Windows ƽ̨<C6BD><CCA8><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WinSDKVer.h<><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><> _WIN32_WINNT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪҪ֧<D2AA>ֵ<EFBFBD>ƽ̨<C6BD><CCA8>Ȼ<EFBFBD><C8BB><EFBFBD>ٰ<EFBFBD><D9B0><EFBFBD> SDKDDKVer.h<><68>
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user