2017-04-27 20:18:03 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-02-11 19:14:46 +01:00
|
|
|
#ifndef DEVICE_H
|
|
|
|
#define DEVICE_H
|
2013-01-09 12:07:09 -08:00
|
|
|
|
2019-08-05 19:41:15 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2013-04-01 13:51:49 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-08-05 19:41:15 +02:00
|
|
|
struct divecomputer;
|
2018-05-05 19:26:48 +02:00
|
|
|
extern void fake_dc(struct divecomputer *dc);
|
2016-06-20 21:07:36 -07:00
|
|
|
extern void set_dc_deviceid(struct divecomputer *dc, unsigned int deviceid);
|
2020-09-13 18:16:01 +02:00
|
|
|
extern void set_dc_nickname(struct dive *dive);
|
2013-06-17 15:58:26 -07:00
|
|
|
extern void create_device_node(const char *model, uint32_t deviceid, const char *serial, const char *firmware, const char *nickname);
|
2014-01-16 09:03:11 +07:00
|
|
|
extern void call_for_each_dc(void *f, void (*callback)(void *, const char *, uint32_t,
|
2015-06-10 07:24:34 -07:00
|
|
|
const char *, const char *, const char *), bool select_only);
|
2020-04-23 23:32:42 +02:00
|
|
|
extern void clear_device_nodes();
|
2013-01-09 12:07:09 -08:00
|
|
|
|
2013-04-01 13:51:49 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-09-13 19:08:41 +02:00
|
|
|
// Functions and global variables that are only available to C++ code
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QVector>
|
|
|
|
class DiveComputerNode {
|
|
|
|
public:
|
|
|
|
bool operator==(const DiveComputerNode &a) const;
|
|
|
|
bool operator!=(const DiveComputerNode &a) const;
|
|
|
|
bool operator<(const DiveComputerNode &a) const;
|
|
|
|
void showchanges(const QString &n, const QString &s, const QString &f) const;
|
|
|
|
QString model;
|
|
|
|
uint32_t deviceId;
|
|
|
|
QString serialNumber;
|
|
|
|
QString firmware;
|
|
|
|
QString nickName;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DiveComputerList {
|
|
|
|
public:
|
|
|
|
const DiveComputerNode *getExact(const QString &m, uint32_t d);
|
|
|
|
const DiveComputerNode *get(const QString &m);
|
|
|
|
void addDC(QString m, uint32_t d, QString n = QString(), QString s = QString(), QString f = QString());
|
|
|
|
|
|
|
|
// Keep the dive computers in a vector sorted by (model, deviceId)
|
|
|
|
QVector<DiveComputerNode> dcs;
|
|
|
|
};
|
|
|
|
|
|
|
|
QString get_dc_nickname(const struct divecomputer *dc);
|
|
|
|
extern DiveComputerList dcList;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2014-02-11 19:14:46 +01:00
|
|
|
#endif // DEVICE_H
|