DaemonAndroid.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef DAEMON_ANDROID_H
  2. #define DAEMON_ANDROID_H
  3. #include <string>
  4. namespace i2p
  5. {
  6. namespace android
  7. {
  8. class DaemonAndroidImpl
  9. {
  10. public:
  11. DaemonAndroidImpl ();
  12. ~DaemonAndroidImpl ();
  13. //typedef void (*runningChangedCallback)();
  14. /**
  15. * @return success
  16. */
  17. bool init(int argc, char* argv[]);
  18. void start();
  19. void stop();
  20. void restart();
  21. //void setRunningCallback(runningChangedCallback cb);
  22. //bool isRunning();
  23. private:
  24. //void setRunning(bool running);
  25. private:
  26. //QMutex* mutex;
  27. //bool m_IsRunning;
  28. //runningChangedCallback m_RunningChangedCallback;
  29. };
  30. /**
  31. * returns "ok" if daemon init failed
  32. * returns errinfo if daemon initialized and started okay
  33. */
  34. std::string start();
  35. // stops the daemon
  36. void stop();
  37. // set datadir received from jni
  38. void SetDataDir(std::string jdataDir);
  39. /*
  40. class Worker : public QObject
  41. {
  42. Q_OBJECT
  43. public:
  44. Worker (DaemonAndroidImpl& daemon);
  45. private:
  46. DaemonAndroidImpl& m_Daemon;
  47. public slots:
  48. void startDaemon();
  49. void restartDaemon();
  50. void stopDaemon();
  51. signals:
  52. void resultReady();
  53. };
  54. class Controller : public QObject
  55. {
  56. Q_OBJECT
  57. QThread workerThread;
  58. public:
  59. Controller(DaemonAndroidImpl& daemon);
  60. ~Controller();
  61. private:
  62. DaemonAndroidImpl& m_Daemon;
  63. public slots:
  64. void handleResults(){}
  65. signals:
  66. void startDaemon();
  67. void stopDaemon();
  68. void restartDaemon();
  69. };
  70. */
  71. }
  72. }
  73. #endif // DAEMON_ANDROID_H