Skip to content

Commit 5f2fb0c

Browse files
authored
Merge pull request #17 from libxengine/develop
V3.1.0.1001 Merge
2 parents 38460b1 + 96136dc commit 5f2fb0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+736
-384
lines changed

CHANGELOG

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
XEngine_APIService V3.1.0.1001
2+
3+
增加:为opencv和qr增加自定义编译开关
4+
增加:p2xp用户离开和万维网ip地址获取,心跳协议支持
5+
修改:自动启动仅仅运行在管理员模式下
6+
修改:用户验证配置为子级别了
7+
修改:当禁用守护进程的时候会停止进程
8+
修改:屏幕录像现在可以设置设备名称了
9+
修改:当图像处理失败会回复消息
10+
修改:图像处理错误方法
11+
修改:所有配置文件被指定到主配置中了
12+
修改:配置重载支持opencc,qr,deamon了
13+
修改:p2xp协议的connect字段不在作为key使用
14+
修正:qr码识别不支持linux的问题
15+
修正:日志配置没有作用的问题
16+
修正:p2p的delete和心跳不争取的问题
17+
修正:图像设置http参数解析不正确的问题
18+
修正:图像的宽高参数解析错误
19+
修正:windows隐藏窗口不正确的问题
20+
删除:没有使用的p2p协议代码
21+
删除:p2p的获取用户信息协议和链接协议
22+
删除:没有使用的内存代码
23+
24+
added:custom build switch for opencv and qr
25+
added:p2p delete client and wan address get and heartbeat supported
26+
modify:Autostart only run with administrator privileges
27+
modify:user ver configure node level
28+
modify:stop process when disable deamon process
29+
modify:screen record can be set device name
30+
modify:reply message when process failed for image
31+
modify:image process error way
32+
modify:All configuration files are specified by the master configuration
33+
modify:configure reload supports opencc and qr and deamon now
34+
modify:p2xp does not use connect address as a key.
35+
fixed:qr not support linux platform
36+
fixed:log configure does not work
37+
fixed:delete and heart p2xp not work
38+
fixed:image set http parament parse is incorrent
39+
fixed:image width and heigth parament is incorrent
40+
fixed:hide window is incorrent for windows
41+
delete:unused p2p protocol code
42+
delete:get user info and connect for p2p client
43+
delete:not used memory code for deamon
44+
======================================================================================
145
XEngine_APIService V3.0.0.1001
246

347
增加:系统API函数模块

README.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ MYSQL database version 8.0 or above is required. Create a table through CreateDa
6969
Modify the database configuration in XSQL in the configuration file to your
7070

7171
#### Windows
72-
need to vcpkg configure third-part env.refer vcpkg install guide.after installed and execution:vcpkg.exe install lua:x84-windows lua:x64-windows opencc:x84-windows opencc:x64-windows opencv[contrib]:x84-windows libqrencode:x84-windows opencv[contrib]:x64-windows libqrencode:x64-windows
72+
need to vcpkg configure third-part env.refer vcpkg install guide.after installed and execution:vcpkg.exe install lua:x86-windows opencc:x86-windows opencv[contrib]:x86-windows libqrencode:x86-windows lua:x64-windows opencc:x64-windows opencv[contrib]:x64-windows libqrencode:x64-windows
7373
use vs open and compile,suport windows 7sp1 and above
7474
Just Run it
7575

@@ -80,7 +80,7 @@ use makefile compile,UBUNTU22.04 x64 or RockyLinux 9 x64
8080
Run it on the terminal
8181

8282
#### Macos
83-
install opencc:brew install opencc
83+
install opencc:brew install opencc opencc opencv qrencode
8484
use makefile compile,mac 13 and above
8585
Run it on the terminal
8686

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ macos执行:./XEngine_LINEnv.sh -i 3
6868
修改配置文件里面XSQL里面的数据库配置为你的
6969

