forked from andijakl/nfcinteractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nfcstats.h
54 lines (44 loc) · 1.54 KB
/
nfcstats.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
/****************************************************************************
**
** 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 NFCSTATS_H
#define NFCSTATS_H
#include <QObject>
#include <QHash>
#include <QSettings>
#include <QDebug>
#include "nfctypes.h"
class NfcStats : public QObject
{
Q_OBJECT
public:
explicit NfcStats(QObject *parent = 0);
public:
int tagReadCount();
void incTagReadCount();
QHash<NfcTypes::MessageType,int> msgWrittenCountAll();
int msgWrittenCount(NfcTypes::MessageType msgType);
Q_INVOKABLE int advMsgWrittenCount();
bool isAdvMsgType(NfcTypes::MessageType msgType);
void resetComposedMsgCount();
void incComposedMsgCount(NfcTypes::MessageType msgType);
void commitComposedToWrittenCount();
private:
void incWrittenMsgCount(NfcTypes::MessageType msgType, const int numMsgPresent);
void loadStats();
void loadCount(QSettings *settings, const NfcTypes::MessageType msgType);
void saveStats();
void saveCount(QSettings* settings, const NfcTypes::MessageType msgType);
private:
int m_tagReadCount;
QHash<NfcTypes::MessageType,int> m_composedMsgCount;
QHash<NfcTypes::MessageType,int> m_writtenMsgCount;
};
#endif // NFCSTATS_H