Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 0)
+++ src/Makefile.am	(revision 0)
@@ -0,0 +1,1 @@
+SUBDIRS=xplra
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 0)
+++ 	(revision )
@@ -1,1 +1,0 @@
-SUBDIRS=xplra
Index: src/xplra/.copyright
===================================================================
--- src/xplra/.copyright	(revision 0)
+++ src/xplra/.copyright	(revision 0)
@@ -0,0 +1,23 @@
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
Index: src/xplra/.copyright
===================================================================
--- src/xplra/.copyright	(revision 0)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
Index: src/xplra/.namespace
===================================================================
--- src/xplra/.namespace	(revision 0)
+++ src/xplra/.namespace	(revision 0)
@@ -0,0 +1,1 @@
+xplra
Index: src/xplra/.namespace
===================================================================
--- src/xplra/.namespace	(revision 0)
+++ 	(revision )
@@ -1,1 +1,0 @@
-xplra
Index: src/xplra/.srcmessage
===================================================================
--- src/xplra/.srcmessage	(revision 0)
+++ src/xplra/.srcmessage	(revision 0)
@@ -0,0 +1,1 @@
+// This file is part of XPLRA, a remote-access plugin for X-Plane
Index: src/xplra/.srcmessage
===================================================================
--- src/xplra/.srcmessage	(revision 0)
+++ 	(revision )
@@ -1,1 +1,0 @@
-// This file is part of XPLRA, a remote-access plugin for X-Plane
Index: src/xplra/DataRefTask.cc
===================================================================
--- src/xplra/DataRefTask.cc	(revision 3)
+++ src/xplra/DataRefTask.cc	(revision 3)
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+#include "xplcommon/Util.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::DataRefTask;
+
+using xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+void DataRefTask::perform()
+{
+    if (dataRef==0) {
+        // Util::debug("DataRefTask::perform: name='%s'\n", name.c_str());
+        dataRef = XPLMFindDataRef(name.c_str());
+        // Util::debug("DataRefTask::perform: dataRef=%p\n", dataRef);
+    }
+    if (dataRef!=0) {
+        process();
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/DataRefTask.cc
===================================================================
--- src/xplra/DataRefTask.cc	(revision 3)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "DataRefTask.h"
-
-#include "xplcommon/Util.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::DataRefTask;
-
-using xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-void DataRefTask::perform()
-{
-    if (dataRef==0) {
-        // Util::debug("DataRefTask::perform: name='%s'\n", name.c_str());
-        dataRef = XPLMFindDataRef(name.c_str());
-        // Util::debug("DataRefTask::perform: dataRef=%p\n", dataRef);
-    }
-    if (dataRef!=0) {
-        process();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/DataRefTask.h
===================================================================
--- src/xplra/DataRefTask.h	(revision 6)
+++ src/xplra/DataRefTask.h	(revision 6)
@@ -0,0 +1,155 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_DATAREFTASK_H
+#define XPLRA_DATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "Task.h"
+
+#include <XPLMDataAccess.h>
+
+#include <string>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A task that works with some dataref. This base class
+ * performs the mapping from dataref name to dataref value. The actual
+ * operation is performed by the subclasses.
+ */
+class DataRefTask : public Task
+{
+private:
+    /**
+     * The name of the dataref.
+     */
+    std::string name;
+
+    /**
+     * The dataref.
+     */
+    XPLMDataRef dataRef;
+
+protected:
+    /**
+     * Construct the dataref task for the dataref with the given name.
+     */
+    DataRefTask(const std::string& name);
+
+    /**
+     * Construct the dataref task for the given dataref.
+     */
+    DataRefTask(XPLMDataRef dataRef);
+
+public:
+    /**
+     * Determine if the task is valid, which is so, if the dataref is
+     * not 0.
+     */
+    bool isValid() const;
+
+    /**
+     * Get the name of the dataref.
+     */
+    const std::string& getName() const;
+
+    /**
+     * Get the dataref.
+     */
+    XPLMDataRef getDataRef() const;
+
+protected:
+    /**
+     * Perform the task. If the dataref is not valid yet, it will be
+     * queried. If the query is successful, the process() function is
+     * called.
+     */
+    virtual void perform();
+
+    /**
+     * Process the dataref. When this function is called, the dataref
+     * is valid.
+     */
+    virtual void process() = 0;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline DataRefTask::DataRefTask(const std::string& name) :
+    name(name),
+    dataRef(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline DataRefTask::DataRefTask(XPLMDataRef dataRef) :
+    dataRef(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataRefTask::isValid() const
+{
+    return dataRef!=0;
+}
+
+//------------------------------------------------------------------------------
+
+inline const std::string& DataRefTask::getName() const
+{
+    return name;
+}
+
+//------------------------------------------------------------------------------
+
+inline XPLMDataRef DataRefTask::getDataRef() const
+{
+    return dataRef;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_DATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/DataRefTask.h
===================================================================
--- src/xplra/DataRefTask.h	(revision 6)
+++ 	(revision )
@@ -1,155 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_DATAREFTASK_H
-#define XPLRA_DATAREFTASK_H
-//------------------------------------------------------------------------------
-
-#include "Task.h"
-
-#include <XPLMDataAccess.h>
-
-#include <string>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A task that works with some dataref. This base class
- * performs the mapping from dataref name to dataref value. The actual
- * operation is performed by the subclasses.
- */
-class DataRefTask : public Task
-{
-private:
-    /**
-     * The name of the dataref.
-     */
-    std::string name;
-
-    /**
-     * The dataref.
-     */
-    XPLMDataRef dataRef;
-
-protected:
-    /**
-     * Construct the dataref task for the dataref with the given name.
-     */
-    DataRefTask(const std::string& name);
-
-    /**
-     * Construct the dataref task for the given dataref.
-     */
-    DataRefTask(XPLMDataRef dataRef);
-
-public:
-    /**
-     * Determine if the task is valid, which is so, if the dataref is
-     * not 0.
-     */
-    bool isValid() const;
-
-    /**
-     * Get the name of the dataref.
-     */
-    const std::string& getName() const;
-
-    /**
-     * Get the dataref.
-     */
-    XPLMDataRef getDataRef() const;
-
-protected:
-    /**
-     * Perform the task. If the dataref is not valid yet, it will be
-     * queried. If the query is successful, the process() function is
-     * called.
-     */
-    virtual void perform();
-
-    /**
-     * Process the dataref. When this function is called, the dataref
-     * is valid.
-     */
-    virtual void process() = 0;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline DataRefTask::DataRefTask(const std::string& name) :
-    name(name),
-    dataRef(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline DataRefTask::DataRefTask(XPLMDataRef dataRef) :
-    dataRef(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataRefTask::isValid() const
-{
-    return dataRef!=0;
-}
-
-//------------------------------------------------------------------------------
-
-inline const std::string& DataRefTask::getName() const
-{
-    return name;
-}
-
-//------------------------------------------------------------------------------
-
-inline XPLMDataRef DataRefTask::getDataRef() const
-{
-    return dataRef;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_DATAREFTASK_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/GetDataRefTask.cc
===================================================================
--- src/xplra/GetDataRefTask.cc	(revision 7)
+++ src/xplra/GetDataRefTask.cc	(revision 7)
@@ -0,0 +1,121 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "GetDataRefTask.h"
+#include "Protocol.h"
+
+#include "xplcommon/Util.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::GetDataRefTask;
+using xplra::GetIntDataRefTask;
+using xplra::GetFloatDataRefTask;
+using xplra::GetDoubleDataRefTask;
+
+using xplcommon::DataStream;
+
+using std::string;
+
+//------------------------------------------------------------------------------
+
+GetDataRefTask* GetDataRefTask::create(uint8_t& result, DataStream& stream)
+{
+    result = Protocol::RESULT_OK;
+
+    string name = stream.readString();
+    uint8_t type = stream.readU8();
+    if (!stream) return 0;
+
+    if (type==Protocol::TYPE_INT) {
+        return new GetIntDataRefTask(name);
+    } else if (type==Protocol::TYPE_FLOAT) {
+        return new GetFloatDataRefTask(name);
+    } else if (type==Protocol::TYPE_DOUBLE) {
+        return new GetDoubleDataRefTask(name);
+    } else if (type==Protocol::TYPE_FLOAT_ARRAY ||
+               type==Protocol::TYPE_INT_ARRAY ||
+               type==Protocol::TYPE_BYTE_ARRAY)
+    {
+        int length = stream.readS32();
+        int offset = stream.readS32();
+        if (!stream) return 0;
+
+        if (length>Protocol::MAX_LENGTH) {
+            result = Protocol::RESULT_INVALID_LENGTH;
+            return 0;
+        }
+        if (offset<0) {
+            result = Protocol::RESULT_INVALID_OFFSET;
+            return 0;
+        }
+
+        if (type==Protocol::TYPE_FLOAT_ARRAY) {
+            return new GetFloatArrayDataRefTask(name, length, offset);
+        } else if (type==Protocol::TYPE_INT_ARRAY) {
+            return new GetIntArrayDataRefTask(name, length, offset);
+        } else {
+            return new GetByteArrayDataRefTask(name, length, offset);
+        }
+    } else {
+        result = Protocol::RESULT_INVALID_TYPE;
+        return 0;
+    }
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void GetIntDataRefTask::writeValue(DataStream& stream)
+{
+    stream.writeS32(getValue());
+}
+
+//------------------------------------------------------------------------------
+
+void GetFloatDataRefTask::writeValue(DataStream& stream)
+{
+    stream.writeFloat(getValue());
+}
+
+//------------------------------------------------------------------------------
+
+void GetDoubleDataRefTask::writeValue(DataStream& stream)
+{
+    stream.writeDouble(getValue());
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/GetDataRefTask.cc
===================================================================
--- src/xplra/GetDataRefTask.cc	(revision 6)
+++ 	(revision )
@@ -1,112 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "GetDataRefTask.h"
-#include "Protocol.h"
-
-#include "xplcommon/Util.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::GetDataRefTask;
-using xplra::GetIntDataRefTask;
-using xplra::GetFloatDataRefTask;
-using xplra::GetDoubleDataRefTask;
-
-using xplcommon::DataStream;
-
-using std::string;
-
-//------------------------------------------------------------------------------
-
-GetDataRefTask* GetDataRefTask::create(uint8_t& result, DataStream& stream)
-{
-    result = Protocol::RESULT_OK;
-
-    string name = stream.readString();
-    uint8_t type = stream.readU8();
-    if (!stream) return 0;
-
-    if (type==Protocol::TYPE_INT) {
-        return new GetIntDataRefTask(name);
-    } else if (type==Protocol::TYPE_FLOAT) {
-        return new GetFloatDataRefTask(name);
-    } else if (type==Protocol::TYPE_DOUBLE) {
-        return new GetDoubleDataRefTask(name);
-    } else if (type==Protocol::TYPE_FLOAT_ARRAY ||
-               type==Protocol::TYPE_INT_ARRAY ||
-               type==Protocol::TYPE_BYTE_ARRAY)
-    {
-        int length = stream.readS32();
-        int offset = stream.readS32();
-        if (!stream) return 0;
-
-        if (type==Protocol::TYPE_FLOAT_ARRAY) {
-            return new GetFloatArrayDataRefTask(name, length, offset);
-        } else if (type==Protocol::TYPE_INT_ARRAY) {
-            return new GetIntArrayDataRefTask(name, length, offset);
-        } else {
-            return new GetByteArrayDataRefTask(name, length, offset);
-        }
-    } else {
-        result = Protocol::RESULT_INVALID_TYPE;
-        return 0;
-    }
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-void GetIntDataRefTask::writeValue(DataStream& stream)
-{
-    stream.writeS32(getValue());
-}
-
-//------------------------------------------------------------------------------
-
-void GetFloatDataRefTask::writeValue(DataStream& stream)
-{
-    stream.writeFloat(getValue());
-}
-
-//------------------------------------------------------------------------------
-
-void GetDoubleDataRefTask::writeValue(DataStream& stream)
-{
-    stream.writeDouble(getValue());
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/GetDataRefTask.h
===================================================================
--- src/xplra/GetDataRefTask.h	(revision 6)
+++ src/xplra/GetDataRefTask.h	(revision 6)
@@ -0,0 +1,722 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_GETDATAREFTASK_H
+#define XPLRA_GETDATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+#include <xplcommon/DataStream.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for tasks that query the value of some dataref.
+ */
+class GetDataRefTask : public DataRefTask
+{
+public:
+    /**
+     * Read a dataref query specification and create the appropriate
+     * GetDataRefTask instance.
+     *
+     * @return the new instance, or 0 on error. In that case the given
+     * result reference variable will be filled with the error code,
+     * unless the stream failed, in which case it remains RESULT_OK.
+     */
+    static GetDataRefTask* create(uint8_t& result, xplcommon::DataStream& stream);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(xplcommon::DataStream& stream) = 0;
+};
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref querying tasks that query some scalar value.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * called queryData, which wraps the corresponding function in XPLM.
+ */
+template <typename T, class ConcreteClass>
+class GetScalarDataRefTask : public GetDataRefTask
+{
+private:
+    /**
+     * The value retrieved.
+     */
+    T value;
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetScalarDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetScalarDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Get the value
+     */
+    T getValue() const;
+
+protected:
+    /**
+     * Perform the actual operation.
+     */
+    virtual void process();
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of an integer.
+ */
+class GetIntDataRefTask :
+        public GetScalarDataRefTask<int, GetIntDataRefTask>
+{
+public:
+    /**
+     * Query the value from XPLM
+     */
+    static int queryData(XPLMDataRef dataRef);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetIntDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetIntDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(xplcommon::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a single-precision
+ * floating point data.
+ */
+class GetFloatDataRefTask :
+        public GetScalarDataRefTask<float, GetFloatDataRefTask>
+{
+public:
+    /**
+     * Query the value from XPLM
+     */
+    static float queryData(XPLMDataRef dataRef);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetFloatDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetFloatDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(xplcommon::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a double-precision
+ * floating point data.
+ */
+class GetDoubleDataRefTask :
+        public GetScalarDataRefTask<double, GetDoubleDataRefTask>
+{
+public:
+    /**
+     * Query the value from XPLM
+     */
+    static double queryData(XPLMDataRef dataRef);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    GetDoubleDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    GetDoubleDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(xplcommon::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref querying tasks that query some array.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * called queryData, which wraps the corresponding function in XPLM.
+ */
+template <typename T, class ConcreteClass>
+class GetArrayDataRefTask : public GetDataRefTask
+{
+private:
+    /**
+     * The maximal number of data items returned.
+     */
+    int maxCount;
+
+    /**
+     * The offset within the dataref's value to start the query from.
+     */
+    int offset;
+
+    /**
+     * The data.
+     */
+    T* data;
+
+    /**
+     * The actual length of the data retrieved.
+     */
+    int length;
+
+protected:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param maxCount the maximal number of items to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size of
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     */
+    GetArrayDataRefTask(const std::string& name,
+                        int maxCount = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param maxCount the maximal number of items to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     */
+    GetArrayDataRefTask(XPLMDataRef dataRef,
+                        int maxCount = -1, int offset = 0);
+
+public:
+    /**
+     * Destroy the object.
+     */
+    virtual ~GetArrayDataRefTask();
+
+    /**
+     * Get the data.
+     */
+    const T* getData() const;
+
+    /**
+     * Get the length of the data.
+     */
+    int getLength() const;
+
+protected:
+    /**
+     * Process the dataref by querying its value.
+     */
+    virtual void process();
+
+    /**
+     * Write the value into the given stream.
+     */
+    virtual void writeValue(xplcommon::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a float array.
+ */
+class GetFloatArrayDataRefTask :
+        public GetArrayDataRefTask<float, GetFloatArrayDataRefTask>
+{
+public:
+    /**
+     * Get the data via XPLM
+     */
+    static int queryData(XPLMDataRef dataRef, float* dest,
+                         int offset, int count);
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param maxCount the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     */
+    GetFloatArrayDataRefTask(const std::string& name,
+                            int maxCount = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param maxBytes the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     */
+    GetFloatArrayDataRefTask(XPLMDataRef dataRef,
+                             int maxCount = -1, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of an integer array.
+ */
+class GetIntArrayDataRefTask :
+        public GetArrayDataRefTask<int, GetIntArrayDataRefTask>
+{
+public:
+    /**
+     * Get the data via XPLM
+     */
+    static int queryData(XPLMDataRef dataRef, int* dest,
+                         int offset, int count);
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param maxCount the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     */
+    GetIntArrayDataRefTask(const std::string& name,
+                           int maxCount = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param maxBytes the maximal number of data items to
+     * retrieve. If <0, the function will perform an extra query to
+     * retrieve the size of the dataref's data, which it will store in
+     * the task, so later on it can be reused.
+     */
+    GetIntArrayDataRefTask(XPLMDataRef dataRef,
+                           int maxCount = -1, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a byte array.
+ */
+class GetByteArrayDataRefTask :
+        public GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>
+{
+public:
+    /**
+     * Get the data via XPLM
+     */
+    static int queryData(XPLMDataRef dataRef, void* dest,
+                         int offset, int count);
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param maxBytes the maximal number of bytes to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     */
+    GetByteArrayDataRefTask(const std::string& name,
+                            int maxBytes = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param maxBytes the maximal number of bytes to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     */
+    GetByteArrayDataRefTask(XPLMDataRef dataRef,
+                            int maxBytes = -1, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+// Template definitions
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetScalarDataRefTask<T, ConcreteClass>::
+GetScalarDataRefTask(const std::string& name) :
+    GetDataRefTask(name),
+    value(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetScalarDataRefTask<T, ConcreteClass>::
+GetScalarDataRefTask(XPLMDataRef dataRef) :
+    GetDataRefTask(dataRef),
+    value(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline T GetScalarDataRefTask<T, ConcreteClass>::getValue() const
+{
+    return value;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void GetScalarDataRefTask<T, ConcreteClass>::process()
+{
+    value = ConcreteClass::queryData(getDataRef());
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetArrayDataRefTask<T, ConcreteClass>::
+GetArrayDataRefTask(const std::string& name, int maxCount, int offset) :
+    GetDataRefTask(name),
+    maxCount(maxCount),
+    offset(offset),
+    data( (maxCount>0) ? new T[maxCount] : 0 ),
+    length(-1)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetArrayDataRefTask<T, ConcreteClass>::
+GetArrayDataRefTask(XPLMDataRef dataRef, int maxCount, int offset) :
+    GetDataRefTask(dataRef),
+    maxCount(maxCount),
+    offset(offset),
+    data( (maxCount>0) ? new T[maxCount] : 0),
+    length(-1)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline GetArrayDataRefTask<T, ConcreteClass>::~GetArrayDataRefTask()
+{
+    delete [] data;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline const T* GetArrayDataRefTask<T, ConcreteClass>::getData() const
+{
+    return data;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline int GetArrayDataRefTask<T, ConcreteClass>::getLength() const
+{
+    return length;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void GetArrayDataRefTask<T, ConcreteClass>::process()
+{
+    if (maxCount<0) {
+        maxCount = ConcreteClass::queryData(getDataRef(), 0, 0, 0);
+
+        if (maxCount>0) {
+            maxCount -= offset;
+        }
+
+        if (maxCount>0) {
+            data = new T[maxCount];
+        } else {
+            maxCount = 0;
+        }
+    }
+
+    // Util::debug("GetByteArrayDataRefTask::process: dataRef=%p, maxBytes=%d, data=%p, offset\n",
+    //             getDataRef(), maxBytes, data, offset);
+    if (maxCount>0) {
+        length = ConcreteClass::queryData(getDataRef(), data, offset, maxCount);
+    } else {
+        length = maxCount;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void GetArrayDataRefTask<T, ConcreteClass>::
+writeValue(xplcommon::DataStream& stream)
+{
+    stream.writeS32(length);
+    if (length>0) {
+        stream.write(data, length * sizeof(T));
+    }
+}
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline GetDataRefTask::GetDataRefTask(const std::string& name) :
+    DataRefTask(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetDataRefTask::GetDataRefTask(XPLMDataRef dataRef) :
+    DataRefTask(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetIntDataRefTask::queryData(XPLMDataRef dataRef)
+{
+    return XPLMGetDatai(dataRef);
+}
+
+//------------------------------------------------------------------------------
+
+inline GetIntDataRefTask::GetIntDataRefTask(const std::string& name) :
+    GetScalarDataRefTask<int, GetIntDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetIntDataRefTask::GetIntDataRefTask(XPLMDataRef dataRef) :
+    GetScalarDataRefTask<int, GetIntDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline float GetFloatDataRefTask::queryData(XPLMDataRef dataRef)
+{
+    return XPLMGetDataf(dataRef);
+}
+
+//------------------------------------------------------------------------------
+
+inline GetFloatDataRefTask::GetFloatDataRefTask(const std::string& name) :
+    GetScalarDataRefTask<float, GetFloatDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetFloatDataRefTask::GetFloatDataRefTask(XPLMDataRef dataRef) :
+    GetScalarDataRefTask<float, GetFloatDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline double GetDoubleDataRefTask::queryData(XPLMDataRef dataRef)
+{
+    return XPLMGetDatad(dataRef);
+}
+
+//------------------------------------------------------------------------------
+
+inline GetDoubleDataRefTask::GetDoubleDataRefTask(const std::string& name) :
+    GetScalarDataRefTask<double, GetDoubleDataRefTask>(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline GetDoubleDataRefTask::GetDoubleDataRefTask(XPLMDataRef dataRef) :
+    GetScalarDataRefTask<double, GetDoubleDataRefTask>(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetFloatArrayDataRefTask::queryData(XPLMDataRef dataRef, float* dest,
+                                               int offset, int count)
+{
+    return XPLMGetDatavf(dataRef, dest, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(const std::string& name,
+                                                   int maxCount, int offset) :
+    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(name, maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(XPLMDataRef dataRef,
+                                                 int maxCount, int offset) :
+    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(dataRef,
+                                                         maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetIntArrayDataRefTask::queryData(XPLMDataRef dataRef, int* dest,
+                                             int offset, int count)
+{
+    return XPLMGetDatavi(dataRef, dest, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetIntArrayDataRefTask::GetIntArrayDataRefTask(const std::string& name,
+                                                   int maxCount, int offset) :
+    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(name, maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetIntArrayDataRefTask::GetIntArrayDataRefTask(XPLMDataRef dataRef,
+                                               int maxCount, int offset) :
+    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(dataRef,
+                                                     maxCount, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline int GetByteArrayDataRefTask::queryData(XPLMDataRef dataRef, void* dest,
+                                              int offset, int count)
+{
+    return XPLMGetDatab(dataRef, dest, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetByteArrayDataRefTask::GetByteArrayDataRefTask(const std::string& name,
+                                                 int maxBytes, int offset) :
+    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(name, maxBytes,
+                                                                offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+GetByteArrayDataRefTask::GetByteArrayDataRefTask(XPLMDataRef dataRef,
+                                                 int maxBytes, int offset) :
+    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(dataRef,
+                                                                maxBytes,
+                                                                offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_GETDATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/GetDataRefTask.h
===================================================================
--- src/xplra/GetDataRefTask.h	(revision 6)
+++ 	(revision )
@@ -1,722 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_GETDATAREFTASK_H
-#define XPLRA_GETDATAREFTASK_H
-//------------------------------------------------------------------------------
-
-#include "DataRefTask.h"
-
-#include <xplcommon/DataStream.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for tasks that query the value of some dataref.
- */
-class GetDataRefTask : public DataRefTask
-{
-public:
-    /**
-     * Read a dataref query specification and create the appropriate
-     * GetDataRefTask instance.
-     *
-     * @return the new instance, or 0 on error. In that case the given
-     * result reference variable will be filled with the error code,
-     * unless the stream failed, in which case it remains RESULT_OK.
-     */
-    static GetDataRefTask* create(uint8_t& result, xplcommon::DataStream& stream);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(xplcommon::DataStream& stream) = 0;
-};
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for dataref querying tasks that query some scalar value.
- *
- * ConcreteClass is the actual child class. It should have a function
- * called queryData, which wraps the corresponding function in XPLM.
- */
-template <typename T, class ConcreteClass>
-class GetScalarDataRefTask : public GetDataRefTask
-{
-private:
-    /**
-     * The value retrieved.
-     */
-    T value;
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetScalarDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetScalarDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Get the value
-     */
-    T getValue() const;
-
-protected:
-    /**
-     * Perform the actual operation.
-     */
-    virtual void process();
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of an integer.
- */
-class GetIntDataRefTask :
-        public GetScalarDataRefTask<int, GetIntDataRefTask>
-{
-public:
-    /**
-     * Query the value from XPLM
-     */
-    static int queryData(XPLMDataRef dataRef);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetIntDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetIntDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(xplcommon::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a single-precision
- * floating point data.
- */
-class GetFloatDataRefTask :
-        public GetScalarDataRefTask<float, GetFloatDataRefTask>
-{
-public:
-    /**
-     * Query the value from XPLM
-     */
-    static float queryData(XPLMDataRef dataRef);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetFloatDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetFloatDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(xplcommon::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a double-precision
- * floating point data.
- */
-class GetDoubleDataRefTask :
-        public GetScalarDataRefTask<double, GetDoubleDataRefTask>
-{
-public:
-    /**
-     * Query the value from XPLM
-     */
-    static double queryData(XPLMDataRef dataRef);
-
-    /**
-     * Construct the task for the dataref with the given name.
-     */
-    GetDoubleDataRefTask(const std::string& name);
-
-    /**
-     * Construct the task for the given dataref.
-     */
-    GetDoubleDataRefTask(XPLMDataRef dataRef);
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(xplcommon::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * Base class for dataref querying tasks that query some array.
- *
- * ConcreteClass is the actual child class. It should have a function
- * called queryData, which wraps the corresponding function in XPLM.
- */
-template <typename T, class ConcreteClass>
-class GetArrayDataRefTask : public GetDataRefTask
-{
-private:
-    /**
-     * The maximal number of data items returned.
-     */
-    int maxCount;
-
-    /**
-     * The offset within the dataref's value to start the query from.
-     */
-    int offset;
-
-    /**
-     * The data.
-     */
-    T* data;
-
-    /**
-     * The actual length of the data retrieved.
-     */
-    int length;
-
-protected:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param maxCount the maximal number of items to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size of
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     */
-    GetArrayDataRefTask(const std::string& name,
-                        int maxCount = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param maxCount the maximal number of items to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     */
-    GetArrayDataRefTask(XPLMDataRef dataRef,
-                        int maxCount = -1, int offset = 0);
-
-public:
-    /**
-     * Destroy the object.
-     */
-    virtual ~GetArrayDataRefTask();
-
-    /**
-     * Get the data.
-     */
-    const T* getData() const;
-
-    /**
-     * Get the length of the data.
-     */
-    int getLength() const;
-
-protected:
-    /**
-     * Process the dataref by querying its value.
-     */
-    virtual void process();
-
-    /**
-     * Write the value into the given stream.
-     */
-    virtual void writeValue(xplcommon::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a float array.
- */
-class GetFloatArrayDataRefTask :
-        public GetArrayDataRefTask<float, GetFloatArrayDataRefTask>
-{
-public:
-    /**
-     * Get the data via XPLM
-     */
-    static int queryData(XPLMDataRef dataRef, float* dest,
-                         int offset, int count);
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param maxCount the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     */
-    GetFloatArrayDataRefTask(const std::string& name,
-                            int maxCount = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param maxBytes the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     */
-    GetFloatArrayDataRefTask(XPLMDataRef dataRef,
-                             int maxCount = -1, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of an integer array.
- */
-class GetIntArrayDataRefTask :
-        public GetArrayDataRefTask<int, GetIntArrayDataRefTask>
-{
-public:
-    /**
-     * Get the data via XPLM
-     */
-    static int queryData(XPLMDataRef dataRef, int* dest,
-                         int offset, int count);
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param maxCount the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     */
-    GetIntArrayDataRefTask(const std::string& name,
-                           int maxCount = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param maxBytes the maximal number of data items to
-     * retrieve. If <0, the function will perform an extra query to
-     * retrieve the size of the dataref's data, which it will store in
-     * the task, so later on it can be reused.
-     */
-    GetIntArrayDataRefTask(XPLMDataRef dataRef,
-                           int maxCount = -1, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-/**
- * A dataref task which retrieves the value of a byte array.
- */
-class GetByteArrayDataRefTask :
-        public GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>
-{
-public:
-    /**
-     * Get the data via XPLM
-     */
-    static int queryData(XPLMDataRef dataRef, void* dest,
-                         int offset, int count);
-
-public:
-    /**
-     * Construct the task for the dataref with the given name.
-     *
-     * @param maxBytes the maximal number of bytes to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     */
-    GetByteArrayDataRefTask(const std::string& name,
-                            int maxBytes = -1, int offset = 0);
-
-    /**
-     * Construct the task for the given dataref
-     *
-     * @param maxBytes the maximal number of bytes to retrieve. If <0,
-     * the function will perform an extra query to retrieve the size
-     * of the dataref's data, which it will store in the task, so
-     * later on it can be reused.
-     */
-    GetByteArrayDataRefTask(XPLMDataRef dataRef,
-                            int maxBytes = -1, int offset = 0);
-};
-
-//------------------------------------------------------------------------------
-// Template definitions
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetScalarDataRefTask<T, ConcreteClass>::
-GetScalarDataRefTask(const std::string& name) :
-    GetDataRefTask(name),
-    value(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetScalarDataRefTask<T, ConcreteClass>::
-GetScalarDataRefTask(XPLMDataRef dataRef) :
-    GetDataRefTask(dataRef),
-    value(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline T GetScalarDataRefTask<T, ConcreteClass>::getValue() const
-{
-    return value;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void GetScalarDataRefTask<T, ConcreteClass>::process()
-{
-    value = ConcreteClass::queryData(getDataRef());
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetArrayDataRefTask<T, ConcreteClass>::
-GetArrayDataRefTask(const std::string& name, int maxCount, int offset) :
-    GetDataRefTask(name),
-    maxCount(maxCount),
-    offset(offset),
-    data( (maxCount>0) ? new T[maxCount] : 0 ),
-    length(-1)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetArrayDataRefTask<T, ConcreteClass>::
-GetArrayDataRefTask(XPLMDataRef dataRef, int maxCount, int offset) :
-    GetDataRefTask(dataRef),
-    maxCount(maxCount),
-    offset(offset),
-    data( (maxCount>0) ? new T[maxCount] : 0),
-    length(-1)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline GetArrayDataRefTask<T, ConcreteClass>::~GetArrayDataRefTask()
-{
-    delete [] data;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline const T* GetArrayDataRefTask<T, ConcreteClass>::getData() const
-{
-    return data;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-inline int GetArrayDataRefTask<T, ConcreteClass>::getLength() const
-{
-    return length;
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void GetArrayDataRefTask<T, ConcreteClass>::process()
-{
-    if (maxCount<0) {
-        maxCount = ConcreteClass::queryData(getDataRef(), 0, 0, 0);
-
-        if (maxCount>0) {
-            maxCount -= offset;
-        }
-
-        if (maxCount>0) {
-            data = new T[maxCount];
-        } else {
-            maxCount = 0;
-        }
-    }
-
-    // Util::debug("GetByteArrayDataRefTask::process: dataRef=%p, maxBytes=%d, data=%p, offset\n",
-    //             getDataRef(), maxBytes, data, offset);
-    if (maxCount>0) {
-        length = ConcreteClass::queryData(getDataRef(), data, offset, maxCount);
-    } else {
-        length = maxCount;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T, class ConcreteClass>
-void GetArrayDataRefTask<T, ConcreteClass>::
-writeValue(xplcommon::DataStream& stream)
-{
-    stream.writeS32(length);
-    if (length>0) {
-        stream.write(data, length * sizeof(T));
-    }
-}
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline GetDataRefTask::GetDataRefTask(const std::string& name) :
-    DataRefTask(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetDataRefTask::GetDataRefTask(XPLMDataRef dataRef) :
-    DataRefTask(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetIntDataRefTask::queryData(XPLMDataRef dataRef)
-{
-    return XPLMGetDatai(dataRef);
-}
-
-//------------------------------------------------------------------------------
-
-inline GetIntDataRefTask::GetIntDataRefTask(const std::string& name) :
-    GetScalarDataRefTask<int, GetIntDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetIntDataRefTask::GetIntDataRefTask(XPLMDataRef dataRef) :
-    GetScalarDataRefTask<int, GetIntDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline float GetFloatDataRefTask::queryData(XPLMDataRef dataRef)
-{
-    return XPLMGetDataf(dataRef);
-}
-
-//------------------------------------------------------------------------------
-
-inline GetFloatDataRefTask::GetFloatDataRefTask(const std::string& name) :
-    GetScalarDataRefTask<float, GetFloatDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetFloatDataRefTask::GetFloatDataRefTask(XPLMDataRef dataRef) :
-    GetScalarDataRefTask<float, GetFloatDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline double GetDoubleDataRefTask::queryData(XPLMDataRef dataRef)
-{
-    return XPLMGetDatad(dataRef);
-}
-
-//------------------------------------------------------------------------------
-
-inline GetDoubleDataRefTask::GetDoubleDataRefTask(const std::string& name) :
-    GetScalarDataRefTask<double, GetDoubleDataRefTask>(name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline GetDoubleDataRefTask::GetDoubleDataRefTask(XPLMDataRef dataRef) :
-    GetScalarDataRefTask<double, GetDoubleDataRefTask>(dataRef)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetFloatArrayDataRefTask::queryData(XPLMDataRef dataRef, float* dest,
-                                               int offset, int count)
-{
-    return XPLMGetDatavf(dataRef, dest, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(const std::string& name,
-                                                   int maxCount, int offset) :
-    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(name, maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetFloatArrayDataRefTask::GetFloatArrayDataRefTask(XPLMDataRef dataRef,
-                                                 int maxCount, int offset) :
-    GetArrayDataRefTask<float, GetFloatArrayDataRefTask>(dataRef,
-                                                         maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetIntArrayDataRefTask::queryData(XPLMDataRef dataRef, int* dest,
-                                             int offset, int count)
-{
-    return XPLMGetDatavi(dataRef, dest, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetIntArrayDataRefTask::GetIntArrayDataRefTask(const std::string& name,
-                                                   int maxCount, int offset) :
-    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(name, maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetIntArrayDataRefTask::GetIntArrayDataRefTask(XPLMDataRef dataRef,
-                                               int maxCount, int offset) :
-    GetArrayDataRefTask<int, GetIntArrayDataRefTask>(dataRef,
-                                                     maxCount, offset)
-{
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline int GetByteArrayDataRefTask::queryData(XPLMDataRef dataRef, void* dest,
-                                              int offset, int count)
-{
-    return XPLMGetDatab(dataRef, dest, offset, count);
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetByteArrayDataRefTask::GetByteArrayDataRefTask(const std::string& name,
-                                                 int maxBytes, int offset) :
-    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(name, maxBytes,
-                                                                offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline
-GetByteArrayDataRefTask::GetByteArrayDataRefTask(XPLMDataRef dataRef,
-                                                 int maxBytes, int offset) :
-    GetArrayDataRefTask<unsigned char, GetByteArrayDataRefTask>(dataRef,
-                                                                maxBytes,
-                                                                offset)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_GETDATAREFTASK_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/ListenThread.cc
===================================================================
--- src/xplra/ListenThread.cc	(revision 3)
+++ src/xplra/ListenThread.cc	(revision 3)
@@ -0,0 +1,75 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ListenThread.h"
+
+#include "ServerThread.h"
+
+#include <xplcommon/LocalServerSocket.h>
+#include <xplcommon/LocalAcceptor.h>
+#include <xplcommon/Util.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::ListenThread;
+
+using xplcommon::LocalServerSocket;
+using xplcommon::LocalAcceptor;
+using xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+void ListenThread::run()
+{
+    Util::debug("xplra::ListenThread::run: started\n");
+
+    LocalServerSocket socket("xplra", &waiter);
+    LocalAcceptor& acceptor = socket.getAcceptor();
+    while(!quitEvent.check() && !quitEvent.failed() && !acceptor.failed()) {
+        if (acceptor.accept()) {
+            ServerThread* serverThread = new ServerThread(requestQueue,
+                                                          acceptor);
+            serverThread->start();
+        }
+        waiter.wait();
+    }
+
+    ServerThread::quitAll();
+
+    Util::debug("xplra::ListenThread::run: quitting\n");
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/ListenThread.cc
===================================================================
--- src/xplra/ListenThread.cc	(revision 3)
+++ 	(revision )
@@ -1,75 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ListenThread.h"
-
-#include "ServerThread.h"
-
-#include <xplcommon/LocalServerSocket.h>
-#include <xplcommon/LocalAcceptor.h>
-#include <xplcommon/Util.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::ListenThread;
-
-using xplcommon::LocalServerSocket;
-using xplcommon::LocalAcceptor;
-using xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-void ListenThread::run()
-{
-    Util::debug("xplra::ListenThread::run: started\n");
-
-    LocalServerSocket socket("xplra", &waiter);
-    LocalAcceptor& acceptor = socket.getAcceptor();
-    while(!quitEvent.check() && !quitEvent.failed() && !acceptor.failed()) {
-        if (acceptor.accept()) {
-            ServerThread* serverThread = new ServerThread(requestQueue,
-                                                          acceptor);
-            serverThread->start();
-        }
-        waiter.wait();
-    }
-
-    ServerThread::quitAll();
-
-    Util::debug("xplra::ListenThread::run: quitting\n");
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/ListenThread.h
===================================================================
--- src/xplra/ListenThread.h	(revision 2)
+++ src/xplra/ListenThread.h	(revision 2)
@@ -0,0 +1,116 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_LISTENTHREAD_H
+#define XPLRA_LISTENTHREAD_H
+//------------------------------------------------------------------------------
+
+#include "RequestQueue.h"
+
+#include <xplcommon/Thread.h>
+#include <xplcommon/Waiter.h>
+#include <xplcommon/WaitableEvent.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * The thread that listens to incoming connections and starts the
+ * client serving threads.
+ *
+ * This is a detached thread, to allow it to quit automatically.
+ */
+class ListenThread : public xplcommon::Thread
+{
+private:
+    /**
+     * The waiter used in the thread.
+     */
+    xplcommon::Waiter waiter;
+
+    /**
+     * The event that can be fired to notify the thread that it should
+     * quit.
+     */
+    xplcommon::WaitableEvent quitEvent;
+
+    /**
+     * The queue for the requests.
+     */
+    RequestQueue requestQueue;
+
+public:
+    /**
+     * Construct the thread.
+     */
+    ListenThread();
+
+    /**
+     * Notify the thread to quit.
+     */
+    void quit();
+
+    /**
+     * Perform the thread's operation.
+     */
+    virtual void run();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline ListenThread::ListenThread() :
+    Thread(true),
+    quitEvent(&waiter)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline void ListenThread::quit()
+{
+    requestQueue.disable();
+    quitEvent.fire();
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_LISTENTHREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/ListenThread.h
===================================================================
--- src/xplra/ListenThread.h	(revision 2)
+++ 	(revision )
@@ -1,116 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_LISTENTHREAD_H
-#define XPLRA_LISTENTHREAD_H
-//------------------------------------------------------------------------------
-
-#include "RequestQueue.h"
-
-#include <xplcommon/Thread.h>
-#include <xplcommon/Waiter.h>
-#include <xplcommon/WaitableEvent.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * The thread that listens to incoming connections and starts the
- * client serving threads.
- *
- * This is a detached thread, to allow it to quit automatically.
- */
-class ListenThread : public xplcommon::Thread
-{
-private:
-    /**
-     * The waiter used in the thread.
-     */
-    xplcommon::Waiter waiter;
-
-    /**
-     * The event that can be fired to notify the thread that it should
-     * quit.
-     */
-    xplcommon::WaitableEvent quitEvent;
-
-    /**
-     * The queue for the requests.
-     */
-    RequestQueue requestQueue;
-
-public:
-    /**
-     * Construct the thread.
-     */
-    ListenThread();
-
-    /**
-     * Notify the thread to quit.
-     */
-    void quit();
-
-    /**
-     * Perform the thread's operation.
-     */
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline ListenThread::ListenThread() :
-    Thread(true),
-    quitEvent(&waiter)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline void ListenThread::quit()
-{
-    requestQueue.disable();
-    quitEvent.fire();
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_LISTENTHREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/Makefile.am
===================================================================
--- src/xplra/Makefile.am	(revision 7)
+++ src/xplra/Makefile.am	(revision 7)
@@ -0,0 +1,47 @@
+INCLUDES=@XPSDK_INCLUDES@
+
+AM_CXXFLAGS=$(LIBXPLCOMMON_CFLAGS)
+
+AM_CPPFLAGS=-DXPLM210
+
+if TARGET_API_WIN32
+AM_CPPFLAGS+=-DIBM
+AM_LDFLAGS=@XPSDK_LDFLAGS@ -no-undefined
+if TARGET_API_WIN64
+AM_LDFLAGS+=-lXPLM_64
+else
+AM_LDFLAGS+=-lXPLM
+endif
+endif
+
+if TARGET_API_POSIX
+AM_CPPFLAGS+=-DLIN
+AM_CXXFLAGS+=-fPIC -fno-stack-protector
+endif
+
+
+lib_LTLIBRARIES=libxplra.la
+
+libxplra_la_SOURCES= \
+	plugin.cc		\
+	ListenThread.cc		\
+	RequestQueue.cc		\
+	ServerThread.cc		\
+	TaskRequest.cc		\
+	DataRefTask.cc		\
+	GetDataRefTask.cc	\
+	SetDataRefTask.cc
+
+libxplra_la_LIBADD=$(LIBXPLCOMMON_LIBS)
+
+noinst_HEADERS= \
+	ListenThread.h		\
+	Request.h		\
+	RequestQueue.h		\
+	Protocol.h		\
+	ServerThread.h		\
+	Task.h			\
+	TaskRequest.h		\
+	DataRefTask.h		\
+	GetDataRefTask.h	\
+	SetDataRefTask.h
Index: src/xplra/Makefile.am
===================================================================
--- src/xplra/Makefile.am	(revision 6)
+++ 	(revision )
@@ -1,45 +1,0 @@
-INCLUDES=@XPSDK_INCLUDES@
-
-AM_CXXFLAGS=$(LIBXPLCOMMON_CFLAGS)
-
-AM_CPPFLAGS=-DXPLM210
-
-if TARGET_API_WIN32
-AM_CPPFLAGS+=-DIBM
-AM_LDFLAGS=@XPSDK_LDFLAGS@ -no-undefined
-if TARGET_API_WIN64
-AM_LDFLAGS+=-lXPLM_64
-else
-AM_LDFLAGS+=-lXPLM
-endif
-endif
-
-if TARGET_API_POSIX
-AM_CPPFLAGS+=-DLIN
-AM_CXXFLAGS+=-fPIC -fno-stack-protector
-endif
-
-
-lib_LTLIBRARIES=libxplra.la
-
-libxplra_la_SOURCES= \
-	plugin.cc		\
-	ListenThread.cc		\
-	RequestQueue.cc		\
-	ServerThread.cc		\
-	TaskRequest.cc		\
-	DataRefTask.cc		\
-	GetDataRefTask.cc
-
-libxplra_la_LIBADD=$(LIBXPLCOMMON_LIBS)
-
-noinst_HEADERS= \
-	ListenThread.h		\
-	Request.h		\
-	RequestQueue.h		\
-	Protocol.h		\
-	ServerThread.h		\
-	Task.h			\
-	TaskRequest.h		\
-	DataRefTask.h		\
-	GetDataRefTask.h
Index: src/xplra/Protocol.h
===================================================================
--- src/xplra/Protocol.h	(revision 7)
+++ src/xplra/Protocol.h	(revision 7)
@@ -0,0 +1,135 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_PROTOCOL_H
+#define XPLRA_PROTOCOL_H
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Constants and helpers for the protocol.
+ */
+class Protocol
+{
+public:
+    /**
+     * Command: get the value of a single dataref.
+     */
+    static const uint8_t COMMAND_GET_SINGLE = 0x01;
+
+    /**
+     * Command: set the value of a single dataref.
+     */
+    static const uint8_t COMMAND_SET_SINGLE = 0x02;
+
+    /**
+     * Data type: int
+     */
+    static const uint8_t TYPE_INT = 0x01;
+
+    /**
+     * Data type: float
+     */
+    static const uint8_t TYPE_FLOAT = 0x02;
+
+    /**
+     * Data type: double
+     */
+    static const uint8_t TYPE_DOUBLE = 0x03;
+
+    /**
+     * Data type: float array
+     */
+    static const uint8_t TYPE_FLOAT_ARRAY = 0x11;
+
+    /**
+     * Data type: int array
+     */
+    static const uint8_t TYPE_INT_ARRAY = 0x12;
+
+    /**
+     * Data type: byte array
+     */
+    static const uint8_t TYPE_BYTE_ARRAY = 0x13;
+
+    /**
+     * Result code: no error, everything is OK.
+     */
+    static const uint8_t RESULT_OK = 0x00;
+
+    /**
+     * Result code: invalid command
+     */
+    static const uint8_t RESULT_INVALID_COMMAND = 0x01;
+
+    /**
+     * Result code: unknown dataref
+     */
+    static const uint8_t RESULT_UNKNOWN_DATAREF = 0x02;
+
+    /**
+     * Result code: invalid type
+     */
+    static const uint8_t RESULT_INVALID_TYPE = 0x03;
+
+    /**
+     * Result code: invalid length
+     */
+    static const uint8_t RESULT_INVALID_LENGTH = 0x04;
+
+    /**
+     * Result code: invalid offset
+     */
+    static const uint8_t RESULT_INVALID_OFFSET = 0x05;
+
+    /**
+     * Result code: other error
+     */
+    static const uint8_t RESULT_OTHER_ERROR = 0xff;
+
+    /**
+     * The maximal length we accept (in order to protect ourselves).
+     */
+    static const int MAX_LENGTH = 2048;
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_PROTOCOL_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/Protocol.h
===================================================================
--- src/xplra/Protocol.h	(revision 6)
+++ 	(revision )
@@ -1,115 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_PROTOCOL_H
-#define XPLRA_PROTOCOL_H
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Constants and helpers for the protocol.
- */
-class Protocol
-{
-public:
-    /**
-     * Command: get the value of a single dataref.
-     */
-    static const uint8_t COMMAND_GET_SINGLE = 0x01;
-
-    /**
-     * Data type: int
-     */
-    static const uint8_t TYPE_INT = 0x01;
-
-    /**
-     * Data type: float
-     */
-    static const uint8_t TYPE_FLOAT = 0x02;
-
-    /**
-     * Data type: double
-     */
-    static const uint8_t TYPE_DOUBLE = 0x03;
-
-    /**
-     * Data type: float array
-     */
-    static const uint8_t TYPE_FLOAT_ARRAY = 0x11;
-
-    /**
-     * Data type: int array
-     */
-    static const uint8_t TYPE_INT_ARRAY = 0x12;
-
-    /**
-     * Data type: byte array
-     */
-    static const uint8_t TYPE_BYTE_ARRAY = 0x13;
-
-    /**
-     * Result code: no error, everything is OK.
-     */
-    static const uint8_t RESULT_OK = 0x00;
-
-    /**
-     * Result code: invalid command
-     */
-    static const uint8_t RESULT_INVALID_COMMAND = 0x01;
-
-    /**
-     * Result code: unknown dataref
-     */
-    static const uint8_t RESULT_UNKNOWN_DATAREF = 0x02;
-
-    /**
-     * Result code: invalid type
-     */
-    static const uint8_t RESULT_INVALID_TYPE = 0x03;
-
-    /**
-     * Result code: other error
-     */
-    static const uint8_t RESULT_OTHER_ERROR = 0xff;
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_PROTOCOL_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/Request.h
===================================================================
--- src/xplra/Request.h	(revision 2)
+++ src/xplra/Request.h	(revision 2)
@@ -0,0 +1,94 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_REQUEST_H
+#define XPLRA_REQUEST_H
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for requests. A request is something that is executed in
+ * the flight loop.
+ */
+class Request
+{
+private:
+    /**
+     * Indicate that the request is completed.
+     */
+    volatile bool completed;
+
+public:
+    /**
+     * Construct the request.
+     */
+    Request();
+
+    /**
+     * Virtual destructor.
+     */
+    virtual ~Request();
+
+    /**
+     * Execute the request. Make this very fast!
+     */
+    virtual void execute() = 0;
+
+    friend class RequestQueue;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline Request::Request() :
+    completed(false)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline Request::~Request()
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_REQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/Request.h
===================================================================
--- src/xplra/Request.h	(revision 2)
+++ 	(revision )
@@ -1,94 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_REQUEST_H
-#define XPLRA_REQUEST_H
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for requests. A request is something that is executed in
- * the flight loop.
- */
-class Request
-{
-private:
-    /**
-     * Indicate that the request is completed.
-     */
-    volatile bool completed;
-
-public:
-    /**
-     * Construct the request.
-     */
-    Request();
-
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Request();
-
-    /**
-     * Execute the request. Make this very fast!
-     */
-    virtual void execute() = 0;
-
-    friend class RequestQueue;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Request::Request() :
-    completed(false)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Request::~Request()
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_REQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/RequestQueue.cc
===================================================================
--- src/xplra/RequestQueue.cc	(revision 2)
+++ src/xplra/RequestQueue.cc	(revision 2)
@@ -0,0 +1,156 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "RequestQueue.h"
+
+#include "Request.h"
+
+#include <xplcommon/Util.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::RequestQueue;
+
+using xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+float RequestQueue::flightLoop(float /*inElapsedSinceLastCall*/,
+                               float /*inElapsedTimeSinceLastFlightLoop*/,
+                               int /*inCounter*/, void* inRefCon)
+{
+    RequestQueue* requestQueue = reinterpret_cast<RequestQueue*>(inRefCon);
+    requestQueue->run();
+#if USE_SCHEDULE_FLIGHTLOOP
+    return 0.0;
+#else
+    return flightLoopInterval;
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+RequestQueue::RequestQueue() :
+    enabled(true)
+{
+#if USE_SCHEDULE_FLIGHTLOOP
+    XPLMCreateFlightLoop_t createFL;
+
+    createFL.structSize = sizeof(createFL);
+    createFL.phase = xplm_FlightLoop_Phase_AfterFlightModel;
+    createFL.callbackFunc = &flightLoop;
+    createFL.refcon = this;
+
+    flightLoopID = XPLMCreateFlightLoop(&createFL);
+#else
+    XPLMRegisterFlightLoopCallback(&flightLoop, flightLoopInterval, this);
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+bool RequestQueue::execute(Request* request)
+{
+    mutex.lock();
+    if (!enabled) {
+        mutex.unlock();
+        return false;
+    }
+
+    request->completed = false;
+    requests.push_back(request);
+
+#if USE_SCHEDULE_FLIGHTLOOP
+    if (requests.size()==1) {
+        XPLMScheduleFlightLoop(flightLoopID, -2.0, true);
+    }
+#endif
+
+    while(enabled && !request->completed) {
+        requestsDone.wait(mutex);
+    }
+
+    bool result = request->completed;
+
+    mutex.unlock();
+
+    return result;
+}
+
+//------------------------------------------------------------------------------
+
+void RequestQueue::disable()
+{
+    mutex.lock();
+    enabled = false;
+    mutex.unlock();
+    requestsDone.broadcast();
+#if USE_SCHEDULE_FLIGHTLOOP
+    XPLMDestroyFlightLoop(flightLoopID);
+#else
+    XPLMUnregisterFlightLoopCallback(&flightLoop, this);
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+void RequestQueue::run()
+{
+    requests_t queuedRequests;
+
+    mutex.lock();
+    requests.swap(queuedRequests);
+    mutex.unlock();
+
+    if (queuedRequests.empty()) return;
+
+    for(requests_t::const_iterator i = queuedRequests.begin();
+        i!=queuedRequests.end(); ++i)
+    {
+        (*i)->execute();
+    }
+
+    mutex.lock();
+    for(requests_t::const_iterator i = queuedRequests.begin();
+        i!=queuedRequests.end(); ++i)
+    {
+        (*i)->completed = true;
+    }
+    mutex.unlock();
+    requestsDone.broadcast();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/RequestQueue.cc
===================================================================
--- src/xplra/RequestQueue.cc	(revision 2)
+++ 	(revision )
@@ -1,156 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "RequestQueue.h"
-
-#include "Request.h"
-
-#include <xplcommon/Util.h>
-
-//------------------------------------------------------------------------------
-
-using xplra::RequestQueue;
-
-using xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-float RequestQueue::flightLoop(float /*inElapsedSinceLastCall*/,
-                               float /*inElapsedTimeSinceLastFlightLoop*/,
-                               int /*inCounter*/, void* inRefCon)
-{
-    RequestQueue* requestQueue = reinterpret_cast<RequestQueue*>(inRefCon);
-    requestQueue->run();
-#if USE_SCHEDULE_FLIGHTLOOP
-    return 0.0;
-#else
-    return flightLoopInterval;
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-RequestQueue::RequestQueue() :
-    enabled(true)
-{
-#if USE_SCHEDULE_FLIGHTLOOP
-    XPLMCreateFlightLoop_t createFL;
-
-    createFL.structSize = sizeof(createFL);
-    createFL.phase = xplm_FlightLoop_Phase_AfterFlightModel;
-    createFL.callbackFunc = &flightLoop;
-    createFL.refcon = this;
-
-    flightLoopID = XPLMCreateFlightLoop(&createFL);
-#else
-    XPLMRegisterFlightLoopCallback(&flightLoop, flightLoopInterval, this);
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-bool RequestQueue::execute(Request* request)
-{
-    mutex.lock();
-    if (!enabled) {
-        mutex.unlock();
-        return false;
-    }
-
-    request->completed = false;
-    requests.push_back(request);
-
-#if USE_SCHEDULE_FLIGHTLOOP
-    if (requests.size()==1) {
-        XPLMScheduleFlightLoop(flightLoopID, -2.0, true);
-    }
-#endif
-
-    while(enabled && !request->completed) {
-        requestsDone.wait(mutex);
-    }
-
-    bool result = request->completed;
-
-    mutex.unlock();
-
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-void RequestQueue::disable()
-{
-    mutex.lock();
-    enabled = false;
-    mutex.unlock();
-    requestsDone.broadcast();
-#if USE_SCHEDULE_FLIGHTLOOP
-    XPLMDestroyFlightLoop(flightLoopID);
-#else
-    XPLMUnregisterFlightLoopCallback(&flightLoop, this);
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-void RequestQueue::run()
-{
-    requests_t queuedRequests;
-
-    mutex.lock();
-    requests.swap(queuedRequests);
-    mutex.unlock();
-
-    if (queuedRequests.empty()) return;
-
-    for(requests_t::const_iterator i = queuedRequests.begin();
-        i!=queuedRequests.end(); ++i)
-    {
-        (*i)->execute();
-    }
-
-    mutex.lock();
-    for(requests_t::const_iterator i = queuedRequests.begin();
-        i!=queuedRequests.end(); ++i)
-    {
-        (*i)->completed = true;
-    }
-    mutex.unlock();
-    requestsDone.broadcast();
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/RequestQueue.h
===================================================================
--- src/xplra/RequestQueue.h	(revision 2)
+++ src/xplra/RequestQueue.h	(revision 2)
@@ -0,0 +1,168 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_REQUESTQUEUE_H
+#define XPLRA_REQUESTQUEUE_H
+//------------------------------------------------------------------------------
+
+#include <xplcommon/Mutex.h>
+#include <xplcommon/CondVar.h>
+
+#include <XPLMProcessing.h>
+
+#include <vector>
+
+//------------------------------------------------------------------------------
+
+// Define to 1, if the new XPLMScheduleFlightLoop function should be
+// used to schedule the flight loop only on-demand
+#define USE_SCHEDULE_FLIGHTLOOP 0
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class Request;
+
+//------------------------------------------------------------------------------
+
+/**
+ * The queue of the requests. Client serving threads can add requests
+ * to the queue. The queue provides a flight loop callback, which it
+ * automatically schedules if a request is added to it, unless we are
+ * already disabled.
+ *
+ * An instance of the queue should be created in the plugin enable
+ * callback. The disable callback should disable the queue, so that it
+ * will not accept any further requests.
+ */
+class RequestQueue
+{
+private:
+    /**
+     * Type for the collection of the queued requests.
+     */
+    typedef std::vector<Request*> requests_t;
+
+#if !USE_SCHEDULE_FLIGHTLOOP
+    /**
+     * The interval of the flight loop.
+     */
+    static const float flightLoopInterval = 0.1;
+#endif
+
+    /**
+     * The flight loop function.
+     */
+    static float flightLoop(float inElapsedSinceLastCall,
+                            float inElapsedTimeSinceLastFlightLoop,
+                            int inCounter, void* inRefCon);
+
+#if USE_SCHEDULE_FLIGHTLOOP
+    /**
+     * The ID of the flight loop running the queue.
+     */
+    XPLMFlightLoopID flightLoopID;
+#endif
+
+    /**
+     * The mutex protecting the queue.
+     */
+    xplcommon::Mutex mutex;
+
+    /**
+     * A conditional variable to notify the threads waiting for their
+     * request to be executed.
+     */
+    xplcommon::CondVar requestsDone;
+
+    /**
+     * Indicate if the queue is enabled or not.
+     */
+    volatile bool enabled;
+
+    /**
+     * The vector of the queued requests.
+     */
+    requests_t requests;
+
+public:
+    /**
+     * Construct the queue. It creates the flight loop, so it should
+     * be called from a plugin callback.
+     */
+    RequestQueue();
+
+    /**
+     * Execute the given request. It will be enqueued, and then this
+     * function will wait until the request is executed or the request
+     * queue is disabled.
+     *
+     * If the queue is already disabled when calling this function, it
+     * returns immediately with false.
+     *
+     * @return if the request was executed
+     */
+    bool execute(Request* request);
+
+    /**
+     * Disable the queue. It sets the flag indicating that the queue
+     * is disabled, and wakes up all waiters waiting on the
+     * conditional variable. It should be called from a plugin
+     * callback, as it also destroys the flight loop.
+     */
+    void disable();
+
+private:
+    /**
+     * Run the queue.
+     *
+     * It locks the mutex, swaps the vector of requests with an empty
+     * one, unlocks the mutex and runs the requests one by one. When
+     * all requests are executed, it wakes up all waiters waiting on
+     * the conditional variable.
+     *
+     * It is called from the flight loop function.
+     */
+    void run();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_REQUESTQUEUE_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/RequestQueue.h
===================================================================
--- src/xplra/RequestQueue.h	(revision 2)
+++ 	(revision )
@@ -1,168 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_REQUESTQUEUE_H
-#define XPLRA_REQUESTQUEUE_H
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Mutex.h>
-#include <xplcommon/CondVar.h>
-
-#include <XPLMProcessing.h>
-
-#include <vector>
-
-//------------------------------------------------------------------------------
-
-// Define to 1, if the new XPLMScheduleFlightLoop function should be
-// used to schedule the flight loop only on-demand
-#define USE_SCHEDULE_FLIGHTLOOP 0
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class Request;
-
-//------------------------------------------------------------------------------
-
-/**
- * The queue of the requests. Client serving threads can add requests
- * to the queue. The queue provides a flight loop callback, which it
- * automatically schedules if a request is added to it, unless we are
- * already disabled.
- *
- * An instance of the queue should be created in the plugin enable
- * callback. The disable callback should disable the queue, so that it
- * will not accept any further requests.
- */
-class RequestQueue
-{
-private:
-    /**
-     * Type for the collection of the queued requests.
-     */
-    typedef std::vector<Request*> requests_t;
-
-#if !USE_SCHEDULE_FLIGHTLOOP
-    /**
-     * The interval of the flight loop.
-     */
-    static const float flightLoopInterval = 0.1;
-#endif
-
-    /**
-     * The flight loop function.
-     */
-    static float flightLoop(float inElapsedSinceLastCall,
-                            float inElapsedTimeSinceLastFlightLoop,
-                            int inCounter, void* inRefCon);
-
-#if USE_SCHEDULE_FLIGHTLOOP
-    /**
-     * The ID of the flight loop running the queue.
-     */
-    XPLMFlightLoopID flightLoopID;
-#endif
-
-    /**
-     * The mutex protecting the queue.
-     */
-    xplcommon::Mutex mutex;
-
-    /**
-     * A conditional variable to notify the threads waiting for their
-     * request to be executed.
-     */
-    xplcommon::CondVar requestsDone;
-
-    /**
-     * Indicate if the queue is enabled or not.
-     */
-    volatile bool enabled;
-
-    /**
-     * The vector of the queued requests.
-     */
-    requests_t requests;
-
-public:
-    /**
-     * Construct the queue. It creates the flight loop, so it should
-     * be called from a plugin callback.
-     */
-    RequestQueue();
-
-    /**
-     * Execute the given request. It will be enqueued, and then this
-     * function will wait until the request is executed or the request
-     * queue is disabled.
-     *
-     * If the queue is already disabled when calling this function, it
-     * returns immediately with false.
-     *
-     * @return if the request was executed
-     */
-    bool execute(Request* request);
-
-    /**
-     * Disable the queue. It sets the flag indicating that the queue
-     * is disabled, and wakes up all waiters waiting on the
-     * conditional variable. It should be called from a plugin
-     * callback, as it also destroys the flight loop.
-     */
-    void disable();
-
-private:
-    /**
-     * Run the queue.
-     *
-     * It locks the mutex, swaps the vector of requests with an empty
-     * one, unlocks the mutex and runs the requests one by one. When
-     * all requests are executed, it wakes up all waiters waiting on
-     * the conditional variable.
-     *
-     * It is called from the flight loop function.
-     */
-    void run();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_REQUESTQUEUE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/ServerThread.cc
===================================================================
--- src/xplra/ServerThread.cc	(revision 7)
+++ src/xplra/ServerThread.cc	(revision 7)
@@ -0,0 +1,179 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ServerThread.h"
+
+#include "RequestQueue.h"
+#include "Protocol.h"
+#include "GetDataRefTask.h"
+#include "SetDataRefTask.h"
+#include "TaskRequest.h"
+
+#include <xplcommon/Util.h>
+
+#include <cstdio>
+
+//------------------------------------------------------------------------------
+
+using xplra::ServerThread;
+
+using xplcommon::LocalAcceptor;
+using xplcommon::Mutex;
+using xplcommon::Util;
+
+using std::string;
+
+//------------------------------------------------------------------------------
+
+Mutex ServerThread::instancesMutex;
+
+ServerThread::instances_t ServerThread::instances;
+
+//------------------------------------------------------------------------------
+
+void ServerThread::quitAll()
+{
+    instancesMutex.lock();
+    for(instances_t::iterator i = instances.begin(); i!=instances.end(); ++i) {
+        (*i)->quit();
+    }
+    instancesMutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+ServerThread::ServerThread(RequestQueue& requestQueue, LocalAcceptor& acceptor) :
+    Thread(true),
+    requestQueue(requestQueue),
+    bufferedStream(acceptor.getSocket(&waiter)),
+    stream(*bufferedStream)
+{
+    instancesMutex.lock();
+    instances.insert(this);
+    instancesMutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+ServerThread::~ServerThread()
+{
+    delete bufferedStream;
+
+    instancesMutex.lock();
+    instances.erase(this);
+    instancesMutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+void ServerThread::quit()
+{
+    stream.interrupt();
+}
+
+//------------------------------------------------------------------------------
+
+void ServerThread::run()
+{
+    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run\n", this);
+    while(stream) {
+        uint8_t command = stream.readU8();
+        if (!stream) continue;
+
+        // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: command=0x%02x\n",
+        //             this, command);
+
+        if (command==Protocol::COMMAND_GET_SINGLE) {
+            if (!handleGetSingle()) break;
+        } else if (command==Protocol::COMMAND_SET_SINGLE) {
+            if (!handleSetSingle()) break;
+        } else {
+            stream.writeU8(Protocol::RESULT_INVALID_COMMAND);
+        }
+        stream.flush();
+    }
+
+    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: quitting\n", this);
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleGetSingle()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    GetDataRefTask* task = GetDataRefTask::create(result, stream);
+
+    if (!stream) return false;
+    else if (task==0) {
+        stream.writeU8(result);
+        return true;
+    }
+
+    TaskRequest request(task);
+    if (!requestQueue.execute(&request)) return false;
+
+    if (task->isValid()) {
+        stream.writeU8(Protocol::RESULT_OK);
+        task->writeValue(stream);
+    } else {
+        stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool ServerThread::handleSetSingle()
+{
+    uint8_t result = Protocol::RESULT_OK;
+    SetDataRefTask* task = SetDataRefTask::create(result, stream);
+
+    if (!stream) return false;
+    else if (task==0) {
+        stream.writeU8(result);
+        return true;
+    }
+
+    TaskRequest request(task);
+    if (!requestQueue.execute(&request)) return false;
+
+    stream.writeU8(task->isValid() ? Protocol::RESULT_OK :
+                   Protocol::RESULT_UNKNOWN_DATAREF);
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/ServerThread.cc
===================================================================
--- src/xplra/ServerThread.cc	(revision 6)
+++ 	(revision )
@@ -1,156 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ServerThread.h"
-
-#include "RequestQueue.h"
-#include "Protocol.h"
-#include "GetDataRefTask.h"
-#include "TaskRequest.h"
-
-#include <xplcommon/Util.h>
-
-#include <cstdio>
-
-//------------------------------------------------------------------------------
-
-using xplra::ServerThread;
-
-using xplcommon::LocalAcceptor;
-using xplcommon::Mutex;
-using xplcommon::Util;
-
-using std::string;
-
-//------------------------------------------------------------------------------
-
-Mutex ServerThread::instancesMutex;
-
-ServerThread::instances_t ServerThread::instances;
-
-//------------------------------------------------------------------------------
-
-void ServerThread::quitAll()
-{
-    instancesMutex.lock();
-    for(instances_t::iterator i = instances.begin(); i!=instances.end(); ++i) {
-        (*i)->quit();
-    }
-    instancesMutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-ServerThread::ServerThread(RequestQueue& requestQueue, LocalAcceptor& acceptor) :
-    Thread(true),
-    requestQueue(requestQueue),
-    bufferedStream(acceptor.getSocket(&waiter)),
-    stream(*bufferedStream)
-{
-    instancesMutex.lock();
-    instances.insert(this);
-    instancesMutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-ServerThread::~ServerThread()
-{
-    delete bufferedStream;
-
-    instancesMutex.lock();
-    instances.erase(this);
-    instancesMutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-void ServerThread::quit()
-{
-    stream.interrupt();
-}
-
-//------------------------------------------------------------------------------
-
-void ServerThread::run()
-{
-    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run\n", this);
-    while(stream) {
-        uint8_t command = stream.readU8();
-        if (!stream) continue;
-
-        // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: command=0x%02x\n",
-        //             this, command);
-
-        if (command==Protocol::COMMAND_GET_SINGLE) {
-            if (!handleGetSingle(stream)) break;
-        } else {
-            stream.writeU8(Protocol::RESULT_INVALID_COMMAND);
-        }
-        stream.flush();
-    }
-
-    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: quitting\n", this);
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerThread::handleGetSingle(xplcommon::DataStream& stream)
-{
-    uint8_t result = Protocol::RESULT_OK;
-
-    GetDataRefTask* task = GetDataRefTask::create(result, stream);
-
-    if (!stream) return false;
-    else if (task==0) {
-        stream.writeU8(Protocol::RESULT_INVALID_TYPE);
-        return true;
-    }
-
-    TaskRequest request(task);
-    if (!requestQueue.execute(&request)) return false;
-
-    if (task->isValid()) {
-        stream.writeU8(Protocol::RESULT_OK);
-        task->writeValue(stream);
-    } else {
-        stream.writeU8(Protocol::RESULT_UNKNOWN_DATAREF);
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/ServerThread.h
===================================================================
--- src/xplra/ServerThread.h	(revision 7)
+++ src/xplra/ServerThread.h	(revision 7)
@@ -0,0 +1,152 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_SERVERTHREAD_H
+#define XPLRA_SERVERTHREAD_H
+//------------------------------------------------------------------------------
+
+#include <xplcommon/Thread.h>
+
+#include <xplcommon/Mutex.h>
+
+#include <xplcommon/Waiter.h>
+#include <xplcommon/BufferedStream.h>
+#include <xplcommon/DataStream.h>
+#include <xplcommon/LocalAcceptor.h>
+
+#include <set>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+class RequestQueue;
+
+//------------------------------------------------------------------------------
+
+/**
+ * A thread serving a client.
+ */
+class ServerThread : public xplcommon::Thread
+{
+private:
+    /**
+     * Type for the set of server thread instances.
+     */
+    typedef std::set<ServerThread*> instances_t;
+
+    /**
+     * A mutex to protect the collection of server threads.
+     */
+    static xplcommon::Mutex instancesMutex;
+
+    /**
+     * The instances of this class.
+     */
+    static instances_t instances;
+
+public:
+    /**
+     * Call quit() an all threads.
+     */
+    static void quitAll();
+
+private:
+    /**
+     * The request queue to use.
+     */
+    RequestQueue& requestQueue;
+
+    /**
+     * Our waiter.
+     */
+    xplcommon::Waiter waiter;
+
+    /**
+     * The buffered stream to use for communication at the low-level.
+     */
+    xplcommon::BufferedStream* bufferedStream;
+
+    /**
+     * The data stream being used for communication.
+     */
+    xplcommon::DataStream stream;
+
+public:
+    /**
+     * Construct the thread by using a LocalSocket returned by the
+     * given acceptor.
+     */
+    ServerThread(RequestQueue& requestQueue,
+                 xplcommon::LocalAcceptor& acceptor);
+
+    /**
+     * Destroy the thread.
+     */
+    virtual ~ServerThread();
+
+    /**
+     * Quit the thread. It interrupts the blocking stream.
+     */
+    void quit();
+
+    /**
+     * Perform the thread's operation.
+     */
+    virtual void run();
+
+private:
+    /**
+     * Handle the COMMAND_GET_SINGLE command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleGetSingle();
+
+    /**
+     * Handle the COMMAND_SET_SINGLE command
+     *
+     * @return true, if we can continue, false if the thread should quit
+     */
+    bool handleSetSingle();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_SERVERTHREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/ServerThread.h
===================================================================
--- src/xplra/ServerThread.h	(revision 6)
+++ 	(revision )
@@ -1,145 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_SERVERTHREAD_H
-#define XPLRA_SERVERTHREAD_H
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Thread.h>
-
-#include <xplcommon/Mutex.h>
-
-#include <xplcommon/Waiter.h>
-#include <xplcommon/BufferedStream.h>
-#include <xplcommon/DataStream.h>
-#include <xplcommon/LocalAcceptor.h>
-
-#include <set>
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-class RequestQueue;
-
-//------------------------------------------------------------------------------
-
-/**
- * A thread serving a client.
- */
-class ServerThread : public xplcommon::Thread
-{
-private:
-    /**
-     * Type for the set of server thread instances.
-     */
-    typedef std::set<ServerThread*> instances_t;
-
-    /**
-     * A mutex to protect the collection of server threads.
-     */
-    static xplcommon::Mutex instancesMutex;
-
-    /**
-     * The instances of this class.
-     */
-    static instances_t instances;
-
-public:
-    /**
-     * Call quit() an all threads.
-     */
-    static void quitAll();
-
-private:
-    /**
-     * The request queue to use.
-     */
-    RequestQueue& requestQueue;
-
-    /**
-     * Our waiter.
-     */
-    xplcommon::Waiter waiter;
-
-    /**
-     * The buffered stream to use for communication at the low-level.
-     */
-    xplcommon::BufferedStream* bufferedStream;
-
-    /**
-     * The data stream being used for communication.
-     */
-    xplcommon::DataStream stream;
-
-public:
-    /**
-     * Construct the thread by using a LocalSocket returned by the
-     * given acceptor.
-     */
-    ServerThread(RequestQueue& requestQueue,
-                 xplcommon::LocalAcceptor& acceptor);
-
-    /**
-     * Destroy the thread.
-     */
-    virtual ~ServerThread();
-
-    /**
-     * Quit the thread. It interrupts the blocking stream.
-     */
-    void quit();
-
-    /**
-     * Perform the thread's operation.
-     */
-    virtual void run();
-
-private:
-    /**
-     * Handle the COMMAND_GET_SINGLE command
-     *
-     * @return true, if we can continue, false if the thread should quit
-     */
-    bool handleGetSingle(xplcommon::DataStream& stream);
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_SERVERTHREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/SetDataRefTask.cc
===================================================================
--- src/xplra/SetDataRefTask.cc	(revision 7)
+++ src/xplra/SetDataRefTask.cc	(revision 7)
@@ -0,0 +1,134 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "SetDataRefTask.h"
+
+#include "Protocol.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::SetDataRefTask;
+using xplra::SetIntDataRefTask;
+using xplra::SetFloatDataRefTask;
+using xplra::SetDoubleDataRefTask;
+
+using xplcommon::DataStream;
+
+using std::string;
+
+//------------------------------------------------------------------------------
+
+SetDataRefTask* SetDataRefTask::create(uint8_t& result, DataStream& stream)
+{
+    result = Protocol::RESULT_OK;
+
+    string name = stream.readString();
+    uint8_t type = stream.readU8();
+    if (!stream) return 0;
+
+    if (type==Protocol::TYPE_INT) {
+        int value = stream.readS32();
+        if (stream) return new SetIntDataRefTask(name, value);
+    } else if (type==Protocol::TYPE_FLOAT) {
+        float value = stream.readFloat();
+        if (stream) return new SetFloatDataRefTask(name, value);
+    } else if (type==Protocol::TYPE_DOUBLE) {
+        double value = stream.readDouble();
+        if (stream) return new SetDoubleDataRefTask(name, value);
+    } else if (type==Protocol::TYPE_FLOAT_ARRAY ||
+               type==Protocol::TYPE_INT_ARRAY ||
+               type==Protocol::TYPE_BYTE_ARRAY)
+    {
+        int length = stream.readS32();
+        int offset = stream.readS32();
+        if (!stream) return 0;
+        if (length<=0 || length>Protocol::MAX_LENGTH) {
+            result = Protocol::RESULT_INVALID_LENGTH;
+            return 0;
+        }
+        if (offset<0) {
+            result = Protocol::RESULT_INVALID_OFFSET;
+            return 0;
+        }
+
+        SetDataRefTask* task = 0;
+        if (type==Protocol::TYPE_INT_ARRAY) {
+            task = new SetIntArrayDataRefTask(name, length, offset);
+        } else if (type==Protocol::TYPE_FLOAT_ARRAY) {
+            task = new SetFloatArrayDataRefTask(name, length, offset);
+        } else {
+            task = new SetByteArrayDataRefTask(name, length, offset);
+        }
+
+        task->readValue(stream);
+
+        if (stream) {
+            return task;
+        } else {
+            delete task;
+        }
+    } else {
+        result = Protocol::RESULT_INVALID_TYPE;
+    }
+
+    return 0;
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void SetIntDataRefTask::readValue(DataStream& stream)
+{
+    value = stream.readS32();
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void SetFloatDataRefTask::readValue(DataStream& stream)
+{
+    value = stream.readFloat();
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+void SetDoubleDataRefTask::readValue(DataStream& stream)
+{
+    value = stream.readDouble();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/SetDataRefTask.h
===================================================================
--- src/xplra/SetDataRefTask.h	(revision 7)
+++ src/xplra/SetDataRefTask.h	(revision 7)
@@ -0,0 +1,621 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_SETDATAREFTASK_H
+#define XPLRA_SETDATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+#include <xplcommon/DataStream.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref tasks that set the value of some data
+ * referenced by a dataref.
+ *
+ * Since XPLM provides no feedback on whether the setting is
+ * successful, we detect only if the dataref is valid or not. So the
+ * isValid() function provides the only feedback if the task executed
+ * successfully or not. (We could use XPLMCanWriteDataRef, but for
+ * efficiency reasons we refrain from it. A separate task may be
+ * created for this purpose.)
+ */
+class SetDataRefTask : public DataRefTask
+{
+public:
+    /**
+     * Read a dataref setting specification and create the appropriate
+     * SetDataRefTask instance.
+     *
+     * @param result will contain the result of the operation. It
+     * signifies an error only, if some wrong data is read. If the
+     * stream fails, it will indicate RESULT_OK.
+     *
+     * @return the new instance or 0 on error.
+     */
+    static SetDataRefTask* create(uint8_t& result, xplcommon::DataStream& stream);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetDataRefTask(const std::string& name);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetDataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(xplcommon::DataStream& stream) = 0;
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref setting tasks that set a single scalar
+ * value.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * name setData() which performs the actual setting.
+ */
+template <typename T, class ConcreteClass>
+class SetScalarDataRefTask : public SetDataRefTask
+{
+protected:
+    /**
+     * The value to set.
+     */
+    T value;
+
+public:
+    /**
+     * Construct the task for setting the data referenced by the
+     * dataref with the given name.
+     */
+    SetScalarDataRefTask(const std::string& name, T value);
+
+    /**
+     * Construct the task for setting the data referenced by the given
+     * dataref.
+     */
+    SetScalarDataRefTask(XPLMDataRef dataRef, T value);
+
+protected:
+    /**
+     * Perform the actual operation.
+     */
+    virtual void process();
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Task to set the value of an integer data.
+ */
+class SetIntDataRefTask :
+        public SetScalarDataRefTask<int, SetIntDataRefTask>
+{
+public:
+    /**
+     * Set the given dataref's value to the given value.
+     */
+    static void setData(XPLMDataRef dataRef, int value);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetIntDataRefTask(const std::string& name, int value);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetIntDataRefTask(XPLMDataRef dataRef, int value);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(xplcommon::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Task to set the value of a single-precision floating point data.
+ */
+class SetFloatDataRefTask :
+        public SetScalarDataRefTask<float, SetFloatDataRefTask>
+{
+public:
+    /**
+     * Set the given dataref's value to the given value.
+     */
+    static void setData(XPLMDataRef dataRef, float value);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetFloatDataRefTask(const std::string& name, float value);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetFloatDataRefTask(XPLMDataRef dataRef, float value);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(xplcommon::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Task to set the value of a double-precision floating point data.
+ */
+class SetDoubleDataRefTask :
+        public SetScalarDataRefTask<double, SetDoubleDataRefTask>
+{
+public:
+    /**
+     * Set the given dataref's value to the given value.
+     */
+    static void setData(XPLMDataRef dataRef, double value);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetDoubleDataRefTask(const std::string& name, double value);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetDoubleDataRefTask(XPLMDataRef dataRef, double value);
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(xplcommon::DataStream& stream);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * Base class for dataref setting tasks that set the values of an
+ * array.
+ *
+ * ConcreteClass is the actual child class. It should have a function
+ * name setData() which performs the actual setting.
+ */
+template <typename T, class ConcreteClass>
+class SetArrayDataRefTask : public SetDataRefTask
+{
+private:
+    /**
+     * The number of data items in the value.
+     */
+    int count;
+
+    /**
+     * The offset starting with which the data should be set.
+     */
+    int offset;
+
+    /**
+     * The value to set.
+     */
+    T* value;
+
+public:
+    /**
+     * Construct the data setting task for the dataref with the given
+     * name.
+     *
+     * The value array will be allocated, but not filled with
+     * data. Thus count should be positive!
+     */
+    SetArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the data setting task for the given dataref.
+     *
+     * The value array will be allocated, but not filled with
+     * data. Thus count should be positive!
+     */
+    SetArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+
+    /**
+     * Destroy the task.
+     */
+    virtual ~SetArrayDataRefTask();
+
+    /**
+     * Read and set the value to update from the given stream
+     */
+    virtual void readValue(xplcommon::DataStream& stream);
+
+protected:
+    /**
+     * Perform the actual operation.
+     */
+    virtual void process();
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref setting task which sets an array of integers.
+ */
+class SetIntArrayDataRefTask :
+    public SetArrayDataRefTask<int, SetIntArrayDataRefTask>
+{
+public:
+    /**
+     * Perform the actual setting.
+     */
+    static void setData(XPLMDataRef dataRef, int* value, int count, int offset);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetIntArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetIntArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref setting task which sets an array of single-precision
+ * floating-point values.
+ */
+class SetFloatArrayDataRefTask :
+    public SetArrayDataRefTask<float, SetFloatArrayDataRefTask>
+{
+public:
+    /**
+     * Perform the actual setting.
+     */
+    static void setData(XPLMDataRef dataRef, float* value, int count, int offset);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetFloatArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetFloatArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref setting task which sets an array of bytes.
+ */
+class SetByteArrayDataRefTask :
+    public SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>
+{
+public:
+    /**
+     * Perform the actual setting.
+     */
+    static void setData(XPLMDataRef dataRef, unsigned char* value,
+                        int count, int offset);
+
+    /**
+     * Construct the task for the dataref with the given name.
+     */
+    SetByteArrayDataRefTask(const std::string& name, int count, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref.
+     */
+    SetByteArrayDataRefTask(XPLMDataRef dataRef, int count, int offset = 0);
+};
+
+//------------------------------------------------------------------------------
+// Template definitions
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetScalarDataRefTask<T, ConcreteClass>::
+SetScalarDataRefTask(const std::string& name, T value) :
+    SetDataRefTask(name),
+    value(value)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetScalarDataRefTask<T, ConcreteClass>::
+SetScalarDataRefTask(XPLMDataRef dataRef, T value) :
+    SetDataRefTask(dataRef),
+    value(value)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void SetScalarDataRefTask<T, ConcreteClass>::process()
+{
+    ConcreteClass::setData(getDataRef(), value);
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetArrayDataRefTask<T, ConcreteClass>::
+SetArrayDataRefTask(const std::string& name, int count, int offset) :
+    SetDataRefTask(name),
+    count(count),
+    offset(offset),
+    value(new T[count])
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetArrayDataRefTask<T, ConcreteClass>::
+SetArrayDataRefTask(XPLMDataRef dataRef, int count, int offset) :
+    SetDataRefTask(dataRef),
+    count(count),
+    offset(offset),
+    value(new T[count])
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+inline SetArrayDataRefTask<T, ConcreteClass>::~SetArrayDataRefTask()
+{
+    delete [] value;
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void SetArrayDataRefTask<T, ConcreteClass>::
+readValue(xplcommon::DataStream& stream)
+{
+    stream.read(value, count * sizeof(T));
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T, class ConcreteClass>
+void SetArrayDataRefTask<T, ConcreteClass>::process()
+{
+    ConcreteClass::setData(getDataRef(), value, count, offset);
+}
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline SetDataRefTask::SetDataRefTask(const std::string& name) :
+    DataRefTask(name)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetDataRefTask::SetDataRefTask(XPLMDataRef dataRef) :
+    DataRefTask(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetIntDataRefTask::setData(XPLMDataRef dataRef, int value)
+{
+    XPLMSetDatai(dataRef, value);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntDataRefTask::SetIntDataRefTask(const std::string& name, int value) :
+    SetScalarDataRefTask<int, SetIntDataRefTask>(name, value)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntDataRefTask::SetIntDataRefTask(XPLMDataRef dataRef, int value) :
+    SetScalarDataRefTask<int, SetIntDataRefTask>(dataRef, value)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetFloatDataRefTask::setData(XPLMDataRef dataRef, float value)
+{
+    XPLMSetDatai(dataRef, value);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetFloatDataRefTask::SetFloatDataRefTask(const std::string& name,
+                                                float value) :
+    SetScalarDataRefTask<float, SetFloatDataRefTask>(name, value)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetFloatDataRefTask::SetFloatDataRefTask(XPLMDataRef dataRef,
+                                                float value) :
+    SetScalarDataRefTask<float, SetFloatDataRefTask>(dataRef, value)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetDoubleDataRefTask::setData(XPLMDataRef dataRef, double value)
+{
+    XPLMSetDatai(dataRef, value);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetDoubleDataRefTask::SetDoubleDataRefTask(const std::string& name,
+                                                  double value) :
+    SetScalarDataRefTask<double, SetDoubleDataRefTask>(name, value)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetDoubleDataRefTask::SetDoubleDataRefTask(XPLMDataRef dataRef,
+                                                  double value) :
+    SetScalarDataRefTask<double, SetDoubleDataRefTask>(dataRef, value)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetIntArrayDataRefTask::setData(XPLMDataRef dataRef, int* value,
+                                            int count, int offset)
+{
+    XPLMSetDatavi(dataRef, value, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntArrayDataRefTask::SetIntArrayDataRefTask(const std::string& name,
+                                                      int count, int offset) :
+    SetArrayDataRefTask<int, SetIntArrayDataRefTask>(name, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline SetIntArrayDataRefTask::SetIntArrayDataRefTask(XPLMDataRef dataRef,
+                                                      int count, int offset) :
+    SetArrayDataRefTask<int, SetIntArrayDataRefTask>(dataRef, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetFloatArrayDataRefTask::setData(XPLMDataRef dataRef,
+                                              float* value,
+                                              int count, int offset)
+{
+    XPLMSetDatavf(dataRef, value, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetFloatArrayDataRefTask::SetFloatArrayDataRefTask(const std::string& name,
+                                                   int count, int offset) :
+    SetArrayDataRefTask<float, SetFloatArrayDataRefTask>(name, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetFloatArrayDataRefTask::SetFloatArrayDataRefTask(XPLMDataRef dataRef,
+                                                   int count, int offset) :
+    SetArrayDataRefTask<float, SetFloatArrayDataRefTask>(dataRef, count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void SetByteArrayDataRefTask::setData(XPLMDataRef dataRef,
+                                             unsigned char* value,
+                                             int count, int offset)
+{
+    XPLMSetDatab(dataRef, value, offset, count);
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetByteArrayDataRefTask::SetByteArrayDataRefTask(const std::string& name,
+                                                 int count, int offset) :
+    SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>(name,
+                                                                count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline
+SetByteArrayDataRefTask::SetByteArrayDataRefTask(XPLMDataRef dataRef,
+                                                 int count, int offset) :
+    SetArrayDataRefTask<unsigned char, SetByteArrayDataRefTask>(dataRef,
+                                                                count, offset)
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_SETDATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/Task.h
===================================================================
--- src/xplra/Task.h	(revision 3)
+++ src/xplra/Task.h	(revision 3)
@@ -0,0 +1,75 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_TASK_H
+#define XPLRA_TASK_H
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A task is like a request, but it cannot be executed directly by the
+ * flight loop callback. Instead, it defines some simple task, of
+ * which potentially many can be added to a single request.
+ */
+class Task
+{
+public:
+    /**
+     * Virtual destructor.
+     */
+    virtual ~Task();
+
+    /**
+     * Perform the task
+     */
+    virtual void perform() = 0;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline Task::~Task()
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_TASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/Task.h
===================================================================
--- src/xplra/Task.h	(revision 3)
+++ 	(revision )
@@ -1,75 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_TASK_H
-#define XPLRA_TASK_H
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A task is like a request, but it cannot be executed directly by the
- * flight loop callback. Instead, it defines some simple task, of
- * which potentially many can be added to a single request.
- */
-class Task
-{
-public:
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Task();
-
-    /**
-     * Perform the task
-     */
-    virtual void perform() = 0;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Task::~Task()
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_TASK_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/TaskRequest.cc
===================================================================
--- src/xplra/TaskRequest.cc	(revision 3)
+++ src/xplra/TaskRequest.cc	(revision 3)
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "TaskRequest.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::TaskRequest;
+
+//------------------------------------------------------------------------------
+
+void TaskRequest::execute()
+{
+    task->perform();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/TaskRequest.cc
===================================================================
--- src/xplra/TaskRequest.cc	(revision 3)
+++ 	(revision )
@@ -1,50 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "TaskRequest.h"
-
-//------------------------------------------------------------------------------
-
-using xplra::TaskRequest;
-
-//------------------------------------------------------------------------------
-
-void TaskRequest::execute()
-{
-    task->perform();
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/TaskRequest.h
===================================================================
--- src/xplra/TaskRequest.h	(revision 3)
+++ src/xplra/TaskRequest.h	(revision 3)
@@ -0,0 +1,101 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_TASKREQUEST_H
+#define XPLRA_TASKREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "Request.h"
+
+#include "Task.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request the performs a task.
+ */
+class TaskRequest : public Request
+{
+private:
+    /**
+     * The task belonging to the request. It is owned by the request,
+     * i.e. deleted when the request is deleted.
+     */
+    Task* task;
+
+public:
+    /**
+     * Construct the request for the given task. The task will become
+     * owned by the request, so it will be deleted when the task is
+     * deleted.
+     */
+    TaskRequest(Task* task);
+
+    /**
+     * Destroy the task request.
+     */
+    virtual ~TaskRequest();
+
+    /**
+     * Execute the request by performing the task.
+     */
+    virtual void execute();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline TaskRequest::TaskRequest(Task* task) :
+    task(task)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline TaskRequest::~TaskRequest()
+{
+    delete task;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_TASKREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/TaskRequest.h
===================================================================
--- src/xplra/TaskRequest.h	(revision 3)
+++ 	(revision )
@@ -1,101 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLRA_TASKREQUEST_H
-#define XPLRA_TASKREQUEST_H
-//------------------------------------------------------------------------------
-
-#include "Request.h"
-
-#include "Task.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplra {
-
-//------------------------------------------------------------------------------
-
-/**
- * A request the performs a task.
- */
-class TaskRequest : public Request
-{
-private:
-    /**
-     * The task belonging to the request. It is owned by the request,
-     * i.e. deleted when the request is deleted.
-     */
-    Task* task;
-
-public:
-    /**
-     * Construct the request for the given task. The task will become
-     * owned by the request, so it will be deleted when the task is
-     * deleted.
-     */
-    TaskRequest(Task* task);
-
-    /**
-     * Destroy the task request.
-     */
-    virtual ~TaskRequest();
-
-    /**
-     * Execute the request by performing the task.
-     */
-    virtual void execute();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline TaskRequest::TaskRequest(Task* task) :
-    task(task)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline TaskRequest::~TaskRequest()
-{
-    delete task;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplra */
-
-//------------------------------------------------------------------------------
-#endif // XPLRA_TASKREQUEST_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplra/plugin.cc
===================================================================
--- src/xplra/plugin.cc	(revision 1)
+++ src/xplra/plugin.cc	(revision 1)
@@ -0,0 +1,114 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ListenThread.h"
+
+#include <xplcommon/Util.h>
+
+#include <XPLMDefs.h>
+#include <XPLMUtilities.h>
+#include <XPLMProcessing.h>
+
+#include <cstdio>
+#include <cstring>
+#include <cstdarg>
+
+//------------------------------------------------------------------------------
+
+using xplra::ListenThread;
+
+using xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+/**
+ * The thread to use to listen for incoming connections.
+ */
+static ListenThread* listenThread = 0;
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API int XPluginStart(char* outName, char* outSignature,
+                            char* outDescription)
+{
+    Util::debug("hu.varadiistvan.xplra called\n");
+
+    strcpy(outName, "X-Plane Remote Access");
+    strcpy(outSignature, "hu.varadiistvan.xplra");
+    strcpy(outDescription, "Provides remote access to datarefs");
+
+    return 1;
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginEnable(void)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginEnable called\n");
+    // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0);
+    listenThread = new ListenThread();
+    listenThread->start();
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginReceiveMessage(XPLMPluginID inFrom, long inMessage,
+                                      void* inParam)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
+          inFrom, inMessage, inParam);
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginDisable(void)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginDisable called\n");
+    // XPLMUnregisterFlightLoopCallback(&callback, 0);
+    if (listenThread!=0) {
+        listenThread->quit();
+        listenThread = 0;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+PLUGIN_API void XPluginStop(void)
+{
+    Util::debug("hu.varadiistvan.xplra.XPluginStop called\n");
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/plugin.cc
===================================================================
--- src/xplra/plugin.cc	(revision 1)
+++ 	(revision )
@@ -1,114 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of XPLRA, a remote-access plugin for X-Plane
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ListenThread.h"
-
-#include <xplcommon/Util.h>
-
-#include <XPLMDefs.h>
-#include <XPLMUtilities.h>
-#include <XPLMProcessing.h>
-
-#include <cstdio>
-#include <cstring>
-#include <cstdarg>
-
-//------------------------------------------------------------------------------
-
-using xplra::ListenThread;
-
-using xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-/**
- * The thread to use to listen for incoming connections.
- */
-static ListenThread* listenThread = 0;
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API int XPluginStart(char* outName, char* outSignature,
-                            char* outDescription)
-{
-    Util::debug("hu.varadiistvan.xplra called\n");
-
-    strcpy(outName, "X-Plane Remote Access");
-    strcpy(outSignature, "hu.varadiistvan.xplra");
-    strcpy(outDescription, "Provides remote access to datarefs");
-
-    return 1;
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginEnable(void)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginEnable called\n");
-    // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0);
-    listenThread = new ListenThread();
-    listenThread->start();
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginReceiveMessage(XPLMPluginID inFrom, long inMessage,
-                                      void* inParam)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
-          inFrom, inMessage, inParam);
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginDisable(void)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginDisable called\n");
-    // XPLMUnregisterFlightLoopCallback(&callback, 0);
-    if (listenThread!=0) {
-        listenThread->quit();
-        listenThread = 0;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-PLUGIN_API void XPluginStop(void)
-{
-    Util::debug("hu.varadiistvan.xplra.XPluginStop called\n");
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