7070
#### Windows
71-
需要vcpkg配置第三方环境,具体参考vcpkg安装方式,安装好后执行:vcpkg.exe install lua:x84-windows lua:x64-windows opencc:x84-windows opencc:x64-windows opencv[contrib]:x84-windows libqrencode:x84-windows opencv[contrib]:x64-windows libqrencode:x64-windows
71+
需要vcpkg配置第三方环境,具体参考vcpkg安装方式,安装好后执行:vcpkg.exe install lua:x86-windows opencc:x86-windows opencv[contrib]:x86-windows libqrencode:x86-windows lua:x64-windows opencc:x64-windows opencv[contrib]:x64-windows libqrencode:x64-windows
7272
使用VS打开并且编译,支持WINDOWS 7SP1以上系统
7373
直接运行即可
7474

@@ -79,7 +79,7 @@ Linux使用Makefile编译,UBUNTU22.04 x64或者RockyLinux 9 x64
7979
在控制台运行
8080

8181
#### Macos
82-
安装opencc,执行命令:brew install lua opencc
82+
安装opencc,执行命令:brew install lua opencc opencv qrencode
8383
使用makefile编译,控制台运行,需要mac 13以及以上版本
8484
在控制台运行
8585

XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.cpp

Lines changed: 72 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,107 @@
22
#include <Windows.h>
33
#include <tchar.h>
44
#pragma comment(lib,"Ws2_32")
5+
#pragma comment(lib,"jsoncpp")
56
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib")
67
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient")
8+
#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi")
79
#endif
810
#include <stdio.h>
911
#include <stdlib.h>
1012
#include <string.h>
1113
#include <inttypes.h>
14+
#include <json/json.h>
1215
#include <XEngine_Include/XEngine_CommHdr.h>
1316
#include <XEngine_Include/XEngine_Types.h>
1417
#include <XEngine_Include/XEngine_ProtocolHdr.h>
1518
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
1619
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
1720
#include <XEngine_Include/XEngine_NetHelp/APIClient_Define.h>
1821
#include <XEngine_Include/XEngine_NetHelp/APIClient_Error.h>
22+
#include <XEngine_Include/XEngine_SystemSdk/ProcFile_Define.h>
23+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Define.h>
24+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Error.h>
1925

2026
//需要优先配置XEngine
2127
//WINDOWS支持VS2022 x64 debug 编译调试
2228
//linux::g++ -std=c++17 -Wall -g APPClient_ImageExample.cpp -o APPClient_ImageExample.exe -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -lXEngine_BaseLib -lNetHelp_APIClient
2329
//macos::g++ -std=c++17 -Wall -g APPClient_ImageExample.cpp -o APPClient_ImageExample.exe -lXEngine_BaseLib -lNetHelp_APIClient
2430

2531

26-
int test_query()
32+
bool APPClient_ImageExample_GetAttr(LPCXSTR lpszMsgBuffer, int nMsgLen, int* pInt_Width, int* pInt_Height)
2733
{
2834
int nCode = 0;
29-
XCHAR* ptszFileBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX);
30-
if (NULL == ptszFileBuffer)
31-
{
32-
return -1;
33-
}
34-
memset(ptszFileBuffer, '\0', XENGINE_MEMORY_SIZE_MAX);
35-
3635
LPCXSTR lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=image&params1=0");
3736

