Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
zoompipeline
提交
42286dc6
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,体验更适合开发者的 AI 搜索 >>
提交
42286dc6
编写于
2月 20, 2014
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add log and log response msg
上级
66fa83cb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
153 addition
and
6 deletion
+153
-6
ZoomPipeline_FuncSvr/smartlink/st_clientnode.h
ZoomPipeline_FuncSvr/smartlink/st_clientnode.h
+3
-1
ZoomPipeline_FuncSvr/smartlink/st_clientnode_impdeal.cpp
ZoomPipeline_FuncSvr/smartlink/st_clientnode_impdeal.cpp
+105
-0
ZoomPipeline_FuncSvr/smartlink/st_clientnode_msgdeal.cpp
ZoomPipeline_FuncSvr/smartlink/st_clientnode_msgdeal.cpp
+21
-5
ZoomPipeline_FuncSvr/smartlink/st_msg_applayer.h
ZoomPipeline_FuncSvr/smartlink/st_msg_applayer.h
+24
-0
未找到文件。
ZoomPipeline_FuncSvr/smartlink/st_clientnode.h
浏览文件 @
42286dc6
...
...
@@ -45,10 +45,12 @@ protected:
//Message Dealers, imp in st_clientnode_msgdeal.cpp
bool
Deal_BoxToServer_Messages
();
//0x
0001
msg, stMsg_HostRegistReq
//0x
1000<->0x1800
msg, stMsg_HostRegistReq
QMutex
m_mutex_equipID
;
bool
RegisitNewNode
();
quint32
AssignNewEquipID
(
const
QString
&
serial
);
//0x1001<->0x1801 msg, stMsg_HostLogonReq
bool
LoginSvr
();
//data items
...
...
ZoomPipeline_FuncSvr/smartlink/st_clientnode_impdeal.cpp
浏览文件 @
42286dc6
...
...
@@ -140,5 +140,110 @@ quint32 st_clientNode::AssignNewEquipID(const QString & serial)
}
return
id
;
}
bool
st_clientNode
::
LoginSvr
()
{
SMARTLINK_MSG_APP
*
pAppLayer
=
(
SMARTLINK_MSG_APP
*
)(
((
const
char
*
)(
m_currentBlock
.
constData
()))
+
sizeof
(
SMARTLINK_MSG
)
-
1
);
//form Msgs
quint16
nMsgLen
=
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostLogonRsp
);
QByteArray
array
(
sizeof
(
SMARTLINK_MSG
)
+
nMsgLen
-
1
,
0
);
char
*
ptr
=
array
.
data
();
SMARTLINK_MSG
*
pMsg
=
(
SMARTLINK_MSG
*
)
ptr
;
SMARTLINK_MSG_APP
*
pApp
=
(
SMARTLINK_MSG_APP
*
)(((
unsigned
char
*
)
(
ptr
))
+
sizeof
(
SMARTLINK_MSG
)
-
1
);
pMsg
->
Mark
=
0x55AA
;
pMsg
->
version
=
m_currentHeader
.
version
;
pMsg
->
SerialNum
=
m_currentHeader
.
SerialNum
;
pMsg
->
Priority
=
m_currentHeader
.
Priority
;
pMsg
->
Reserved1
=
0
;
pMsg
->
source_id
=
(
quint32
)((
quint64
)(
m_currentHeader
.
destin_id
)
&
0xffffffff
);
pMsg
->
destin_id
=
(
quint32
)((
quint64
)(
m_currentHeader
.
source_id
)
&
0xffffffff
);;
pMsg
->
data_length
=
nMsgLen
;
pMsg
->
Reserved2
=
0
;
pApp
->
header
.
AskID
=
m_current_app_header
.
header
.
AskID
;
pApp
->
header
.
MsgType
=
0x1801
;
pApp
->
header
.
MsgFmtVersion
=
m_current_app_header
.
header
.
MsgFmtVersion
;
stMsg_HostLogonRsp
&
reply
=
pApp
->
MsgUnion
.
msg_HostLogonRsp
;
//Check the database, find current equipment info
QSqlDatabase
db
=
m_pClientTable
->
dbRes
()
->
databse
(
m_pClientTable
->
Database_UserAcct
());
reply
.
DoneCode
=
3
;
strcpy
(
reply
.
TextInfo
,
"Unknown error"
);
if
(
db
.
isValid
()
==
true
&&
db
.
isOpen
()
==
true
)
{
QSqlQuery
query
(
db
);
QString
strSerial
;
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
strSerial
+=
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
);
if
(
true
==
query
.
exec
())
{
if
(
query
.
next
())
{
bool
bOk
=
false
;
int
ncurrid
=
query
.
value
(
1
).
toInt
(
&
bOk
);
if
(
bOk
==
true
)
{
if
(
ncurrid
>=
0x0010000
&&
ncurrid
<=
0x0FFFFFFF
)
{
reply
.
ID
=
ncurrid
;
reply
.
DoneCode
=
1
;
strcpy
(
reply
.
TextInfo
,
"Re-regisit Succeed."
);
}
else
{
reply
.
ID
=
AssignNewEquipID
(
strSerial
);
if
(
reply
.
ID
>=
0x0010000
&&
reply
.
ID
<=
0x0FFFFFFF
)
{
reply
.
DoneCode
=
0
;
strcpy
(
reply
.
TextInfo
,
"First-regisit Succeed."
);
}
else
strcpy
(
reply
.
TextInfo
,
"Equip ID resource error."
);
}
}
else
strcpy
(
reply
.
TextInfo
,
"Raw Dev ID Is Invalid."
);
}
else
{
// No such device
strcpy
(
reply
.
TextInfo
,
"No such device ID."
);
}
}
else
{
strcpy
(
reply
.
TextInfo
,
"Server Access Error."
);
emit
evt_Message
(
tr
(
"Database Access Error :"
)
+
query
.
lastError
().
text
());
}
}
else
{
//Server db is currently not accessable, wait.
strcpy
(
reply
.
TextInfo
,
"Server Not Accessable Now."
);
}
//Send back
emit
evt_SendDataToClient
(
this
->
sock
(),
array
);
return
reply
.
DoneCode
==
2
?
false
:
true
;
}
}
ZoomPipeline_FuncSvr/smartlink/st_clientnode_msgdeal.cpp
浏览文件 @
42286dc6
...
...
@@ -4,6 +4,7 @@
namespace
SmartLink
{
bool
st_clientNode
::
Deal_BoxToServer_Messages
()
{
bool
res
=
true
;
//The bytes left to recieve.
qint32
bytesLeft
=
m_currentHeader
.
data_length
+
sizeof
(
SMARTLINK_MSG
)
-
1
-
m_currentMessageSize
;
...
...
@@ -40,20 +41,35 @@ bool st_clientNode::Deal_BoxToServer_Messages()
+
sizeof
(
stMsg_HostRegistReq
))
{
emit
evt_Message
(
tr
(
"Broken Message stMsg_HostRegistReq, size not correct."
));
emit
evt_close_client
(
this
->
sock
());
return
false
;
res
=
false
;
}
return
this
->
RegisitNewNode
();
else
res
=
this
->
RegisitNewNode
();
break
;
case
0x1001
:
if
(
bytesLeft
>
0
)
// message is not complete, return
return
true
;
if
(
m_currentMessageSize
!=
sizeof
(
SMARTLINK_MSG
)
-
1
+
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
)
+
sizeof
(
stMsg_HostLogonReq
))
{
emit
evt_Message
(
tr
(
"Broken Message stMsg_HostLogonReq, size not correct."
));
res
=
false
;
}
else
res
=
this
->
LoginSvr
();
break
;
default:
emit
evt_Message
(
tr
(
"Message type not supported."
));
emit
evt_close_client
(
this
->
sock
())
;
res
=
false
;
break
;
}
m_currentBlock
.
clear
();
return
true
;
return
res
;
}
}
ZoomPipeline_FuncSvr/smartlink/st_msg_applayer.h
浏览文件 @
42286dc6
...
...
@@ -22,6 +22,12 @@ typedef struct tag_stMsg_HostRegistRsp{
__UINT32_TYPE__
ID
;
}
stMsg_HostRegistRsp
;
//Host Log request
//SMARTLINK_MSG_APP::MsgType = 0x1001
typedef
struct
tag_stMsg_HostLogonReq
{
__UINT32_TYPE__
ID
;
char
HostSerialNum
[
64
];
}
stMsg_HostLogonReq
;
typedef
struct
tag_smartlink_app_layer
{
struct
tag_app_layer_header
{
...
...
@@ -33,6 +39,8 @@ typedef struct tag_smartlink_app_layer{
{
stMsg_HostRegistReq
msg_HostRegistReq
;
stMsg_HostRegistRsp
msg_HostRegistRsp
;
stMsg_HostLogonReq
msg_HostLogonReq
;
stMsg_HostLogonRsp
msg_HostLogonRsp
;
}
MsgUnion
;
}
SMARTLINK_MSG_APP
;
...
...
@@ -55,6 +63,20 @@ typedef struct tag_stMsg_HostRegistRsp{
unsigned
__int32
ID
;
}
stMsg_HostRegistRsp
;
//Host Log request
//SMARTLINK_MSG_APP::MsgType = 0x1001
typedef
struct
tag_stMsg_HostLogonReq
{
unsigned
__int32
ID
;
char
HostSerialNum
[
64
];
}
stMsg_HostLogonReq
;
//Host Log response
//SMARTLINK_MSG_APP::MsgType = 0x1801
typedef
struct
tag_stMsg_HostLogonRsp
{
unsigned
__int8
DoneCode
;
char
TextInfo
[
64
];
}
stMsg_HostLogonRsp
;
typedef
struct
tag_smartlink_app_layer
{
struct
tag_app_layer_header
{
...
...
@@ -66,6 +88,8 @@ typedef struct tag_smartlink_app_layer{
{
stMsg_HostRegistReq
msg_HostRegistReq
;
stMsg_HostRegistRsp
msg_HostRegistRsp
;
stMsg_HostLogonReq
msg_HostLogonReq
;
stMsg_HostLogonRsp
msg_HostLogonRsp
;
}
MsgUnion
;
}
SMARTLINK_MSG_APP
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录