EchoLinkDispatcher_demo.cpp

An example of how to use the EchoLink::Dispatcher class

00001 #include <iostream>
00002 #include <cstdlib>
00003 #include <AsyncCppApplication.h>
00004 #include <EchoLinkDispatcher.h>
00005 
00006 using namespace std;
00007 using namespace Async;
00008 using namespace EchoLink;
00009 
00010 class MyClass : public sigc::trackable
00011 {
00012   public:
00013     MyClass(void)
00014     {
00015       if (Dispatcher::instance() == 0)
00016       {
00017         cerr << "Could not create EchoLink listener (Dispatcher) object\n";
00018         exit(1);
00019       }
00020 
00021       Dispatcher::instance()->incomingConnection.connect(mem_fun(*this,
00022           &MyClass::onIncomingConnection));
00023     }
00024     
00025   private:
00026     void onIncomingConnection(const IpAddress& ip, const string& callsign,
00027                               const string& name, const string& priv)
00028     {
00029       cerr << "Incoming connection from " << ip << ": " << callsign
00030            << " (" << name << ")\n";
00031       // Find out the station data by using the Directory class
00032       // Create a new Qso object to accept the connection
00033     }
00034 };
00035 
00036 int main(int argc, char **argv)
00037 {
00038   CppApplication app; // or QtApplication
00039   MyClass my_class;
00040   app.exec();
00041 }

Generated on Mon Mar 25 18:14:45 2013 for EchoLib by  doxygen 1.4.7