#pragma once

//#include "BaseModule.h"
//#include "libaray_symbols.h"
#include "Redis.h"
#include <QtNetwork/QUdpSocket>
#include <QtCore/QVariant>
#include <QtCore/QObject>

class RedisAgent : public QObject,public EventSubInterface//,public BaseModule
{
	Q_OBJECT
public:
    RedisAgent();
    ~RedisAgent();

private:
//    virtual void Setup(ModuleInfo mi) {};
//    virtual void regConsumer(DataConsumer* pDC) {};
//    virtual bool isInheritedFrom(std::string tp) {return false;};
//    virtual void OnSubData(std::string name,std::string val) {};

private:
    Redis objRedis;

signals:
    void sigEvent(const std::string topic, const std::string msg);

private:
    void SubCB(const std::string topic, const std::string msg);

public:
    bool Connect(tagSetup ts);
    bool Subscribe(std::list<std::string> lstTopic);
    void Publish(std::string,QVariant v);
    QStringList hvals(QString k);
    QHash<QString, QString> hgetall(QString k);
    bool hset(QString k, QString f, QString v);
};

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