forked from andrewpalumbo/dudestar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserialambe.h
executable file
·60 lines (53 loc) · 1.59 KB
/
serialambe.h
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
/*
Copyright (C) 2019-2021 Doug McLain
This program 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, either version 3 of the License, or
(at your option) any later version.
This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SERIALAMBE_H
#define SERIALAMBE_H
#include <QObject>
#include <QSerialPort>
#include <QQueue>
class SerialAMBE : public QObject
{
Q_OBJECT
public:
SerialAMBE(QString);
~SerialAMBE();
static QMap<QString, QString> discover_devices();
void connect_to_serial(QString);
bool get_audio(int16_t *);
bool get_ambe(uint8_t *ambe);
void decode(uint8_t *);
void encode(int16_t *);
void clear_queue();//{ m_serialdata.clear(); }
void set_decode_gain(qreal g){ m_decode_gain = g; }
private slots:
void process_serial();
private:
QSerialPort *m_serial;
QString m_description;
QString m_manufacturer;
QString m_serialnum;
QString m_protocol;
uint8_t packet_size;
qreal m_decode_gain;
QQueue<char> m_serialdata;
void decode_2020(uint8_t *);
void encode_2020(int16_t *);
void decode_3000(uint8_t *);
void encode_3000(int16_t *);
void process_serial_2020();
void process_serial_3000();
signals:
void data_ready();
};
#endif // SERIALAMBE_H