drivingface_alarm.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef DRIVINGFACE_ALARM_H
  2. #define DRIVINGFACE_ALARM_H
  3. #include "struct_def.h"
  4. #include "point.h"
  5. #include <map>
  6. using namespace std;
  7. const int OT_CARD = 9;
  8. //掘进面靠近预警区域告警
  9. const int ET_CARD_DRIVINGFACE_WARNING_AREA = 28;
  10. struct DrivingFaceInfo {
  11. int vehicle_id; //掘进机ID
  12. int vehicle_type_id; //设备类型 26-掘进机
  13. double warning_threshold; //与分站距离超限告警值
  14. int warning_count; //告警次数
  15. bool bWarning; //是否报警
  16. double distance; //距离
  17. DrivingFaceInfo() {
  18. vehicle_id = 0;
  19. vehicle_type_id = 0;
  20. warning_threshold = 0.0f;
  21. warning_count = 0;
  22. bWarning = false;
  23. distance = 0.0;
  24. }
  25. void clean()
  26. {
  27. vehicle_id = 0;
  28. vehicle_type_id = 0;
  29. warning_threshold = 0.0f;
  30. warning_count = 0;
  31. bWarning = false;
  32. distance = 0.0;
  33. }
  34. };
  35. struct DrivingCard : point{
  36. int vehicle_card_id;//掘进机对应的卡ID
  37. int vehicle_id; //掘进机ID
  38. int card_type; //卡类型1-人卡,2-车卡,4-采煤机,5-掘进机
  39. int reader_id; //分站ID
  40. double reader_x; //分站X
  41. double reader_y; //分站Y
  42. double map_scale; //比例
  43. DrivingCard() {
  44. vehicle_card_id = 0;
  45. vehicle_id = 0;
  46. card_type = 0;
  47. reader_id = 0;
  48. reader_x = 0.0;
  49. reader_y = 0.0;
  50. map_scale = 0.0;
  51. }
  52. };
  53. class DrivingFaceAlarm {
  54. public:
  55. void init(int drivingface_id = 0);
  56. void driving_alarm(DrivingCard &card);
  57. void set_send_callback(const SendCallBack &cb)
  58. {
  59. m_send_callback = move(cb);
  60. }
  61. public:
  62. void init_drivingface_db( int drivingface_id = 0);
  63. void del_drivingface(int drivingface_id );
  64. private:
  65. map<int, DrivingFaceInfo> m_map_drivingface;
  66. SendCallBack m_send_callback;
  67. };
  68. #endif