#include "module_other_alarm.h"
#include "event.h"
#include "common_tool.h"
#include "log.h"

/*
 * @brief       低电量报警
 * @param       std::shared_ptr<card_location_base> card_ptr    卡对象
 * @return      无
 * @note
 * @warning
 * @bug
 * */
void module_other_alarm::power_lower_serious(std::shared_ptr<card_location_base> card_ptr)
{
    uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
    event_tool::instance()->handle_event(OT_CARD, ET_CARD_LOW_POWER_SERIOUS, id, 0, 0, true);
}

/*
 * @brief       电量正常时,取消电量低报警
 * @param       std::shared_ptr<card_location_base> card_ptr
 * @return      无
 * @note
 * @warning
 * @bug
 * */
void module_other_alarm::power_normal(std::shared_ptr<card_location_base> card_ptr)
{
    uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
    event_tool::instance()->handle_event(OT_CARD, ET_CARD_LOW_POWER_SERIOUS, id, 0, 0, false);
}