void Pince::run(){ col.run(); if (period_run.is_over()) { period_run.reset(); asc.run(); if (asc.is_up()) { trigger(T_BUMP_HAUT); } if (is_time_out()) { trigger(trigger_to_be); } if (ir_feu.is_off()) { trigger(T_IR); } if (state == MONTE_COOL2 ) { if (coul_feu) { trigger(COOL_OK); } else { trigger(COOL_NOT_OK); } } /* if (couleur == ROUGE) { if (col.is_red()) { trigger(COOL_OK); } else if (col.is_yellow()) { trigger(COOL_NOT_OK); } } else { if (col.is_yellow()) { trigger(COOL_OK); } else if (col.is_red()) { trigger(COOL_NOT_OK); } } */ } }
static void on_timer(int epoll_fd) { // 这次每次都调用is_time_out,会有多次time系统调用,需改进 std::map<int, socket_buf>::iterator it = sb_array.begin(); for(; it != sb_array.end(); it++) { if(is_time_out(it->second->timer) == HTTP_TIME_OUT){ printf("connect:%d time out\n", it->first); on_close(epoll_fd, it->first); } } }
void Bras::run(){ col.run(); if (asc.run()) { trigger(T_ASC_ARRIVE); } if (is_pression_on()) { trigger(T_CAPT_PRESSION_ON); } if (period_run.is_over()) { period_run.reset(); if (state == ATTENTE_ACTIF && coul_to_be_on){ coul_to_be_on = false; next_coul = next_coul_to_be; next_coul_on = true; } if (state == ATTENTE_ACTIF && trigger_attente_on){ trigger_attente_on = false; trigger(trigger_attente); } if ((state == PRISE_VERT || state == PRISE_LAT) && next_coul_on) { next_coul_on = false; if (next_coul) { trigger(T_COUL_OK_MASTER); } else { trigger(T_COUL_NOT_OK_MASTER); } } if (mon_ir_actif && ir.is_on()) { trigger(T_MON_IR); } if (asc.is_up()) { trigger(T_BUMP_HAUT); } if (is_time_out()) { trigger(trigger_to_be); } if (asc.is_arrive()) { trigger(T_ASC_ARRIVE); } if (asc.is_near()) { trigger(T_ASC_PRESQUE_ARRIVE); } if (couleur == ROUGE) { if (col.is_red()) { trigger(T_COUL_OK); } else if (col.is_yellow()) { trigger(T_COUL_NOT_OK); } } else { if (col.is_yellow()) { trigger(T_COUL_OK); } else if (col.is_red()) { trigger(T_COUL_NOT_OK); } } } }