summaryrefslogtreecommitdiffstats
path: root/src/nfc/ios/qiosnfcndefsessiondelegate_p.h
blob: 5ec1c12b557681ddcfcd24917ea068a34c202314 (plain)
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
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QIOSNFCNDEFSESSIONDELEFATE_P_H
#define QIOSNFCNDEFSESSIONDELEFATE_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtCore/qglobal.h>

#include <QtCore/private/qcore_mac_p.h>

#include "qnearfieldmanager.h"
#include "qnearfieldtarget.h"

#include <Foundation/Foundation.h>
#include <CoreNFC/CoreNFC.h>

QT_BEGIN_NAMESPACE

class QNearFieldManagerPrivateImpl;
class QNfcNdefNotifier;
class QNearFieldTarget;
class QNdefMessage;
class QString;

dispatch_queue_t qt_Nfc_Queue();

QT_END_NAMESPACE

QT_USE_NAMESPACE

@interface QT_MANGLE_NAMESPACE(QIosNfcNdefSessionDelegate) : NSObject<NFCNDEFReaderSessionDelegate>

@property (strong, nonatomic) NFCNDEFReaderSession *session;
@property (strong, nonatomic) id<NFCNDEFTag> ndefTag;


-(instancetype)initWithNotifier:(QNfcNdefNotifier *)aNotifier;
-(void)dealloc;

-(QNfcNdefNotifier *)ndefNotifier;

-(void)setAlertMessage:(const QString &)message;

// Those methods to be called on the session.sessionQueue:
-(bool)startSession;
-(void)stopSession:(const QString &)message;
-(void)abort;

// Delegate's methods, implementing the protocol NFCNDEFReaderSessionDelegate.
// Those methods not to be called by the Qt.

// "Gets called when a session becomes invalid.  At this point the client is expected to
// discard the returned session object."
-(void)readerSession:(NFCNDEFReaderSession *)session
       didInvalidateWithError:(NSError *)error;

// "Gets called when the reader detects NFC tag(s) with NDEF messages in the polling sequence.
// Polling is automatically restarted once the detected tag is removed from the reader's read
// range.  This method is only get call if the optional -readerSession:didDetectTags: method
// is not implemented."
-(void)readerSession:(NFCNDEFReaderSession *)session
       didDetectNDEFs:(NSArray<NFCNDEFMessage *> *)messages;

// "Gets called when the reader detects NDEF tag(s) in the RF field.  Presence of this method
// overrides -readerSession:didDetectNDEFs: and enables read-write capability for the session."
-(void)readerSession:(NFCNDEFReaderSession *)session
       didDetectTags:(NSArray<__kindof id<NFCNDEFTag>> *)tags;

// "Gets called when the NFC reader session has become active. RF is enabled and reader is
// scanning for tags."
-(void)readerSessionDidBecomeActive:(NFCNDEFReaderSession *)session;

@end

QT_NAMESPACE_ALIAS_OBJC_CLASS(QIosNfcNdefSessionDelegate);

#endif // QIOSNFCNDEFSESSIONDELEFATE_P_H