1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef MODULE_MOTIONLESS_PERSION_H
- #define MODULE_MOTIONLESS_PERSION_H
- #include"module_singleton_base.h"
- #include"module_i_thread.h"
- #include"card.h"
- #include"config_file.h"
- class module_motionless_persion : public i_thread, public singleton_base<module_motionless_persion>
- {
- private:
- friend class singleton_base<module_motionless_persion>;
- module_motionless_persion()
- {
- }
- int _acc_0count_limit;
- int _acc_seconds_limit;
- 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);
- public:
- void init(config_file& config)
- {
- sleep_ms = std::stoi(config.get("service.motionless_thread_sleep_ms","5000"));
- _acc_0count_limit = std::stoi(config.get("service.motionless_acc_0count_limit","20"));
- _acc_seconds_limit = std::stoi(config.get("service.motionless_acc_seconds_limit","120"));
- }
- void on_enter(std::shared_ptr<card_location_base> card_ptr, int index);
- void on_hover(std::shared_ptr<card_location_base> card_ptr, int index);
- void on_leave(std::shared_ptr<card_location_base> card_ptr, int index);
- };
- #endif
|