|
|
@@ -19,6 +19,7 @@ DataUpdateThread::DataUpdateThread(QObject *parent)
|
|
|
nReadType=0;
|
|
|
m_shmData=0;
|
|
|
bTacStatus=0;
|
|
|
+ nIndexMSG=0;
|
|
|
}
|
|
|
|
|
|
DataUpdateThread::~DataUpdateThread()
|
|
|
@@ -80,12 +81,14 @@ void DataUpdateThread::run()
|
|
|
pwidget->UpdateDate();
|
|
|
pwidget->update();
|
|
|
}
|
|
|
+ ReadMSG();
|
|
|
}else
|
|
|
{
|
|
|
int nMode=pwidget->getShowModeIndex();
|
|
|
int nPage=pwidget->getShowPagIndex();
|
|
|
//qDebug() <<"ReadType=1 nMode:"<<nMode<<";nPage"<<nPage;
|
|
|
ReadShmMaxch();
|
|
|
+ ReadMSG();
|
|
|
if(nMode==0&&nPage!=0)
|
|
|
{
|
|
|
int nSubPag=pwidget->getShowSubIndex();
|
|
|
@@ -118,6 +121,12 @@ void DataUpdateThread::run()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void DataUpdateThread::SetShowWidget(Widget *pShowWidget)
|
|
|
+{
|
|
|
+ pwidget=pShowWidget;
|
|
|
+ connect(pwidget,SIGNAL(signal_ClickMSG()),this,SLOT(slot_ClickMSG()));
|
|
|
+}
|
|
|
+
|
|
|
void DataUpdateThread::ReadSqlData(int nCHID)
|
|
|
{
|
|
|
if(!isDBOpen)
|
|
|
@@ -319,4 +328,98 @@ int DataUpdateThread::isT_ACType()
|
|
|
return bTacStatus;
|
|
|
}
|
|
|
|
|
|
+void DataUpdateThread::ReadMSG()
|
|
|
+{
|
|
|
+ if(nReadType!=1&&!m_shmData)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(0<=nIndexMSG&&nIndexMSG<10)
|
|
|
+ {
|
|
|
+ switch(m_shmData->nTypeCtrlType[nIndexMSG])
|
|
|
+ {
|
|
|
+ case MSGCtrl_Null:
|
|
|
+ case MSGCtrl_Click:
|
|
|
+ {
|
|
|
+ bool isHaveMSG=false;
|
|
|
+ //未检测到更新从当前位置循环遍历一遍
|
|
|
+ qDebug()<<"MSG_Find"<<nIndexMSG<<"=Null";
|
|
|
+ for(int nIndex=0;nIndex<10;nIndex++)//监测其他的点是否有被更新依次刷新过去
|
|
|
+ {
|
|
|
+ nIndexMSG=NextIndex();
|
|
|
+ if(m_shmData->nTypeCtrlType[nIndexMSG]==MSGCtrl_Write)//检测到新的点。
|
|
|
+ {
|
|
|
+ qDebug()<<nIndexMSG<<"=MSGCtrl_Write";
|
|
|
+ isHaveMSG=true;
|
|
|
+ QString strShow=QString::fromLocal8Bit(m_shmData->strMSG[nIndexMSG]);
|
|
|
+ qDebug()<<"MSG_Update char*MSG="<<m_shmData->strMSG[nIndexMSG];
|
|
|
+ qDebug()<<"MSG_Update strMSG="<<strShow;
|
|
|
+ ShowMSGWidget(strShow);
|
|
|
+ break;
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ //qDebug()<<nIndexMSG<<"="<<m_shmData->nTypeCtrlType[nIndexMSG];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(isHaveMSG)
|
|
|
+ {
|
|
|
+ nIndexMSG=0;//如果全没有就重新设置到0从0开始
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case MSGCtrl_Write://存在已写入的数据
|
|
|
+ {
|
|
|
+ QString strShow=QString::fromLocal8Bit(m_shmData->strMSG[nIndexMSG]);
|
|
|
+ qDebug()<<"MSG_Update char*MSG="<<m_shmData->strMSG[nIndexMSG];
|
|
|
+ qDebug()<<"MSG_Update strMSG="<<strShow;
|
|
|
+ ShowMSGWidget(strShow);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ qDebug()<<"MSG_Switch_end nIndexMSG ="<<nIndexMSG;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int DataUpdateThread::NextIndex()
|
|
|
+{
|
|
|
+ if(0<=nIndexMSG&&nIndexMSG<9)
|
|
|
+ {
|
|
|
+ return nIndexMSG+1;
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void DataUpdateThread::ShowMSGWidget(QString strShowData)
|
|
|
+{
|
|
|
+ if(strShowData.isEmpty())return;
|
|
|
+ if(pwidget&&pwidget->isHiddenMSGWidget())
|
|
|
+ {
|
|
|
+ if(strShowData!=strNowMSG)
|
|
|
+ {
|
|
|
+ strNowMSG=strShowData;
|
|
|
+ pwidget->ShowMSGWidget(strShowData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void DataUpdateThread::slot_ClickMSG()
|
|
|
+{
|
|
|
+ strNowMSG="";
|
|
|
+ if(nReadType!=1&&!m_shmData)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(0<=nIndexMSG&&nIndexMSG<10)
|
|
|
+ {
|
|
|
+ m_shmData->nTypeCtrlType[nIndexMSG]=MSGCtrl_Click;
|
|
|
+ }
|
|
|
+ nIndexMSG=NextIndex();
|
|
|
+
|
|
|
+ //ReadMSG();
|
|
|
+}
|
|
|
+
|
|
|
|