提交 4d1f04d1 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

remove TextInfo

上级 a41d8880
......@@ -642,10 +642,9 @@ int MainDialog::deal_current_message_block()
if (pApp->header.MsgType==0x1800)
{
ui->lineEdit_boxid->setText(QString("%1").arg(pApp->MsgUnion.msg_HostRegistRsp.ID));
displayMessage(tr("Res = %1, ID = %2, Text = %3")
displayMessage(tr("Res = %1, ID = %2")
.arg(pApp->MsgUnion.msg_HostRegistRsp.DoneCode)
.arg(pApp->MsgUnion.msg_HostRegistRsp.ID)
.arg(pApp->MsgUnion.msg_HostRegistRsp.TextInfo)
);
if (pApp->MsgUnion.msg_HostRegistRsp.DoneCode!=2)
m_bUUIDGot = true;
......@@ -659,9 +658,8 @@ int MainDialog::deal_current_message_block()
}
else
QMessageBox::information(this,tr("Failed!"),tr("Log in Failed!"));
displayMessage(tr("Res = %1, Text = %2")
displayMessage(tr("Res = %1")
.arg(pApp->MsgUnion.msg_HostLogonRsp.DoneCode)
.arg(pApp->MsgUnion.msg_HostLogonRsp.TextInfo)
);
}
else if (pApp->header.MsgType==0x1802)
......@@ -670,9 +668,8 @@ int MainDialog::deal_current_message_block()
QMessageBox::information(this,tr("Succeed!"),tr("Time Corrected!"));
else
QMessageBox::information(this,tr("Failed!"),tr("Time Correct Failed!"));
displayMessage(tr("Res = %1, Text = %2")
displayMessage(tr("Res = %1")
.arg(pApp->MsgUnion.msg_HostTimeCorrectRsp.DoneCode)
.arg(pApp->MsgUnion.msg_HostTimeCorrectRsp.TextInfo)
);
QString tm = QString("%1-%2-%3 %4:%5:%6")
.arg(pApp->MsgUnion.msg_HostTimeCorrectRsp.DateTime.Year)
......@@ -694,9 +691,8 @@ int MainDialog::deal_current_message_block()
}
else
QMessageBox::information(this,tr("Failed!"),tr("Log in Failed!"));
displayMessage(tr("Res = %1, Text = %2")
displayMessage(tr("Res = %1")
.arg(pApp->MsgUnion.msg_ClientLoginRsp.DoneCode)
.arg(pApp->MsgUnion.msg_ClientLoginRsp.TextInfo)
);
ui->lineEdit_userid->setText(QString ("%1").arg(pApp->MsgUnion.msg_ClientLoginRsp.UserID));
}
......@@ -706,9 +702,8 @@ int MainDialog::deal_current_message_block()
QMessageBox::information(this,tr("Succeed!"),tr("upload succeed!"));
else
QMessageBox::information(this,tr("Failed!"),tr("upload in Failed!"));
displayMessage(tr("Res = %1, Text = %2")
displayMessage(tr("Res = %1")
.arg(pApp->MsgUnion.msg_UploadUserListRsp.DoneCode)
.arg(pApp->MsgUnion.msg_UploadUserListRsp.TextInfo)
);
}
......@@ -726,9 +721,8 @@ int MainDialog::deal_current_message_block()
}
else
QMessageBox::information(this,tr("Failed!"),tr("download in Failed!"));
displayMessage(tr("Res = %1, Text = %2")
displayMessage(tr("Res = %1")
.arg(pApp->MsgUnion.msg_DownloadUserListRsp.DoneCode)
.arg(pApp->MsgUnion.msg_DownloadUserListRsp.TextInfo)
);
}
......@@ -738,9 +732,8 @@ int MainDialog::deal_current_message_block()
QMessageBox::information(this,tr("Succeed!"),tr("log out succeed!"));
else
QMessageBox::information(this,tr("Failed!"),tr("download in Failed!"));
displayMessage(tr("Res = %1, Text = %2")
displayMessage(tr("Res = %1")
.arg(pApp->MsgUnion.msg_ClientLogoutRsp.DoneCode)
.arg(pApp->MsgUnion.msg_ClientLogoutRsp.TextInfo)
);
this->client->abort();
}
......@@ -752,7 +745,7 @@ int MainDialog::deal_current_message_block()
QString strRes;
for (quint16 i = 0;i<pApp->MsgUnion.msg_GetHostListRsp.HostNum;i++)
{
strRes += QString("%1,").arg(pApp->MsgUnion.msg_GetHostListRsp.pHostIDList[i]);
strRes += QString("%1").arg(pApp->MsgUnion.msg_GetHostListRsp.pHostIDList[i]);
}
ui->plainTextEdit_hostsIds->setPlainText(strRes);
}
......
......@@ -9,9 +9,9 @@
#include <QSqlError>
#include <QSet>
namespace SmartLink{
//0x0001 msg, stMsg_HostRegistReq
bool st_clientNodeAppLayer::RegisitNewBoxNode()
{
//0x0001 msg, stMsg_HostRegistReq
bool st_clientNodeAppLayer::RegisitNewBoxNode()
{
const SMARTLINK_MSG_APP * pAppLayer =
(const SMARTLINK_MSG_APP *)(
((const char *)(m_currentBlock.constData()))
......@@ -49,7 +49,7 @@ bool st_clientNodeAppLayer::RegisitNewBoxNode()
reply.DoneCode = 2;
reply.ID = 0xffffffff;
strcpy(reply.TextInfo,"Unknown error");
//strcpy(reply.TextInfo,"Unknown error");
if (db.isValid()==true && db.isOpen()==true )
{
QSqlQuery query(db);
......@@ -76,13 +76,13 @@ bool st_clientNodeAppLayer::RegisitNewBoxNode()
{
reply.ID = ncurrid;
reply.DoneCode = nfirstlogin==1?0:1;
strcpy(reply.TextInfo,"Re-regisit Succeed.");
//strcpy(reply.TextInfo,"Re-regisit Succeed.");
m_bUUIDRecieved = true;
m_uuid = ncurrid;
m_pClientTable->regisitClientUUID(this);
if (nfirstlogin==1)
{
strcpy(reply.TextInfo,"First-Regisit Succeed.");
//strcpy(reply.TextInfo,"First-Regisit Succeed.");
QSqlQuery queryUpdate(db);
sql = "update instruments set first_login = 0 where host_serial_num = ?;";
queryUpdate.prepare(sql);
......@@ -90,35 +90,35 @@ bool st_clientNodeAppLayer::RegisitNewBoxNode()
if (false==queryUpdate.exec())
{
reply.DoneCode = 2;
strcpy(reply.TextInfo,"Internal Server Error!");
//strcpy(reply.TextInfo,"Internal Server Error!");
}
}
}
else
{
strcpy(reply.TextInfo,"Equip ID resource error.");
//strcpy(reply.TextInfo,"Equip ID resource error.");
}
}
else
strcpy(reply.TextInfo,"Raw Dev ID Is Invalid.");
//else
//strcpy(reply.TextInfo,"Raw Dev ID Is Invalid.");
}
else
{
// No such device
strcpy(reply.TextInfo,"No such device ID.");
//strcpy(reply.TextInfo,"No such device ID.");
}
}
else
{
strcpy(reply.TextInfo,"Server Access Error.");
//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.");
//strcpy(reply.TextInfo,"Server Not Accessable Now.");
}
......@@ -128,11 +128,11 @@ bool st_clientNodeAppLayer::RegisitNewBoxNode()
return reply.DoneCode==2?false:true;
}
}
bool st_clientNodeAppLayer::LoginBox()
{
bool st_clientNodeAppLayer::LoginBox()
{
const SMARTLINK_MSG_APP * pAppLayer =
(const SMARTLINK_MSG_APP *)(
((const char *)(m_currentBlock.constData()))
......@@ -169,7 +169,7 @@ bool st_clientNodeAppLayer::LoginBox()
QSqlDatabase db = m_pClientTable->dbRes()->databse(m_pClientTable->Database_UserAcct());
reply.DoneCode = 3;
strcpy(reply.TextInfo,"Unknown error");
//strcpy(reply.TextInfo,"Unknown error");
if (db.isValid()==true && db.isOpen()==true )
{
QSqlQuery query(db);
......@@ -195,7 +195,7 @@ bool st_clientNodeAppLayer::LoginBox()
{
if (pAppLayer->MsgUnion.msg_HostLogonReq.ID==ncurrid)
{
reply.TextInfo[0] = 0;
//reply.TextInfo[0] = 0;
reply.DoneCode = 0;
m_bLoggedIn = true;
m_bUUIDRecieved = true;
......@@ -203,35 +203,35 @@ bool st_clientNodeAppLayer::LoginBox()
m_pClientTable->regisitClientUUID(this);
if (false == loadRelations())
{
strcpy(reply.TextInfo,"Error, fail to load relations from db.");
//strcpy(reply.TextInfo,"Error, fail to load relations from db.");
reply.DoneCode = 3;
}
}
else
strcpy(reply.TextInfo,"ID Not matched.");
// else
//strcpy(reply.TextInfo,"ID Not matched.");
}
else
strcpy(reply.TextInfo,"Equip ID has not been regisited.");
//else
//strcpy(reply.TextInfo,"Equip ID has not been regisited.");
}
else
strcpy(reply.TextInfo,"Raw Dev ID Is Invalid.");
// else
//strcpy(reply.TextInfo,"Raw Dev ID Is Invalid.");
}
else
{
// No such device
strcpy(reply.TextInfo,"No such device ID.");
//strcpy(reply.TextInfo,"No such device ID.");
}
}
else
{
strcpy(reply.TextInfo,"Server Access Error.");
//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.");
//strcpy(reply.TextInfo,"Server Not Accessable Now.");
}
......@@ -241,10 +241,10 @@ bool st_clientNodeAppLayer::LoginBox()
return reply.DoneCode==0?true:false;
}
}
bool st_clientNodeAppLayer::LoginClient()
{
bool st_clientNodeAppLayer::LoginClient()
{
const SMARTLINK_MSG_APP * pAppLayer =
(const SMARTLINK_MSG_APP *)(
((const char *)(m_currentBlock.constData()))
......@@ -281,7 +281,7 @@ bool st_clientNodeAppLayer::LoginClient()
QSqlDatabase db = m_pClientTable->dbRes()->databse(m_pClientTable->Database_UserAcct());
reply.DoneCode = 3;
strcpy(reply.TextInfo,"Unknown error");
//strcpy(reply.TextInfo,"Unknown error");
if (db.isValid()==true && db.isOpen()==true )
{
QSqlQuery query(db);
......@@ -309,7 +309,7 @@ bool st_clientNodeAppLayer::LoginClient()
{
if (ncurrid>= (unsigned int)0x80000000 && ncurrid <= (unsigned int)0xAFFFFFFF )
{
reply.TextInfo[0] = 0;
//reply.TextInfo[0] = 0;
reply.DoneCode = 0;
reply.UserID = ncurrid;
m_bLoggedIn = true;
......@@ -318,32 +318,32 @@ bool st_clientNodeAppLayer::LoginClient()
m_pClientTable->regisitClientUUID(this);
if (false == loadRelations())
{
strcpy(reply.TextInfo,"Error, fail to load relations from db.");
//strcpy(reply.TextInfo,"Error, fail to load relations from db.");
reply.DoneCode = 3;
}
}
else
strcpy(reply.TextInfo,"UserID Is Invalid.Accunt locked by svr");
// else
// strcpy(reply.TextInfo,"UserID Is Invalid.Accunt locked by svr");
}
else
strcpy(reply.TextInfo,"UserID Is Invalid.Accunt locked by svr");
//else
// strcpy(reply.TextInfo,"UserID Is Invalid.Accunt locked by svr");
}
else
{
// No such device
strcpy(reply.TextInfo,"No such user or password.");
//strcpy(reply.TextInfo,"No such user or password.");
}
}
else
{
strcpy(reply.TextInfo,"Server Access Error.");
//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.");
//strcpy(reply.TextInfo,"Server Not Accessable Now.");
}
......@@ -353,9 +353,9 @@ bool st_clientNodeAppLayer::LoginClient()
return reply.DoneCode==0?true:false;
}
bool st_clientNodeAppLayer::Box2Svr_CorrectTime()
{
}
bool st_clientNodeAppLayer::Box2Svr_CorrectTime()
{
//form Msgs
quint16 nMsgLen = sizeof(SMARTLINK_MSG_APP::tag_app_layer_header)
+sizeof(stMsg_HostTimeCorrectRsp);
......@@ -385,7 +385,7 @@ bool st_clientNodeAppLayer::Box2Svr_CorrectTime()
stMsg_HostTimeCorrectRsp & reply = pApp->MsgUnion.msg_HostTimeCorrectRsp;
reply.DoneCode = 0;
reply.TextInfo[0]= 0;
//reply.TextInfo[0]= 0;
QDateTime dtm = QDateTime::currentDateTimeUtc();
......@@ -401,10 +401,10 @@ bool st_clientNodeAppLayer::Box2Svr_CorrectTime()
return reply.DoneCode==0?true:false;
}
}
bool st_clientNodeAppLayer::Box2Svr_UploadUserTable()
{
bool st_clientNodeAppLayer::Box2Svr_UploadUserTable()
{
const SMARTLINK_MSG_APP * pAppLayer =
(const SMARTLINK_MSG_APP *)(
((const char *)(m_currentBlock.constData()))
......@@ -449,7 +449,7 @@ bool st_clientNodeAppLayer::Box2Svr_UploadUserTable()
stMsg_UploadUserListRsp & reply = pApp->MsgUnion.msg_UploadUserListRsp;
reply.DoneCode = 1;
strcpy(reply.TextInfo,"Unknown error");
//strcpy(reply.TextInfo,"Unknown error");
if (loadRelations()==true )
{
for (quint32 i = 0; i <pAppLayer->MsgUnion.msg_UploadUserListReq.UserNum && i<4096;i++)
......@@ -461,13 +461,13 @@ bool st_clientNodeAppLayer::Box2Svr_UploadUserTable()
if (true == saveRelations())
{
reply.DoneCode = 0;
strcpy(reply.TextInfo,"Succeeded.");
//strcpy(reply.TextInfo,"Succeeded.");
}
}
else
{
//Server db is currently not accessable, wait.
strcpy(reply.TextInfo,"Failed to load current relations from db.");
//strcpy(reply.TextInfo,"Failed to load current relations from db.");
}
......@@ -477,9 +477,9 @@ bool st_clientNodeAppLayer::Box2Svr_UploadUserTable()
return reply.DoneCode==0?true:false;
}
bool st_clientNodeAppLayer::Box2Svr_DownloadUserTable()
{
}
bool st_clientNodeAppLayer::Box2Svr_DownloadUserTable()
{
bool res = true;
//form Msgs
quint16 nMsgLen = sizeof(SMARTLINK_MSG_APP::tag_app_layer_header)
......@@ -520,8 +520,8 @@ bool st_clientNodeAppLayer::Box2Svr_DownloadUserTable()
stMsg_DownloadUserListRsp & reply = pApp->MsgUnion.msg_DownloadUserListRsp;
reply.DoneCode = res==true?0:1;
if (res==false)
strcpy(reply.TextInfo,"load Relation failed");
//if (res==false)
//strcpy(reply.TextInfo,"load Relation failed");
int ii = 0;
foreach (quint32 it, m_matched_nodes)
{
......@@ -540,14 +540,14 @@ bool st_clientNodeAppLayer::Box2Svr_DownloadUserTable()
return reply.DoneCode==0?true:false;
}
bool st_clientNodeAppLayer::ClientLogout()
{
}
bool st_clientNodeAppLayer::ClientLogout()
{
bool res = true;
//form Msgs
quint16 nMsgLen = sizeof(SMARTLINK_MSG_APP::tag_app_layer_header)
+sizeof(stMsg_ClientLogoutRsp);
int nSz = 0;
//int nSz = 0;
//form Msgs
QByteArray array(sizeof(SMARTLINK_MSG) + nMsgLen - 1,0);
char * ptr = array.data();
......@@ -575,14 +575,14 @@ bool st_clientNodeAppLayer::ClientLogout()
stMsg_ClientLogoutRsp & reply = pApp->MsgUnion.msg_ClientLogoutRsp;
reply.DoneCode = res==true?0:1;
if (res==false)
strcpy(reply.TextInfo,"load Relation failed");
//if (res==false)
//strcpy(reply.TextInfo,"load Relation failed");
//Send back
emit evt_SendDataToClient(this->sock(),array);
return reply.DoneCode==0?true:false;
}
bool st_clientNodeAppLayer::GetHostList()
{
}
bool st_clientNodeAppLayer::GetHostList()
{
bool res = true;
//form Msgs
......@@ -644,5 +644,5 @@ bool st_clientNodeAppLayer::GetHostList()
return res;
}
}
}
......@@ -162,7 +162,7 @@ typedef struct tag_stMsg_HostRegistReq{
//SMARTLINK_MSG_APP::MsgType = 0x1800
typedef struct tag_stMsg_HostRegistRsp{
unsigned __int8 DoneCode;
char TextInfo[64];
//char TextInfo[64];
unsigned __int32 ID;
}stMsg_HostRegistRsp;
......@@ -177,7 +177,7 @@ typedef struct tag_stMsg_HostLogonReq{
//SMARTLINK_MSG_APP::MsgType = 0x1801
typedef struct tag_stMsg_HostLogonRsp{
unsigned __int8 DoneCode;
char TextInfo[64];
//char TextInfo[64];
} stMsg_HostLogonRsp;
//User Login request
......@@ -193,7 +193,7 @@ typedef struct tag_stMsg_ClientLoginReq{
typedef struct tag_stMsg_ClientLoginRsp{
unsigned __int8 DoneCode;
unsigned __int32 UserID;
char TextInfo[64];
//char TextInfo[64];
} stMsg_ClientLoginRsp;
......@@ -206,7 +206,7 @@ typedef struct tag_stMsg_HostTimeCorrectReq{
//Time Correct
typedef struct tag_stMsg_HostTimeCorrectRsp{
unsigned __int8 DoneCode;
char TextInfo[64];
//char TextInfo[64];
struct tag_stDateTime{
unsigned __int16 Year;
unsigned __int8 Month;
......@@ -227,7 +227,7 @@ typedef struct tag_stMsg_UploadUserListReq{
//SMARTLINK_MSG_APP::MsgType = 0x1803
typedef struct tag_stMsg_UploadUserListRsp{
unsigned __int8 DoneCode;
char TextInfo[64];
//char TextInfo[64];
} stMsg_UploadUserListRsp;
......@@ -239,7 +239,7 @@ typedef struct tag_stMsg_DownloadUserListReq{
//SMARTLINK_MSG_APP::MsgType = 0x1804
typedef struct tag_stMsg_DownloadUserListRsp{
unsigned __int8 DoneCode;
char TextInfo[64];
//char TextInfo[64];
unsigned __int16 UserNum;
unsigned __int32 pUserIDList[1];
} stMsg_DownloadUserListRsp;
......@@ -252,7 +252,7 @@ typedef struct tag_stMsg_ClientLogoutReq{
//0x3801
typedef struct tag_stMsg_ClientLogoutRsp{
unsigned __int8 DoneCode;
char TextInfo[64];
//char TextInfo[64];
}stMsg_ClientLogoutRsp;
//SMARTLINK_MSG_APP::MsgType = 0x3002
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册