Mistake on this page?
Report an issue in GitHub or email us
NFCRemoteInitiator.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2018 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MBED_NFC_REMOTE_INITIATOR_H
18 #define MBED_NFC_REMOTE_INITIATOR_H
19 
20 #include <stdint.h>
21 
22 #include "NFCDefinitions.h"
23 #include "NFCRemoteEndpoint.h"
24 #include "NFCNDEFCapable.h"
25 #include "stack/tech/iso7816/iso7816_app.h"
26 
27 #include "platform/Span.h"
28 
29 namespace mbed {
30 namespace nfc {
31 
32 /**
33  * @addtogroup nfc
34  * @{
35  */
36 
37 class NFCController;
38 
39 /**
40  * This class represents a remote NFC initiator (the local controller being in target mode).
41  *
42  * An initiator can be a NFC reader, a NFC-enabled phone or other NFC device capable of generating a RF field.
43  */
45 public:
46  /**
47  * Create a NFCRemoteInitiator.
48  * @param[in] controller the NFCController instance that detected this endpoint
49  * @param[in] buffer a bytes array used to store NDEF messages
50  */
51  NFCRemoteInitiator(NFCController *controller, const Span<uint8_t> &buffer);
52  virtual ~NFCRemoteInitiator();
53 
54  /**
55  * The NFCRemoteInitiator delegate. Users of the NFCRemoteInitiator class need to implement this delegate's methods to receive events.
56  */
58  protected:
59  ~Delegate() {}
60  };
61 
62  /**
63  * Set the delegate that will receive events generated by the initiator.
64  *
65  * @param[in] delegate the delegate instance to use
66  */
67  void set_delegate(Delegate *delegate);
68 
69  /**
70  * Retrieve the NFC tag type exposed by the controller to communicate with the initiator.
71  *
72  * @return the relevant NFC tag type
73  */
74  virtual nfc_tag_type_t nfc_tag_type() const = 0;
75 
76  /**
77  * Retrieve whether ISO7816 applications are supported by the underlying technology.
78  *
79  * @return whether ISO7816 applications are supported
80  */
81  virtual bool is_iso7816_supported() const = 0;
82 
83  /**
84  * Register an ISO7816 application to be used by the initiator.
85  *
86  * @param[in] application a pointer to an nfc_tech_iso7816_app_t instance as defined by the MuNFC stack
87  */
88  virtual void add_iso7816_application(nfc_tech_iso7816_app_t *application) = 0;
89 
90 protected:
91  virtual void connected();
92  virtual void disconnected();
93 
94 private:
95  // NFCNDEFCapable implementation
96  virtual NFCNDEFCapable::Delegate *ndef_capable_delegate();
97 
98  Delegate *_delegate;
99 };
100 
101 /**
102  * @}
103  */
104 
105 } // namespace nfc
106 } // namespace mbed
107 
108 #endif
virtual void connected()
Mark endpoint as connected.
The NFCRemoteInitiator delegate.
virtual nfc_tag_type_t nfc_tag_type() const =0
Retrieve the NFC tag type exposed by the controller to communicate with the initiator.
virtual void disconnected()
Mark endpoint as disconnected.
This class represents a remote NFC initiator (the local controller being in target mode)...
This class represents a NFC Controller.
Definition: NFCController.h:53
virtual void add_iso7816_application(nfc_tech_iso7816_app_t *application)=0
Register an ISO7816 application to be used by the initiator.
virtual bool is_iso7816_supported() const =0
Retrieve whether ISO7816 applications are supported by the underlying technology. ...
The base class for all endpoints that can support NDEF content.
This is the base class for all remote endpoints (initiators and targets) addressable over the air int...
void set_delegate(Delegate *delegate)
Set the delegate that will receive events generated by the initiator.
The NFCRemoteEndpoint base delegate.
NFCRemoteInitiator(NFCController *controller, const Span< uint8_t > &buffer)
Create a NFCRemoteInitiator.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.