You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LibNfcOperation.h 952B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Created by robin on 10/1/17.
  3. //
  4. #ifndef MIFARE_TOOLS_LIBNFCOPERATION_H
  5. #define MIFARE_TOOLS_LIBNFCOPERATION_H
  6. #include <QtCore/QThread>
  7. #include <QtCore/QSharedPointer>
  8. #include <Business/LibNfcBusiness.h>
  9. class LibNfcOperation : public QThread
  10. {
  11. Q_OBJECT
  12. public:
  13. template<typename T>
  14. static void runOperation(QSharedPointer<LibNfcBusiness> libNfc,
  15. std::function<Result<T>(QSharedPointer<LibNfcBusiness>)> operation,
  16. std::function<void(Result<T>)> callback);
  17. protected:
  18. void run() override;
  19. //signals:
  20. // void operationFinished(Result<T> result);
  21. private:
  22. explicit LibNfcOperation(QSharedPointer<LibNfcBusiness>& libNfc,
  23. std::function<void(QSharedPointer<LibNfcBusiness>)> operation);
  24. QSharedPointer<LibNfcBusiness> m_pLibNfc;
  25. std::function<void(QSharedPointer<LibNfcBusiness>)> m_operation;
  26. };
  27. #endif //MIFARE_TOOLS_LIBNFCOPERATION_H