Index: /trunk/FACT++/src/fadctrl.cc
===================================================================
--- /trunk/FACT++/src/fadctrl.cc	(revision 11030)
+++ /trunk/FACT++/src/fadctrl.cc	(revision 11031)
@@ -46,4 +46,5 @@
     bool fIsHexOutput;
     bool fIsDataOutput;
+    bool fBlockTransmission;
 
     uint64_t fCounter;
@@ -304,6 +305,10 @@
     }
 
+public:
     void PostCmd(std::vector<uint16_t> cmd)
     {
+        if (fBlockTransmission)
+            return;
+
 #ifdef DEBUG_TX
         ostringstream msg;
@@ -320,4 +325,7 @@
     void PostCmd(uint16_t cmd)
     {
+        if (fBlockTransmission)
+            return;
+
 #ifdef DEBUG_TX
         ostringstream msg;
@@ -332,4 +340,7 @@
     void PostCmd(uint16_t cmd, uint16_t data)
     {
+        if (fBlockTransmission)
+            return;
+
 #ifdef DEBUG_TX
         ostringstream msg;
@@ -345,6 +356,7 @@
 public:
     ConnectionFAD(ba::io_service& ioservice, MessageImp &imp) :
-    Connection(ioservice, imp()),
-    fIsVerbose(false), fIsHexOutput(false), fIsDataOutput(false), fCounter(0)
+        Connection(ioservice, imp()),
+        fIsVerbose(false), fIsHexOutput(false), fIsDataOutput(false),
+        fBlockTransmission(false), fCounter(0)
     {
         // Maximum possible needed space:
@@ -508,4 +520,9 @@
     {
         fIsDataOutput = b;
+    }
+
+    void SetBlockTransmission(bool b)
+    {
+        fBlockTransmission = b;
     }
 
@@ -546,4 +563,46 @@
         for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
             i->second.second->Cmd(command);
+
+        return T::GetCurrentState();
+    }
+
+    int SendCmd(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "SendCmd", 4))
+            return T::kSM_FatalError;
+
+        if (evt.GetUInt()>0xffff)
+        {
+            T::Warn("Command value out of range (0-65535).");
+            return T::GetCurrentState();
+        }
+
+        for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
+            i->second.second->PostCmd(evt.GetUInt());
+
+        return T::GetCurrentState();
+    }
+
+    int SendCmdData(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "SendCmdData", 8))
+            return T::kSM_FatalError;
+
+        const uint32_t *ptr = evt.Ptr<uint32_t>();
+
+        if (ptr[0]>0xffff)
+        {
+            T::Warn("Command value out of range (0-65535).");
+            return T::GetCurrentState();
+        }
+
+        if (ptr[1]>0xffff)
+        {
+            T::Warn("Data value out of range (0-65535).");
+            return T::GetCurrentState();
+        }
+
+        for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
+            i->second.second->PostCmd(ptr[0], ptr[1]);
 
         return T::GetCurrentState();
@@ -756,4 +815,25 @@
        for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
             i->second.second->SetDataOutput(evt.GetBool());
+
+        return T::GetCurrentState();
+    }
+
+    int SetBlockTransmission(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "SetBlockTransmission", 5))
+            return T::kSM_FatalError;
+
+        const int32_t slot = evt.Get<int32_t>();
+
+        const BoardList::iterator it=fBoards.find(slot);
+        if (it==fBoards.end())
+        {
+            ostringstream str;
+            str << "Slot " << slot << " not found.";
+            T::Warn(str);
+            return T::GetCurrentState();
+        }
+
+        it->second.second->SetBlockTransmission(evt.Get<uint8_t>(4));
 
         return T::GetCurrentState();
@@ -1054,4 +1134,14 @@
 
         // FAD Commands
+        T::AddEvent("SEND_CMD", "I:1")
+            (boost::bind(&StateMachineFAD::SendCmd, this, _1))
+            ("Send a command to the FADs. Values between 0 and 65535 are allowed."
+             "|command[uint16]:Command to be transmittted.");
+        T::AddEvent("SEND_DATA", "I:2")
+            (boost::bind(&StateMachineFAD::SendCmdData, this, _1))
+            ("Send a command with data to the FADs. Values between 0 and 65535 are allowed."
+             "|command[uint16]:Command to be transmittted."
+             "|data[uint16]:Data to be sent with the command.");
+
         T::AddEvent("ENABLE_SRCLK", "B:1")
             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdSrclk))
@@ -1141,4 +1231,10 @@
             ("");
 
+        T::AddEvent("BLOCK_TRANSMISSION", "I:1;B:1")
+            (boost::bind(&StateMachineFAD::SetBlockTransmission, this, _1))
+            ("Blocks the transmission of commands to the given slot. Use with care! For debugging pupose only!"
+             "|slot[int]:Slot to which the command transmission should be blocked (0-39)"
+             "|enable[bool]:Whether the command transmission should be blockes (yes) or allowed (no)");
+
         // Conenction commands
         /*
