-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsocket-handler.h
More file actions
69 lines (66 loc) · 1.96 KB
/
socket-handler.h
File metadata and controls
69 lines (66 loc) · 1.96 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
/*
* Copyright (C) 2026
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the ft8 module
*
* ft8 module is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation,
* version 2 of the License.
*
* ft8 module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ft8 module interface; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include <QObject>
#include <QTimer>
#include <QUrl>
#include <QtWebSockets/QWebSocket>
#include <QAbstractSocket>
#include <QString>
#include <QSettings>
#include <atomic>
#include <string>
#include <vector>
#include <complex>
#include <mutex>
#include "constants.h"
#include "ringbuffer.h"
//
// Lowest level, connecting reading and writing raw data
// from and to an SDRconnect instance
class socketHandler: public QObject {
Q_OBJECT
public:
socketHandler (const QString &hostAddress,
int portNumber,
RingBuffer<std::complex<int16_t>> *);
~socketHandler ();
void sendMessage (const QString &);
private:
QString hostAddress;
int portNumber;
QWebSocket *socket;
bool connected;
RingBuffer<std::complex<int16_t>> *_I_Buffer;
public slots:
void onConnected ();
void onDisconnect ();
void onSocketError (QAbstractSocket::SocketError);
void binaryMessageReceived (const QByteArray &);
void textMessageReceived (const QString &);
signals:
void dispatchMessage (const QString &);
void binDataAvailable ();
void reportConnect ();
void reportDisconnect ();
};