Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
zoompipeline
提交
6aa5624f
zoompipeline
项目概览
colorEagleStdio
/
zoompipeline
通知
181
Star
12
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
zoompipeline
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6aa5624f
编写于
4月 12, 2014
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change the fix-length serial nums to variant
上级
e0774521
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
96 addition
and
71 deletion
+96
-71
FunctionalClientTest/maindialog.cpp
FunctionalClientTest/maindialog.cpp
+38
-27
ZoomPipeline_FuncSvr/smartlink/st_clientnode_app_imp.cpp
ZoomPipeline_FuncSvr/smartlink/st_clientnode_app_imp.cpp
+35
-21
ZoomPipeline_FuncSvr/smartlink/st_clientnode_applayer.cpp
ZoomPipeline_FuncSvr/smartlink/st_clientnode_applayer.cpp
+6
-6
ZoomPipeline_FuncSvr/smartlink/st_msg_applayer.h
ZoomPipeline_FuncSvr/smartlink/st_msg_applayer.h
+17
-17
未找到文件。
FunctionalClientTest/maindialog.cpp
浏览文件 @
6aa5624f
...
...
@@ -153,8 +153,14 @@ void MainDialog::on_pushButton_regisit_clicked()
return
;
}
saveIni
();
QString
strSerial
=
ui
->
plainTextEdit_boxSerialNum
->
toPlainText
();
std
::
string
strStdSerial
=
strSerial
.
toStdString
();
const
char
*
pSrc
=
strStdSerial
.
c_str
();
int
nMaxLen
=
strStdSerial
.
length
();
quint16
nMsgLen
=
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostRegistReq
);
+
sizeof
(
stMsg_HostRegistReq
)
+
nMaxLen
/*Length Include \0*/
;
QByteArray
array
(
sizeof
(
SMARTLINK_MSG
)
+
nMsgLen
-
1
,
0
);
char
*
ptr
=
array
.
data
();
SMARTLINK_MSG
*
pMsg
=
(
SMARTLINK_MSG
*
)
ptr
;
...
...
@@ -177,11 +183,8 @@ void MainDialog::on_pushButton_regisit_clicked()
pApp
->
header
.
AskID
=
0x01
;
pApp
->
header
.
MsgType
=
0x1000
;
pApp
->
header
.
MsgFmtVersion
=
0x01
;
QString
strSerial
=
ui
->
plainTextEdit_boxSerialNum
->
toPlainText
();
std
::
string
strStdSerial
=
strSerial
.
toStdString
();
const
char
*
pSrc
=
strStdSerial
.
c_str
();
int
nMaxLen
=
strStdSerial
.
length
();
for
(
int
i
=
0
;
i
<
64
;
i
++
)
for
(
int
i
=
0
;
i
<=
nMaxLen
;
i
++
)
pApp
->
MsgUnion
.
msg_HostRegistReq
.
HostSerialNum
[
i
]
=
i
<
nMaxLen
?
pSrc
[
i
]
:
0
;
//3/10 possibility to send a data block to server
...
...
@@ -196,8 +199,15 @@ void MainDialog::on_pushButton_Login_clicked()
return
;
}
saveIni
();
QString
strSerial
=
ui
->
plainTextEdit_boxSerialNum
->
toPlainText
();
std
::
string
strStdSerial
=
strSerial
.
toStdString
();
const
char
*
pSrc
=
strStdSerial
.
c_str
();
int
nMaxLen
=
strStdSerial
.
length
();
quint16
nMsgLen
=
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostLogonReq
);
+
sizeof
(
stMsg_HostLogonReq
)
+
nMaxLen
/*\0 included*/
;
QByteArray
array
(
sizeof
(
SMARTLINK_MSG
)
+
nMsgLen
-
1
,
0
);
char
*
ptr
=
array
.
data
();
SMARTLINK_MSG
*
pMsg
=
(
SMARTLINK_MSG
*
)
ptr
;
...
...
@@ -220,11 +230,8 @@ void MainDialog::on_pushButton_Login_clicked()
pApp
->
header
.
AskID
=
0x01
;
pApp
->
header
.
MsgType
=
0x1001
;
pApp
->
header
.
MsgFmtVersion
=
0x01
;
QString
strSerial
=
ui
->
plainTextEdit_boxSerialNum
->
toPlainText
();
std
::
string
strStdSerial
=
strSerial
.
toStdString
();
const
char
*
pSrc
=
strStdSerial
.
c_str
();
int
nMaxLen
=
strStdSerial
.
length
();
for
(
int
i
=
0
;
i
<
64
;
i
++
)
for
(
int
i
=
0
;
i
<=
nMaxLen
;
i
++
)
pApp
->
MsgUnion
.
msg_HostLogonReq
.
HostSerialNum
[
i
]
=
i
<
nMaxLen
?
pSrc
[
i
]
:
0
;
pApp
->
MsgUnion
.
msg_HostLogonReq
.
ID
=
ui
->
lineEdit_boxid
->
text
().
toUInt
();
...
...
@@ -240,8 +247,17 @@ void MainDialog::on_pushButton_clientLogin_clicked()
return
;
}
saveIni
();
QString
strUserName
=
ui
->
lineEdit_username
->
text
();
QString
strPassWd
=
ui
->
lineEdit_password
->
text
();
std
::
string
strStdUserName
=
strUserName
.
toStdString
();
const
char
*
pSrcUsername
=
strStdUserName
.
c_str
();
int
nMaxLenUserName
=
strStdUserName
.
length
();
std
::
string
strStdPassword
=
strPassWd
.
toStdString
();
const
char
*
pSrcPassword
=
strStdPassword
.
c_str
();
int
nMaxLenPassword
=
strStdPassword
.
length
();
quint16
nMsgLen
=
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_ClientLoginReq
);
+
sizeof
(
stMsg_ClientLoginReq
)
+
nMaxLenUserName
+
nMaxLenPassword
+
1
;
QByteArray
array
(
sizeof
(
SMARTLINK_MSG
)
+
nMsgLen
-
1
,
0
);
char
*
ptr
=
array
.
data
();
SMARTLINK_MSG
*
pMsg
=
(
SMARTLINK_MSG
*
)
ptr
;
...
...
@@ -264,22 +280,17 @@ void MainDialog::on_pushButton_clientLogin_clicked()
pApp
->
header
.
AskID
=
0x01
;
pApp
->
header
.
MsgType
=
0x3000
;
pApp
->
header
.
MsgFmtVersion
=
0x01
;
QString
strUserName
=
ui
->
lineEdit_username
->
text
();
QString
strPassWd
=
ui
->
lineEdit_password
->
text
();
std
::
string
strStdUserName
=
strUserName
.
toStdString
();
const
char
*
pSrc
=
strStdUserName
.
c_str
();
int
nMaxLen
=
strStdUserName
.
length
();
for
(
int
i
=
0
;
i
<
32
;
i
++
)
pApp
->
MsgUnion
.
msg_ClientLoginReq
.
UserName
[
i
]
=
i
<
nMaxLen
?
pSrc
[
i
]
:
0
;
std
::
string
strStdPassword
=
strPassWd
.
toStdString
();
pSrc
=
strStdPassword
.
c_str
();
nMaxLen
=
strStdPassword
.
length
();
for
(
int
i
=
0
;
i
<
32
;
i
++
)
pApp
->
MsgUnion
.
msg_ClientLoginReq
.
Password
[
i
]
=
i
<
nMaxLen
?
pSrc
[
i
]
:
0
;
for
(
int
i
=
0
;
i
<=
nMaxLenUserName
;
i
++
)
pApp
->
MsgUnion
.
msg_ClientLoginReq
.
UserNameAndPasswd
[
i
]
=
i
<
nMaxLenUserName
?
pSrcUsername
[
i
]
:
0
;
for
(
int
i
=
0
;
i
<=
nMaxLenPassword
;
i
++
)
pApp
->
MsgUnion
.
msg_ClientLoginReq
.
UserNameAndPasswd
[
i
+
nMaxLenUserName
+
1
]
=
i
<
nMaxLenPassword
?
pSrcPassword
[
i
]
:
0
;
pApp
->
MsgUnion
.
msg_ClientLoginReq
.
ClientVersion
=
0
;
...
...
ZoomPipeline_FuncSvr/smartlink/st_clientnode_app_imp.cpp
浏览文件 @
6aa5624f
...
...
@@ -16,7 +16,16 @@ namespace SmartLink{
(
const
SMARTLINK_MSG_APP
*
)(
((
const
char
*
)(
m_currentBlock
.
constData
()))
+
sizeof
(
SMARTLINK_MSG
)
-
1
);
//form Msgs
int
nAppLen
=
m_currentBlock
.
length
()
-
(
sizeof
(
SMARTLINK_MSG
)
-
1
);
QString
strSerial
;
for
(
int
i
=
0
;
i
<
nAppLen
/*64*/
&&
pAppLayer
->
MsgUnion
.
msg_HostRegistReq
.
HostSerialNum
[
i
]
!=
0
;
i
++
)
{
strSerial
+=
pAppLayer
->
MsgUnion
.
msg_HostRegistReq
.
HostSerialNum
[
i
];
m_serialNum
[
i
]
=
pAppLayer
->
MsgUnion
.
msg_HostRegistReq
.
HostSerialNum
[
i
];
}
//form return Msgs
quint16
nMsgLen
=
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostRegistRsp
);
QByteArray
array
(
sizeof
(
SMARTLINK_MSG
)
+
nMsgLen
-
1
,
0
);
...
...
@@ -53,12 +62,7 @@ namespace SmartLink{
if
(
db
.
isValid
()
==
true
&&
db
.
isOpen
()
==
true
)
{
QSqlQuery
query
(
db
);
QString
strSerial
;
for
(
int
i
=
0
;
i
<
64
&&
pAppLayer
->
MsgUnion
.
msg_HostRegistReq
.
HostSerialNum
[
i
]
!=
0
;
i
++
)
{
strSerial
+=
pAppLayer
->
MsgUnion
.
msg_HostRegistReq
.
HostSerialNum
[
i
];
m_serialNum
[
i
]
=
pAppLayer
->
MsgUnion
.
msg_HostRegistReq
.
HostSerialNum
[
i
];
}
QString
sql
=
"select host_serial_num,equip_id,first_login from instruments where host_serial_num = ?;"
;
query
.
prepare
(
sql
);
query
.
addBindValue
(
strSerial
);
...
...
@@ -137,6 +141,14 @@ namespace SmartLink{
(
const
SMARTLINK_MSG_APP
*
)(
((
const
char
*
)(
m_currentBlock
.
constData
()))
+
sizeof
(
SMARTLINK_MSG
)
-
1
);
int
nAppLen
=
m_currentBlock
.
length
()
-
(
sizeof
(
SMARTLINK_MSG
)
-
1
);
QString
strSerial
;
for
(
int
i
=
0
;
i
<
nAppLen
&&
pAppLayer
->
MsgUnion
.
msg_HostLogonReq
.
HostSerialNum
[
i
]
!=
0
;
i
++
)
{
strSerial
+=
pAppLayer
->
MsgUnion
.
msg_HostLogonReq
.
HostSerialNum
[
i
];
m_serialNum
[
i
]
=
pAppLayer
->
MsgUnion
.
msg_HostLogonReq
.
HostSerialNum
[
i
];
}
//form Msgs
quint16
nMsgLen
=
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostLogonRsp
);
...
...
@@ -173,12 +185,7 @@ namespace SmartLink{
if
(
db
.
isValid
()
==
true
&&
db
.
isOpen
()
==
true
)
{
QSqlQuery
query
(
db
);
QString
strSerial
;
for
(
int
i
=
0
;
i
<
64
&&
pAppLayer
->
MsgUnion
.
msg_HostLogonReq
.
HostSerialNum
[
i
]
!=
0
;
i
++
)
{
strSerial
+=
pAppLayer
->
MsgUnion
.
msg_HostLogonReq
.
HostSerialNum
[
i
];
m_serialNum
[
i
]
=
pAppLayer
->
MsgUnion
.
msg_HostLogonReq
.
HostSerialNum
[
i
];
}
QString
sql
=
"select host_serial_num,equip_id from instruments where host_serial_num = ?;"
;
query
.
prepare
(
sql
);
query
.
addBindValue
(
strSerial
);
...
...
@@ -249,6 +256,21 @@ namespace SmartLink{
(
const
SMARTLINK_MSG_APP
*
)(
((
const
char
*
)(
m_currentBlock
.
constData
()))
+
sizeof
(
SMARTLINK_MSG
)
-
1
);
int
nAppLen
=
m_currentBlock
.
length
()
-
(
sizeof
(
SMARTLINK_MSG
)
-
1
)
-
sizeof
(
quint16
);
QString
strUserName
,
strPasswd
;
int
nSwim
=
0
;
int
usernameLen
=
0
,
passwordlen
=
0
;
while
(
nSwim
<
nAppLen
&&
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserNameAndPasswd
[
nSwim
]
!=
0
)
{
m_username
[
usernameLen
++
]
=
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserNameAndPasswd
[
nSwim
];
strUserName
+=
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserNameAndPasswd
[
nSwim
];
++
nSwim
;
}
++
nSwim
;
while
(
nSwim
<
nAppLen
&&
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserNameAndPasswd
[
nSwim
]
!=
0
)
strPasswd
+=
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserNameAndPasswd
[
nSwim
++
];
//form Msgs
quint16
nMsgLen
=
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_ClientLoginRsp
);
...
...
@@ -285,14 +307,6 @@ namespace SmartLink{
if
(
db
.
isValid
()
==
true
&&
db
.
isOpen
()
==
true
)
{
QSqlQuery
query
(
db
);
QString
strUserName
,
strPasswd
;
for
(
int
i
=
0
;
i
<
32
&&
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserName
[
i
]
!=
0
;
i
++
)
{
m_username
[
i
]
=
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserName
[
i
];
strUserName
+=
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
UserName
[
i
];
}
for
(
int
i
=
0
;
i
<
32
&&
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
Password
[
i
]
!=
0
;
i
++
)
strPasswd
+=
pAppLayer
->
MsgUnion
.
msg_ClientLoginReq
.
Password
[
i
];
QString
sql
=
"select user_name,user_id,password from users where user_name = ? and password = ?;"
;
query
.
prepare
(
sql
);
...
...
ZoomPipeline_FuncSvr/smartlink/st_clientnode_applayer.cpp
浏览文件 @
6aa5624f
...
...
@@ -256,10 +256,10 @@ namespace SmartLink{
if
(
bytesLeft
()
>
0
)
// message is not complete, return
return
true
;
if
(
m_currentMessageSize
!=
if
(
m_currentMessageSize
>
sizeof
(
SMARTLINK_MSG
)
-
1
+
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostRegistReq
))
+
sizeof
(
stMsg_HostRegistReq
)
+
64
)
{
emit
evt_Message
(
tr
(
"Broken Message stMsg_HostRegistReq, size not correct."
));
res
=
false
;
...
...
@@ -271,10 +271,10 @@ namespace SmartLink{
if
(
bytesLeft
()
>
0
)
// message is not complete, return
return
true
;
if
(
m_currentMessageSize
!=
if
(
m_currentMessageSize
>
sizeof
(
SMARTLINK_MSG
)
-
1
+
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostLogonReq
))
+
sizeof
(
stMsg_HostLogonReq
)
+
64
)
{
emit
evt_Message
(
tr
(
"Broken Message stMsg_HostLogonReq, size not correct."
));
res
=
false
;
...
...
@@ -286,10 +286,10 @@ namespace SmartLink{
if
(
bytesLeft
()
>
0
)
// message is not complete, return
return
true
;
if
(
m_currentMessageSize
!=
if
(
m_currentMessageSize
>
sizeof
(
SMARTLINK_MSG
)
-
1
+
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_ClientLoginReq
))
+
sizeof
(
stMsg_ClientLoginReq
)
+
66
)
{
emit
evt_Message
(
tr
(
"Broken Message stMsg_ClientLoginReq, size not correct."
));
res
=
false
;
...
...
ZoomPipeline_FuncSvr/smartlink/st_msg_applayer.h
浏览文件 @
6aa5624f
...
...
@@ -11,14 +11,14 @@ namespace SmartLink{
//Host Reg request, send 64 byte Serial Num to Server
//SMARTLINK_MSG_APP::MsgType = 0x1000
typedef
struct
tag_stMsg_HostRegistReq
{
char
HostSerialNum
[
64
];
char
HostSerialNum
[
1
];
//max 64
}
stMsg_HostRegistReq
;
//Host Reg replay, send back 4 byte ID
//SMARTLINK_MSG_APP::MsgType = 0x1800
typedef
struct
tag_stMsg_HostRegistRsp
{
__UINT8_TYPE__
DoneCode
;
//0 first ok, 1 ok 2 failed
char
TextInfo
[
64
];
//
char TextInfo[64];
__UINT32_TYPE__
ID
;
}
stMsg_HostRegistRsp
;
...
...
@@ -26,22 +26,22 @@ namespace SmartLink{
//SMARTLINK_MSG_APP::MsgType = 0x1001
typedef
struct
tag_stMsg_HostLogonReq
{
__UINT32_TYPE__
ID
;
char
HostSerialNum
[
64
];
char
HostSerialNum
[
1
];
//max 64
}
stMsg_HostLogonReq
;
//Host Log response
//SMARTLINK_MSG_APP::MsgType = 0x1801
typedef
struct
tag_stMsg_HostLogonRsp
{
__UINT8_TYPE__
DoneCode
;
char
TextInfo
[
64
];
//
char TextInfo[64];
}
stMsg_HostLogonRsp
;
//User Login request
//SMARTLINK_MSG_APP::MsgType = 0x3000
typedef
struct
tag_stMsg_ClientLoginReq
{
__UINT16_TYPE__
ClientVersion
;
char
UserName
[
32
];
char
Password
[
32
];
char
UserName
AndPasswd
[
1
];
//
char Password[32];
}
stMsg_ClientLoginReq
;
//User Log response
...
...
@@ -49,7 +49,7 @@ namespace SmartLink{
typedef
struct
tag_stMsg_ClientLoginRsp
{
__UINT8_TYPE__
DoneCode
;
__UINT32_TYPE__
UserID
;
char
TextInfo
[
64
];
//
char TextInfo[64];
}
stMsg_ClientLoginRsp
;
//User Log response
...
...
@@ -61,7 +61,7 @@ namespace SmartLink{
//Time Correct
typedef
struct
tag_stMsg_HostTimeCorrectRsp
{
__UINT8_TYPE__
DoneCode
;
char
TextInfo
[
64
];
//
char TextInfo[64];
struct
tag_stDateTime
{
__UINT16_TYPE__
Year
;
__UINT8_TYPE__
Month
;
...
...
@@ -82,7 +82,7 @@ namespace SmartLink{
//SMARTLINK_MSG_APP::MsgType = 0x1803
typedef
struct
tag_stMsg_UploadUserListRsp
{
__UINT8_TYPE__
DoneCode
;
char
TextInfo
[
64
];
//
char TextInfo[64];
}
stMsg_UploadUserListRsp
;
//SMARTLINK_MSG_APP::MsgType = 0x1004
...
...
@@ -93,7 +93,7 @@ namespace SmartLink{
//SMARTLINK_MSG_APP::MsgType = 0x1804
typedef
struct
tag_stMsg_DownloadUserListRsp
{
__UINT8_TYPE__
DoneCode
;
char
TextInfo
[
64
];
//
char TextInfo[64];
__UINT16_TYPE__
UserNum
;
__UINT32_TYPE__
pUserIDList
[
1
];
}
stMsg_DownloadUserListRsp
;
...
...
@@ -101,13 +101,13 @@ namespace SmartLink{
//0x3001
typedef
struct
tag_stMsg_ClientLogoutReq
{
char
UserName
[
32
];
char
UserName
[
1
];
//max 32
}
stMsg_ClientLogoutReq
;
//0x3801
typedef
struct
tag_stMsg_ClientLogoutRsp
{
__UINT8_TYPE__
DoneCode
;
char
TextInfo
[
64
];
//
char TextInfo[64];
}
stMsg_ClientLogoutRsp
;
//SMARTLINK_MSG_APP::MsgType = 0x3002
...
...
@@ -154,7 +154,7 @@ namespace SmartLink{
//Host Reg request, send 64 byte Serial Num to Server
//SMARTLINK_MSG_APP::MsgType = 0x1000
typedef
struct
tag_stMsg_HostRegistReq
{
char
HostSerialNum
[
64
];
char
HostSerialNum
[
1
];
//max 64
}
stMsg_HostRegistReq
;
...
...
@@ -170,7 +170,7 @@ namespace SmartLink{
//SMARTLINK_MSG_APP::MsgType = 0x1001
typedef
struct
tag_stMsg_HostLogonReq
{
unsigned
__int32
ID
;
char
HostSerialNum
[
64
];
char
HostSerialNum
[
1
];
//max 64
}
stMsg_HostLogonReq
;
//Host Log response
...
...
@@ -184,8 +184,8 @@ namespace SmartLink{
//SMARTLINK_MSG_APP::MsgType = 0x3000
typedef
struct
tag_stMsg_ClientLoginReq
{
unsigned
__int16
ClientVersion
;
char
UserName
[
32
];
char
Password
[
32
];
char
UserName
AndPasswd
[
1
];
//max 65
//char Password[1];//max 32
}
stMsg_ClientLoginReq
;
//User Log response
...
...
@@ -246,7 +246,7 @@ namespace SmartLink{
//0x3001
typedef
struct
tag_stMsg_ClientLogoutReq
{
char
UserName
[
32
];
char
UserName
[
1
];
//max 32
}
stMsg_ClientLogoutReq
;
//0x3801
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录