operating_rate.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef OPERATING_RATE_H
  2. #define OPERATING_RATE_H
  3. #include "three_rates.h"
  4. #include "tr_tool.h"
  5. #include <memory>
  6. #include <iostream>
  7. class operating_rate
  8. {
  9. public:
  10. // Function: Constructor
  11. operating_rate();
  12. // Function: Destructor
  13. ~operating_rate();
  14. // Function: Get restart mark
  15. bool get_restart() const
  16. {
  17. return m_brestart;
  18. }
  19. // Function: Get zero time mark
  20. bool get_zero() const
  21. {
  22. return m_bzero;
  23. }
  24. /*
  25. * Functon: Init drivingface and coalface vehicle
  26. * Parameters: void
  27. * Returns: int, returns 0 normally, otherwise it returns 1
  28. * Throws: void
  29. */
  30. int init_coaldrivingface_vehicle();
  31. /*
  32. * Functon: Update the unprocessed record across days
  33. * Parameters: void
  34. * Returns: int, returns 0 normally, otherwise it returns 1
  35. * Throws: void
  36. */
  37. int zero_update_unprocess_record(time_t tCurTime);
  38. //判断是否零点 再更新
  39. void zeroes_update();
  40. /*
  41. * Functon: Update the unprocessed record when restarting
  42. * Parameters: tCurTime time_t
  43. * Returns: int, returns 0 normally, otherwise it returns 1
  44. * Throws: void
  45. */
  46. int restart_update_unprocess_record();
  47. /*
  48. * Functon: Get the schedule startup time of vihicle
  49. * Parameters: void
  50. * Returns: void
  51. * Throws: void
  52. */
  53. void get_schedulestartuptime(int cardType, std::string strCard, double &scheduleStartupTime,std::string strDate);
  54. double get_schedulestartuptime(int work_face_id,const std::string &strDate);
  55. /*
  56. * Functon: Get vibrate threthold of vihicle
  57. * Parameters: void
  58. * Returns: void
  59. * Throws: void
  60. */
  61. void get_vibratethrethold(std::shared_ptr<coaldrivingface_card> card, int& threshold);
  62. /*
  63. * Functon: Open machine
  64. * Parameters: card, coalface or drivingface card
  65. * Returns: int, returns 0 normally, otherwise it returns 1
  66. * Throws: void
  67. */
  68. int open_machine(std::shared_ptr<coaldrivingface_card> card);
  69. /*
  70. * Functon: Close machine
  71. * Parameters: card, coalface or drivingface card
  72. * Returns: int, returns 0 normally, otherwise it returns 1
  73. * Throws: void
  74. */
  75. int close_machine(std::shared_ptr<coaldrivingface_card> card, bool bTimeOut = true);
  76. /*
  77. * Functon: Store machine state
  78. * Parameters: card, coalface or drivingface card
  79. * Returns: int, returns 0 normally, otherwise it returns 1
  80. * Throws: void
  81. */
  82. int store_machine_state(std::shared_ptr<coaldrivingface_card> card);
  83. private:
  84. bool m_bzero;
  85. bool m_brestart;
  86. public:
  87. coaldrivingface_map m_coaldrivingface_map;
  88. public:
  89. //车卡状态标记:开状态 的个数 表示开机
  90. static const int STARTUP_STATE_COUNT = 7;
  91. //车卡状态标记:关状态 的个数 表示关机
  92. static const int SHUTDOWN_STATE_COUNT = 3;
  93. static const int SEC_TO_HOUR = 3600;
  94. };
  95. #endif