38-
FILE* pSt_File = _xtfopen(_X("D:\\XEngine_APIService\\XEngine_APPClient\\x64\\Debug\\1.png"), "rb");
39-
int nRet = fread(ptszFileBuffer, 1, XENGINE_MEMORY_SIZE_MAX, pSt_File);
40-
4137
XCHAR* ptszMsgBuffer = NULL;
42-
if (!APIClient_Http_Request(_X("POST"), lpszAPIUrl, ptszFileBuffer, &nCode, &ptszMsgBuffer, &nRet))
38+
if (!APIClient_Http_Request(_X("POST"), lpszAPIUrl, lpszMsgBuffer, &nCode, &ptszMsgBuffer, &nMsgLen))
4339
{
4440
printf("发送投递失败!\n");
4541
return 0;
4642
}
47-
printf("接受到数据,大小:%d,内容:%s\n", nRet, ptszMsgBuffer);
43+
Json::Value st_JsonRoot;
44+
JSONCPP_STRING st_JsonError;
45+
Json::CharReaderBuilder st_JsonBuilder;
46+
//开始解析配置文件
47+
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_JsonBuilder.newCharReader());
48+
if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
49+
{
50+
printf("json parse failed\n");
51+
return false;
52+
}
4853
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
49-
free(ptszFileBuffer);
54+
55+
Json::Value st_JsonBase = st_JsonRoot["st_BaseInfo"];
56+
*pInt_Width = st_JsonBase["nWidth"].asInt();
57+
*pInt_Height = st_JsonBase["nHeigth"].asInt();
58+
return 0;
59+
}
60+
int test_imgzoom()
61+
{
62+
LPCXSTR lpszFileDir = _X("D:\\Image\\*.png");
63+
64+
int nListCount = 0;
65+
XCHAR** pptszListFile;
66+
67+
SystemApi_File_EnumFile(lpszFileDir, &pptszListFile, &nListCount);
68+
for (int i = 0; i < nListCount; i++)
69+
{
70+
int nCode = 0;
71+
int nWidth = 0;
72+
int nHeight = 0;
73+
XCHAR* ptszFileBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX);
74+
if (NULL == ptszFileBuffer)
75+
{
76+
return -1;
77+
}
78+
memset(ptszFileBuffer, '\0', XENGINE_MEMORY_SIZE_MAX);
79+
80+
FILE* pSt_File = _xtfopen(pptszListFile[i], _X("rb"));
81+
int nRet = (int)fread(ptszFileBuffer, 1, XENGINE_MEMORY_SIZE_MAX, pSt_File);
82+
fclose(pSt_File);
83+
APPClient_ImageExample_GetAttr(ptszFileBuffer, nRet, &nWidth, &nHeight);
84+
85+
XCHAR tszAPIUrl[MAX_PATH];
86+
memset(tszAPIUrl, '\0', sizeof(tszAPIUrl));
87+
88+
_xstprintf(tszAPIUrl, _X("http://127.0.0.1:5501/api?function=image&type=1&ext=png&width=%d&height=%d"), nWidth / 2, nHeight / 2);
89+
90+
XCHAR* ptszMsgBuffer = NULL;
91+
if (!APIClient_Http_Request(_X("POST"), tszAPIUrl, ptszFileBuffer, &nCode, &ptszMsgBuffer, &nRet))
92+
{
93+
printf("发送投递失败!\n");
94+
return 0;
95+
}
96+
free(ptszFileBuffer);
97+
98+
pSt_File = _xtfopen(pptszListFile[i], _X("wb"));
99+
fwrite(ptszMsgBuffer, 1, nRet, pSt_File);
100+
fclose(pSt_File);
101+
102+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
103+
}
104+
105+
50106
return 0;
51107
}
52108

@@ -56,7 +112,8 @@ int main()
56112
WSADATA st_WSAData;
57113
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
58114
#endif
59-
test_query();
115+
116+
test_imgzoom();
60117

61118
#ifdef _MSC_BUILD
62119
WSACleanup();

XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
</ImportGroup>
7272
<PropertyGroup Label="UserMacros" />
7373
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
74-
<IncludePath>$(XEngine_Include);$(IncludePath)</IncludePath>
75-
<LibraryPath>$(XEngine_Lib64);$(LibraryPath)</LibraryPath>
74+
<IncludePath>$(XEngine_Include);../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
75+
<LibraryPath>$(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath)</LibraryPath>
7676
</PropertyGroup>
7777
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
7878
<ClCompile>

XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ BOOL APIHelp_NetWork_GetIPNet(XCHAR* ptszIPAddr)
5252
int APPClient_P2XPLogin()
5353
{
5454
Json::Value st_JsonRoot;
55-
LPCXSTR lpszAddr = _T("http://192.168.1.8:5501/api?function=p2p&params1=24577");
55+
LPCXSTR lpszAddr = _T("http://127.0.0.1:5501/api?function=p2p&params1=24577");
5656
ENUM_XENGINE_NETXAPI_SOCKET_CONNECTTYPE dwNetType;
5757

5858
memset(tszPublicAddr, '\0', sizeof(tszPublicAddr));
@@ -95,7 +95,7 @@ int APPClient_P2XPLogin()
9595
int APPClient_P2XPList()
9696
{
9797
Json::Value st_JsonRoot;
98-
LPCXSTR lpszAddr = _T("http://192.168.1.8:5501/api?function=p2p&params1=24579");
98+
LPCXSTR lpszAddr = _T("http://127.0.0.1:5501/api?function=p2p&params1=24581");
9999

100100
st_JsonRoot["tszUserName"] = lpszUserName;
101101
st_JsonRoot["tszPrivateAddr"] = tszPrivateAddr;
@@ -113,31 +113,27 @@ int APPClient_P2XPList()
113113
return 0;
114114
}
115115

116-
int APPClient_P2XPGetUser()
116+
int APPClient_P2XPWan()
117117
{
118118
Json::Value st_JsonRoot;
119-
LPCXSTR lpszAddr = _T("http://192.168.1.8:5501/api?function=p2p&params1=24583");
120-
121-
st_JsonRoot["tszUserName"] = lpszUserName;
122-
st_JsonRoot["tszPrivateAddr"] = tszPrivateAddr;
123-
st_JsonRoot["tszPublicAddr"] = tszPublicAddr;
119+
LPCXSTR lpszAddr = _T("http://127.0.0.1:5501/api?function=p2p&params1=24583");
124120

125121
int nMsgLen = 0;
126122
int nHTTPCode = 0;
127123
XCHAR* ptszMsgBuffer = NULL;
128-
if (!APIClient_Http_Request(_T("POST"), lpszAddr, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen))
124+
if (!APIClient_Http_Request(_T("POST"), lpszAddr, NULL, &nHTTPCode, &ptszMsgBuffer, &nMsgLen))
129125
{
130126
return -1;
131127
}
132-
printf("APPClient_P2XPGetUser,&nMsgLen:%d,%s\n", nMsgLen, ptszMsgBuffer);
128+
printf("APPClient_P2XPWan,&nMsgLen:%d,%s\n", nMsgLen, ptszMsgBuffer);
133129
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
134130
return 0;
135131
}
136132

137-
int APPClient_P2XPConnect()
133+
int APPClient_P2XPLogout()
138134
{
139135
Json::Value st_JsonRoot;
140-
LPCXSTR lpszAddr = _T("http://192.168.1.8:5501/api?function=p2p&params1=24581");
136+
LPCXSTR lpszAddr = _T("http://127.0.0.1:5501/api?function=p2p&params1=24579");
141137

142138
st_JsonRoot["tszUserName"] = lpszUserName;
143139
st_JsonRoot["tszPrivateAddr"] = tszPrivateAddr;
@@ -150,7 +146,7 @@ int APPClient_P2XPConnect()
150146
{
151147
return -1;
152148
}
153-
printf("APPClient_P2XPConnect,&nMsgLen:%d,%s\n", nMsgLen, ptszMsgBuffer);
149+
printf("APPClient_P2XPLogout,&nMsgLen:%d,%s\n", nMsgLen, ptszMsgBuffer);
154150
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
155151
return 0;
156152
}
@@ -164,8 +160,8 @@ int main()
164160

165161
APPClient_P2XPLogin();
166162
APPClient_P2XPList();
167-
//APPClient_P2XPGetUser();
168-
//APPClient_P2XPConnect();
163+
APPClient_P2XPWan();
164+
APPClient_P2XPLogout();
169165

170166
#ifdef _MSC_BUILD
171167
WSACleanup();

XEngine_Docment/Docment_en.docx

2.25 KB
Binary file not shown.

XEngine_Docment/Docment_zh.docx

2.18 KB
Binary file not shown.

0 commit comments

Comments
 (0)