dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_sts_idle.cpp
diff --git a/dol/src/dol/visitor/hdsd/scd/fsm/scd_sts_idle.cpp b/dol/src/dol/visitor/hdsd/scd/fsm/scd_sts_idle.cpp
new file mode 100644 (file)
index 0000000..cbb0f94
--- /dev/null
@@ -0,0 +1,37 @@
+#include "fsm/scd_sts_idle.h"
+
+#include "scd_logging.h"
+#include "scd_exception.h"
+#include "scd_cont_man_slave.h"
+
+
+void scd_sts_idle::recv_time_req()
+{
+    if (_sim.get_poller().wait(SCD_CONT_DELAY))
+    {
+        // had activity on sockets => we might be receiving data
+        scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_TIME_NACK);
+        _fsm.send_command(cmd);
+    }
+    else
+    {
+        scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_TIME_ACK);
+        _fsm.send_command(cmd);
+        _fsm.save_state();
+        _fsm.set_state(_st_time_ack);
+    }
+}
+
+
+void scd_sts_idle::set_busy()
+{
+    scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_BUSY);
+    _fsm.send_command(cmd);
+    _fsm.set_state(_st_busy);
+}
+
+
+void scd_sts_idle::set_done()
+{
+    scd_warn("slave: transition attempt from idle to done");
+}