package org.inaetics.dronessimulator.drone.components.radio;

import org.inaetics.dronessimulator.common.D3PoolCoordinate;
import org.inaetics.dronessimulator.common.D3Vector;
import org.inaetics.dronessimulator.common.protocol.TextMessage;
import org.inaetics.dronessimulator.common.protocol.MessageTopic;
import org.inaetics.dronessimulator.common.protocol.StateMessage;
import org.inaetics.dronessimulator.drone.droneinit.DroneInit;
import org.inaetics.dronessimulator.pubsub.api.Message;
import org.inaetics.dronessimulator.pubsub.api.MessageHandler;
import org.inaetics.dronessimulator.pubsub.api.subscriber.Subscriber;
import org.inaetics.dronessimulator.pubsub.api.publisher.Publisher;


import java.io.IOException;
import java.util.concurrent.ConcurrentLinkedQueue;

public class Radio implements MessageHandler {
    private volatile Subscriber m_subscriber;
    private volatile Publisher m_publisher;
    private volatile DroneInit m_drone;
    private ConcurrentLinkedQueue<String> received_queue = new ConcurrentLinkedQueue<String>();

    /**
     * FELIX CALLBACKS
     */
    public void start() {
        try {
            this.m_subscriber.addTopic(MessageTopic.RADIO);
        } catch (IOException e) {
            System.out.println("IO Exception add Topic"); // todo logging
        }
        this.m_subscriber.addHandler(StateMessage.class, this);
    }

    public void sendText(String text){
        TextMessage msg = new TextMessage();
        msg.setText(text);
        try{
            m_publisher.send(MessageTopic.RADIO, msg);
        } catch(IOException e){
            System.out.println("Exception");
        }
    }

    public ConcurrentLinkedQueue<String> getMessages(){
        return received_queue;
    }

    /**
     * -- MESSAGEHANDLER
     */
    public void handleMessage(Message message) {
        if (message instanceof TextMessage){
            TextMessage textMessage = (TextMessage) message;
            received_queue.add(textMessage.getText());

        }
    }

}

@@ -70,108 +70,26 @@
 org.
-inaetics.dronessimulator.common.D3PoolCoordinate;%0Aimport org.inaetics.dronessimulator.common.D3Vecto
+apache.log4j.Logge
 r;%0Ai
@@ -733,16 +733,89 @@
 ndler %7B%0A
+    private static final Logger logger = Logger.getLogger(Radio.class);%0A%0A
     priv
@@ -1222,69 +1222,24 @@
     
-System.out.println(%22IO Exception add Topic%22); // todo logging
+logger.fatal(e);
 %0A   
@@ -1543,38 +1543,22 @@
     
-System.out.println(%22Exception%22
+logger.fatal(e
 );%0A 

Add logger to Radio