123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- // struct and constant
- #ifndef STRUCT_DEF_H
- #define STRUCT_DEF_H
- #include <functional>
- typedef std::function<void(const int, const int, uint64_t, double, double, bool)> SendCallBack;
- struct init_para
- {
- std::function<void(uint32_t,bool,uint32_t)> send_pt;
- SendCallBack driving_face_alarm;
- bool m_restart;
- int m_shutdown_timeout; //超时关机时间阈值(读取配置数据)
- init_para()
- {
- m_restart = false;
- m_shutdown_timeout = 0;
- send_pt = nullptr;
- driving_face_alarm = nullptr;
- }
- void set_alarm_callback(const SendCallBack &cb)
- {
- driving_face_alarm = move(cb);
- }
- };
- struct card_pos
- {
- card_pos()
- {
- work_line=0; //1.一线工人 2.二线工人等
- rec_time=0;
- running_stat=-1;
- biz_stat=-1;
- vibration=0;map_id=-1;//enter_time=0;leave_time=0;
- x=y=z=0;type=id=identifier_id=dpt_id=0;
- final_v = 0.0;
- work_type_id =reader_id = 0;
- reader_x = 0.0;
- reader_y = 0.0;
- }
- void copy(const card_pos & pos)
- {
- *this = pos;
- }
- int work_line; // work level
- uint64_t rec_time; // receive time
- int running_stat; // sport status
- int biz_stat; // business status
- int vibration; // vibration for coalface and drivingface machine
- // int area_id; // current area id
- int map_id; // map sacle id
- // uint64_t enter_time; // time of enter aera
- // uint64_t leave_time; // time of leave area
- double x; // located x
- double y; // located y
- double z; // located z
- uint64_t type; // card type
- uint32_t id; // card id
- uint32_t identifier_id; // staff id
- uint32_t dpt_id; //部门ID
- int work_type_id;
- int reader_id; //分站ID
- double reader_x; //分站X
- double reader_y; //分站Y
- double final_v;
- };
- struct area_data
- {
- area_data()
- {
- is_work_area=false;
- area_id=0;
- area_type=0;
- enter_time=0;
- leave_time=0;
- }
- bool is_work_area; // whether it is a work area
- int area_id; // current area id
- int area_type; // area type
- uint64_t enter_time; // time of enter aera
- uint64_t leave_time; // time of leave area
- };
- struct db_para
- {
- std::string Host;//数据库主机地址
- std::string User;//用户名
- std::string PWD;//密码
- std::string DBName;//数据库名
- std::string CharSet;//字符集
- int TimeOut;
- int PoolSize;
- int Port; //端口
- };
- struct map_info{
- int m_map_id;
- double m_map_scale;
- map_info():m_map_id(0),m_map_scale(0.0){}
- };
- #endif
|