#include "dogcore.h"
#include "dogshm.h"

DogCore::DogCore(QObject *parent) : QObject(parent)
{
    timer = new QTimer(this);
    connect(timer,&QTimer::timeout,this,&DogCore::time_out);
}

void DogCore::start()
{
    timer->start(5000);
}

void DogCore::time_out()
{
    uint time = QDateTime::currentDateTime().toTime_t();
    if((time-dogshm->data_feedtime)>30){
        if((system("killall ytDMPDataServer"))!=-1){
            if((system("/root/bin/ytDMPDataServer &"))!=-1){

            }
        }
    }
    if((time-dogshm->version_feedtime)>30){
        if((system("killall ytDMPVersionServer"))!=-1){
            if((system("/root/bin/ytDMPVersionServer &"))!=-1){

            }
        }

    }
}
