File: EchoLinkDispatcher_demo.cpp

package info (click to toggle)
svxlink 15.11-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 14,296 kB
  • ctags: 7,558
  • sloc: cpp: 48,996; tcl: 3,273; ansic: 2,831; sh: 1,054; perl: 335; ruby: 160; makefile: 96
file content (41 lines) | stat: -rw-r--r-- 1,013 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <cstdlib>
#include <AsyncCppApplication.h>
#include <EchoLinkDispatcher.h>

using namespace std;
using namespace Async;
using namespace EchoLink;

class MyClass : public sigc::trackable
{
  public:
    MyClass(void)
    {
      if (Dispatcher::instance() == 0)
      {
	cerr << "Could not create EchoLink listener (Dispatcher) object\n";
	exit(1);
      }

      Dispatcher::instance()->incomingConnection.connect(mem_fun(*this,
	  &MyClass::onIncomingConnection));
    }
    
  private:
    void onIncomingConnection(const IpAddress& ip, const string& callsign,
      	      	      	      const string& name, const string& priv)
    {
      cerr << "Incoming connection from " << ip << ": " << callsign
      	   << " (" << name << ")\n";
      // Find out the station data by using the Directory class
      // Create a new Qso object to accept the connection
    }
};

int main(int argc, char **argv)
{
  CppApplication app; // or QtApplication
  MyClass my_class;
  app.exec();
}