#ifndef TMPDEVCLEAR_H
#define TMPDEVCLEAR_H

#include <QObject>
#include <QMap>
#include <QMutex>
#include <QStringList>
#include <KF5/BluezQt/bluezqt/adapter.h>

class QTimer;

class TmpDevClear final : public QObject
{
    Q_OBJECT
public:
    static TmpDevClear* getInstant();

    void init();

    void fini(void);

    TmpDevClear(TmpDevClear&&) = delete;
    TmpDevClear(const TmpDevClear&) = delete;
    TmpDevClear& operator =(TmpDevClear&) = delete;
    ~TmpDevClear();

    //更新时间戳
    void updateTime(const QString & addr);
private:
    explicit TmpDevClear(QObject *parent = nullptr);

    void removeConnectionFromMap();

    static TmpDevClear*_instant;

    QMap<QString,QMetaObject::Connection> connections;
    QMap<QString,qint64> devUpdates;
    QTimer* baseTime = nullptr;


private:
    QStringList m_cleardev;

public slots:
    void rssiChanaged(BluezQt::DevicePtr);
};

#endif // TMPDEVCLEAR_H
