clock

Dependencies:   mbed

main.cpp

Committer:
donghuoyinzi
Date:
2018-05-12
Revision:
1:013b9fdc4e78
Parent:
0:17e9016529cf
Child:
2:e54d9d87c6cb

File content as of revision 1:013b9fdc4e78:

#include "main.h"

/*******************************
Fun.:Desc.:whattime/where runing
Desc.:
Auth. Date.:2017.7.2
*******************************/
int main()
{
    tm *tim;
    
    string strx,stry, strz;
    int n,f;

    f401Act::init();                          //映射平台初始化

    maiAct::init_scorp();                    //增强硬件初始化

    f401Act::put_rwdg();                       //Refresh iwdg

    maiAct::init_dat();                       //data initialization 
    maiAct::init_star();                       //start initialization 

    while(1){ 
        if(know::polSta[46]=="1"){                                        //state of tick2S
            time_t seconds=time(NULL);
            tim=localtime(&seconds);

            strx=know::task[0];
            stry=strx.substr(13,12);                  //提取时间,从索引13开始12个字符
            //strz="yymmddhh"+to_string(tim->tm_min)+"ss";
            if(stry == strz){                               //bc95动作
                know::polDat[1]= tim->tm_hour;
                know::polDat[2]= tim->tm_min;
                know::polDat[3]= tim->tm_sec;

                bc95Act:: put();
            }
            if(know::polSta[16]=="1"&& know::polSta[15]=="0") bc95Act::get_knw();   // puts, getknwS
            //if(know::polSta[4]=="1"&& know::polSta4[9]=="0") bc95Act::setrtc();     // setrtcS私有
            if(know::polSta[18]=="1"&& know::polSta[0]=="0") knowAct::buildtsk();   // buildtskS 

            n=0;
            f=1;
            while(f==1){
                n++;
                strx=know::task[n];
                stry= strx.substr(13,12);                  //提取时间,从索引13开始12个字符
                //strz= "yymmdd"+ to_string (tim->tm_hour)+to_string (tim->tm_min)+"ss";
                if(stry == strz){
                    stry= strx. substr(12,2);                    //提取语音编号
                    //播放
                    f=0;
                }
            }
        }
         //f401Act::sys_sleepy();                    //cpu sleep                                  
    }
}

/*****************************************
Fun.: initialization of scorp。
Desc.: 
Auth. Vesion:2017.7.2
*****************************************/
void maiAct::init_scorp(void)
{
    bc95Act::init();                        //基础初始化
    cloDAct::init();
    cloSAct::init();
}

/*****************************************
Fun.: initialization. of data
Desc.: 
Auth. Vesion:2017.7.2
*****************************************/
void maiAct::init_dat(void)
{
    bc95Act::data();                        //基础初始化
}

/*****************************************
Fun.: initialization of ready。
Desc.: 
Auth. Vesion:2017.7.2
*****************************************/
void maiAct::init_ready(void)
{
    set_time(1514806505);//自1970年1月1日0时0分0秒到2018年1月1日11时35分05秒

    f401Act::ready();
    //cloDAct::ready(); 
    cloSAct::ready();  
}

/*****************************************
Fun.: initialization of start。
Desc.: 
Auth. Vesion:2017.7.2
*****************************************/
void maiAct::init_star(void)
{
   
}

/*****************************************
Fun.: Seep judge。
Desc.:
Auth. Vesion:2017.7.2
*****************************************/
void maiAct::judg_sleep(void)
{
    //if(all Flag==0) deepsleep();
}