Ejemplo n.º 1
0
	void TemperatureManager::updateCurrentTemperature(float temp)
	{
#ifdef DOGLCD
		m_control->setCurrentTemperature(temp);
#endif		
		if (m_current_temperature != temp)
		{
			m_current_temperature = temp;
			notify();
		}
		fanControl();
	}
Ejemplo n.º 2
0
void InteHomeFurn::mousePressEvent(QMouseEvent *event)
{
    if (event->pos().x() > 360 && event->pos().x() < 490)
    {
        if(event->pos().y() > 160 && event->pos().y() < 215)
        {
            if(ui->stackedWidget->currentIndex()==2)
            {
                if(m_control->yanshibanID<0)
                {
                    QMessageBox::warning(0,trUtf8("提示"),trUtf8("未添加演示板设备"));
                    return;
                }
                fanControl();
            }
        }
    }

    if (event->pos().x() > 360 && event->pos().x() < 490)
    {
        if(event->pos().y() > 310 && event->pos().y() < 365)
        {
            if(ui->stackedWidget->currentIndex()==2)
            {
                if(yuyinStatus==false)
                {
                    ui->yuyinLabel->setPixmap(QPixmap(":/images/intehomefurn/on.png"));
                    yuyinStatus=true;
                }
                else
                {
                    ui->yuyinLabel->setPixmap(QPixmap(":/images/intehomefurn/off.png"));
                    yuyinStatus=false;
                }
            }
        }
    }
}
Ejemplo n.º 3
0
void InteHomeFurn::readInfo()
{
    if(m_control->changeData1)
    {
        if(m_control->rownum[6]>0)
        {
            ui->rainLabel->setText("<font color=green>"+m_control->jieluNow+"</font>");
        }
        if(m_control->rownum[8]>0)
        {
            ui->sunLabel->setText("<font color=green>"+m_control->guangminNow+"</font>");
        }
        if(m_control->rownum[2]>0)
        {
            ui->tempLabel->setText("<font color=green>"+m_control->tempNow+"</font>");
            ui->humLabel->setText("<font color=green>"+m_control->humNow+"</font>");
        }
        if(m_control->rownum[3]>0)
        {
            ui->fireLabel->setText("<font color=green>"+m_control->huoyanNow+"</font>");
        }
        if(m_control->rownum[4]>0)
        {
            ui->airLabel->setText("<font color=green>"+m_control->airNow+"</font>");
        }
        if(m_control->rownum[5]>0)
        {
            ui->paLabel->setText("<font color=green>"+m_control->qiyaNow+"</font>");
        }

        if(m_control->ithreefivestructlength>0)
        {
            //315设备
            if(m_control->threefiveNow.contains(trUtf8("烟雾"))==true)
            {
                ui->gasLabel->setText("<font color=red>"+trUtf8("有警情")+"</font>");
                fengshanStatus=false;
                fanControl();
                countNum[0]=0;

            }
            else if(m_control->threefiveNow.contains(trUtf8("气体"))==true)
            {
                ui->smogLabel->setText("<font color=red>"+trUtf8("有警情")+"</font>");
                fengshanStatus=false;
                fanControl();
                countNum[1]=0;
            }
            else if(m_control->threefiveNow.contains(trUtf8("人体"))==true)
            {
                ui->manLabel->setText("<font color=red>"+trUtf8("有警情")+"</font>");
                countNum[2]=0;
            }
            else if(m_control->threefiveNow.contains(trUtf8("门磁"))==true)
            {
                ui->doorLabel->setText("<font color=red>"+trUtf8("有警情")+"</font>");
                countNum[3]=0;
            }

            for(int i=0;i<4;i++)
            {
                if(countNum[i]==11) continue;
                countNum[i]++;
            }
            if(countNum[0]==10)
            {
                fengshanStatus=true;
                fanControl();
                ui->gasLabel->setText("<font color=green>"+trUtf8("正常")+"</font>");
            }
            if(countNum[1]==10)
            {
                fengshanStatus=true;
                fanControl();
                ui->smogLabel->setText("<font color=green>"+trUtf8("正常")+"</font>");
            }

            if(countNum[2]==10)
            {
                ui->manLabel->setText("<font color=green>"+trUtf8("正常")+"</font>");
            }
            if(countNum[3]==10)
            {
                ui->doorLabel->setText("<font color=green>"+trUtf8("正常")+"</font>");
            }
            for(int i=0;i<m_control->ithreefivestructlength;i++)
            {
                if(m_control->m_threefivestruct[i].name==trUtf8("烟雾"))
                    ui->pix4Label->setPixmap(pixmap2);
                else
                    ui->pix4Label->setPixmap(pixmap1);
                if(m_control->m_threefivestruct[i].name==trUtf8("气体"))
                    ui->pix13Label->setPixmap(pixmap2);
                else
                    ui->pix13Label->setPixmap(pixmap1);
                if(m_control->m_threefivestruct[i].name==trUtf8("人体"))
                    ui->pix15Label->setPixmap(pixmap2);
                else
                    ui->pix15Label->setPixmap(pixmap1);
                if(m_control->m_threefivestruct[i].name==trUtf8("门磁"))
                    ui->pix2Label->setPixmap(pixmap2);
                else
                    ui->pix2Label->setPixmap(pixmap1);
            }
        }
        m_control->changeData1=false;
    }
//强电设备1
    if(m_control->powerID1 || m_control->powerID2)
    {
        ui->pix18Label->setPixmap(pixmap2);
    }
    else
    {
        ui->pix18Label->setPixmap(pixmap1);
    }

    if(m_control->changeHomeDB)
    {
        for(int i=0;i<m_control->isensorlength;i++)
        {
            if(m_control->m_sensorstruct[i].name==trUtf8("光敏"))
            {
                if(m_control->m_sensorstruct[i].status==trUtf8("在线"))
                {
                    ui->pix1Label->setPixmap(pixmap2);
                }
                else
                {
                    ui->sunLabel->setText("");
                    ui->pix1Label->setPixmap(pixmap1);
                }
            }

            if(m_control->m_sensorstruct[i].name==trUtf8("火焰") && m_control->m_sensorstruct[i].dir==trUtf8("智能家居"))
            {
                if(m_control->m_sensorstruct[i].status==trUtf8("在线"))
                {
                    ui->pix3Label->setPixmap(pixmap2);
                }
                else
                {
                    ui->pix3Label->setPixmap(pixmap1);
                }
            }

            if(m_control->m_sensorstruct[i].name==trUtf8("空气质量"))
            {
                if(m_control->m_sensorstruct[i].status==trUtf8("在线"))
                {
                    ui->pix5Label->setPixmap(pixmap2);
                }
                else
                {
                    ui->airLabel->setText("");
                    ui->pix5Label->setPixmap(pixmap1);
                }
            }

            if(m_control->m_sensorstruct[i].name==trUtf8("温湿度") && m_control->m_sensorstruct[i].dir==trUtf8("智能家居"))
            {
                if(m_control->m_sensorstruct[i].status==trUtf8("在线"))
                {
                    ui->pix7Label->setPixmap(pixmap2);
                }
                else
                {
                    ui->tempLabel->setText("");
                    ui->humLabel->setText("");
                    ui->pix7Label->setPixmap(pixmap1);
                }
            }

            if(m_control->m_sensorstruct[i].name==trUtf8("气压"))
            {
                if(m_control->m_sensorstruct[i].status==trUtf8("在线"))
                {
                    ui->pix9Label->setPixmap(pixmap2);
                }
                else
                {
                    ui->paLabel->setText("");
                    ui->pix9Label->setPixmap(pixmap1);
                }
            }

            if(m_control->m_sensorstruct[i].name==trUtf8("结露"))
            {
                if(m_control->m_sensorstruct[i].status==trUtf8("在线"))
                {
                    ui->pix11Label->setPixmap(pixmap2);
                }
                else
                {
                    ui->rainLabel->setText("");
                    ui->pix11Label->setPixmap(pixmap1);
                }
            }

            if(m_control->m_sensorstruct[i].name==trUtf8("调光"))
            {
                ui->pix17Label->setPixmap(pixmap2);
            }
            else
            {
                ui->pix17Label->setPixmap(pixmap1);
            }
        }
    }

    if(m_control->yanshibanID)
    {
        if(m_control->rownum[2]>0)
        {
            countSMG++;
            if(countSMG==10)
            {
                if(SMGStatus==false)
                {
                    ui->pix10Label->setPixmap(pixmap2);
                }
                float fnum=m_control->tempNow.toFloat();
                int inum=(int)fnum;
                unsigned char abb=(unsigned char)inum;
                m_control->YanShi_ShuMaGuan(m_control->stryanshibanaddr,m_control->stryanshibanmacaddr,abb);
                countSMG=0;
            }
        }
        else
        {
            if(SMGStatus)
            {
                ui->pix10Label->setPixmap(pixmap1);
                countSMG=0;
            }
        }

//     LED
//        if(m_control->rownum[8] )
//        {
//            if(LEDStatus==false)
//                ui->pix16Label->setPixmap(pixmap2);
//        }
//        else
//        {
//            if(LEDStatus)
//                ui->pix16Label->setPixmap(pixmap1);
//        }
    }
//    else
//    {
//        if(LEDStatus)
//            ui->pix10Label->setPixmap(pixmap1);
//    }
    //按键
    if(m_control->rownum[7])
        ui->pix14Label->setPixmap(pixmap2);
    else
        ui->pix14Label->setPixmap(pixmap1);
    //红外
    if(m_control->iirtructlength)
        ui->pix12Label->setPixmap(pixmap2);
    else
        ui->pix12Label->setPixmap(pixmap1);
}