69 int fake_busy_interval_sec = 0;
70 std::chrono::seconds chrono_fake_busy_interval(fake_busy_interval_sec);
71 int fake_busy_duration_sec = 0;
72 std::chrono::seconds chrono_fake_busy_duration(fake_busy_duration_sec);
73 int min_interval_between_inhibit_messages_msec = 0;
74 std::chrono::milliseconds chrono_min_interval_between_inhibit_messages(min_interval_between_inhibit_messages_msec);
83 std::chrono::steady_clock::time_point current_time = std::chrono::steady_clock::now();
85 std::chrono::steady_clock::time_point last_sent_time = current_time;
86 LocalState requested_state = no_update;
87 LocalState current_state = free_state;
88 int32_t received_message_count = 0;
89 int32_t sent_message_count = 0;
92 while (running_flag.load()) {
98 ++received_message_count;
102 }
catch (
const iomanager::TimeoutExpired& excpt) {
115 if (temp_trig_num_at_start >= temp_trig_num_at_end &&
116 (temp_trig_num_at_start - temp_trig_num_at_end) >= threshold) {
117 if (current_state == free_state) {
118 requested_state = busy_state;
121 if (current_state == busy_state) {
122 requested_state = free_state;
130 if (requested_state != no_update && requested_state != current_state) {
131 if ((std::chrono::steady_clock::now() - last_sent_time) >= chrono_min_interval_between_inhibit_messages) {
133 if (requested_state == busy_state) {
134 inhibit_message.
busy =
true;
136 inhibit_message.
busy =
false;
140 << inhibit_message.
busy <<
" onto the output queue";
143 ++sent_message_count;
146 std::ostringstream oss_sent;
147 oss_sent <<
": Successfully pushed a TriggerInhibit message with busy state set to " << inhibit_message.
busy
148 <<
" onto the output queue";
153 current_state = requested_state;
154 requested_state = no_update;
155 last_sent_time = std::chrono::steady_clock::now();
156 }
catch (
const iomanager::TimeoutExpired& excpt) {
163 <<
": TIMEOUT pushing a TriggerInhibit message onto the output queue";
169 std::ostringstream oss_summ;
170 oss_summ <<
": Exiting the do_work() method, received " << received_message_count
171 <<
" TriggerDecision messages and sent " << sent_message_count
172 <<
" TriggerInhibit messages of all types (both Busy and Free).";