// Gena_Notify.cpp: implementation of the Gena_Notify class. // ////////////////////////////////////////////////////////////////////// //#include "stdafx.h" #include "Gena_Notify_s.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif #define MaxPacket 50 ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// Gena_Notify::~Gena_Notify() { } void Gena_Notify::Init( S_PROTOCOLCFG * pcfg ) { PRawCtrl = pcfg->PRawCtrl; pRxBuf = pcfg->pRxBuf; pTxBuf = pcfg->pTxBuf; pCmdMem = pcfg->pCmdMem; pRtu = pcfg->pRtu; pLink = pcfg->pLink; pTable = pcfg->pTable; pZfDataCtrl = pcfg->pZfDataCtrl; // pHis = pcfg->pHis; pVst = pcfg->pVst; pPara = pcfg->pPara; m_sendFireSubResqFlag = 0; m_sendVentSubResqFlag = 0; m_sendPowerSubResqFlag = 0; m_responseFlag = 0; m_rollingFlag = 0; m_ventStepFlag=1; m_StepFlag = 1; // m_lastSubTime = GetNowSecond(); m_LastSendTime = GetNowSecond(); //WYF 20181228 char filename[512]; CReadConf readconf; char *pWorkPath; pWorkPath=getenv("FEPROOT"); if(pWorkPath!=NULL){ #if defined(__unix) sprintf(filename,"%s%s",pWorkPath,"/cfg/AtsDef.ini"); #else sprintf(filename,"%s%s",pWorkPath,"\\cfg\\AtsDef.ini"); #endif } StaNum=0; StaNum=readconf.ReadLong("HEADCODE","count",filename,"1"); if(40GetRxTimeouts();//WYF 20190118 全数据扫描间隔秒 if(m_RxTimeout<10)m_RxTimeout=30; m_CallAlldata=0; } sint32 Gena_Notify::TxProc() { E_RAW_ComStat commstatus = pLink->GetCommStatus(); if( commstatus !=CMST_TX_CNT && commstatus !=CMST_NORMAL) return 0; /* if(m_com_status == DEF_MSG_COMMDOWN) { } */ //检测订阅状况 //初始报文是否要一次性送过去。不是一次性送的话,初始的报文还没全部送完,更新订阅就过来了。 uint8 value = 0; //float fvalue; int nowtime = GetNowSecond(); // if ((nowtime-m_LastSendTime) < 1) // return 1; //WYF 20190118 PRawCtrl->GetAYx(m_rtuNO,3,&value); if ((2==value) && ((nowtime-m_LastSendTime) > m_RxTimeout))//WYF 20190118update接收超时时间作为空闲全数据发送时间 m_CallAlldata=1; if(value==1 && m_sendVentSubResqFlag==0 && m_StepFlag==1) //一次性对方只能接受50包数据,而风机有132包。分三次发送。 { // if ((nowtime-m_LastSendTime) < 1) // return 1; //if(strncmp(bEMCS,"YES",3)==0){ //WYF 20190104 PrintLog(LOG_INFORMATION,"通知风机初始报文"); if(m_ventStepFlag==1) { //PrintLog(LOG_INFORMATION,"风机初始报文1-45"); getVentStatus(); NotifyVent1Birth(); m_ventStepFlag=2; return 1; }else if(m_ventStepFlag==2) { //PrintLog(LOG_INFORMATION,"风机初始报文46-90"); NotifyVent2Birth(); m_ventStepFlag=3; return 1; } else { //PrintLog(LOG_INFORMATION,"风机初始报文91-132"); NotifyVent3Birth(); m_sendVentSubResqFlag =1 ; m_ventStepFlag=1; m_StepFlag=2; return 1; } } else if(value ==2 && m_StepFlag==1) { //PrintLog(LOG_INFORMATION,"通知风机更新报文"); if(m_ventStepFlag==1) { //PrintLog(LOG_INFORMATION,"风机更新报文1-45"); getVentStatus(); NotifyVent1Update(); m_ventStepFlag=2; return 1; } else if(m_ventStepFlag==2) {// PrintLog(LOG_INFORMATION,"风机更新报文46-90"); NotifyVent2Update(); m_ventStepFlag=3; return 1; } else { // PrintLog(LOG_INFORMATION,"风机更新报文91-132"); NotifyVent3Update(); m_sendVentSubResqFlag =1 ; m_ventStepFlag=1; m_StepFlag=2; return 1; } } //}//WYF 20190104 //if(strncmp(bPSCADA,"YES",3)==0){//WYF 20190104 // if(strncmp(bEMCS,"YES",3)!=0)m_StepFlag=2;//WYF 20190104 value = 0; PRawCtrl->GetAYx(m_rtuNO,5,&value); //m_rollingFlag = POWERSECTIONSTATUS_START; if(value == 1 && m_sendPowerSubResqFlag == 0&& m_StepFlag==2) { PrintLog(LOG_INFORMATION,"电力区段初始报文"); getPowerStatus(); NotifyPowerBirth(); m_sendPowerSubResqFlag = 1 ; if(strncmp(bFAS,"YES",3)==0) m_StepFlag=3;//SHL6789=1;//SHL5=3;//WYF 20190103 6789无火灾要求 else{ // if(strncmp(bEMCS,"YES",3)==0) m_StepFlag=1; // else // m_StepFlag=2; } return 1; } else if(value == 2&& m_StepFlag==2) { //PrintLog(LOG_INFORMATION,"电力区段更新报文"); getPowerStatus(); NotifyPowerUpdate(); if(strncmp(bFAS,"YES",3)==0) m_StepFlag=3;//SHL6789=1;//SHL5=3;//WYF 20190103 6789无火灾要求 else{ // if(strncmp(bEMCS,"YES",3)==0) m_StepFlag=1; if(0GetAYx(m_rtuNO,1,&value); //m_rollingFlag = FIRESTATUS_START; if(value == 1 && m_sendFireSubResqFlag == 0&& m_StepFlag==3) { PrintLog(LOG_INFORMATION,"火灾初始报文"); getFireStatus(); NotifyFireBirth(); m_sendFireSubResqFlag = 1; m_StepFlag=1; return 1; } else if(value ==2&& m_StepFlag==3) { //PrintLog(LOG_INFORMATION,"火灾更新报文"); //NotifyUpdate(SUB_FIRE); getFireStatus(); NotifyFireUpdate(); m_StepFlag=1; if(0200705 改变标志 }S_RDB_ZFYx; */ sint32 Gena_Notify::RxProc() { sint32 rtuno = pLink->GetRtuNo(); unsigned char rtuaddr = pRtu->GetRtuAddr(rtuno); int buflen=pRxBuf->GetReadableSize(); int nowtime=GetNowSecond(); E_RAW_ComStat coms = pLink->GetCommStatus(); // if ( coms ==CMST_RX_CNT && (nowtime-m_lastSubTime) >= 50) if ( coms ==CMST_RX_CNT && (nowtime-m_LastSendTime) >= m_RxTimeout)//50)//WYF 20190118 { //超时不重发,直接跳到下一个终端 pRxBuf->Move(buflen); pLink->RegisterFrm(FRAME_RX_TIMEOUT); pLink->SetCommStatus(CMST_NORMAL); PrintLog(LOG_INFORMATION,"接收超时"); return 1; } if (buflen<14) //无数据 { //PrintLog(LOG_INFORMATION,"无数据返回"); return 1; } int nRet= 0; uint8 buf[1024]; memset(buf,0,1024); sint32 datalen = 0; sint32 contlen = 0; while((buflen=pRxBuf->GetReadableSize())>0) { if(buflen > 1024) buflen = 1024; datalen = pRxBuf->Read(buf,buflen,DEF_BUFF_NOMOVE); contlen = m_Soap.ParseMessage((const char*)(buf),datalen); //PrintLog(LOG_INFORMATION,">>>>>内容%s",buf); if(contlen<0) //error { pRxBuf->Move(datalen); return 0; } if(contlen == 0) return 1; DataProcess(); //PrintLog(LOG_INFORMATION,"删除内容%d",contlen); pRxBuf->Move(contlen); pLink->RegisterFrm(FRAME_RX_SUC); pLink->SetCommStatus(CMST_NORMAL); } return 1; } void Gena_Notify::DataProcess() { HTTP_RESP_TYPE resptype = m_Soap.GetRespType(); if(resptype == RESPTYPE_STATUS)//初始订阅成功响应成功,需要设置SID。更新订阅成功不需设置 { //m_waitRespFlag = 0 ; if(m_Soap.GetStatusCode() == 200)//响应OK { PrintLog(LOG_INFORMATION,"接收到响应200"); m_responseFlag =1; } else //响应错误代码 { PrintLog(LOG_INFORMATION,"接收到http 1.1 %d",m_Soap.GetStatusCode()); //m_responseFlag =1; } } else { PrintLog(LOG_INFORMATION,"接收到错误代码"); } } void Gena_Notify::SetExtendedPara(uint16 no, sint32 val) { if(no == 1) { m_rtuNO = val; //取得订阅RTU号 PrintLog(LOG_INFORMATION,"取得订阅RTU号:%d",m_rtuNO); } } void Gena_Notify::NotifyVentBirth() { int len = 0; char *pCode = NULL; for(int i=0;iGetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); // pCode = m_Soap.NotifyUpdate(len); pCode = m_Soap.NotifyBirth(len);//WYF 20190118 if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); } } } void Gena_Notify::NotifyVent1Birth() { int len = 0; char *pCode = NULL; for(int i=0;iGetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); // pCode = m_Soap.NotifyUpdate(len); pCode = m_Soap.NotifyBirth(len);//WYF 20190118 if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyVent2Birth() { int len = 0; char *pCode = NULL; for(int i=MaxPacket;iGetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); // pCode = m_Soap.NotifyUpdate(len); pCode = m_Soap.NotifyBirth(len);//WYF 20190118 if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyVent3Birth() { int len = 0; char *pCode = NULL; for(int i=MaxPacket*2;iGetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); // pCode = m_Soap.NotifyUpdate(len); pCode = m_Soap.NotifyBirth(len);//WYF 20190118 if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyFireBirth() { int len = 0; char *pCode = NULL; ST_FIRE_ALARM st_fire; for(int i=0;iGetAYx(m_rtuNO,2,&sid); m_Soap.SetSrvSID(sid); // pCode = m_Soap.NotifyUpdate(len); pCode = m_Soap.NotifyBirth(len);//WYF 20190118 if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyPowerBirth() { int len = 0; char *pCode = NULL; ST_POWERSECTION st_power; for(int i=0;iGetAYx(m_rtuNO,6,&sid); m_Soap.SetSrvSID(sid); // pCode = m_Soap.NotifyUpdate(len); pCode = m_Soap.NotifyBirth(len);//WYF 20190118 if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyVentUpdate() { int len = 0; char *pCode = NULL; for(int i=0;im_CallAlldata){//隔30-60s时间全数据发送 if(m_oldVent[i].status == m_curVent[i].status && m_oldVent[i].direction == m_curVent[i].direction) continue; } m_oldVent[i] = m_curVent[i]; m_Soap.SetFanStatusContent(m_curVent[i]); //取得sid号 uint8 sid; PRawCtrl->GetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); pCode = m_Soap.NotifyUpdate(len); if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyVent1Update() { int len = 0; char *pCode = NULL; for(int i=0;im_CallAlldata){//隔30-60s时间全数据发送 if(m_oldVent[i].status == m_curVent[i].status && m_oldVent[i].direction == m_curVent[i].direction) continue; } PrintLog(LOG_INFORMATION,"%d号风机更新风机状态:状态%d,方向%d",i+1,m_curVent[i].status,m_curVent[i].direction); m_oldVent[i] = m_curVent[i]; m_Soap.SetFanStatusContent(m_curVent[i]); //取得sid号 uint8 sid; PRawCtrl->GetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); pCode = m_Soap.NotifyUpdate(len); if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyVent2Update() { int len = 0; char *pCode = NULL; for(int i=MaxPacket;im_CallAlldata){//隔30-60s时间全数据发送 if(m_oldVent[i].status == m_curVent[i].status && m_oldVent[i].direction == m_curVent[i].direction) continue; } PrintLog(LOG_INFORMATION,"%d号风机更新风机状态:状态%d,方向%d",i+1,m_curVent[i].status,m_curVent[i].direction); m_oldVent[i] = m_curVent[i]; m_Soap.SetFanStatusContent(m_curVent[i]); //取得sid号 uint8 sid; PRawCtrl->GetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); pCode = m_Soap.NotifyUpdate(len); if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyVent3Update() { int len = 0; char *pCode = NULL; for(int i=MaxPacket*2;im_CallAlldata){//隔30-60s时间全数据发送 if(m_oldVent[i].status == m_curVent[i].status && m_oldVent[i].direction == m_curVent[i].direction) continue; } PrintLog(LOG_INFORMATION,"%d号风机更新风机状态:状态%d,方向%d",i+1,m_curVent[i].status,m_curVent[i].direction); m_oldVent[i] = m_curVent[i]; m_Soap.SetFanStatusContent(m_curVent[i]); //取得sid号 uint8 sid; PRawCtrl->GetAYx(m_rtuNO,4,&sid); m_Soap.SetSrvSID(sid); pCode = m_Soap.NotifyUpdate(len); if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyFireUpdate() { int len = 0; char *pCode = NULL; ST_FIRE_ALARM st_fire; for(int i=0;im_CallAlldata){//隔30-60s时间全数据发送 if(m_oldFire[i] == m_curFire[i]) continue; } PrintLog(LOG_INFORMATION,"%d号火警更新状态:状态%d",i+1,m_curFire[i]); m_oldFire[i] = m_curFire[i]; st_fire.objid = i+1; if((12-1)<=i && i<=(19-1))st_fire.objid += 90;//WYF 20190630 5号线12-19站,对应102-109站id st_fire.stat_flag=1; st_fire.status=m_curFire[i]; m_Soap.SetFireAlarmContent(st_fire); //取得sid号 uint8 sid; PRawCtrl->GetAYx(m_rtuNO,2,&sid); m_Soap.SetSrvSID(sid); pCode = m_Soap.NotifyUpdate(len); if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyPowerUpdate() { int len = 0; char *pCode = NULL; ST_POWERSECTION st_power; for(int i=0;im_CallAlldata){//隔30-60s时间全数据发送 if(m_oldPower[i] == m_curPower[i]) continue; } PrintLog(LOG_INFORMATION,"%d号电力区段更新状态:状态%d",i+1,m_curPower[i]); m_oldPower[i] = m_curPower[i]; st_power.objid = i+1; st_power.stat_flag=1; st_power.status=m_curPower[i]; m_Soap.SetPowerSectionContent(st_power); //取得sid号 uint8 sid; PRawCtrl->GetAYx(m_rtuNO,6,&sid); m_Soap.SetSrvSID(sid); pCode = m_Soap.NotifyUpdate(len); if(len>0) { pTxBuf->Write((uint8*)pCode,len); //pLink->SetCommStatus(CMST_RX_CNT); m_LastSendTime = GetNowSecond(); } } } void Gena_Notify::NotifyDeath(SUB_ENUM subObj) { //怎么判断是否发送结束报文 //从转发表中取出数据,然后转发给ATS } void Gena_Notify::getFireStatus() { CEasyList *yxlist=pZfDataCtrl->GetYxStructList(); sint32 numYx = yxlist->GetListLen(); uint8 yxVal=0,yxVal1=0; if(numYx<=0) { return ; } S_RDB_ZFYx *yxinfo,*yxinfo1; int i=0; //1---33遥信号为33个车站火警状态号 34 ---66为供电区段状态号 67以后为上下行风机状态号...以次类推.. for(i=0;iGetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 yxinfo1=(S_RDB_ZFYx *)((*yxlist)[FIRESTATUS_START+i*2+1]); PRawCtrl->GetAYx(yxinfo1->sr_rtuno,yxinfo1->sr_yxno,&yxVal1);//WYF 20190103 // if(yxinfo->Val>0 && yxinfo1->Val==1) if(yxVal>0 && yxVal1==1) { m_curFire[i] = 1; }/* else if(yxinfo->Val==0 && yxinfo1->Val==1) { m_curFire[i] = 0; } else{ m_curFire[i] = 2; }*/ } return ; } void Gena_Notify::getVentStatus() { CEasyList *yxlist=pZfDataCtrl->GetYxStructList(); sint32 numYx = yxlist->GetListLen(); if(numYx<=0) { return ; } uint8 yxVal=0,yxVal1=0,yxVal2=0; S_RDB_ZFYx *yxinfo,*yxinfo1; int i=0; for(i=0;iGetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 if(/*yxinfo->Val*/yxVal == 1) { m_curVent[i].stat_flag = 1; m_curVent[i].status = 2;//在SetFanStatusContent函数中status=0为停止 1为运行 2为故障,设置点号为2。"Fault" //PrintLog(LOG_INFORMATION,"隧道风机初始报文,风机号:%d,风机故障",fanStatus.objid); } else { yxinfo=(S_RDB_ZFYx *)((*yxlist)[VENTSTATUS_START+i*4+1]);//停止点 m_curVent[i].stat_flag = 1; PRawCtrl->GetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 if(/*yxinfo->Val*/yxVal == 0)//风机为开状态,则判断风机方向 { yxinfo=(S_RDB_ZFYx *)((*yxlist)[VENTSTATUS_START+i*4+2]);//风机方向上行点 PRawCtrl->GetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 yxinfo1=(S_RDB_ZFYx *)((*yxlist)[VENTSTATUS_START+i*4+3]);//风机方向上行点 PRawCtrl->GetAYx(yxinfo1->sr_rtuno,yxinfo1->sr_yxno,&yxVal1);//WYF 20190103 // if(yxinfo->Val == yxinfo1->Val) if(yxVal == yxVal1) { m_curVent[i].status = 2;// 风机故障 } else { m_curVent[i].status = 1;// 风机运行 m_curVent[i].direct_flag = 1; if(/*yxinfo->Val*/yxVal == 1) { m_curVent[i].direction = 1;//上行为1 } else { m_curVent[i].direction = 0; } //PrintLog(LOG_INFORMATION,"隧道风机初始报文,风机号:%d,状态%d",m_curVent[i].objid,m_curVent[i].direction); } } else { m_curVent[i].status = 0;// //PrintLog(LOG_INFORMATION,"隧道风机初始报文,风机号:%d,关",m_curVent[i].objid); } } } } void Gena_Notify::getPowerStatus() { int power[STANUMS*4];//WYF 20190103 int i=0; uint8 yxVal=0,yxVal1=0,yxVal2=0,yxVal3=0,yxVal4=0,yxVal5=0,yxVal6=0; float32 ycVal=0,ycVal1=0; CEasyList *yxlist=pZfDataCtrl->GetYxStructList(); sint32 numYx = yxlist->GetListLen(); CEasyList *yclist=pZfDataCtrl->GetYcStructList(); sint32 numYc = yclist->GetListLen(); if(numYx<=0||numYc<=0) { return ; } S_RDB_ZFYx *yxinfo,*yxinfo1,*yxinfo2,*yxinfo3,*yxinfo4,*yxinfo5; S_RDB_ZFYc *ycinfo,*ycinfo1; for(i=0; iGetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 yxinfo1=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+1]); PRawCtrl->GetAYx(yxinfo1->sr_rtuno,yxinfo1->sr_yxno,&yxVal1);//WYF 20190103 yxinfo2=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+2]); PRawCtrl->GetAYx(yxinfo2->sr_rtuno,yxinfo2->sr_yxno,&yxVal2);//WYF 20190103 yxinfo3=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+3]); PRawCtrl->GetAYx(yxinfo3->sr_rtuno,yxinfo3->sr_yxno,&yxVal3);//WYF 20190103 yxinfo4=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+4]); PRawCtrl->GetAYx(yxinfo4->sr_rtuno,yxinfo4->sr_yxno,&yxVal4);//WYF 20190103 yxinfo5=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+5]); PRawCtrl->GetAYx(yxinfo5->sr_rtuno,yxinfo5->sr_yxno,&yxVal5);//WYF 20190103 ycinfo=(S_RDB_ZFYc *)((*yclist)[POWERSECTIONSTATUS_AISTART+i*2]); PRawCtrl->GetAYc(ycinfo->sr_rtuno,ycinfo->sr_ycno,&ycVal);//WYF 20190103 ycinfo1=(S_RDB_ZFYc *)((*yclist)[POWERSECTIONSTATUS_AISTART+i*2+1]); PRawCtrl->GetAYc(ycinfo1->sr_rtuno,ycinfo1->sr_ycno,&ycVal1);//WYF 20190103 // if((ycinfo->Val>100)&&(yxinfo->Val==1)&&(yxinfo1->Val==1)||(ycinfo1->Val>100)&&(yxinfo3->Val==1)&&(yxinfo4->Val==1)) if((ycVal>100)&&(yxVal==1)&&(yxVal1==1)||(ycVal1>100)&&(yxVal3==1)&&(yxVal4==1)) { power[i] = 1; } } for(i=0;iGetAYx(yxinfo5->sr_rtuno,yxinfo5->sr_yxno,&yxVal5);//WYF 20190103 // if(yxinfo5->Val==1) if(yxVal5==1) { m_curPower[i] = (power[i]==1)||(power[i+2]==1); yxinfo=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+(i+2)*6+5]); PRawCtrl->GetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 // if(yxinfo->Val==1) if(yxVal==1) { m_curPower[i] = (power[i]==1)||(power[i+2]==1)||(power[i+4]==1); } } } if(i==2||i==3)//最左边两个电力区段,判别下面两个电力区段 { yxinfo3=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+2]); PRawCtrl->GetAYx(yxinfo3->sr_rtuno,yxinfo3->sr_yxno,&yxVal3);//WYF 20190103 // if(yxinfo3->Val==1)//判上一区段 if(yxVal3==1)//判上一区段 { m_curPower[i] = (power[i]==1)||(power[i-2]==1); } if(m_curPower[i]!=1)//如果还是没电,则判别下两个区段 { yxinfo5=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+5]); PRawCtrl->GetAYx(yxinfo5->sr_rtuno,yxinfo5->sr_yxno,&yxVal5);//WYF 20190103 // if(yxinfo5->Val==1) if(yxVal5==1) { m_curPower[i] = (power[i]==1)||(power[i+2]==1); yxinfo=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+(i+2)*6+5]); PRawCtrl->GetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 // if(yxinfo->Val==1) if(yxVal==1) { m_curPower[i] = (power[i]==1)||(power[i+2]==1)||(power[i+4]==1); } } } } else { yxinfo3=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+2]); PRawCtrl->GetAYx(yxinfo3->sr_rtuno,yxinfo3->sr_yxno,&yxVal3);//WYF 20190103 // if(yxinfo3->Val==1)//判上两个区段 if(yxVal3==1)//判上两个区段 { m_curPower[i] = (power[i]==1)||(power[i-2]==1); yxinfo=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+(i-2)*6+5]); PRawCtrl->GetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 // if(yxinfo->Val==1) if(yxVal==1) { m_curPower[i] = (power[i]==1)||(power[i-2]==1)||(power[i-4]==1); } } if(m_curPower[i]!=1)//如果还是没电,则判别下两个区段 { yxinfo5=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+i*6+5]); PRawCtrl->GetAYx(yxinfo5->sr_rtuno,yxinfo5->sr_yxno,&yxVal5);//WYF 20190103 // if(yxinfo5->Val==1) if(yxVal5==1) { m_curPower[i] = (power[i]==1)||(power[i+2]==1); yxinfo=(S_RDB_ZFYx *)((*yxlist)[POWERSECTIONSTATUS_START+(i+2)*6+5]); PRawCtrl->GetAYx(yxinfo->sr_rtuno,yxinfo->sr_yxno,&yxVal);//WYF 20190103 // if(yxinfo->Val==1) if(yxVal==1) { m_curPower[i] = (power[i]==1)||(power[i+2]==1)||(power[i+4]==1); } } } } } else { m_curPower[i] = 1; } } } int Gena_Notify::GetNowSecond() { CSeTime SE_T; TCriterionTime tmptime; SE_T.GetNow(&tmptime); return (int)tmptime; } sint32 Gena_Notify::MsgProc(sint32 msg) { if(msg == DEF_MSG_COMMDOWN) { m_com_status = DEF_MSG_COMMDOWN; } return 1; } //规约对象创建函数 #ifdef __unix extern "C" CProtocol* CreateProtocol(char *defpara) #else extern "C" __declspec(dllexport) CProtocol* CreateProtocol(char *defpara) #endif { CProtocol *pEpv = new Gena_Notify; return pEpv; }