2022-12-08 09:40:43 +00:00
|
|
|
|
#include "base/HGDef.h"
|
|
|
|
|
#include "base/HGInc.h"
|
|
|
|
|
#include "../HGPdtToolDb/HGPdtToolDb.h"
|
2023-01-03 10:11:21 +00:00
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
static std::string AnsiToUtf8(const char* text)
|
|
|
|
|
{
|
|
|
|
|
int wlen = ::MultiByteToWideChar(CP_ACP, 0, text, -1, NULL, 0);
|
|
|
|
|
WCHAR* pUnicode = new WCHAR[wlen];
|
|
|
|
|
::MultiByteToWideChar(CP_ACP, 0, text, -1, pUnicode, wlen);
|
|
|
|
|
int len = ::WideCharToMultiByte(CP_UTF8, 0, pUnicode, -1, NULL, 0, NULL, NULL);
|
|
|
|
|
CHAR* pUTF8 = new CHAR[len];
|
|
|
|
|
::WideCharToMultiByte(CP_UTF8, 0, pUnicode, -1, pUTF8, len, NULL, NULL);
|
|
|
|
|
delete[] pUnicode;
|
|
|
|
|
std::string ret = pUTF8;
|
|
|
|
|
delete[] pUTF8;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-12-08 09:40:43 +00:00
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
HGPdtToolDbUserMgr userMgr = NULL;
|
2022-12-22 02:07:39 +00:00
|
|
|
|
HGPdtToolDb_CreateUserMgr("127.0.0.1", 3306, "root", "123456", &userMgr);
|
2022-12-08 09:40:43 +00:00
|
|
|
|
if (NULL != userMgr)
|
|
|
|
|
{
|
2022-12-15 07:13:21 +00:00
|
|
|
|
//HGPdtToolDb_UploadFile(userMgr, "G100", "D:\\config.json");
|
|
|
|
|
//HGPdtToolDb_DownloadFile(userMgr, "G100", "D:\\123.txt");
|
2022-12-08 09:40:43 +00:00
|
|
|
|
|
2023-01-03 10:11:21 +00:00
|
|
|
|
std::string str = AnsiToUtf8("图像质量");
|
|
|
|
|
HGPdtToolDb_SetEntryNameCnStr(userMgr, "image_quality", str.c_str());
|
|
|
|
|
|
2022-12-09 09:39:01 +00:00
|
|
|
|
HGPdtToolDbDevice device = NULL;
|
2022-12-27 08:30:54 +00:00
|
|
|
|
HGPdtToolDb_OpenDevice(userMgr, "G654321", &device);
|
2023-01-03 10:11:21 +00:00
|
|
|
|
HGPdtToolDb_SetDeviceEntryStatus(device, "image_quality", 1);
|
|
|
|
|
HGPdtToolDb_UploadDeviceEntryImage(device, "image_quality", "192.168.1.70", 21, "D:\\1.jpg");
|
|
|
|
|
HGPdtToolDb_DownloadDeviceEntryImage(device, "image_quality", "192.168.1.70", 21, 0, "D:\\22.jpg");
|
2022-12-22 02:07:16 +00:00
|
|
|
|
//HGPdtToolDb_CloseDevice(device);
|
2022-12-09 09:39:01 +00:00
|
|
|
|
|
2022-12-23 06:17:36 +00:00
|
|
|
|
HGPdtToolDb_Export(userMgr, "D:\\1.xls");
|
2022-12-08 09:40:43 +00:00
|
|
|
|
HGPdtToolDb_DestroyUserMgr(userMgr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|