add timeout transition
This commit is contained in:
@@ -69,6 +69,7 @@ void PITransitionBase::trigger() {
|
||||
// piCout << "common" << common_count;
|
||||
source_path.remove(source_path.size_s() - common_count, common_count);
|
||||
target_path.remove(target_path.size_s() - common_count, common_count);
|
||||
// piCout << "source_target_path" << source_target_path;
|
||||
// piCout << "source_path" << source_path;
|
||||
// piCout << "target_path" << target_path;
|
||||
// piCout << "source_state before" << source_state;
|
||||
@@ -92,3 +93,30 @@ void PITransitionBase::trigger() {
|
||||
}
|
||||
if (target_state->isCompound()) target_state->start();
|
||||
}
|
||||
|
||||
|
||||
// PITransitionTimeout
|
||||
|
||||
PITransitionTimeout::PITransitionTimeout(PIStateBase * source, PIStateBase * target, PISystemTime timeout)
|
||||
: PITransitionBase(source, target, 0) {
|
||||
timer.setInterval(timeout);
|
||||
timer.setSlot([this] {
|
||||
trigger();
|
||||
timer.stopLater();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
PITransitionTimeout::~PITransitionTimeout() {
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
|
||||
void PITransitionTimeout::enabled() {
|
||||
timer.start();
|
||||
}
|
||||
|
||||
|
||||
void PITransitionTimeout::disabled() {
|
||||
timer.stopLater();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user