Yingdi Yu | f340118 | 2015-02-02 20:21:07 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame] | 3 | * Copyright (c) 2020, Regents of the University of California |
Yingdi Yu | f340118 | 2015-02-02 20:21:07 -0800 | [diff] [blame] | 4 | * |
| 5 | * BSD license, See the LICENSE file for more information |
| 6 | * |
| 7 | * Author: Qiuhan Ding <qiuhanding@cs.ucla.edu> |
| 8 | */ |
| 9 | |
| 10 | #ifndef CHRONOCHAT_NFD_CONNECTION_CHECKER_HPP |
| 11 | #define CHRONOCHAT_NFD_CONNECTION_CHECKER_HPP |
| 12 | |
Yingdi Yu | f340118 | 2015-02-02 20:21:07 -0800 | [diff] [blame] | 13 | #include "common.hpp" |
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame] | 14 | |
| 15 | #include <QThread> |
Yingdi Yu | f340118 | 2015-02-02 20:21:07 -0800 | [diff] [blame] | 16 | #include <mutex> |
| 17 | #include <boost/thread.hpp> |
| 18 | #include <ndn-cxx/face.hpp> |
Yingdi Yu | f340118 | 2015-02-02 20:21:07 -0800 | [diff] [blame] | 19 | |
| 20 | namespace chronochat { |
| 21 | |
| 22 | class NfdConnectionChecker : public QThread |
| 23 | { |
| 24 | Q_OBJECT |
| 25 | |
| 26 | public: |
| 27 | NfdConnectionChecker(QObject* parent = nullptr); |
| 28 | |
| 29 | protected: |
| 30 | void |
| 31 | run(); |
| 32 | |
| 33 | signals: |
| 34 | void |
| 35 | nfdConnected(); |
| 36 | |
| 37 | public slots: |
| 38 | void |
| 39 | shutdown(); |
| 40 | |
| 41 | private: |
| 42 | bool m_nfdConnected; |
| 43 | std::mutex m_nfdMutex; |
| 44 | |
| 45 | unique_ptr<ndn::Face> m_face; |
| 46 | }; |
| 47 | |
| 48 | } // namespace chronochat |
| 49 | |
| 50 | #endif // CHRONOCHAT_NFD_CONNECTION_CHECKER_HPP |