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.

mainclass.h 816B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef MAINCLASS_H
  2. #define MAINCLASS_H
  3. #include <QObject>
  4. #include <sys/time.h>
  5. #include "inputbusiness.h"
  6. class MainClass : public QObject
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit MainClass(QObject *parent = 0);
  11. enum DeviceType
  12. {
  13. Gpio,
  14. Random
  15. };
  16. signals:
  17. public slots:
  18. void main();
  19. void maySend();
  20. inline __suseconds_t getTime() const;
  21. private:
  22. InputBusiness* m_input;
  23. QTimer* m_timer;
  24. DeviceType m_device;
  25. QHostAddress m_address;
  26. QList<QVariant> m_channels;
  27. int m_port;
  28. bool m_verbose;
  29. int m_interval;
  30. __suseconds_t m_lastTime;
  31. void getOpts();
  32. };
  33. __suseconds_t MainClass::getTime() const
  34. {
  35. struct timeval time;
  36. gettimeofday(&time, NULL);
  37. return 1000000 * time.tv_sec + time.tv_usec;
  38. }
  39. #endif // MAINCLASS_H