#ifndef AREA_BUSINESS_MOTIONLESS_PERSION
#define AREA_BUSINESS_MOTIONLESS_PERSION

/**
 * @brief 简要说明
 * @author 戴月腾
 * @date 2019-01-12
 */

//#include"module_singleton_base.h"
//#include"module_i_thread.h"
//#include"card.h"
#include"area_business.h"

struct config_file;
/**
 * @brief 一、硬件输出的状态
当完全静止时人卡会连续发送 30 次定位数据,在该定位数据中的加速度状态为 0;发送
完这一系列的定位数据之后进入休眠状态,不再发送任何定位数据。
 当人卡从静止切换到运动状态会在毫秒级完成。然后 2 秒后把定位数据发上来,此时加
速度状态为 1(运动状态)。
二、处理逻辑
当连续收到 X(X 可以配置,X 建议不小于 10)次静止状态定位数据之后才认为完全静止。
经过 Y(Y 可以配置)秒之后开始告警,只要收到运动状态的定位数据就认为非静止立刻取消
告警
 */
class area_business_motionless_persion : public area_business// : public i_thread, public singleton_base<module_motionless_persion>
{
    //    void run()
    //    {
    //        auto cardlist = card_list::instance()->m_map;
    //        auto iter_m_map=cardlist.begin();
    //        for(;iter_m_map!=cardlist.end();++iter_m_map)
    //        {
    //            deal_alarm(iter_m_map->second);
    //        }
    //    }

    //    void deal_alarm(std::shared_ptr<card_location_base>& card_ptr);
private:
    static int _acc_0count_limit;

public:
    int area_business_type()
    {
        return 10;
    }
    static void init(config_file& config);

    void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);
    void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
    void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
};

#endif // MODULE_MOTIONLESS_PERSION_H