//
// Created by WJG on 2021-8-23.
//

#ifndef SMARTPANEL_COSS_BODYSENSORTIMER_H
#define SMARTPANEL_COSS_BODYSENSORTIMER_H

#include <string>
#include "../MsgSchedule/CThread.h"

class BodySensorTimer : public CThread{
public:
    BodySensorTimer(const std::string& id,const std::string& uuid);
    void Run() override ;
    void resetTimer();

private:
    int counter;            //自上次以来的触发计数
    unsigned int s_timer;
    int trg_counter;        //自上次触发以来的计时
    bool can_trigger;       //可否再次触发

    bool is_looping;        //退出触发器计时循环
    bool stop_timer;        //退出计时器
    std::string sensor_id;
    std::string sensor_uuid;

    std::mutex  mutex_;
    void sendSensorMessage(int value);
    void setTriggerStatus();

    void clearBodyStatus();
};

#endif //SMARTPANEL_COSS_BODYSENSORTIMER_H
