forked from andijakl/nfcinteractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appsettings.h
113 lines (94 loc) · 3.52 KB
/
appsettings.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Andreas Jakl ([email protected])
**
** Released under Nokia Example Code License.
** See license.txt in the main project folder.
**
****************************************************************************/
#ifndef APPSETTINGS_H
#define APPSETTINGS_H
#include <QObject>
#include <QSettings>
#include <QDebug>
#include "nfctypes.h"
// Used for the QSettings file, for stats and IAP
#define SETTINGS_ORG "Nokia"
#define SETTINGS_APP "NfcInteractor"
#define SETTINGS_VERSION 4
#if defined(Q_OS_SYMBIAN)
#define DEFAULT_NDEF_LOG_DIR "E:/nfc/"
#elif defined(MEEGO_EDITION_HARMATTAN)
#define DEFAULT_NDEF_LOG_DIR "/home/user/MyDocs/nfc/"
#elif defined(QT_SIMULATOR)
#define DEFAULT_NDEF_LOG_DIR "C:/nfc/"
#endif
#define COLLECTED_LOG_DIR "collected/"
#define SAVED_LOG_DIR "saved/"
/*! Default connection URN for the connection-oriented SNEP mode. */
#define LLCP_CONNECTIONORIENTED_SERVICENAME "urn:nfc:sn:snep"
/*! Default connection port for connection-less mode. */
#define LLCP_CONNECTIONLESS_PORT 4
class AppSettings : public QObject
{
Q_OBJECT
public:
explicit AppSettings(QObject *parent = 0);
/*! Reporting level, affects mainly the amount of status updates sent as signals,
as well some debug output on the console. */
enum ReportingLevel {
DebugReporting,
FullReporting,
OnlyImportantReporting
};
signals:
public slots:
void saveSettings();
void setLogNdefToFile(const bool logNdefToFile);
bool logNdefToFile() const;
void setLogNdefDir(const QString& logNdefDir);
QString logNdefDir() const;
QString logNdefDir(const bool collected);
void setDeleteTagBeforeWriting(const bool deleteTagBeforeWriting);
bool deleteTagBeforeWriting() const;
// Peer to peer
void setUseSnep(const bool useSnep);
bool useSnep() const;
// Raw peer to peer
void setUseConnectionLess(const bool useConnectionLess);
bool useConnectionLess() const;
void setNfcUri(const QString& nfcUri);
QString nfcUri() const;
void setNfcPort(const int nfcPort);
int nfcPort() const;
void setSendThroughServerSocket(const bool sendThroughServerSocket);
bool sendThroughServerSocket() const;
void setConnectClientSocket(const bool connectClientSocket);
bool connectClientSocket() const;
void setConnectServerSocket(const bool connectServerSocket);
bool connectServerSocket() const;
private:
void loadSettings();
private:
/*! Is logging of read tags to files enabled. */
bool m_logNdefToFile;
/*! If logging tags to files is enabled, in which directory so store them. */
QString m_logNdefDir;
/*! Write an empty message to the tag before writing the cached message.
This increases the stability when writing to factory-empty tags, as
writing an empty message formats the tag, and the successive NDEF
message writing then usually works fine. */
bool m_deleteTagBeforeWriting;
/*! Use the SNEP (Simple Ndef Exchange Protocol) for peer-to-peer communication. */
bool m_useSnep;
// Peer to peer
bool m_useConnectionLess;
QString m_nfcUri;
int m_nfcPort;
bool m_sendThroughServerSocket;
bool m_connectClientSocket;
bool m_connectServerSocket;
};
#endif // APPSETTINGS_H