#pragma once
#include "BaseModule.h"
#include <QtCore/QThread>
#include <QtCore/QVariant>
#include <QtCore/QDebug>
#include <thread>
#include <stdlib.h>
#include <math.h>
#include "alarmlight_global.h"

typedef struct
{
public:
    QString sourceobject;
    QString useoperator;
    double operator1;
    double operator2;
    QString targetdevice;
    QString targetdevicecommand;
}oneregulation;

class ALARMLIGHT_EXPORT Alarmlight : public BaseModule
{
public:
    Alarmlight();

private:
    std::map<QString,QString>                  m_mpDeviceLastCommand; // 记录设备的上一次操作,如果连续发后续就不发了
    std::multimap<std::string,oneregulation>   m_mpRegulation;
    DataConsumer*                              m_pDataConsumer;

public:
    virtual void Setup(ModuleInfo moduleInfo);
    virtual void regConsumer(DataConsumer* pDC);
    virtual bool isInheritedFrom(std::string tp);
    virtual void OnSubData(std::string name,std::string val);
};

extern "C" {//一定要添加上
ALARMLIGHT_EXPORT BaseModule* instance();
ALARMLIGHT_EXPORT void destroy(BaseModule*);
}
