Index: trunk/include/Pacpus/kernel/InputOutputInterface.h
===================================================================
--- trunk/include/Pacpus/kernel/InputOutputInterface.h	(revision 202)
+++ trunk/include/Pacpus/kernel/InputOutputInterface.h	(revision 206)
@@ -23,8 +23,10 @@
         : InputInterfaceBase(name, component, component)
         , method(processMethod)
-    {}
+    {
+    }
 
     ~InputInterface()
-    {}
+    {
+    }
 
     std::size_t getDataSize() const
@@ -39,22 +41,35 @@
 
     // FIXME: what's the purpose of this function?
-    PacpusEvent * getEventTemplate()
-    {
-        return new PacpusTypedEvent<T>(TYPED_EVENT);
-    }
+    //PacpusEvent * getEventTemplate()
+    //{
+    //    return new PacpusTypedEvent<T>(TYPED_EVENT);
+    //}
 
     // FIXME: what's the purpose of this function?
     void customEvent(QEvent * event)
     {
-        // TODO check component state started
-        //if (_component) get state
+        // check that component has been started
+        if ((NULL == getComponent()) || (!getComponent()->isActive())) {
+            LOG_DEBUG("component is not active");
+            return;
+        }
+        
+        LOG_DEBUG("Receiver: " << getSignature());
+
+        //PacpusTypedEvent<T> * typedEvent = dynamic_cast<PacpusTypedEvent<T> *>(event);
+        PacpusEvent * pacpusEvent = dynamic_cast<PacpusEvent *>(event);
+        if (!pacpusEvent) {
+            LOG_WARN("dynamic_cast failed: not a PacpusEvent");
+            return;
+        }
+        PacpusTypedEvent<T> * typedEvent = dynamic_cast<PacpusTypedEvent<T> *>(pacpusEvent);
+        if (!typedEvent) {
+            LOG_WARN("dynamic_cast failed: incompatible event types");
+            return;
+        }
+
         switch (event->type()) {
         case TYPED_EVENT:
-            {
-            PacpusTypedEvent<T> * typedEvent = dynamic_cast<PacpusTypedEvent<T> *> (event);
-
-            LOG_DEBUG("Receiver: " << getSignature());
-
-            if (typedEvent->timerange() < 500 && readingMode() == TimeBounded) {
+            if (TimeBounded == readingMode() && typedEvent->timerange() < 500) {
                 LOG_WARN("Incorrect TimeRange (0), switch to NeverSkip");
                 readingMode() = NeverSkip;
@@ -63,7 +78,6 @@
             switch (readingMode()) {
             case TimeBounded:
-
                 if (road_time() - typedEvent->time() > typedEvent->timerange()) {
-                    LOG_DEBUG("Data skipped, receiver: " << this->getSignature());
+                    LOG_TRACE("Data skipped, receiver: " << this->getSignature());
                     break;
                 }
@@ -73,5 +87,4 @@
 
             case GetLast:
-
                 (dynamic_cast<C*>(component())->*method)(typedEvent->data());
                 // delete all remaining events
@@ -85,7 +98,7 @@
             default:
                 LOG_WARN("Unknown reading mode " << readingMode());
+                break;
             }
             break;
-        }
 
         // Add here new event type if needed
@@ -95,12 +108,12 @@
             break;
         }
-    event->accept();
+        event->accept();
     }
 
     // TODO for Pulling mode (not yet implemented !!!)
-    T & getData() {
+    T & getData()
+    {
         T data;
         // TODO ask output data;
-
         return data;
     }
@@ -125,5 +138,5 @@
     {}
 
-    // Used by Components to send data througth typed output
+    /// Send data through a typed output
     void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0);
     
@@ -150,5 +163,9 @@
         //  It is not safe to access the event after it has been posted.    
         QEvent * newEvent = new PacpusTypedEvent<T>(TYPED_EVENT, data, t, tr);
-        QCoreApplication::postEvent(it->getInterface(), newEvent, it->getPriority());
+        QCoreApplication::postEvent(
+            it->getInterface(), 
+            newEvent, 
+            it->getPriority()
+        );
         LOG_DEBUG("Sender: " << it->getInterface()->getSignature());
         LOG_DEBUG("Data &: " << &data);
