Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qnfctagtype4ndeffsm_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QNFCTAGTYPE4NDEFFSM_P_H
5#define QNFCTAGTYPE4NDEFFSM_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qndefaccessfsm_p.h"
19#include "qapduutils_p.h"
20
22
24{
25public:
26 QByteArray getCommand(Action &nextAction) override;
27 QNdefMessage getMessage(Action &nextAction) override;
28 Action provideResponse(const QByteArray &response) override;
29
30 Action detectNdefSupport() override;
31 Action readMessages() override;
32 Action writeMessages(const QList<QNdefMessage> &messages) override;
33
34private:
35 enum State {
36 SelectApplicationForProbe,
37 SelectCCFile,
38 ReadCCFile,
39 NdefSupportDetected,
40 NdefNotSupported,
41
42 SelectApplicationForRead,
43 SelectNdefFileForRead,
44 ReadNdefMessageLength,
45 ReadNdefMessage,
46 NdefMessageRead,
47
48 SelectApplicationForWrite,
49 SelectNdefFileForWrite,
50 ClearNdefLength,
51 WriteNdefFile,
52 WriteNdefLength,
53 NdefMessageWritten // Only for target state, it is never actually reached
54 };
55
56 State m_currentState = SelectApplicationForProbe;
57 State m_targetState = SelectApplicationForProbe;
58
59 // Initialized during the detection phase
60 uint16_t m_maxReadSize;
61 uint16_t m_maxUpdateSize;
62 QByteArray m_ndefFileId;
63 uint16_t m_maxNdefSize = 0xFFFF;
64 bool m_writable;
65
66 // Used during the read and write operations
67 uint16_t m_fileSize;
68 uint16_t m_fileOffset;
69 QByteArray m_ndefData;
70
71 Action handleSimpleResponse(const QResponseApdu &response, State okState, State failedState,
72 Action okAction = SendCommand);
73
74 Action handleReadCCResponse(const QResponseApdu &response);
75 Action handleReadFileLengthResponse(const QResponseApdu &response);
76 Action handleReadFileResponse(const QResponseApdu &response);
77 Action handleWriteNdefFileResponse(const QResponseApdu &response);
78};
79
81
82#endif // QNFCTAGTYPE4NDEFFSM_P_H
\inmodule QtCore
Definition qbytearray.h:57
The QNdefMessage class provides an NFC NDEF message.
Action provideResponse(const QByteArray &response) override
Action writeMessages(const QList< QNdefMessage > &messages) override
Action readMessages() override
QNdefMessage getMessage(Action &nextAction) override
Action detectNdefSupport() override
QByteArray getCommand(Action &nextAction) override
Combined button and popup list for selecting options.