summaryrefslogtreecommitdiff
path: root/Network/PSKReporter.hpp
blob: 3b1f4f135c1bf705da4f212851af733cac9e00a4 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef PSK_REPORTER_HPP_
#define PSK_REPORTER_HPP_

#include <QObject>
#include <QDateTime>
#include <QString>
#include "Radio.hpp"
#include "pimpl_h.hpp"

class QString;
class Configuration;

class PSKReporter final
  : public QObject
{
  Q_OBJECT

public:
  struct Options
  {
    bool use_tcpip;
    QString eclipse_file_path;
    QString program_info;
    QString destination_host {"report.pskreporter.info"};
    quint16 destination_port {4739};
  };

  explicit PSKReporter (Configuration const *, QString const& program_info);
  explicit PSKReporter (Options const& options);
  ~PSKReporter ();

  void reconnect ();

  void setLocalStation (QString const& call, QString const& grid, QString const& antenna, QString const& rigInformation);

  // Returns false if accepting the spot required dropping an older pending spot.
  bool addRemoteStation (QString const& call, QString const& grid, Radio::Frequency freq, QString const& mode, int snr, QDateTime spotTime);

  //
  // Flush any pending spots to PSK Reporter
  //
  void sendReport (bool last = false);

  //
  // True if current time falls withing a +/- window of a solar eclipse for HamSCI use
  bool eclipse_active(QDateTime now);

  Q_SIGNAL void errorOccurred (QString const& reason);

private:
  class impl;
  pimpl<impl> m_;
};

#endif