Yingdi Yu | f340118 | 2015-02-02 20:21:07 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 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 | |
| 13 | #include <QThread> |
| 14 | |
| 15 | #ifndef Q_MOC_RUN |
| 16 | #include "common.hpp" |
| 17 | #include <mutex> |
| 18 | #include <boost/thread.hpp> |
| 19 | #include <ndn-cxx/face.hpp> |
| 20 | #endif |
| 21 | |
| 22 | namespace chronochat { |
| 23 | |
| 24 | class NfdConnectionChecker : public QThread |
| 25 | { |
| 26 | Q_OBJECT |
| 27 | |
| 28 | public: |
| 29 | NfdConnectionChecker(QObject* parent = nullptr); |
| 30 | |
| 31 | protected: |
| 32 | void |
| 33 | run(); |
| 34 | |
| 35 | signals: |
| 36 | void |
| 37 | nfdConnected(); |
| 38 | |
| 39 | public slots: |
| 40 | void |
| 41 | shutdown(); |
| 42 | |
| 43 | private: |
| 44 | bool m_nfdConnected; |
| 45 | std::mutex m_nfdMutex; |
| 46 | |
| 47 | unique_ptr<ndn::Face> m_face; |
| 48 | }; |
| 49 | |
| 50 | } // namespace chronochat |
| 51 | |
| 52 | #endif // CHRONOCHAT_NFD_CONNECTION_CHECKER_HPP |