Completed initial definition of driver classes, added stub drivers for each class.
authorbruceperens <bruceperens@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 12 Dec 2013 22:03:43 +0000 (22:03 +0000)
committerbruceperens <bruceperens@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 12 Dec 2013 22:03:43 +0000 (22:03 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1340 01035d8c-6547-0410-b346-abe4f91aad63

freedv-server/CMakeLists.txt
freedv-server/source/blank_panel.cpp [new file with mode: 0644]
freedv-server/source/drivers.h
freedv-server/source/ptt_constant.cpp [new file with mode: 0644]
freedv-server/source/text_constant.cpp [new file with mode: 0644]
freedv-server/source/user_interface.cpp

index 03986e95bf830bdbf7519a7b0f46fc5ac3a35ab1..51c59d60fdaab29faa0c3153328f4d8258cfa927 100644 (file)
@@ -85,11 +85,14 @@ set(Compile.sources
   source/audio_input.cpp
   source/audio_output.cpp
   source/audio_sink.cpp
+  source/blank_panel.cpp
   source/driver_manager.cpp
   source/keying.cpp
   source/keying_sink.cpp
   source/main.cpp
   source/ptt_input.cpp
+  source/ptt_constant.cpp
+  source/text_constant.cpp
   source/text_input.cpp
   source/tone.cpp
   source/user_interface.cpp
diff --git a/freedv-server/source/blank_panel.cpp b/freedv-server/source/blank_panel.cpp
new file mode 100644 (file)
index 0000000..3c74936
--- /dev/null
@@ -0,0 +1,34 @@
+#include "drivers.h"
+#include <iostream>
+
+// This is a test driver that provides tones.
+namespace FreeDV {
+  class BlankPanel : public UserInterface {
+  public:
+                       BlankPanel(const char * parameter);
+    virtual            ~BlankPanel();
+    
+  };
+
+  BlankPanel::BlankPanel(const char * parameter)
+  {
+  }
+
+  BlankPanel::~BlankPanel()
+  {
+  }
+
+  static UserInterface *
+  creator(const char * parameter)
+  {
+    return new BlankPanel(parameter);
+  }
+
+  static bool
+  initializer()
+  {
+    driver_manager.register_user_interface("blank-panel", creator);
+    return true;
+  }
+  static const bool initialized = initializer();
+};
index 90084d097bed832dc80a006252ae27572a4d547f..36ee07a6d796407392b9935378141c2c58356b73 100644 (file)
@@ -116,19 +116,19 @@ namespace FreeDV {
   public:
        // If this interface prodvides its own microphone driver, return it. Otherwise return 0.
        // This is guaranteed to return the same object every time, for the lifetime of this object.
-       virtual AudioInput *    microphone() = 0;
+       virtual AudioInput *    microphone();
 
        // If this interface prodvides its own loudspeaker driver, return it. Otherwise return 0.
        // This is guaranteed to return the same object every time, for the lifetime of this object.
-       virtual AudioOutput *   loudspeaker() = 0;
+       virtual AudioOutput *   loudspeaker();
 
        // If this interface prodvides its own text input driver, return it. Otherwise return 0.
        // This is guaranteed to return the same object every time, for the lifetime of this object.
-       virtual TextInput *     text_input() = 0;
+       virtual TextInput *     text_input();
 
        // If this interface prodvides its own push-to-talk input driver, return it. Otherwise return 0.
        // This is guaranteed to return the same object every time, for the lifetime of this object.
-       virtual PTTInput *      ptt_input() = 0;
+       virtual PTTInput *      ptt_input();
   };
 
   class DriverManager {
diff --git a/freedv-server/source/ptt_constant.cpp b/freedv-server/source/ptt_constant.cpp
new file mode 100644 (file)
index 0000000..c0ba089
--- /dev/null
@@ -0,0 +1,34 @@
+#include "drivers.h"
+#include <iostream>
+
+// PTT driver that is constant transmit or constant receive. For testing.
+namespace FreeDV {
+  class PTTConstant : public PTTInput {
+  public:
+                       PTTConstant(const char * parameter);
+    virtual            ~PTTConstant();
+    
+  };
+
+  PTTConstant::PTTConstant(const char * parameter)
+  {
+  }
+
+  PTTConstant::~PTTConstant()
+  {
+  }
+
+  static PTTInput *
+  creator(const char * parameter)
+  {
+    return new PTTConstant(parameter);
+  }
+
+  static bool
+  initializer()
+  {
+    driver_manager.register_ptt_input("constant", creator);
+    return true;
+  }
+  static const bool initialized = initializer();
+};
diff --git a/freedv-server/source/text_constant.cpp b/freedv-server/source/text_constant.cpp
new file mode 100644 (file)
index 0000000..b5b0e2b
--- /dev/null
@@ -0,0 +1,34 @@
+#include "drivers.h"
+#include <iostream>
+
+// This is a test driver that provides tones.
+namespace FreeDV {
+  class TextConstant : public TextInput {
+  public:
+                       TextConstant(const char * parameter);
+    virtual            ~TextConstant();
+    
+  };
+
+  TextConstant::TextConstant(const char * parameter)
+  {
+  }
+
+  TextConstant::~TextConstant()
+  {
+  }
+
+  static TextInput *
+  creator(const char * parameter)
+  {
+    return new TextConstant(parameter);
+  }
+
+  static bool
+  initializer()
+  {
+    driver_manager.register_text_input("constant", creator);
+    return true;
+  }
+  static const bool initialized = initializer();
+};
index c39b65845f95204df9078f6fdf821735332306f3..0ebe5cbdf204a632ac9bab3d2250c2921eb66aa6 100644 (file)
@@ -9,4 +9,28 @@ namespace FreeDV {
   UserInterface::~UserInterface()
   {
   }
+
+  AudioInput *
+  UserInterface::microphone()
+  {
+    return 0;
+  }
+
+  AudioOutput *
+  UserInterface::loudspeaker()
+  {
+    return 0;
+  }
+
+  TextInput *
+  UserInterface::text_input()
+  {
+    return 0;
+  }
+
+  PTTInput *
+  UserInterface::ptt_input()
+  {
+    return 0;
+  }
 };