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