-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdevice.h
More file actions
95 lines (77 loc) · 2.04 KB
/
device.h
File metadata and controls
95 lines (77 loc) · 2.04 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef DEVICE_H
#define DEVICE_H
#include <QJsonObject>
#include <QSet>
#include <QString>
class Battery
{
public:
Battery();
Battery(QString stat, int lev);
QString status = "BATTERY_UNAVAILABLE";
int level = 0;
};
class EqualizerPreset
{
public:
QString name;
QList<double> values;
};
class Equalizer
{
public:
Equalizer();
Equalizer(int bands, int baseline, double step, int min, int max);
int bands_number = 0;
int band_baseline = 0;
double band_step = 0;
int band_min = 0;
int band_max = 0;
};
class Device
{
public:
Device();
Device(const QJsonObject &jsonObj, QString jsonData);
// Status
QString status;
// Basic info
QString device;
QString vendor;
QString product;
QString id_vendor;
QString id_product;
QSet<QString> capabilities;
// Info to get from json and display
Battery battery;
int chatmix = 65;
QList<EqualizerPreset> presets_list;
Equalizer equalizer;
bool notification_sound = false;
// Info to set with gui and to save
int lights = -1;
int sidetone = -1;
int voice_prompts = -1;
int inactive_time = -1;
int equalizer_preset = -1;
QList<double> equalizer_curve;
int volume_limiter = -1;
int rotate_to_mute = -1;
int mic_mute_led_brightness = -1;
int mic_volume = -1;
int bt_when_powered_on = -1;
int bt_call_volume = -1;
bool operator!=(const Device &d) const;
bool operator==(const Device &d) const;
bool operator==(const Device *d) const;
void copyConfig(Device* device);
void updateConfig(const QList<Device *> &list);
void updateInfo(const Device *new_device);
QJsonObject toJson() const;
static Device *fromJson(const QJsonObject &json);
};
void updateDeviceFromSource(QList<Device *> &devicesToUpdate, const Device *sourceDevice);
void serializeDevices(const QList<Device *> &devices, const QString &filePath);
QList<Device *> deserializeDevices(const QString &filePath);
void deleteDevices(QList<Device *> deviceList);
#endif // DEVICE_H