forked from SiriusDely/Cascades-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nfcsender.qdoc
66 lines (50 loc) · 2.4 KB
/
nfcsender.qdoc
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
/****************************************************************************
**
** Copyright (C) 2012 Research In Motion Limited.
** All rights reserved.
** Contact: Research In Motion Ltd. (http://www.rim.com/company/contact/)
**
** This file is part of the examples of the BB10 Platform.
**
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms
** and conditions contained in a signed written agreement between you
** and Research In Motion Limited.
**
****************************************************************************/
/*!
\page nfcsender
\example nfcsender
\title NFC Sender
\section1 Description
The NFC Sender example allows a user to send content to another NFC enabled device.
\image nfcsender-example.png
\section1 Overview
In this example we'll learn how to send text data to another NFC enabled device.
The business logic is encapsulated in the C++ class \c NfcSender, which is exported
to QML under the name '_nfcSender'.
\snippet nfcsender/src/main.cpp 0
\section1 The UI
The UI contains a \c TextField and a \c Label with the usage description. Once the user enters
some text into the field, this data will be shared with another NFC enabled device, or written to
an NFC tag (through tag writing).
\snippet nfcsender/assets/main.qml 0
\section1 NfcSender
The following class is responsible for sending a text payload, using the NFC SNEP push protocol, to another NFC
enabled device, or to write to an NFC tag.
\snippet nfcsender/src/NfcSender.cpp 0
This code does the Bps initialization for use with the current thread and subscribes to receive NFC events and
registers as a snep client.
\snippet nfcsender/src/NfcSender.cpp 1
This method listens to the NFC events, and upon receiving a successful NFC SNEP connection it invokes the
handleSnepPush() method to deal with sending the data.
\snippet nfcsender/src/NfcSender.cpp 2
This method creates a ndefrecord that houses the payload (data), this record is than added to a standard ndefmessage
which is than pushed to the other device using the SNEP protocol.
*/